Subject: Re: [PATCH] powerpc/64: irq_work avoid immediate interrupt when raised with hard irqs enabled

From: Nicholas Piggin <[email-masked]>
Date: Mon, 9 Apr 2018 20:45:53 +1000

On Mon, 09 Apr 2018 18:46:29 +1000
Benjamin Herrenschmidt <[email-masked]> wrote:

> On Fri, 2018-04-06 at 00:31 +1000, Nicholas Piggin wrote:
> > irq_work_raise should not schedule the hardware decrementer interrupt
> > unless it is called from NMI context. Doing so often just results in an
> > immediate masked decrementer interrupt:
> > 
> >    <...>-550    90d...    4us : update_curr_rt <-dequeue_task_rt
> >    <...>-550    90d...    5us : dbs_update_util_handler <-update_curr_rt
> >    <...>-550    90d...    6us : arch_irq_work_raise <-irq_work_queue
> >    <...>-550    90d...    7us : soft_nmi_interrupt <-soft_nmi_common
> >    <...>-550    90d...    7us : printk_nmi_enter <-soft_nmi_interrupt
> >    <...>-550    90d.Z.    8us : rcu_nmi_enter <-soft_nmi_interrupt
> >    <...>-550    90d.Z.    9us : rcu_nmi_exit <-soft_nmi_interrupt
> >    <...>-550    90d...    9us : printk_nmi_exit <-soft_nmi_interrupt
> >    <...>-550    90d...   10us : cpuacct_charge <-update_curr_rt
> > 
> > Set the decrementer pending in the irq_happened mask directly, rather
> > than having the masked decrementer handler do it.  
> 
> Setting the paca field needs hard irqs off...

Doh! Good catch, I should have noticed that :)

> also preempt_disable
> doesn't look necessary if IRQs are off.

True, just copied from existing code.

Thanks,
Nick