All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Maxim Levitsky <mlevitsk@redhat.com>
Cc: kvm@vger.kernel.org, Suzuki K Poulose <suzuki.poulose@arm.com>,
	Jing Zhang <jingzhangos@google.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Sebastian Ott <sebott@redhat.com>,
	Shusen Li <lishusen2@huawei.com>,
	Waiman Long <longman@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-arm-kernel@lists.infradead.org,
	Bjorn Helgaas <bhelgaas@google.com>,
	Borislav Petkov <bp@alien8.de>, Anup Patel <anup@brainfault.org>,
	Will Deacon <will@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Alexander Potapenko <glider@google.com>,
	kvmarm@lists.linux.dev,
	Keisuke Nishimura <keisuke.nishimura@inria.fr>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Atish Patra <atishp@atishpatra.org>,
	Joey Gouly <joey.gouly@arm.com>,
	x86@kernel.org, Marc Zyngier <maz@kernel.org>,
	Sean Christopherson <seanjc@google.com>,
	Andre Przywara <andre.przywara@arm.com>,
	Kunkun Jiang <jiangkunkun@huawei.com>,
	linux-riscv@lists.infradead.org,
	Randy Dunlap <rdunlap@infradead.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Alexandre Ghiti <alex@ghiti.fr>,
	linux-kernel@vger.kernel.org,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Oliver Upton <oliver.upton@linux.dev>,
	kvm-riscv@lists.infradead.org, Ingo Molnar <mingo@redhat.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Albert Ou <aou@eecs.berkeley.edu>
Subject: Re: [PATCH v5 0/6] KVM: lockdep improvements
Date: Tue, 13 May 2025 13:45:55 +0200	[thread overview]
Message-ID: <20250513114555.GF25763@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250512180407.659015-1-mlevitsk@redhat.com>

On Mon, May 12, 2025 at 02:04:01PM -0400, Maxim Levitsky wrote:
> This is	a continuation of my 'extract lock_all_vcpus/unlock_all_vcpus'
> patch series.
> 
> Implement the suggestion of using lockdep's "nest_lock" feature
> when locking all KVM vCPUs by adding mutex_trylock_nest_lock() and
> mutex_lock_killable_nest_lock() and use these functions	in the
> implementation of the
> kvm_trylock_all_vcpus()/kvm_lock_all_vcpus()/kvm_unlock_all_vcpus().
> 
> Those changes allow removal of a custom workaround that was needed to
> silence the lockdep warning in the SEV code and also stop lockdep from
> complaining in case of ARM and RISC-V code which doesn't include the above
> mentioned workaround.
> 
> Finally, it's worth noting that this patch series removes a fair
> amount of duplicate code by implementing the logic in one place.
> 
> V5: addressed review feedback.
> 
> Best regards,
> 	Maxim Levitsky
> 
> Maxim Levitsky (6):
>   locking/mutex: implement mutex_trylock_nested
>   locking/mutex: implement mutex_lock_killable_nest_lock
>   KVM: add kvm_lock_all_vcpus and kvm_trylock_all_vcpus
>   x86: KVM: SVM: use kvm_lock_all_vcpus instead of a custom
>     implementation
>   KVM: arm64: use kvm_trylock_all_vcpus when locking all vCPUs
>   RISC-V: KVM: use kvm_trylock_all_vcpus when locking 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                | 72 ++-------------------------
>  include/linux/kvm_host.h              |  4 ++
>  include/linux/mutex.h                 | 32 ++++++++++--
>  kernel/locking/mutex.c                | 21 +++++---
>  virt/kvm/kvm_main.c                   | 59 ++++++++++++++++++++++
>  12 files changed, 126 insertions(+), 170 deletions(-)

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

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

WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: Maxim Levitsky <mlevitsk@redhat.com>
Cc: kvm@vger.kernel.org, Suzuki K Poulose <suzuki.poulose@arm.com>,
	Jing Zhang <jingzhangos@google.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Sebastian Ott <sebott@redhat.com>,
	Shusen Li <lishusen2@huawei.com>,
	Waiman Long <longman@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-arm-kernel@lists.infradead.org,
	Bjorn Helgaas <bhelgaas@google.com>,
	Borislav Petkov <bp@alien8.de>, Anup Patel <anup@brainfault.org>,
	Will Deacon <will@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Alexander Potapenko <glider@google.com>,
	kvmarm@lists.linux.dev,
	Keisuke Nishimura <keisuke.nishimura@inria.fr>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Atish Patra <atishp@atishpatra.org>,
	Joey Gouly <joey.gouly@arm.com>,
	x86@kernel.org, Marc Zyngier <maz@kernel.org>,
	Sean Christopherson <seanjc@google.com>,
	Andre Przywara <andre.przywara@arm.com>,
	Kunkun Jiang <jiangkunkun@huawei.com>,
	linux-riscv@lists.infradead.org,
	Randy Dunlap <rdunlap@infradead.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Alexandre Ghiti <alex@ghiti.fr>,
	linux-kernel@vger.kernel.org,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Oliver Upton <oliver.upton@linux.dev>,
	kvm-riscv@lists.infradead.org, Ingo Molnar <mingo@redhat.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Albert Ou <aou@eecs.berkeley.edu>
Subject: Re: [PATCH v5 0/6] KVM: lockdep improvements
Date: Tue, 13 May 2025 13:45:55 +0200	[thread overview]
Message-ID: <20250513114555.GF25763@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250512180407.659015-1-mlevitsk@redhat.com>

On Mon, May 12, 2025 at 02:04:01PM -0400, Maxim Levitsky wrote:
> This is	a continuation of my 'extract lock_all_vcpus/unlock_all_vcpus'
> patch series.
> 
> Implement the suggestion of using lockdep's "nest_lock" feature
> when locking all KVM vCPUs by adding mutex_trylock_nest_lock() and
> mutex_lock_killable_nest_lock() and use these functions	in the
> implementation of the
> kvm_trylock_all_vcpus()/kvm_lock_all_vcpus()/kvm_unlock_all_vcpus().
> 
> Those changes allow removal of a custom workaround that was needed to
> silence the lockdep warning in the SEV code and also stop lockdep from
> complaining in case of ARM and RISC-V code which doesn't include the above
> mentioned workaround.
> 
> Finally, it's worth noting that this patch series removes a fair
> amount of duplicate code by implementing the logic in one place.
> 
> V5: addressed review feedback.
> 
> Best regards,
> 	Maxim Levitsky
> 
> Maxim Levitsky (6):
>   locking/mutex: implement mutex_trylock_nested
>   locking/mutex: implement mutex_lock_killable_nest_lock
>   KVM: add kvm_lock_all_vcpus and kvm_trylock_all_vcpus
>   x86: KVM: SVM: use kvm_lock_all_vcpus instead of a custom
>     implementation
>   KVM: arm64: use kvm_trylock_all_vcpus when locking all vCPUs
>   RISC-V: KVM: use kvm_trylock_all_vcpus when locking 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                | 72 ++-------------------------
>  include/linux/kvm_host.h              |  4 ++
>  include/linux/mutex.h                 | 32 ++++++++++--
>  kernel/locking/mutex.c                | 21 +++++---
>  virt/kvm/kvm_main.c                   | 59 ++++++++++++++++++++++
>  12 files changed, 126 insertions(+), 170 deletions(-)

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

WARNING: multiple messages have this Message-ID (diff)
From: Peter Zijlstra <peterz@infradead.org>
To: Maxim Levitsky <mlevitsk@redhat.com>
Cc: kvm@vger.kernel.org, Suzuki K Poulose <suzuki.poulose@arm.com>,
	Jing Zhang <jingzhangos@google.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Sebastian Ott <sebott@redhat.com>,
	Shusen Li <lishusen2@huawei.com>,
	Waiman Long <longman@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-arm-kernel@lists.infradead.org,
	Bjorn Helgaas <bhelgaas@google.com>,
	Borislav Petkov <bp@alien8.de>, Anup Patel <anup@brainfault.org>,
	Will Deacon <will@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Alexander Potapenko <glider@google.com>,
	kvmarm@lists.linux.dev,
	Keisuke Nishimura <keisuke.nishimura@inria.fr>,
	Zenghui Yu <yuzenghui@huawei.com>,
	Atish Patra <atishp@atishpatra.org>,
	Joey Gouly <joey.gouly@arm.com>,
	x86@kernel.org, Marc Zyngier <maz@kernel.org>,
	Sean Christopherson <seanjc@google.com>,
	Andre Przywara <andre.przywara@arm.com>,
	Kunkun Jiang <jiangkunkun@huawei.com>,
	linux-riscv@lists.infradead.org,
	Randy Dunlap <rdunlap@infradead.org>,
	Paolo Bonzini <pbonzini@redhat.com>,
	Boqun Feng <boqun.feng@gmail.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Alexandre Ghiti <alex@ghiti.fr>,
	linux-kernel@vger.kernel.org,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Oliver Upton <oliver.upton@linux.dev>,
	kvm-riscv@lists.infradead.org, Ingo Molnar <mingo@redhat.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Albert Ou <aou@eecs.berkeley.edu>
Subject: Re: [PATCH v5 0/6] KVM: lockdep improvements
Date: Tue, 13 May 2025 13:45:55 +0200	[thread overview]
Message-ID: <20250513114555.GF25763@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250512180407.659015-1-mlevitsk@redhat.com>

On Mon, May 12, 2025 at 02:04:01PM -0400, Maxim Levitsky wrote:
> This is	a continuation of my 'extract lock_all_vcpus/unlock_all_vcpus'
> patch series.
> 
> Implement the suggestion of using lockdep's "nest_lock" feature
> when locking all KVM vCPUs by adding mutex_trylock_nest_lock() and
> mutex_lock_killable_nest_lock() and use these functions	in the
> implementation of the
> kvm_trylock_all_vcpus()/kvm_lock_all_vcpus()/kvm_unlock_all_vcpus().
> 
> Those changes allow removal of a custom workaround that was needed to
> silence the lockdep warning in the SEV code and also stop lockdep from
> complaining in case of ARM and RISC-V code which doesn't include the above
> mentioned workaround.
> 
> Finally, it's worth noting that this patch series removes a fair
> amount of duplicate code by implementing the logic in one place.
> 
> V5: addressed review feedback.
> 
> Best regards,
> 	Maxim Levitsky
> 
> Maxim Levitsky (6):
>   locking/mutex: implement mutex_trylock_nested
>   locking/mutex: implement mutex_lock_killable_nest_lock
>   KVM: add kvm_lock_all_vcpus and kvm_trylock_all_vcpus
>   x86: KVM: SVM: use kvm_lock_all_vcpus instead of a custom
>     implementation
>   KVM: arm64: use kvm_trylock_all_vcpus when locking all vCPUs
>   RISC-V: KVM: use kvm_trylock_all_vcpus when locking 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                | 72 ++-------------------------
>  include/linux/kvm_host.h              |  4 ++
>  include/linux/mutex.h                 | 32 ++++++++++--
>  kernel/locking/mutex.c                | 21 +++++---
>  virt/kvm/kvm_main.c                   | 59 ++++++++++++++++++++++
>  12 files changed, 126 insertions(+), 170 deletions(-)

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

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

  parent reply	other threads:[~2025-05-13 11:46 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-12 18:04 [PATCH v5 0/6] KVM: lockdep improvements Maxim Levitsky
2025-05-12 18:04 ` Maxim Levitsky
2025-05-12 18:04 ` Maxim Levitsky
2025-05-12 18:04 ` [PATCH v5 1/6] locking/mutex: implement mutex_trylock_nested Maxim Levitsky
2025-05-12 18:04   ` Maxim Levitsky
2025-05-12 18:04   ` Maxim Levitsky
2025-05-12 18:04 ` [PATCH v5 2/6] locking/mutex: implement mutex_lock_killable_nest_lock Maxim Levitsky
2025-05-12 18:04   ` Maxim Levitsky
2025-05-12 18:04   ` Maxim Levitsky
2025-05-12 18:04 ` [PATCH v5 3/6] KVM: add kvm_lock_all_vcpus and kvm_trylock_all_vcpus Maxim Levitsky
2025-05-12 18:04   ` Maxim Levitsky
2025-05-12 18:04   ` Maxim Levitsky
2025-05-14  9:33   ` Marc Zyngier
2025-05-14  9:33     ` Marc Zyngier
2025-05-14  9:33     ` Marc Zyngier
2025-05-12 18:04 ` [PATCH v5 4/6] x86: KVM: SVM: use kvm_lock_all_vcpus instead of a custom implementation Maxim Levitsky
2025-05-12 18:04   ` Maxim Levitsky
2025-05-12 18:04   ` Maxim Levitsky
2025-05-12 18:04 ` [PATCH v5 5/6] KVM: arm64: use kvm_trylock_all_vcpus when locking all vCPUs Maxim Levitsky
2025-05-12 18:04   ` Maxim Levitsky
2025-05-12 18:04   ` Maxim Levitsky
2025-05-14  9:35   ` Marc Zyngier
2025-05-14  9:35     ` Marc Zyngier
2025-05-14  9:35     ` Marc Zyngier
2025-05-12 18:04 ` [PATCH v5 6/6] RISC-V: KVM: " Maxim Levitsky
2025-05-12 18:04   ` Maxim Levitsky
2025-05-12 18:04   ` Maxim Levitsky
2025-05-13 11:18   ` Anup Patel
2025-05-13 11:18     ` Anup Patel
2025-05-13 11:18     ` Anup Patel
2025-05-13 11:45 ` Peter Zijlstra [this message]
2025-05-13 11:45   ` [PATCH v5 0/6] KVM: lockdep improvements Peter Zijlstra
2025-05-13 11:45   ` Peter Zijlstra
2025-05-27 16:23 ` Paolo Bonzini
2025-06-10 16:28 ` patchwork-bot+linux-riscv
2025-06-10 16:28   ` patchwork-bot+linux-riscv
2025-06-10 16:28   ` patchwork-bot+linux-riscv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250513114555.GF25763@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=alex@ghiti.fr \
    --cc=andre.przywara@arm.com \
    --cc=anup@brainfault.org \
    --cc=aou@eecs.berkeley.edu \
    --cc=atishp@atishpatra.org \
    --cc=bhelgaas@google.com \
    --cc=boqun.feng@gmail.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=glider@google.com \
    --cc=hpa@zytor.com \
    --cc=jiangkunkun@huawei.com \
    --cc=jingzhangos@google.com \
    --cc=joey.gouly@arm.com \
    --cc=keisuke.nishimura@inria.fr \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=lishusen2@huawei.com \
    --cc=longman@redhat.com \
    --cc=maz@kernel.org \
    --cc=mingo@redhat.com \
    --cc=mlevitsk@redhat.com \
    --cc=oliver.upton@linux.dev \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=pbonzini@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=seanjc@google.com \
    --cc=sebott@redhat.com \
    --cc=suzuki.poulose@arm.com \
    --cc=tglx@linutronix.de \
    --cc=will@kernel.org \
    --cc=x86@kernel.org \
    --cc=yuzenghui@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.