From f172b138b70104a219b40f9cc52e0e6d685b3a5e Mon Sep 17 00:00:00 2001 From: Ksawlii Date: Sun, 24 Nov 2024 00:22:53 +0100 Subject: [PATCH] Revert "KVM: Fix a data race on last_boosted_vcpu in kvm_vcpu_on_spin()" This reverts commit 1ea1717b127401eeffd5aa33f6753b4e29765283. --- virt/kvm/kvm_main.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index ef66abe68..b7638c3c9 100755 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -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--;