]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: fix avic_set_running for preemptable kernels
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 30 Nov 2021 08:46:07 +0000 (03:46 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 30 Nov 2021 12:40:48 +0000 (07:40 -0500)
commit5cefc44e71d3914acf5500a116e33e8bc0b65094
treea5b87c639298951bfee39ba9e2b14f36d9dd6af8
parentc6b37814f7271a7d074d31880cbd997f8295c9d6
KVM: fix avic_set_running for preemptable kernels

avic_set_running() passes the current CPU to avic_vcpu_load(), albeit
via vcpu->cpu rather than smp_processor_id().  If the thread is migrated
while avic_set_running runs, the call to avic_vcpu_load() can use a stale
value for the processor id.  Avoid this by blocking preemption over the
entire execution of avic_set_running().

Reported-by: Sean Christopherson <seanjc@google.com>
Fixes: af9badde83f5 ("svm: Manage vcpu load/unload when enable AVIC")
Cc: stable@vger.kernel.org
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/svm/avic.c