]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
KVM: handle last_boosted_vcpu = 0 case
authorRik van Riel <riel@redhat.com>
Tue, 19 Jun 2012 20:51:04 +0000 (16:51 -0400)
committerMarcelo Tosatti <mtosatti@redhat.com>
Fri, 6 Jul 2012 17:11:18 +0000 (14:11 -0300)
If last_boosted_vcpu == 0, then we fall through all test cases and
may end up with all VCPUs pouncing on vcpu 0.  With a large enough
guest, this can result in enormous runqueue lock contention, which
can prevent vcpu0 from running, leading to a livelock.

Changing < to <= makes sure we properly handle that case.

Signed-off-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
virt/kvm/kvm_main.c

index 636bd08bb399d55d44807bce76401e8cbe78d2aa..b3ce91c623e25640c5c736a18ed53b69c3b5f0a1 100644 (file)
@@ -1598,7 +1598,7 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me)
         */
        for (pass = 0; pass < 2 && !yielded; pass++) {
                kvm_for_each_vcpu(i, vcpu, kvm) {
-                       if (!pass && i < last_boosted_vcpu) {
+                       if (!pass && i <= last_boosted_vcpu) {
                                i = last_boosted_vcpu;
                                continue;
                        } else if (pass && i > last_boosted_vcpu)