From: Frederic Weisbecker <fweisbec@gmail.com>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Alessio Igor Bogani <abogani@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Avi Kivity <avi@redhat.com>, Chris Metcalf <cmetcalf@tilera.com>,
Christoph Lameter <cl@linux.com>,
Geoff Levand <geoff@infradead.org>,
Gilad Ben Yossef <gilad@benyossef.com>,
Hakan Akkan <hakanakkan@gmail.com>,
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@kernel.org>,
Josh Triplett <josh@joshtriplett.org>,
Kevin Hilman <khilman@ti.com>,
Max Krasnyansky <maxk@qualcomm.com>,
Peter Zijlstra <peterz@infradead.org>,
Stephen Hemminger <shemminger@vyatta.com>,
Steven Rostedt <rostedt@goodmis.org>,
Sven-Thorsten Dietrich <thebigcorporation@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCH 3/6] rcu: Exit RCU extended QS on preemption in irq exit
Date: Fri, 6 Jul 2012 14:00:15 +0200 [thread overview]
Message-ID: <1341576018-10721-4-git-send-email-fweisbec@gmail.com> (raw)
In-Reply-To: <1341576018-10721-1-git-send-email-fweisbec@gmail.com>
Syscalls and exceptions low level handlers must be contained
between rcu_user_exit() and rcu_user_enter(). But irq high
level handlers are already protected inside rcu_irq_enter/exit()
so we don't need to call rcu_user_exit() on irq entry. But if
we preempt the running task in the end of the interrupt, we need
to exit the RCU userspace mode because schedule() itself and the
next task are in the kernel and may contain RCU read side critical
section..
To solve this, call rcu_user_exit() from irq exit preemption points:
- If we interrupted kernelspace, we call preempt_schedule_irq() and
rcu_user_exit() is called from it.
- If we interrupted userspace, we usually call schedule() directly.
Now we will rely on a new API schedule_user() which calls rcu_user_exit()
before calling schedule().
The low level irq handler may need to call rcu_user_enter() if we
resume userspace after the task is woken up from its preemption.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Alessio Igor Bogani <abogani@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Avi Kivity <avi@redhat.com>
Cc: Chris Metcalf <cmetcalf@tilera.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Geoff Levand <geoff@infradead.org>
Cc: Gilad Ben Yossef <gilad@benyossef.com>
Cc: Hakan Akkan <hakanakkan@gmail.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Josh Triplett <josh@joshtriplett.org>
Cc: Kevin Hilman <khilman@ti.com>
Cc: Max Krasnyansky <maxk@qualcomm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephen Hemminger <shemminger@vyatta.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Sven-Thorsten Dietrich <thebigcorporation@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
---
kernel/sched/core.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index d5594a4..1630532 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -3332,6 +3332,12 @@ asmlinkage void __sched schedule(void)
}
EXPORT_SYMBOL(schedule);
+asmlinkage void __sched schedule_user(void)
+{
+ rcu_user_exit();
+ schedule();
+}
+
/**
* schedule_preempt_disabled - called with preemption disabled
*
@@ -3433,6 +3439,7 @@ asmlinkage void __sched preempt_schedule_irq(void)
/* Catch callers which need to be fixed */
BUG_ON(ti->preempt_count || !irqs_disabled());
+ rcu_user_exit();
do {
add_preempt_count(PREEMPT_ACTIVE);
local_irq_enable();
--
1.7.5.4
next prev parent reply other threads:[~2012-07-06 12:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-06 12:00 [RFC PATCH 0/6] rcu: Userspace RCU extended quiescent state Frederic Weisbecker
2012-07-06 12:00 ` [PATCH 1/6] rcu: Settle config for userspace " Frederic Weisbecker
2012-07-06 16:31 ` Paul E. McKenney
2012-07-09 17:42 ` Frederic Weisbecker
2012-07-06 12:00 ` [PATCH 2/6] rcu: Allow rcu_user_enter()/exit() to nest Frederic Weisbecker
2012-07-06 16:27 ` Paul E. McKenney
2012-07-09 17:39 ` Frederic Weisbecker
2012-07-08 15:54 ` Avi Kivity
2012-07-09 17:45 ` Frederic Weisbecker
2012-07-06 12:00 ` Frederic Weisbecker [this message]
2012-07-06 12:00 ` [PATCH 4/6] x86: Use the new schedule_user API on user preemption Frederic Weisbecker
2012-07-06 12:00 ` [PATCH 5/6] x86: Kernel entry/exit hooks for RCU Frederic Weisbecker
2012-07-06 12:00 ` [PATCH 6/6] x86: Exit RCU extended QS on notify resume Frederic Weisbecker
2012-07-06 16:33 ` Paul E. McKenney
2012-07-06 20:43 ` Josh Triplett
2012-07-08 21:17 ` Paul E. McKenney
2012-07-10 9:18 ` Frederic Weisbecker
2012-07-09 17:43 ` Frederic Weisbecker
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=1341576018-10721-4-git-send-email-fweisbec@gmail.com \
--to=fweisbec@gmail.com \
--cc=abogani@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=avi@redhat.com \
--cc=cl@linux.com \
--cc=cmetcalf@tilera.com \
--cc=geoff@infradead.org \
--cc=gilad@benyossef.com \
--cc=hakanakkan@gmail.com \
--cc=hpa@zytor.com \
--cc=josh@joshtriplett.org \
--cc=khilman@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maxk@qualcomm.com \
--cc=mingo@kernel.org \
--cc=paulmck@linux.vnet.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=shemminger@vyatta.com \
--cc=tglx@linutronix.de \
--cc=thebigcorporation@gmail.com \
/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
all inboxes | Powered by JetHome®