diff options
author | 2024-04-17 15:45:25 +0800 | |
---|---|---|
committer | 2024-04-22 10:37:11 +0530 | |
commit | 2121cadec45aaf61fa45b3aa3d99723ed4e6683a (patch) | |
tree | 4e2988e18b8011af58bca07e987a3c48d73bea6b /lib/dump_stack.c | |
parent | RISC-V: KVM: selftests: Add ebreak test support (diff) | |
download | wireguard-linux-2121cadec45aaf61fa45b3aa3d99723ed4e6683a.tar.xz wireguard-linux-2121cadec45aaf61fa45b3aa3d99723ed4e6683a.zip |
RISCV: KVM: Introduce mp_state_lock to avoid lock inversion
Documentation/virt/kvm/locking.rst advises that kvm->lock should be
acquired outside vcpu->mutex and kvm->srcu. However, when KVM/RISC-V
handling SBI_EXT_HSM_HART_START, the lock ordering is vcpu->mutex,
kvm->srcu then kvm->lock.
Although the lockdep checking no longer complains about this after commit
f0f44752f5f6 ("rcu: Annotate SRCU's update-side lockdep dependencies"),
it's necessary to replace kvm->lock with a new dedicated lock to ensure
only one hart can execute the SBI_EXT_HSM_HART_START call for the target
hart simultaneously.
Additionally, this patch also rename "power_off" to "mp_state" with two
possible values. The vcpu->mp_state_lock also protects the access of
vcpu->mp_state.
Signed-off-by: Yong-Xuan Wang <yongxuan.wang@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20240417074528.16506-2-yongxuan.wang@sifive.com
Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'lib/dump_stack.c')
0 files changed, 0 insertions, 0 deletions