All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Marc Zyngier" <maz@kernel.org>,
	kvmarm@lists.linux.dev, kvm@vger.kernel.org
Cc: "Oliver Upton" <oupton@kernel.org>
Subject: Re: [PATCH 6.12.y 5/5] KVM: arm64: vgic: Linearise AP list pruning process
Date: Sat, 05 Dec 2026 11:06:50 +0000	[thread overview]
Message-ID: <sashiko-outbox-251441@kernel.org> (raw)
In-Reply-To: <20261205104132.1432014-6-maz@kernel.org>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] KVM: arm64: vgic: stale comments and dead IS_ERR checks in AP
  list pruning
--

commit bd77f930cb999af9dd0a13b7508cf2a102774270
Author: Marc Zyngier <maz@kernel.org>

KVM: arm64: vgic: Linearise AP list pruning process

This commit backports upstream commit 504fa43c028d ("KVM: arm64: vgic:
Linearise AP list pruning process") to replace the quadratic AP list
pruning loop in vgic_prune_ap_list() with a linear culling-list pass that
holds only one vCPU ap_list_lock at a time.

> diff --git a/arch/arm64/kvm/vgic/vgic.c b/arch/arm64/kvm/vgic/vgic.c
> index 967d8111642cf..16818433dc112 100644
> --- a/arch/arm64/kvm/vgic/vgic.c
> +++ b/arch/arm64/kvm/vgic/vgic.c
> @@ -608,6 +608,26 @@ int kvm_vgic_set_owner(struct kvm_vcpu *vcpu, unsigned int intid, void *owner)
>  	return ret;
>  }
>  
> +/*
> + * This helper checks the target *and* does the laundry, nuking the irq off
> + * the ap_list when necessary, and doing the refcount drop on LPIs. -ENOENT
> + * is returned when LPI release is warranted.
> + */
> +static struct kvm_vcpu *vgic_predict_target(struct kvm *kvm, struct vgic_irq *irq)
> +{
> +	struct kvm_vcpu *target;
> +
> +	lockdep_assert_held(&irq->irq_lock);
> +
> +	target = vgic_target_oracle(irq);
> +	if (!target) {
> +		list_del(&irq->ap_list);
> +		irq->vcpu = NULL;
> +	}
> +
> +	return target;
> +}

[ ... ]

> +		/*
> +		 * We skip the processing of an irq in a few cases:
> +		 * - the irq is on the correct target: nothing to do.
> +		 * - the target is NULL: vgic_predict_target() will have
> +		 *   culled the irq from the ap_list.
> +		 * - we get an error back: the LPI has been deleted.
> +		 */
> +		irq_target = vgic_predict_target(vcpu->kvm, irq);
> +		if (irq_target == vcpu || IS_ERR_OR_NULL(irq_target)) {
> +			raw_spin_unlock(&irq->irq_lock);
> +			if (!irq_target)
> +				vgic_put_irq(vcpu->kvm, irq);
> +			continue;
> +		}

[ ... ]

> +			irq_target = vgic_predict_target(vcpu->kvm, irq);
> +			if (IS_ERR_OR_NULL(irq_target)) {
> +				raw_spin_unlock(&irq->irq_lock);
> +				vgic_put_irq(vcpu->kvm, irq);
> +				continue;
> +			}

[Severity: Low]
In this backport adaptation, vgic_predict_target() no longer drops LPI
refcounts or returns -ENOENT, and its kvm parameter is unused.  Because
vgic_target_oracle() only returns a struct kvm_vcpu pointer or NULL, the
comments about -ENOENT and deleted LPIs are stale.

Both IS_ERR_OR_NULL(irq_target) checks in vgic_prune_ap_list() also test
an unreachable error-pointer case, and treat it inconsistently by guarding
vgic_put_irq() with if (!irq_target) only in the first loop.

Should the comments be updated, the unused kvm parameter dropped, and
IS_ERR_OR_NULL(irq_target) simplified to !irq_target?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261205104132.1432014-1-maz@kernel.org?part=5

      reply	other threads:[~2026-12-05 11:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05 10:41 [PATCH 6.12.y 0/5] KVM/arm64 stable fixes Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.12.y 1/5] KVM: arm64: vgic-its: Stop the VM when handling MOVALL Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.12.y 2/5] KVM: arm64: vgic-its: Bound PINTID during ITE table restore Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.12.y 3/5] irqchip/gic-v4: Contain VMAPTI vINTID to the expected boundaries Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.12.y 4/5] KVM: arm64: vgic-its: Add signal checks in scan_its_table() Marc Zyngier
2026-12-05 10:41 ` [PATCH 6.12.y 5/5] KVM: arm64: vgic: Linearise AP list pruning process Marc Zyngier
2026-12-05 11:06   ` sashiko-bot [this message]

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=sashiko-outbox-251441@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=kvmarm@lists.linux.dev \
    --cc=maz@kernel.org \
    --cc=oupton@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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.