Re: [PATCH tip/core/rcu 09/12] rcu: Make call_rcu_tasks() tolerate first call with irqs disabled

From: Paul E. McKenney
Date: Wed Jun 15 2016 - 18:58:22 EST


On Thu, Jun 16, 2016 at 12:16:04AM +0200, Peter Zijlstra wrote:
> On Wed, Jun 15, 2016 at 02:46:10PM -0700, Paul E. McKenney wrote:
> > Currently, if the very first call to call_rcu_tasks() has irqs disabled,
> > it will create the rcu_tasks_kthread with irqs disabled, which will
> > result in a splat in the memory allocator, which kthread_run() invokes
> > with the expectation that irqs are enabled.
> >
> > This commit fixes this problem by deferring kthread creation if called
> > with irqs disabled. The first call to call_rcu_tasks() that has irqs
> > enabled will create the kthread.
> >
> > This bug was detected by rcutorture changes that were motivated by
> > Iftekhar Ahmed's mutation-testing efforts.
>
> Seems fragile. What if someone manages to only use call_rcu_tasks() with
> IRQs disabled?

It would have to have users before that could possibly happen. :-/
And it would not be hard to remove the fragility if needed by setting
up a workqueue, possibly mediated by a timer or whatever. But it is
hard to motivate myself to do so in advance of users. For that matter...

Steven, is call_rcu_tasks() needed, or should I just rip it out?

Thanx, Paul