Subject: Re: [RFC PATCH v2 10/11] powerpc: Support to replay PMIs

From: Benjamin Herrenschmidt <[email-masked]>
Date: Mon, 01 Aug 2016 18:52:42 +1000

On Mon, 2016-08-01 at 18:07 +1000, Nicholas Piggin wrote:
> > +static inline unsigned long soft_irq_set_level(int value)
> > +{
> > +     unsigned long flags, zero;
> > +
> > +     asm volatile(
> > +             "li %1,%3; lbz %0,%2(13); stb %1,%2(13)"
> > +             : "=r" (flags), "=&r" (zero)
> > +             : "i" (offsetof(struct paca_struct, soft_enabled)),\
> > +               "i" (value)
> > +             : "memory");
> > +
> > +     return flags;
> > +}

I would add a WARN_ON (possibly under control
of CONFIG_TRACE_IRQFLAGS(*) to verify we only ever use this to make
interrupts "less enabled".

(*) Or check if distros use CONFIG_TRACE_IRQFLAGS these days, then
create a new CONFIG_DEBUG_IRQ or something like that, and also move
the other use of CONFIG_TRACE_IRQFLAGS in local_irq_restore that
checks the msr as we really don't want that in production kernels.

Cheers,
Ben.