Skip to content

Commit

Permalink
KVM: handle last_boosted_vcpu = 0 case
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>
  • Loading branch information
Rik van Riel authored and matosatti committed Jul 6, 2012
1 parent 21b26c0 commit 5cfc2aa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5cfc2aa

Please sign in to comment.