Re: [PATCH v5 tip/core/rcu 15/16] rcu: Make RCU-tasks wait for idle tasks

From: Paul E. McKenney
Date: Wed Aug 13 2014 - 16:56:34 EST


On Wed, Aug 13, 2014 at 09:51:32AM -0400, Steven Rostedt wrote:
> On Wed, 13 Aug 2014 15:40:25 +0200
> Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> > On Wed, Aug 13, 2014 at 05:48:18AM -0700, Paul E. McKenney wrote:
> > > On Wed, Aug 13, 2014 at 10:12:15AM +0200, Peter Zijlstra wrote:
> > > > On Mon, Aug 11, 2014 at 03:49:04PM -0700, Paul E. McKenney wrote:
> > > > > From: "Paul E. McKenney" <paulmck@xxxxxxxxxxxxxxxxxx>
> > > > >
> > > > > Because idle-task code may need to be patched, RCU-tasks need to wait
> > > > > for idle tasks to schedule. This commit therefore detects this case
> > > > > via context switch. Block CPU hotplug during this time to avoid sending
> > > > > IPIs to offline CPUs.
> > > > >
> > > > > Note that checking for changes in the dyntick-idle counters is tempting,
> > > > > but wrong. The reason that it is wrong is that a interrupt or NMI can
> > > > > increment these counters without necessarily allowing the idle tasks to
> > > > > make any forward progress.
> > > >
> > > > I'm going to NAK this.. with that rcu_idle patch I send there's
> > > > typically only a single idle function thats out of bounds and if its
> > > > more it can be made that with a bit of tlc to the cpuidle driver in
> > > > question.
> > > >
> > > > This needs _FAR_ more justification than a maybe and a want.
> > >
> > > Peter, your patch might be a good start, but I didn't see any reaction
> > > from Steven or Masami and it did only x86.
> >
> > That's not an excuse for doing horrible things. And inventing new infra
> > that needs to wake all CPUs is horrible.
>
> I still need to look at the patches, but if this is just for the idle
> case, then we don't need it. The idle case can be solved with a simple
> sched_on_each_cpu(). I need a way to solve waiting for processes to
> finish from a preemption point.
>
> That's all I want, and if we can remove the "idle" case and document it
> well that it's not covered and a sched_on_each_cpu() may be needed,
> then I'm fine with that.
>
> sched_on_each_cpu(dummy_op);
> call_rcu_tasks(free_tramp);
>
> Would that work?

If you are taking that approach, I can of course drop my commit dealing
with idle tasks. Should the rcu_idle_enter() and rcu_idle_exit() calls
avoid cover any functions needing trampolines, it would be easy to pull
them back in -- especially given that the RCU dyntick-idle information
would call out the quiescent states appropriately.

So unless you tell me otherwise, Steven, I will drop the idle-detection
commit in favor of your sched_on_each_cpu() approach.

Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/