summary refs log tree commit diff
path: root/virt
diff options
context:
space:
mode:
authorRik van Riel <riel@redhat.com>2012-06-19 16:51:04 -0400
committerMarcelo Tosatti <mtosatti@redhat.com>2012-07-06 14:11:18 -0300
commit5cfc2aabcb282f4554e7086c9893b386ad6ba9d4 (patch)
tree81b9989c069f54e42a748c8af6a2989bdbe6a8b9 /virt
parent21b26c08535c992802402c7ba2d789ca9e1a5707 (diff)
downloadlinux-5cfc2aabcb282f4554e7086c9893b386ad6ba9d4.tar.gz
KVM: handle last_boosted_vcpu = 0 case
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>
Diffstat (limited to 'virt')
-rw-r--r--virt/kvm/kvm_main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 636bd08bb399..b3ce91c623e2 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -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)