]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: Disable preemption in kvm_get_running_vcpu()
authorMarc Zyngier <maz@kernel.org>
Fri, 7 Feb 2020 16:34:10 +0000 (16:34 +0000)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 12 Feb 2020 11:19:35 +0000 (12:19 +0100)
commita231a9558e5474ea4beac14e6653c6399133b1f0
treec2b7086cba02b146916fb93fde7d4ae9d2195469
parentaef851ca85c2f405382d13f03b21ada34454ebf4
KVM: Disable preemption in kvm_get_running_vcpu()

Accessing a per-cpu variable only makes sense when preemption is
disabled (and the kernel does check this when the right debug options
are switched on).

For kvm_get_running_vcpu(), it is fine to return the value after
re-enabling preemption, as the preempt notifiers will make sure that
this is kept consistent across task migration (the comment above the
function hints at it, but lacks the crucial preemption management).

While we're at it, move the comment from the ARM code, which explains
why the whole thing works.

Fixes: b5bfb32bb14c ("KVM: Move running VCPU from ARM to common code").
Cc: Paolo Bonzini <pbonzini@redhat.com>
Reported-by: Zenghui Yu <yuzenghui@huawei.com>
Tested-by: Zenghui Yu <yuzenghui@huawei.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/318984f6-bc36-33a3-abc6-bf2295974b06@huawei.com
Message-id: <20200207163410.31276-1-maz@kernel.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/arm/vgic/vgic-mmio.c
virt/kvm/kvm_main.c