[PATCH v2 5/5] arm64: irqflags: use alternative branches for pseudo-NMI logic

Mark Rutland mark.rutland at arm.com
Thu Jan 26 02:31:52 PST 2023


On Thu, Jan 26, 2023 at 08:49:38AM +0000, Marc Zyngier wrote:
> On Wed, 25 Jan 2023 16:38:26 +0000,
> Mark Rutland <mark.rutland at arm.com> wrote:
> 
> [...]
> 
> > +static __always_inline void __daif_local_irq_restore(unsigned long flags)
> > +{
> > +	barrier();
> > +	write_sysreg(flags, daif);
> > +	barrier();
> > +}
> > +
> > +static __always_inline void __pmr_local_irq_restore(unsigned long flags)
> > +{
> > +	barrier();
> > +	write_sysreg_s(flags, SYS_ICC_PMR_EL1);
> > +	pmr_sync();
> > +	barrier();
> > +}
> 
> It would be good to at least mention why we need these compile-time
> barriers which are not that explicit in the existing code. I guess
> they are equivalent to the "memory" clobber in the asm sequences that
> this replaces, 

Yes; that was the idea.

> but they don't seem to be used consistently throughout this patch.

Yes; looking with fresh eyes, the missing barriers around PMR manipulation are
buggy. Thanks for pointing that out!

I'll go and add the missing barriers, and update the commit message
accordingly.

I'll also use barrier() around the DAIF helpers rather than a memory clobber so
that the equivalent DAIF and PMR helpers more clearly correspond to one
another.

Thanks,
Mark.



More information about the linux-arm-kernel mailing list