[PATCH 0/3] KVM: extract lock_all_vcpus/unlock_all_vcpus

Maxim Levitsky mlevitsk at redhat.com
Mon Feb 10 16:09:14 PST 2025


Implement Paolo's suggestion of reusing
sev_lock/unlock_vcpus_for_migration in arm and riscv code
for the purpose of taking vcpu->mutex of all vcpus of a VM.

Because sev_lock/unlock_vcpus_for_migration already have a workaround
for lockdep max lock depth, this fixes the lockdep warnings on arm
which were the inspiration for this refactoring.

This patch series was only compile tested on all 3 architectures.

Best regards,
	Maxim Levitsky

Maxim Levitsky (3):
  KVM: x86: move sev_lock/unlock_vcpus_for_migration to kvm_main.c
  KVM: arm64: switch to using kvm_lock/unlock_all_vcpus
  RISC-V: KVM: switch to kvm_lock/unlock_all_vcpus

 arch/arm64/include/asm/kvm_host.h     |  3 --
 arch/arm64/kvm/arch_timer.c           |  8 ++--
 arch/arm64/kvm/arm.c                  | 32 -------------
 arch/arm64/kvm/vgic/vgic-init.c       | 11 +++--
 arch/arm64/kvm/vgic/vgic-its.c        | 18 +++----
 arch/arm64/kvm/vgic/vgic-kvm-device.c | 21 ++++----
 arch/riscv/kvm/aia_device.c           | 36 ++------------
 arch/x86/kvm/svm/sev.c                | 65 ++-----------------------
 include/linux/kvm_host.h              |  6 +++
 virt/kvm/kvm_main.c                   | 69 +++++++++++++++++++++++++++
 10 files changed, 115 insertions(+), 154 deletions(-)

-- 
2.26.3





More information about the linux-riscv mailing list