From: Peter Zijlstra <peterz@infradead.org>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
laijs@cn.fujitsu.com, dipankar@in.ibm.com,
akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
josh@joshtriplett.org, tglx@linutronix.de, rostedt@goodmis.org,
dhowells@redhat.com, edumazet@google.com, dvhart@linux.intel.com,
fweisbec@gmail.com, oleg@redhat.com, bobby.prani@gmail.com,
rafael@kernel.org
Subject: Re: [PATCH v5 tip/core/rcu 15/16] rcu: Make RCU-tasks wait for idle tasks
Date: Wed, 13 Aug 2014 20:55:29 +0200 [thread overview]
Message-ID: <20140813185529.GA16043@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20140813182030.GD4752@linux.vnet.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 3875 bytes --]
On Wed, Aug 13, 2014 at 11:20:30AM -0700, Paul E. McKenney wrote:
> cpuidle_idle_call() does a fastpath irq-enable/exit if need-resched,
> then does stop_critical_timings() and rcu_idle_enter(). Then we
> have the buried complexity with cpuidle_select(), but a negative
> return says to check need-resched and enable interrupts or to
> invoke arch_cpu_idle(), which executes various sleep instructions
> on various architectures. Some notable variants:
> And various other architectures seem to work similarly, but lots of
> hair here. So Steven, you OK with the underlying arch_cpu_idle()
> functions being off-limits to tracing?
I didn't find anything particularly hairy in the arch_cpu_idle()
implementations, lots of simple 'go sleep' or 'spin' like things.
> Now, if cpuidle_select() returns non-negative, we are dealing with
> the CPU-idle governor, which is invoked at the later cpuidle_enter().
>
> Hmmm... On the CPU-idle drivers...
>
> o apm_idle_driver puts the idle loop into the ->enter() function,
> apm_cpu_idle().
Yes, this one is creative. The best I came up with is
adding CPUIDLE_FLAG_RCU_IDLE which indicates that the driver will do the
rcu_idle calls and place them in apm_do_idle() around the
apm_bios_call_simple() thing.
Now, that apm_bios_call_simple() thing uses on_cpu0(), which schedules
work on cpu0, which to me seems to guarantee this won't be used on any
SMP system, because that simply _cannot_ work for idle.
And on UP its a few more function calls, we could sprinkle some
__always_inline()s around if we really care I suppose.
> o ACPI puts the idle loop in acpi_idle_do_entry(), and does call
> stop_critical_timings(), but not rcu_idle_enter().
> So presumably stop_critical_timings() can nest? Not clear
> from the code.
Yeah, so I'm not sure I see that they nest properly..
Still ACPI does a lot of weird crap in the busmaster idle function,
again I'd suggest that CPUIDLE_FLAG_RCU_IDLE which would let the driver
do rcu_idle itself, and place it in appropriate sites.
Not too hard I think in this case.
> o The CPS driver is even stranger... Is cps_gen_entry_code()
> really depositing assembly instructions into a buffer that is
> passed back as a function?
I had not yet looked at this one; its got that cpu_pm_{enter,exit}()
thing going.. we could do the same and place the manual RCU_IDLE around
cps_pm_enter_state()
> o The intel_idle driver is the one with mwait_idle_with_hints(),
> so you covered it below.
Yeah, fairly straight fwd driver that, _lots_ saner than the ACPI one.
> Your patch covers the cpuidle_enter() transition, which means
> that functions like cpuidle_enter(), acpi_idle_enter_c1(), and
> acpi_idle_do_entry() would be off-limits to trampolining. In the case
> of CPS, quite a bit of code.
So I think we can do this; sure lots of code, but typically 'simpler'
than RCU stuff.
> > We should push the rcu_idle_{enter,exit}() down to around
> > mwait_idle_with_hints(), so we don't call half the word with RCU
> > disabled.
>
> That would be for the intel_idle.c CPU-idle driver. The other drivers
> also need rcu_idle_{enter,exit}().
Right, so simple drivers can use the generic rcu_idle bits from
kernel/sched/idle.c and difficult drivers can use CPUIDLE_FLAG_RCU_IDLE
and do some manual cleverness.
> > > I have already said that I will be happy to rip out the wakeup code
> > > when it is no longer needed, and I agree that it would be way better if
> > > not needed.
> >
> > I'd prefer to dtrt now and not needing to fix it later.
>
> Once it works, I might consider it "right" and adjust accordingly.
> At the moment, speculation.
I think its simpler than doing RCU, maybe a little more work, but hey,
I'm the idiot that does full arch/ sweeps on a semi regular basis.
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2014-08-13 18:55 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-11 22:48 [PATCH tip/core/rcu 0/16] RCU-tasks implementation Paul E. McKenney
2014-08-11 22:48 ` [PATCH v5 tip/core/rcu 01/16] rcu: Add call_rcu_tasks() Paul E. McKenney
2014-08-11 22:48 ` [PATCH v5 tip/core/rcu 02/16] rcu: Provide cond_resched_rcu_qs() to force quiescent states in long loops Paul E. McKenney
2014-08-11 22:48 ` [PATCH v5 tip/core/rcu 03/16] rcu: Add synchronous grace-period waiting for RCU-tasks Paul E. McKenney
2014-08-11 22:48 ` [PATCH v5 tip/core/rcu 04/16] rcu: Make TASKS_RCU handle tasks that are almost done exiting Paul E. McKenney
2014-08-11 22:48 ` [PATCH v5 tip/core/rcu 05/16] rcu: Export RCU-tasks APIs to GPL modules Paul E. McKenney
2014-08-14 19:08 ` Pranith Kumar
2014-08-14 21:29 ` Paul E. McKenney
2014-08-11 22:48 ` [PATCH v5 tip/core/rcu 06/16] rcutorture: Add torture tests for RCU-tasks Paul E. McKenney
2014-08-14 21:34 ` Pranith Kumar
2014-08-14 21:44 ` Paul E. McKenney
2014-08-14 21:49 ` Paul E. McKenney
2014-08-11 22:48 ` [PATCH v5 tip/core/rcu 07/16] rcutorture: Add RCU-tasks test cases Paul E. McKenney
2014-08-11 22:48 ` [PATCH v5 tip/core/rcu 08/16] rcu: Add stall-warning checks for RCU-tasks Paul E. McKenney
2014-08-14 21:39 ` Pranith Kumar
2014-08-14 21:59 ` Paul E. McKenney
2014-08-11 22:48 ` [PATCH v5 tip/core/rcu 09/16] rcu: Improve RCU-tasks energy efficiency Paul E. McKenney
2014-08-14 21:42 ` Pranith Kumar
2014-08-14 21:55 ` Paul E. McKenney
2014-08-14 22:00 ` Pranith Kumar
2014-08-11 22:48 ` [PATCH v5 tip/core/rcu 10/16] documentation: Add verbiage on RCU-tasks stall warning messages Paul E. McKenney
2014-08-11 22:49 ` [PATCH v5 tip/core/rcu 11/16] rcu: Defer rcu_tasks_kthread() creation till first call_rcu_tasks() Paul E. McKenney
2014-08-14 22:28 ` Pranith Kumar
2014-08-14 22:53 ` Paul E. McKenney
2014-08-11 22:49 ` [PATCH v5 tip/core/rcu 12/16] rcu: Make TASKS_RCU handle nohz_full= CPUs Paul E. McKenney
2014-08-14 22:55 ` Pranith Kumar
2014-08-14 23:16 ` Paul E. McKenney
2014-08-11 22:49 ` [PATCH v5 tip/core/rcu 13/16] rcu: Make rcu_tasks_kthread()'s GP-wait loop allow preemption Paul E. McKenney
2014-08-11 22:49 ` [PATCH v5 tip/core/rcu 14/16] rcu: Remove redundant preempt_disable() from rcu_note_voluntary_context_switch() Paul E. McKenney
2014-08-13 10:56 ` Peter Zijlstra
2014-08-13 14:07 ` Paul E. McKenney
2014-08-13 14:33 ` Peter Zijlstra
2014-08-13 20:06 ` Paul E. McKenney
2014-08-11 22:49 ` [PATCH v5 tip/core/rcu 15/16] rcu: Make RCU-tasks wait for idle tasks Paul E. McKenney
2014-08-13 8:12 ` Peter Zijlstra
2014-08-13 12:48 ` Paul E. McKenney
2014-08-13 13:40 ` Peter Zijlstra
2014-08-13 13:51 ` Steven Rostedt
2014-08-13 14:07 ` Peter Zijlstra
2014-08-13 14:13 ` Steven Rostedt
2014-08-13 14:43 ` Paul E. McKenney
2014-08-13 16:30 ` Peter Zijlstra
2014-08-13 16:43 ` Jacob Pan
2014-08-13 18:24 ` Paul E. McKenney
2014-08-13 16:35 ` Peter Zijlstra
2014-08-13 18:25 ` Paul E. McKenney
2014-08-13 14:43 ` Peter Zijlstra
2014-08-13 20:56 ` Paul E. McKenney
2014-08-13 14:12 ` Paul E. McKenney
2014-08-13 14:42 ` Peter Zijlstra
2014-08-13 17:24 ` Peter Zijlstra
2014-08-13 17:30 ` Peter Zijlstra
2014-08-13 18:16 ` Peter Zijlstra
2014-08-13 18:20 ` Paul E. McKenney
2014-08-13 18:55 ` Peter Zijlstra [this message]
2014-08-13 19:54 ` Paul E. McKenney
2014-08-11 22:49 ` [PATCH v5 tip/core/rcu 16/16] rcu: Additional information on RCU-tasks stall-warning messages Paul E. McKenney
2014-08-14 20:46 ` [PATCH v5 tip/core/rcu 01/16] rcu: Add call_rcu_tasks() Pranith Kumar
2014-08-14 21:22 ` Paul E. McKenney
2014-08-12 23:57 ` [PATCH tip/core/rcu 0/16] RCU-tasks implementation Paul E. McKenney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140813185529.GA16043@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=bobby.prani@gmail.com \
--cc=dhowells@redhat.com \
--cc=dipankar@in.ibm.com \
--cc=dvhart@linux.intel.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=josh@joshtriplett.org \
--cc=laijs@cn.fujitsu.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=paulmck@linux.vnet.ibm.com \
--cc=rafael@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome