On 2020/2/8 0:34, Marc Zyngier wrote:
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: 7495e22bb165 ("KVM: Move running VCPU from ARM to common code"). Cc: Peter Xu <peterx@xxxxxxxxxx> Cc: Paolo Bonzini <pbonzini@xxxxxxxxxx> Reported-by: Zenghui Yu <yuzenghui@xxxxxxxxxx> Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx> Link: https://lore.kernel.org/r/318984f6-bc36-33a3-abc6-bf2295974b06@xxxxxxxxxx
Tested-by: Zenghui Yu <yuzenghui@xxxxxxxxxx> on top of v5.6-rc1. Thanks