From: Marc Zyngier <maz@kernel.org>
To: Oliver Upton <oliver.upton@linux.dev>
Cc: kvmarm@lists.linux.dev, Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>
Subject: Re: [PATCH 4/5] KVM: arm64: vgic-v3: Don't require IRQs be disabled for LPI xarray lock
Date: Fri, 05 Sep 2025 09:13:45 +0100 [thread overview]
Message-ID: <87plc5z58m.wl-maz@kernel.org> (raw)
In-Reply-To: <20250904062348.223976-5-oliver.upton@linux.dev>
On Thu, 04 Sep 2025 07:23:47 +0100,
Oliver Upton <oliver.upton@linux.dev> wrote:
>
> Now that the LPI xarray is only read with IRQs disabled, relax the
> locking on the xarray to a non-IRQ disabling spinlock.
>
> Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
> ---
> arch/arm64/kvm/vgic/vgic-init.c | 2 +-
> arch/arm64/kvm/vgic/vgic-its.c | 7 +++----
> arch/arm64/kvm/vgic/vgic.c | 13 ++++++-------
> 3 files changed, 10 insertions(+), 12 deletions(-)
>
> diff --git a/arch/arm64/kvm/vgic/vgic-init.c b/arch/arm64/kvm/vgic/vgic-init.c
> index 4c777136ea5f..4c3c0d82e476 100644
> --- a/arch/arm64/kvm/vgic/vgic-init.c
> +++ b/arch/arm64/kvm/vgic/vgic-init.c
> @@ -53,7 +53,7 @@ void kvm_vgic_early_init(struct kvm *kvm)
> {
> struct vgic_dist *dist = &kvm->arch.vgic;
>
> - xa_init_flags(&dist->lpi_xa, XA_FLAGS_LOCK_IRQ);
> + xa_init(&dist->lpi_xa);
> }
>
> /* CREATION */
> diff --git a/arch/arm64/kvm/vgic/vgic-its.c b/arch/arm64/kvm/vgic/vgic-its.c
> index f162206adb48..ce3e3ed3f29f 100644
> --- a/arch/arm64/kvm/vgic/vgic-its.c
> +++ b/arch/arm64/kvm/vgic/vgic-its.c
> @@ -78,7 +78,6 @@ static struct vgic_irq *vgic_add_lpi(struct kvm *kvm, u32 intid,
> {
> struct vgic_dist *dist = &kvm->arch.vgic;
> struct vgic_irq *irq = vgic_get_irq(kvm, intid), *oldirq;
> - unsigned long flags;
> int ret;
>
> /* In this case there is no put, since we keep the reference. */
> @@ -89,7 +88,7 @@ static struct vgic_irq *vgic_add_lpi(struct kvm *kvm, u32 intid,
> if (!irq)
> return ERR_PTR(-ENOMEM);
>
> - ret = xa_reserve_irq(&dist->lpi_xa, intid, GFP_KERNEL_ACCOUNT);
> + ret = xa_reserve(&dist->lpi_xa, intid, GFP_KERNEL_ACCOUNT);
> if (ret) {
> kfree(irq);
> return ERR_PTR(ret);
> @@ -104,7 +103,7 @@ static struct vgic_irq *vgic_add_lpi(struct kvm *kvm, u32 intid,
> irq->target_vcpu = vcpu;
> irq->group = 1;
>
> - xa_lock_irqsave(&dist->lpi_xa, flags);
> + xa_lock(&dist->lpi_xa);
>
> /*
> * There could be a race with another vgic_add_lpi(), so we need to
> @@ -126,7 +125,7 @@ static struct vgic_irq *vgic_add_lpi(struct kvm *kvm, u32 intid,
> }
>
> out_unlock:
> - xa_unlock_irqrestore(&dist->lpi_xa, flags);
> + xa_unlock(&dist->lpi_xa);
>
> if (ret)
> return ERR_PTR(ret);
> diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c
> index 480391a0dcad..a21b482844ce 100644
> --- a/arch/arm64/kvm/vgic/vgic.c
> +++ b/arch/arm64/kvm/vgic/vgic.c
> @@ -28,7 +28,7 @@ struct vgic_global kvm_vgic_global_state __ro_after_init = {
> * kvm->arch.config_lock (mutex)
> * its->cmd_lock (mutex)
> * its->its_lock (mutex)
> - * vgic_dist->lpi_xa.xa_lock must be taken with IRQs disabled
> + * vgic_dist->lpi_xa.xa_lock
Doesn't this contradict the commit message statement that we always
take this lock with interrupts disabled?
Thanks,
M.
--
Jazz isn't dead. It just smells funny.
next prev parent reply other threads:[~2025-09-05 8:13 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 [this message]
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
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=87plc5z58m.wl-maz@kernel.org \
--to=maz@kernel.org \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=oliver.upton@linux.dev \
--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