Patch "KVM: x86: disable preemption while updating apicv inhibition" has been added to the 5.18-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    KVM: x86: disable preemption while updating apicv inhibition

to the 5.18-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kvm-x86-disable-preemption-while-updating-apicv-inhi.patch
and it can be found in the queue-5.18 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 4fc1688d87063c8fba524640fb2ab8073c7836c3
Author: Maxim Levitsky <mlevitsk@xxxxxxxxxx>
Date:   Mon Jun 6 21:08:27 2022 +0300

    KVM: x86: disable preemption while updating apicv inhibition
    
    [ Upstream commit 66c768d30e64e1280520f34dbef83419f55f3459 ]
    
    Currently nothing prevents preemption in kvm_vcpu_update_apicv.
    
    On SVM, If the preemption happens after we update the
    vcpu->arch.apicv_active, the preemption itself will
    'update' the inhibition since the AVIC will be first disabled
    on vCPU unload and then enabled, when the current task
    is loaded again.
    
    Then we will try to update it again, which will lead to a warning
    in __avic_vcpu_load, that the AVIC is already enabled.
    
    Fix this by disabling preemption in this code.
    
    Signed-off-by: Maxim Levitsky <mlevitsk@xxxxxxxxxx>
    Message-Id: <20220606180829.102503-6-mlevitsk@xxxxxxxxxx>
    Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 91d887fd10ab..65b0ec28bd52 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -9784,6 +9784,7 @@ void kvm_vcpu_update_apicv(struct kvm_vcpu *vcpu)
 		return;
 
 	down_read(&vcpu->kvm->arch.apicv_update_lock);
+	preempt_disable();
 
 	activate = kvm_apicv_activated(vcpu->kvm);
 	if (vcpu->arch.apicv_active == activate)
@@ -9803,6 +9804,7 @@ void kvm_vcpu_update_apicv(struct kvm_vcpu *vcpu)
 		kvm_make_request(KVM_REQ_EVENT, vcpu);
 
 out:
+	preempt_enable();
 	up_read(&vcpu->kvm->arch.apicv_update_lock);
 }
 EXPORT_SYMBOL_GPL(kvm_vcpu_update_apicv);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux