Re: [PATCH 2/8] x86/irq: Track if IRQ was found in PIR during initial loop (to load PIR vals)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 17, 2025, Thomas Gleixner wrote:
> On Fri, Mar 14 2025 at 20:06, Sean Christopherson wrote:
> > @@ -409,25 +409,28 @@ static __always_inline bool handle_pending_pir(u64 *pir, struct pt_regs *regs)
> >  {
> >  	int i, vec = FIRST_EXTERNAL_VECTOR;
> >  	unsigned long pir_copy[4];
> > -	bool handled = false;
> > +	bool found_irq = false;
> >  
> > -	for (i = 0; i < 4; i++)
> > +	for (i = 0; i < 4; i++) {
> >  		pir_copy[i] = READ_ONCE(pir[i]);
> > +		if (pir_copy[i])
> > +			found_irq = true;
> > +	}
> 
> That's four extra conditional branches. You can avoid them completely. See
> delta patch below.

Huh.  gcc elides the conditional branches when computing found_irq regardless of
the approach; the JEs in the changelog are from skipping the XCHG.

But clang-14 does not.  I'll slot this in.

Thanks!




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux