[PATCH v2 20/45] KVM: arm64: Revamp vgic maintenance interrupt configuration

Marc Zyngier maz at kernel.org
Wed Nov 12 00:33:54 PST 2025


On Wed, 12 Nov 2025 00:08:37 +0000,
Oliver Upton <oupton at kernel.org> wrote:
> 
> On Sun, Nov 09, 2025 at 05:15:54PM +0000, Marc Zyngier wrote:
> > +static void summarize_ap_list(struct kvm_vcpu *vcpu,
> > +			      struct ap_list_summary *als)
> >  {
> >  	struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;
> >  	struct vgic_irq *irq;
> > -	int count = 0;
> > -
> > -	*multi_sgi = false;
> >  
> >  	lockdep_assert_held(&vgic_cpu->ap_list_lock);
> >  
> > -	list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list) {
> > -		int w;
> > +	*als = (typeof(*als)){};
> >  
> > -		raw_spin_lock(&irq->irq_lock);
> > -		/* GICv2 SGIs can count for more than one... */
> > -		w = vgic_irq_get_lr_count(irq);
> > -		raw_spin_unlock(&irq->irq_lock);
> > +	list_for_each_entry(irq, &vgic_cpu->ap_list_head, ap_list) {
> > +		scoped_guard(raw_spinlock, &irq->irq_lock) {
> > +			if (vgic_target_oracle(irq) != vcpu)
> > +				continue;
> 
> From our conversation about this sort of thing a few weeks ago, wont
> this 'continue' interact pooly with the for loop that scoped_guard()
> expands to?

Gahhh... I was sure I had killed that everywhere, but obviously failed
to. I wish there was a coccinelle script to detect this sort of broken
constructs (where are the script kiddies when you really need them?).

Thanks for spotting it!

> Consistent with the other checks against the destination oracle you'll
> probably want a branch hint too.

Yup, I'll add that.

Thanks again,

	M.

-- 
Without deviation from the norm, progress is not possible.



More information about the linux-arm-kernel mailing list