Linux KVM/arm64 development list
 help / color / mirror / Atom feed
From: Oliver Upton <oliver.upton@linux.dev>
To: Ben Horgan <ben.horgan@arm.com>
Cc: kvmarm@lists.linux.dev, Marc Zyngier <maz@kernel.org>,
	Joey Gouly <joey.gouly@arm.com>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Zenghui Yu <yuzenghui@huawei.com>
Subject: Re: [PATCH 5/5] KVM: arm64: vgic-v3: Indicate vgic_put_irq() may take LPI xarray lock
Date: Thu, 4 Sep 2025 01:19:12 -0700	[thread overview]
Message-ID: <aLlLgC4GBXYnUWO4@linux.dev> (raw)
In-Reply-To: <308ef1ea-f81c-4081-b664-a55e77de81d6@arm.com>

On Thu, Sep 04, 2025 at 11:25:08AM +0100, Ben Horgan wrote:
> Hi Oliver,
> 
> On 9/4/25 07:23, Oliver Upton wrote:
> > The release path on LPIs is quite rare, meaning it can be difficult to
> > find lock ordering bugs on the LPI xarray's spinlock. Tell lockdep that
> > vgic_put_irq() might acquire the xa_lock to make unsafe patterns more
> > obvious.
> > 
> > Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> > ---
> >  arch/arm64/kvm/vgic/vgic.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c
> > index a21b482844ce..e61b95167ed1 100644
> > --- a/arch/arm64/kvm/vgic/vgic.c
> > +++ b/arch/arm64/kvm/vgic/vgic.c
> > @@ -142,6 +142,9 @@ void vgic_put_irq(struct kvm *kvm, struct vgic_irq *irq)
> >  {
> >  	struct vgic_dist *dist = &kvm->arch.vgic;
> >  
> > +	if (irq->intid > VGIC_MIN_LPI)
> > +		might_lock(&dist->lpi_xa.xa_lock);
> > +
> 
> nit: Use >= rather than > to include all LPI.

Of course, silly typo.

Thanks!
Oliver

  reply	other threads:[~2025-09-04 11:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04  6:23 [PATCH 0/5] KVM: arm64: vgic-v3: Fix yet another lock ordering turd Oliver Upton
2025-09-04  6:23 ` [PATCH 1/5] KVM: arm64: vgic-v3: Use bare refcount for VGIC LPIs Oliver Upton
2025-09-04  6:23 ` [PATCH 2/5] KVM: arm64: Spin off release helper from vgic_put_irq() Oliver Upton
2025-09-04  6:23 ` [PATCH 3/5] KVM: arm64: vgic-v3: Erase LPIs from xarray outside of raw spinlocks Oliver Upton
2025-09-05  7:44   ` Marc Zyngier
2025-09-05  7:19     ` Oliver Upton
2025-09-04  6:23 ` [PATCH 4/5] KVM: arm64: vgic-v3: Don't require IRQs be disabled for LPI xarray lock Oliver Upton
2025-09-05  8:13   ` Marc Zyngier
2025-09-05  8:55     ` Oliver Upton
2025-09-04  6:23 ` [PATCH 5/5] KVM: arm64: vgic-v3: Indicate vgic_put_irq() may take " Oliver Upton
2025-09-04 10:25   ` Ben Horgan
2025-09-04  8:19     ` Oliver Upton [this message]
2025-09-05  8:29 ` [PATCH 0/5] KVM: arm64: vgic-v3: Fix yet another lock ordering turd Marc Zyngier

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=aLlLgC4GBXYnUWO4@linux.dev \
    --to=oliver.upton@linux.dev \
    --cc=ben.horgan@arm.com \
    --cc=joey.gouly@arm.com \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox