kvm-riscv.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] KVM: extract lock_all_vcpus/unlock_all_vcpus
@ 2025-04-09  1:41 Maxim Levitsky
  2025-04-09  1:41 ` [PATCH v2 1/4] locking/mutex: implement mutex_trylock_nested Maxim Levitsky
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Maxim Levitsky @ 2025-04-09  1:41 UTC (permalink / raw)
  To: kvm
  Cc: Alexander Potapenko, H. Peter Anvin, Suzuki K Poulose, kvm-riscv,
	Oliver Upton, Dave Hansen, Jing Zhang, Waiman Long, x86,
	Kunkun Jiang, Boqun Feng, Anup Patel, Albert Ou, kvmarm,
	linux-kernel, Zenghui Yu, Borislav Petkov, Alexandre Ghiti,
	Keisuke Nishimura, Sebastian Ott, Paolo Bonzini, Atish Patra,
	Paul Walmsley, Randy Dunlap, Will Deacon, Palmer Dabbelt,
	linux-riscv, Marc Zyngier, linux-arm-kernel, Joey Gouly,
	Peter Zijlstra, Ingo Molnar, Andre Przywara, Thomas Gleixner,
	Sean Christopherson, Catalin Marinas, Maxim Levitsky,
	Bjorn Helgaas

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.

V2: added trylock option to kvm_lock_all_vcpus to be better compatible
with the orginal code.

Best regards,
	Maxim Levitsky

Maxim Levitsky (4):
  locking/mutex: implement mutex_trylock_nested
  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           |  4 +-
 arch/arm64/kvm/arm.c                  | 43 ----------------
 arch/arm64/kvm/vgic/vgic-init.c       |  4 +-
 arch/arm64/kvm/vgic/vgic-its.c        |  8 +--
 arch/arm64/kvm/vgic/vgic-kvm-device.c | 12 ++---
 arch/riscv/kvm/aia_device.c           | 34 +------------
 arch/x86/kvm/svm/sev.c                | 65 ++----------------------
 include/linux/kvm_host.h              |  6 +++
 include/linux/mutex.h                 |  8 +++
 kernel/locking/mutex.c                | 14 ++++--
 virt/kvm/kvm_main.c                   | 71 +++++++++++++++++++++++++++
 12 files changed, 116 insertions(+), 156 deletions(-)

-- 
2.26.3



-- 
kvm-riscv mailing list
kvm-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kvm-riscv

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-04-17  9:54 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-09  1:41 [PATCH v2 0/4] KVM: extract lock_all_vcpus/unlock_all_vcpus Maxim Levitsky
2025-04-09  1:41 ` [PATCH v2 1/4] locking/mutex: implement mutex_trylock_nested Maxim Levitsky
2025-04-10  8:04   ` Peter Zijlstra
2025-04-09  1:41 ` [PATCH v2 2/4] KVM: x86: move sev_lock/unlock_vcpus_for_migration to kvm_main.c Maxim Levitsky
2025-04-09 13:47   ` Waiman Long
2025-04-09 20:45   ` Oliver Upton
2025-04-10  8:16   ` Peter Zijlstra
2025-04-16 17:48     ` Paolo Bonzini
2025-04-16 18:50       ` Peter Zijlstra
2025-04-17  9:53         ` Paolo Bonzini
2025-04-09  1:41 ` [PATCH v2 3/4] KVM: arm64: switch to using kvm_lock/unlock_all_vcpus Maxim Levitsky
2025-04-09  1:41 ` [PATCH v2 4/4] RISC-V: KVM: switch to kvm_lock/unlock_all_vcpus Maxim Levitsky
2025-04-09 19:53 ` [PATCH v2 0/4] KVM: extract lock_all_vcpus/unlock_all_vcpus Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).