Re: [PATCH] rcu/tree: Fix self wakeups for grace period kthread
From: Steven Rostedt
Date: Tue Mar 12 2019 - 10:56:14 EST
On Tue, 12 Mar 2019 07:09:23 -0700
"Paul E. McKenney" <paulmck@xxxxxxxxxxxxx> wrote:
> On Tue, Mar 12, 2019 at 05:25:28PM +0530, Neeraj Upadhyay wrote:
> > On 3/12/19 7:20 AM, Steven Rostedt wrote:
> > >On Fri, 8 Mar 2019 15:16:18 +0530
> > >Neeraj Upadhyay <neeraju@xxxxxxxxxxxxxx> wrote:
> > >
> > >>Update the code to match the comment that self wakeup of
> > >>grace period kthread is allowed from interrupt handler, and
> > >>softirq handler, running in the grace period kthread's
> > >>context. Present code allows self wakeups from all
> > >>interrupt contexts - nmi, softirq and hardirq contexts.
> > >
> > >That's not actually the issue. But it appears that we return if we
> > >simply have BH disabled, which I don't think we want, and we don't care
> > >about NMI as NMI should never call this code.
> > >
> > >I think your patch is correct, but the change log is not.
>
> How about this?
>
> The current rcu_gp_kthread_wake() function uses in_interrupt()
> and thus does a self-wakeup from all interrupt contexts,
> including the pointless case where the GP kthread happens to be
> running with bottom halves disabled, along with the impossible
> case where the GP kthread is running within an NMI handler (you
> are not supposed to invoke rcu_gp_kthread_wake() from within an
> NMI handler. This commit therefore replaces the in_interrupt()
> with in_irq(), so that the self-wakeups happen only from handlers
> for hardware interrupts and softirqs. This also makes the code
> match the comment.
Acked-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
>
> Thanx, Paul
>
> > >-- Steve
> > >
> >
> > Hi Steve, sorry, I don't understand fully, why we want to not return
> > in BH disabled case. From the commit logs and lkml discussion, there
> > is a case where GP kthread is interrupted in the wait event path and
> > rcu_gp_kthread_wake() is called in softirq handler (I am not sure
> > about interrupt handler case; how rcu_gp_kthread_wake() is called
> > from that path).
BH disabled case isn't a case where the kthread is preempted. It's just
that the kthread disabled BH, and thus we want to return.
-- Steve