]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
KVM: Fix hang on uniprocessor
authorMarko Kohtala <marko.kohtala@gmail.com>
Sun, 2 Dec 2007 11:18:43 +0000 (13:18 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 14 Dec 2007 17:50:56 +0000 (09:50 -0800)
This is not in mainline, as it was fixed differently in that tree.

first_cpu(cpus) returns the only CPU when NR_CPUS is 1 regardless of
the cpus mask. Therefore we avoid a kernel hang in
KVM_SET_MEMORY_REGION ioctl on uniprocessor by not entering the loop at
all.

Signed-off-by: Marko Kohtala <marko.kohtala@gmail.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/kvm/kvm_main.c

index cd0557954e50ef3614c03c334b38f06104ca0551..b514dfbb6758a4e8dfb95b57e838fd9c4c547ef9 100644 (file)
@@ -273,6 +273,11 @@ void kvm_flush_remote_tlbs(struct kvm *kvm)
                        }
        }
 
+       /* Uniprocessor kernel does not respect cpus in first_cpu. So
+        * do not go there if we have nothing to do. */
+       if (cpus_empty(cpus))
+               return;
+
        /*
         * We really want smp_call_function_mask() here.  But that's not
         * available, so ipi all cpus in parallel and wait for them