Revert "KVM: Fix a data race on last_boosted_vcpu in kvm_vcpu_on_spin()"

This reverts commit 1ea1717b12.
This commit is contained in:
Ksawlii 2024-11-24 00:22:53 +01:00
parent 0a13b31c06
commit f172b138b7

View file

@ -3090,13 +3090,12 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me, bool yield_to_kernel_mode)
{
struct kvm *kvm = me->kvm;
struct kvm_vcpu *vcpu;
int last_boosted_vcpu;
int last_boosted_vcpu = me->kvm->last_boosted_vcpu;
int yielded = 0;
int try = 3;
int pass;
int i;
last_boosted_vcpu = READ_ONCE(kvm->last_boosted_vcpu);
kvm_vcpu_set_in_spin_loop(me, true);
/*
* We boost the priority of a VCPU that is runnable but not
@ -3127,7 +3126,7 @@ void kvm_vcpu_on_spin(struct kvm_vcpu *me, bool yield_to_kernel_mode)
yielded = kvm_vcpu_yield_to(vcpu);
if (yielded > 0) {
WRITE_ONCE(kvm->last_boosted_vcpu, i);
kvm->last_boosted_vcpu = i;
break;
} else if (yielded < 0) {
try--;