Skip to contentSkip to conversation

rcu: Userspace RCU extended quiescent state v2

RFC PATCH In review Frederic Weisbecker 2 participants 14 messages Jul 11, 2012 – Jul 16, 2012

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover rcu: Userspace RCU extended quiescent state v2

Hi,

There are significant changes this time. I reverted back to using a TIF flag to hook on syscalls slow path and put the hooks on high level exception handlers instead of low level ones.

It makes the code more portable between x86-32 and x86-64, it makes the hooks clearer and easier to review and the overhead is lowered in the off-case. This can be even better if we use jump labels later.

Thanks.

git://github.com/fweisbec/linux-dynticks.git

	rcu/user-2

Frederic Weisbecker (11):
rcu: Settle config for userspace extended quiescent state
rcu: Allow rcu_user_enter()/exit() to nest
rcu: Ignore userspace extended quiescent state by default
rcu: Switch task's syscall hooks on context switch
x86: Syscall hooks for userspace RCU extended QS
x86: Exception hooks for userspace RCU extended QS
rcu: Exit RCU extended QS on kernel preemption after irq/exception
rcu: Exit RCU extended QS on user preemption
x86: Use the new schedule_user API on userspace preemption
x86: Exit RCU extended QS on notify resume
rcu: Userspace RCU extended QS selftest

 arch/Kconfig                       |   10 ++++++
 arch/um/drivers/mconsole_kern.c    |    2 +-
 arch/x86/Kconfig                   |    1 +
 arch/x86/include/asm/rcu.h         |   20 +++++++++++
 arch/x86/include/asm/thread_info.h |   10 ++++--
 arch/x86/kernel/entry_64.S         |    8 ++--
 arch/x86/kernel/ptrace.c           |    5 +++
 arch/x86/kernel/signal.c           |    4 ++
 arch/x86/kernel/traps.c            |   30 ++++++++++++----
 arch/x86/mm/fault.c                |   13 ++++++-
 include/linux/rcupdate.h           |   10 ++++++
 include/linux/sched.h              |   20 ++++++-----
 init/Kconfig                       |   18 ++++++++++
 kernel/rcutree.c                   |   64 +++++++++++++++++++++++++++++++-----
 kernel/rcutree.h                   |    4 ++
 kernel/sched/core.c                |   10 +++++-
 16 files changed, 192 insertions(+), 37 deletions(-)
 create mode 100644 arch/x86/include/asm/rcu.h
Signature · 1 line
1.7.5.4
#1 lore raw

PATCH 1/11 rcu: Settle config for userspace extended quiescent state

Create a new config option under the RCU menu that put CPUs under RCU extended quiescent state (as in dynticks idle mode) when they run in userspace. This require some contribution from architectures to hook into kernel and userspace boundaries.

Cc Alessio Igor Bogani <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Max Krasnyansky <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Sven-Thorsten Dietrich <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/Kconfig             |   10 ++++++++++
 include/linux/rcupdate.h |    8 ++++++++
 init/Kconfig             |   10 ++++++++++
 kernel/rcutree.c         |    5 ++++-
 4 files changed, 32 insertions(+), 1 deletions(-)
arch/Kconfig +10 -0
index 8c3d957..1c7c9be 100644
@@ -274,4 +274,14 @@ config SECCOMP_FILTER
 
 	  See Documentation/prctl/seccomp_filter.txt for details.
 
+config HAVE_RCU_USER_QS
+	bool
+	help
+	  Provide kernel entry/exit hooks necessary for userspace
+	  RCU extended quiescent state. Syscalls need to be wrapped inside
+	  rcu_user_exit()-rcu_user_enter() through the slow path using
+	  TIF_NOHZ flag. Exceptions handlers must be wrapped as well. Irqs
+	  are already protected inside rcu_irq_enter/rcu_irq_exit() but
+	  preemption or signal handling on irq exit still need to be protected.
+
 source "kernel/gcov/Kconfig"
include/linux/rcupdate.h +8 -0
index 148f381..a72f25e 100644
@@ -192,10 +192,18 @@ extern void rcu_idle_enter(void);
 extern void rcu_idle_exit(void);
 extern void rcu_irq_enter(void);
 extern void rcu_irq_exit(void);
+
+#ifdef CONFIG_RCU_USER_QS
 extern void rcu_user_enter(void);
 extern void rcu_user_exit(void);
 extern void rcu_user_enter_irq(void);
 extern void rcu_user_exit_irq(void);
+#else
+static inline void rcu_user_enter(void) { }
+static inline void rcu_user_exit(void) { }
+#endif /* CONFIG_RCU_USER_QS */
+
+
 extern void exit_rcu(void);
 
 /**
init/Kconfig +10 -0
index d07dcf9..3a4af8f 100644
@@ -441,6 +441,16 @@ config PREEMPT_RCU
 	  This option enables preemptible-RCU code that is common between
 	  the TREE_PREEMPT_RCU and TINY_PREEMPT_RCU implementations.
 
+config RCU_USER_QS
+	bool "Consider userspace as in RCU extended quiescent state"
+	depends on HAVE_RCU_USER_QS && SMP
+	help
+	  This option sets hooks on kernel / userspace boundaries and
+	  puts RCU in extended quiescent state when the CPU runs in
+	  userspace. It means that when a CPU runs in userspace, it is
+	  excluded from the global RCU state machine and thus doesn't
+	  to keep the timer tick on for RCU.
+
 config RCU_FANOUT
 	int "Tree-based hierarchical RCU fanout value"
 	range 2 64 if 64BIT
kernel/rcutree.c +4 -1
index 5541a07..efa5983 100644
@@ -423,6 +423,7 @@ void rcu_idle_enter(void)
 }
 EXPORT_SYMBOL_GPL(rcu_idle_enter);
 
+#ifdef CONFIG_RCU_USER_QS
 /**
  * rcu_user_enter - inform RCU that we are resuming userspace.
  *
@@ -437,7 +438,6 @@ void rcu_user_enter(void)
 }
 EXPORT_SYMBOL_GPL(rcu_user_enter);
 
-
 /**
  * rcu_user_enter_irq - inform RCU that we are going to resume userspace
  * after the current irq returns.
@@ -458,6 +458,7 @@ void rcu_user_enter_irq(void)
 	rdtp->dynticks_nesting = 1;
 	local_irq_restore(flags);
 }
+#endif
 
 /**
  * rcu_irq_exit - inform RCU that current CPU is exiting irq towards idle
@@ -561,6 +562,7 @@ void rcu_idle_exit(void)
 }
 EXPORT_SYMBOL_GPL(rcu_idle_exit);
 
+#ifdef CONFIG_RCU_USER_QS
 /**
  * rcu_user_exit - inform RCU that we are exiting userspace.
  *
@@ -594,6 +596,7 @@ void rcu_user_exit_irq(void)
 	rdtp->dynticks_nesting += DYNTICK_TASK_EXIT_IDLE;
 	local_irq_restore(flags);
 }
+#endif
 
 /**
  * rcu_irq_enter - inform RCU that current CPU is entering irq away from idle
Signature · 1 line
1.7.5.4
#2 lore raw

PATCH 2/11 rcu: Allow rcu_user_enter()/exit() to nest

In reply to Frederic Weisbecker

Allow calls to rcu_user_enter() even if we are already in userspace (as seen by RCU) and allow calls to rcu_user_exit() even if we are already in the kernel.

This makes the APIs more flexible to be called from architectures. Exception entries for example won't need to know if they come from userspace before calling rcu_user_exit().

Cc Alessio Igor Bogani <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Max Krasnyansky <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Sven-Thorsten Dietrich <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 kernel/rcutree.c |   41 +++++++++++++++++++++++++++++++++--------
 kernel/rcutree.h |    3 +++
 2 files changed, 36 insertions(+), 8 deletions(-)
kernel/rcutree.c +33 -8
index efa5983..d5df618 100644
@@ -389,11 +389,9 @@ static void rcu_eqs_enter_common(struct rcu_dynticks *rdtp, long long oldval,
  */
 static void rcu_eqs_enter(bool user)
 {
-	unsigned long flags;
 	long long oldval;
 	struct rcu_dynticks *rdtp;
 
-	local_irq_save(flags);
 	rdtp = &__get_cpu_var(rcu_dynticks);
 	oldval = rdtp->dynticks_nesting;
 	WARN_ON_ONCE((oldval & DYNTICK_TASK_NEST_MASK) == 0);
@@ -402,7 +400,6 @@ static void rcu_eqs_enter(bool user)
 	else
 		rdtp->dynticks_nesting -= DYNTICK_TASK_NEST_VALUE;
 	rcu_eqs_enter_common(rdtp, oldval, user);
-	local_irq_restore(flags);
 }
 
 /**
@@ -419,7 +416,11 @@ static void rcu_eqs_enter(bool user)
  */
 void rcu_idle_enter(void)
 {
+	unsigned long flags;
+
+	local_irq_save(flags);
 	rcu_eqs_enter(0);
+	local_irq_restore(flags);
 }
 EXPORT_SYMBOL_GPL(rcu_idle_enter);
 
@@ -434,7 +435,18 @@ EXPORT_SYMBOL_GPL(rcu_idle_enter);
  */
 void rcu_user_enter(void)
 {
-	rcu_eqs_enter(1);
+	unsigned long flags;
+	struct rcu_dynticks *rdtp;
+
+	WARN_ON_ONCE(!current->mm);
+
+	local_irq_save(flags);
+	rdtp = &__get_cpu_var(rcu_dynticks);
+	if (!rdtp->in_user) {
+		rdtp->in_user = true;
+		rcu_eqs_enter(1);
+	}
+	local_irq_restore(flags);
 }
 EXPORT_SYMBOL_GPL(rcu_user_enter);
 
@@ -529,11 +541,9 @@ static void rcu_eqs_exit_common(struct rcu_dynticks *rdtp, long long oldval,
  */
 static void rcu_eqs_exit(bool user)
 {
-	unsigned long flags;
 	struct rcu_dynticks *rdtp;
 	long long oldval;
 
-	local_irq_save(flags);
 	rdtp = &__get_cpu_var(rcu_dynticks);
 	oldval = rdtp->dynticks_nesting;
 	WARN_ON_ONCE(oldval < 0);
@@ -542,7 +552,6 @@ static void rcu_eqs_exit(bool user)
 	else
 		rdtp->dynticks_nesting = DYNTICK_TASK_EXIT_IDLE;
 	rcu_eqs_exit_common(rdtp, oldval, user);
-	local_irq_restore(flags);
 }
 
 /**
@@ -558,7 +567,11 @@ static void rcu_eqs_exit(bool user)
  */
 void rcu_idle_exit(void)
 {
+	unsigned long flags;
+
+	local_irq_save(flags);
 	rcu_eqs_exit(0);
+	local_irq_restore(flags);
 }
 EXPORT_SYMBOL_GPL(rcu_idle_exit);
 
@@ -571,7 +584,16 @@ EXPORT_SYMBOL_GPL(rcu_idle_exit);
  */
 void rcu_user_exit(void)
 {
-	rcu_eqs_exit(1);
+	unsigned long flags;
+	struct rcu_dynticks *rdtp;
+
+	local_irq_save(flags);
+	rdtp = &__get_cpu_var(rcu_dynticks);
+	if (rdtp->in_user) {
+		rdtp->in_user = false;
+		rcu_eqs_exit(1);
+	}
+	local_irq_restore(flags);
 }
 EXPORT_SYMBOL_GPL(rcu_user_exit);
 
@@ -2660,6 +2682,9 @@ rcu_boot_init_percpu_data(int cpu, struct rcu_state *rsp)
 	rdp->dynticks = &per_cpu(rcu_dynticks, cpu);
 	WARN_ON_ONCE(rdp->dynticks->dynticks_nesting != DYNTICK_TASK_EXIT_IDLE);
 	WARN_ON_ONCE(atomic_read(&rdp->dynticks->dynticks) != 1);
+#ifdef CONFIG_RCU_USER_QS
+	WARN_ON_ONCE(rdp->dynticks->in_user);
+#endif
 	rdp->cpu = cpu;
 	rdp->rsp = rsp;
 	raw_spin_unlock_irqrestore(&rnp->lock, flags);
kernel/rcutree.h +3 -0
index cad96cb..4d82cb5 100644
@@ -102,6 +102,9 @@ struct rcu_dynticks {
 				    /* idle-period nonlazy_posted snapshot. */
 	int tick_nohz_enabled_snap; /* Previously seen value from sysfs. */
 #endif /* #ifdef CONFIG_RCU_FAST_NO_HZ */
+#ifdef CONFIG_RCU_USER_QS
+	bool in_user;		    /* Is the CPU in userland from RCU POV? */
+#endif
 };
 
 /* RCU's kthread states for tracing. */
Signature · 1 line
1.7.5.4
#3 lore raw

PATCH 3/11 rcu: Ignore userspace extended quiescent state by default

In reply to Frederic Weisbecker

By default we don't want to enter into RCU extended quiescent state while in userspace because doing this produces some overhead (eg: use of syscall slowpath). Set it off by default and ready to run when some feature like adaptive tickless need it.

Cc Alessio Igor Bogani <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Max Krasnyansky <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Sven-Thorsten Dietrich <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 kernel/rcutree.c |    5 ++++-
 kernel/rcutree.h |    1 +
 2 files changed, 5 insertions(+), 1 deletions(-)
kernel/rcutree.c +4 -1
index d5df618..78b0c30 100644
@@ -209,6 +209,9 @@ EXPORT_SYMBOL_GPL(rcu_note_context_switch);
 DEFINE_PER_CPU(struct rcu_dynticks, rcu_dynticks) = {
 	.dynticks_nesting = DYNTICK_TASK_EXIT_IDLE,
 	.dynticks = ATOMIC_INIT(1),
+#ifdef CONFIG_RCU_USER_QS
+	.ignore_user_qs = true,
+#endif
 };
 
 static int blimit = 10;		/* Maximum callbacks per rcu_do_batch. */
@@ -442,7 +445,7 @@ void rcu_user_enter(void)
 
 	local_irq_save(flags);
 	rdtp = &__get_cpu_var(rcu_dynticks);
-	if (!rdtp->in_user) {
+	if (!rdtp->ignore_user_qs && !rdtp->in_user) {
 		rdtp->in_user = true;
 		rcu_eqs_enter(1);
 	}
kernel/rcutree.h +1 -0
index 4d82cb5..55bcef1 100644
@@ -103,6 +103,7 @@ struct rcu_dynticks {
 	int tick_nohz_enabled_snap; /* Previously seen value from sysfs. */
 #endif /* #ifdef CONFIG_RCU_FAST_NO_HZ */
 #ifdef CONFIG_RCU_USER_QS
+	bool ignore_user_qs;	    /* Treat userspace as extended QS or not */
 	bool in_user;		    /* Is the CPU in userland from RCU POV? */
 #endif
 };
Signature · 1 line
1.7.5.4
#4 lore raw

PATCH 4/11 rcu: Switch task's syscall hooks on context switch

In reply to Frederic Weisbecker

Clear the syscalls hook of a task when it's scheduled out so that if the task migrates, it doesn't run the syscall slow path on a CPU that might not need it.

Also set the syscalls hook on the next task if needed.

Cc Alessio Igor Bogani <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Max Krasnyansky <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Sven-Thorsten Dietrich <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/um/drivers/mconsole_kern.c |    2 +-
 include/linux/rcupdate.h        |    2 ++
 include/linux/sched.h           |   20 +++++++++++---------
 kernel/rcutree.c                |   15 +++++++++++++++
 kernel/sched/core.c             |    2 +-
 5 files changed, 30 insertions(+), 11 deletions(-)
arch/um/drivers/mconsole_kern.c +1 -1
index 88e466b..e61922d 100644
@@ -705,7 +705,7 @@ static void stack_proc(void *arg)
 	struct task_struct *from = current, *to = arg;
 
 	to->thread.saved_task = from;
-	rcu_switch_from(from);
+	rcu_switch(from, to);
 	switch_to(from, to, from);
 }
 
include/linux/rcupdate.h +2 -0
index a72f25e..1e57888 100644
@@ -198,6 +198,8 @@ extern void rcu_user_enter(void);
 extern void rcu_user_exit(void);
 extern void rcu_user_enter_irq(void);
 extern void rcu_user_exit_irq(void);
+extern void rcu_user_hooks_switch(struct task_struct *prev,
+				  struct task_struct *next);
 #else
 static inline void rcu_user_enter(void) { }
 static inline void rcu_user_exit(void) { }
include/linux/sched.h +11 -9
index 4059c0f..e17fcd0 100644
@@ -1871,23 +1871,25 @@ static inline void rcu_copy_process(struct task_struct *p)
 	INIT_LIST_HEAD(&p->rcu_node_entry);
 }
 
-static inline void rcu_switch_from(struct task_struct *prev)
-{
-	if (prev->rcu_read_lock_nesting != 0)
-		rcu_preempt_note_context_switch();
-}
-
 #else
 
 static inline void rcu_copy_process(struct task_struct *p)
 {
 }
 
-static inline void rcu_switch_from(struct task_struct *prev)
-{
-}
+#endif
 
+static inline void rcu_switch(struct task_struct *prev,
+			      struct task_struct *next)
+{
+#ifdef CONFIG_PREEMPT_RCU
+	if (prev->rcu_read_lock_nesting != 0)
+		rcu_preempt_note_context_switch();
+#endif
+#ifdef CONFIG_RCU_USER_QS
+	rcu_user_hooks_switch(prev, next);
 #endif
+}
 
 #ifdef CONFIG_SMP
 extern void do_set_cpus_allowed(struct task_struct *p,
kernel/rcutree.c +15 -0
index 78b0c30..2d79308 100644
@@ -720,6 +720,21 @@ int rcu_is_cpu_idle(void)
 }
 EXPORT_SYMBOL(rcu_is_cpu_idle);
 
+#ifdef CONFIG_RCU_USER_QS
+void rcu_user_hooks_switch(struct task_struct *prev,
+			   struct task_struct *next)
+{
+	struct rcu_dynticks *rdtp;
+
+	/* Interrupts are disabled in context switch */
+	rdtp = &__get_cpu_var(rcu_dynticks);
+	if (!rdtp->ignore_user_qs) {
+		clear_tsk_thread_flag(prev, TIF_NOHZ);
+		set_tsk_thread_flag(next, TIF_NOHZ);
+	}
+}
+#endif
+
 #if defined(CONFIG_PROVE_RCU) && defined(CONFIG_HOTPLUG_CPU)
 
 /*
kernel/sched/core.c +1 -1
index d5594a4..fa61d8a 100644
@@ -2081,7 +2081,7 @@ context_switch(struct rq *rq, struct task_struct *prev,
 #endif
 
 	/* Here we just switch the register state and the stack. */
-	rcu_switch_from(prev);
+	rcu_switch(prev, next);
 	switch_to(prev, next, prev);
 
 	barrier();
Signature · 1 line
1.7.5.4
#5 lore raw

PATCH 5/11 x86: Syscall hooks for userspace RCU extended QS

In reply to Frederic Weisbecker

Add syscall slow path hooks to notify syscall entry and exit on CPUs that want to support userspace RCU extended quiescent state.

Cc Alessio Igor Bogani <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Max Krasnyansky <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Sven-Thorsten Dietrich <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/x86/include/asm/thread_info.h |   10 +++++++---
 arch/x86/kernel/ptrace.c           |    5 +++++
 2 files changed, 12 insertions(+), 3 deletions(-)
arch/x86/include/asm/thread_info.h +7 -3
index 89f794f..c535d84 100644
@@ -89,6 +89,7 @@ struct thread_info {
 #define TIF_NOTSC		16	/* TSC is not accessible in userland */
 #define TIF_IA32		17	/* IA32 compatibility process */
 #define TIF_FORK		18	/* ret_from_fork */
+#define TIF_NOHZ		19	/* in adaptive nohz mode */
 #define TIF_MEMDIE		20	/* is terminating due to OOM killer */
 #define TIF_DEBUG		21	/* uses debug registers */
 #define TIF_IO_BITMAP		22	/* uses I/O bitmap */
@@ -114,6 +115,7 @@ struct thread_info {
 #define _TIF_NOTSC		(1 << TIF_NOTSC)
 #define _TIF_IA32		(1 << TIF_IA32)
 #define _TIF_FORK		(1 << TIF_FORK)
+#define _TIF_NOHZ		(1 << TIF_NOHZ)
 #define _TIF_DEBUG		(1 << TIF_DEBUG)
 #define _TIF_IO_BITMAP		(1 << TIF_IO_BITMAP)
 #define _TIF_FORCED_TF		(1 << TIF_FORCED_TF)
@@ -126,12 +128,13 @@ struct thread_info {
 /* work to do in syscall_trace_enter() */
 #define _TIF_WORK_SYSCALL_ENTRY	\
 	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_EMU | _TIF_SYSCALL_AUDIT |	\
-	 _TIF_SECCOMP | _TIF_SINGLESTEP | _TIF_SYSCALL_TRACEPOINT)
+	 _TIF_SECCOMP | _TIF_SINGLESTEP | _TIF_SYSCALL_TRACEPOINT |	\
+	 _TIF_NOHZ)
 
 /* work to do in syscall_trace_leave() */
 #define _TIF_WORK_SYSCALL_EXIT	\
 	(_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | _TIF_SINGLESTEP |	\
-	 _TIF_SYSCALL_TRACEPOINT)
+	 _TIF_SYSCALL_TRACEPOINT | _TIF_NOHZ)
 
 /* work to do on interrupt/exception return */
 #define _TIF_WORK_MASK							\
@@ -141,7 +144,8 @@ struct thread_info {
 
 /* work to do on any return to user space */
 #define _TIF_ALLWORK_MASK						\
-	((0x0000FFFF & ~_TIF_SECCOMP) | _TIF_SYSCALL_TRACEPOINT)
+	((0x0000FFFF & ~_TIF_SECCOMP) | _TIF_SYSCALL_TRACEPOINT |	\
+	_TIF_NOHZ)
 
 /* Only used for 64 bit */
 #define _TIF_DO_NOTIFY_MASK						\
arch/x86/kernel/ptrace.c +5 -0
index c4c6a5c..9f94f8e 100644
@@ -21,6 +21,7 @@
 #include <linux/signal.h>
 #include <linux/perf_event.h>
 #include <linux/hw_breakpoint.h>
+#include <linux/rcupdate.h>
 
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
@@ -1463,6 +1464,8 @@ long syscall_trace_enter(struct pt_regs *regs)
 {
 	long ret = 0;
 
+	rcu_user_exit();
+
 	/*
 	 * If we stepped into a sysenter/syscall insn, it trapped in
 	 * kernel mode; do_debug() cleared TF and set TIF_SINGLESTEP.
@@ -1526,4 +1529,6 @@ void syscall_trace_leave(struct pt_regs *regs)
 			!test_thread_flag(TIF_SYSCALL_EMU);
 	if (step || test_thread_flag(TIF_SYSCALL_TRACE))
 		tracehook_report_syscall_exit(regs, step);
+
+	rcu_user_enter();
 }
Signature · 1 line
1.7.5.4
#7 lore raw

PATCH 7/11 rcu: Exit RCU extended QS on kernel preemption after irq/exception

In reply to Frederic Weisbecker

When an exception or an irq exits, and we are going to resume into interrupted kernel code, the low level architecture code calls preempt_schedule_irq() if there is a need to reschedule.

If the interrupt/exception occured between a call to rcu_user_enter() (from syscall exit, exception exit, do_notify_resume exit, ...) and a real resume to userspace (iret,...), preempt_schedule_irq() can be called whereas RCU thinks we are in userspace. But preempt_schedule_irq() is going to run kernel code and may be some RCU read side critical section. We must exit the userspace extended quiescent state before we call it.

To solve this, just call rcu_user_exit() in the beginning of preempt_schedule_irq().

Cc Alessio Igor Bogani <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Max Krasnyansky <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Sven-Thorsten Dietrich <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 kernel/sched/core.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
kernel/sched/core.c +1 -0
index fa61d8a..1e0fa5b 100644
@@ -3433,6 +3433,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();
Signature · 1 line
1.7.5.4
#6 lore raw

PATCH 6/11 x86: Exception hooks for userspace RCU extended QS

In reply to Frederic Weisbecker

Add necessary hooks to x86 exception for userspace RCU extended quiescent state support.

This includes traps, page fault, debug exceptions, etc...

Cc Alessio Igor Bogani <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Max Krasnyansky <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Sven-Thorsten Dietrich <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/x86/include/asm/rcu.h |   20 ++++++++++++++++++++
 arch/x86/kernel/traps.c    |   30 ++++++++++++++++++++++--------
 arch/x86/mm/fault.c        |   13 +++++++++++--
 3 files changed, 53 insertions(+), 10 deletions(-)
 create mode 100644 arch/x86/include/asm/rcu.h
arch/x86/include/asm/rcu.h new file +20 -0
new file mode 100644
index 0000000..439815b
@@ -0,0 +1,20 @@
+#ifndef _ASM_X86_RCU_H
+#define _ASM_X86_RCU_H
+
+#include <linux/rcupdate.h>
+#include <asm/ptrace.h>
+
+static inline void exception_enter(struct pt_regs *regs)
+{
+	rcu_user_exit();
+}
+
+static inline void exception_exit(struct pt_regs *regs)
+{
+#ifdef CONFIG_RCU_USER_QS
+	if (user_mode(regs))
+		rcu_user_enter();
+#endif
+}
+
+#endif
arch/x86/kernel/traps.c +22 -8
index 05b31d9..9b8195b 100644
@@ -52,6 +52,7 @@
 #include <asm/i387.h>
 #include <asm/fpu-internal.h>
 #include <asm/mce.h>
+#include <asm/rcu.h>
 
 #include <asm/mach_traps.h>
 
@@ -178,11 +179,15 @@ vm86_trap:
 #define DO_ERROR(trapnr, signr, str, name)				\
 dotraplinkage void do_##name(struct pt_regs *regs, long error_code)	\
 {									\
-	if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr)	\
-							== NOTIFY_STOP)	\
+	exception_enter(regs);						\
+	if (notify_die(DIE_TRAP, str, regs, error_code,			\
+			trapnr, signr) == NOTIFY_STOP) {		\
+		exception_exit(regs);					\
 		return;							\
+	}								\
 	conditional_sti(regs);						\
 	do_trap(trapnr, signr, str, regs, error_code, NULL);		\
+	exception_exit(regs);						\
 }
 
 #define DO_ERROR_INFO(trapnr, signr, str, name, sicode, siaddr)		\
@@ -193,11 +198,15 @@ dotraplinkage void do_##name(struct pt_regs *regs, long error_code)	\
 	info.si_errno = 0;						\
 	info.si_code = sicode;						\
 	info.si_addr = (void __user *)siaddr;				\
-	if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr)	\
-							== NOTIFY_STOP)	\
+	exception_enter(regs);						\
+	if (notify_die(DIE_TRAP, str, regs, error_code,			\
+			trapnr, signr) == NOTIFY_STOP) {		\
+		exception_exit(regs);					\
 		return;							\
+	}								\
 	conditional_sti(regs);						\
 	do_trap(trapnr, signr, str, regs, error_code, &info);		\
+	exception_exit(regs);						\
 }
 
 DO_ERROR_INFO(X86_TRAP_DE, SIGFPE, "divide error", divide_error, FPE_INTDIV,
@@ -311,6 +320,7 @@ dotraplinkage void __kprobes notrace do_int3(struct pt_regs *regs, long error_co
 	    ftrace_int3_handler(regs))
 		return;
 #endif
+	exception_enter(regs);
 #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
 	if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP,
 				SIGTRAP) == NOTIFY_STOP)
@@ -330,6 +340,7 @@ dotraplinkage void __kprobes notrace do_int3(struct pt_regs *regs, long error_co
 	do_trap(X86_TRAP_BP, SIGTRAP, "int3", regs, error_code, NULL);
 	preempt_conditional_cli(regs);
 	debug_stack_usage_dec();
+	exception_exit(regs);
 }
 
 #ifdef CONFIG_X86_64
@@ -390,6 +401,8 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
 	unsigned long dr6;
 	int si_code;
 
+	exception_enter(regs);
+
 	get_debugreg(dr6, 6);
 
 	/* Filter out all the reserved bits which are preset to 1 */
@@ -405,7 +418,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
 
 	/* Catch kmemcheck conditions first of all! */
 	if ((dr6 & DR_STEP) && kmemcheck_trap(regs))
-		return;
+		goto exit;
 
 	/* DR6 may or may not be cleared by the CPU */
 	set_debugreg(0, 6);
@@ -420,7 +433,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
 
 	if (notify_die(DIE_DEBUG, "debug", regs, PTR_ERR(&dr6), error_code,
 							SIGTRAP) == NOTIFY_STOP)
-		return;
+		goto exit;
 
 	/*
 	 * Let others (NMI) know that the debug stack is in use
@@ -436,7 +449,7 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
 					X86_TRAP_DB);
 		preempt_conditional_cli(regs);
 		debug_stack_usage_dec();
-		return;
+		goto exit;
 	}
 
 	/*
@@ -457,7 +470,8 @@ dotraplinkage void __kprobes do_debug(struct pt_regs *regs, long error_code)
 	preempt_conditional_cli(regs);
 	debug_stack_usage_dec();
 
-	return;
+exit:
+	exception_exit(regs);
 }
 
 /*
arch/x86/mm/fault.c +11 -2
index 76dcd9d..7dde46d 100644
@@ -18,6 +18,7 @@
 #include <asm/pgalloc.h>		/* pgd_*(), ...			*/
 #include <asm/kmemcheck.h>		/* kmemcheck_*(), ...		*/
 #include <asm/fixmap.h>			/* VSYSCALL_START		*/
+#include <asm/rcu.h>			/* exception_enter(), ...	*/
 
 /*
  * Page fault error code bits:
@@ -1000,8 +1001,8 @@ static int fault_in_kernel_space(unsigned long address)
  * and the problem, and then passes it off to one of the appropriate
  * routines.
  */
-dotraplinkage void __kprobes
-do_page_fault(struct pt_regs *regs, unsigned long error_code)
+static void __kprobes
+__do_page_fault(struct pt_regs *regs, unsigned long error_code)
 {
 	struct vm_area_struct *vma;
 	struct task_struct *tsk;
@@ -1209,3 +1210,11 @@ good_area:
 
 	up_read(&mm->mmap_sem);
 }
+
+dotraplinkage void __kprobes
+do_page_fault(struct pt_regs *regs, unsigned long error_code)
+{
+	exception_enter(regs);
+	__do_page_fault(regs, error_code);
+	exception_exit(regs);
+}
Signature · 1 line
1.7.5.4
#9 lore raw

PATCH 9/11 x86: Use the new schedule_user API on userspace preemption

In reply to Frederic Weisbecker

This way we can exit the RCU extended quiescent state before we schedule a new task from irq/exception exit.

Cc Alessio Igor Bogani <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Max Krasnyansky <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Sven-Thorsten Dietrich <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/x86/kernel/entry_64.S |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/kernel/entry_64.S +4 -4
index 7d65133..e97d42d 100644
@@ -565,7 +565,7 @@ sysret_careful:
 	TRACE_IRQS_ON
 	ENABLE_INTERRUPTS(CLBR_NONE)
 	pushq_cfi %rdi
-	call schedule
+	call schedule_user
 	popq_cfi %rdi
 	jmp sysret_check
 
@@ -678,7 +678,7 @@ int_careful:
 	TRACE_IRQS_ON
 	ENABLE_INTERRUPTS(CLBR_NONE)
 	pushq_cfi %rdi
-	call schedule
+	call schedule_user
 	popq_cfi %rdi
 	DISABLE_INTERRUPTS(CLBR_NONE)
 	TRACE_IRQS_OFF
@@ -974,7 +974,7 @@ retint_careful:
 	TRACE_IRQS_ON
 	ENABLE_INTERRUPTS(CLBR_NONE)
 	pushq_cfi %rdi
-	call  schedule
+	call  schedule_user
 	popq_cfi %rdi
 	GET_THREAD_INFO(%rcx)
 	DISABLE_INTERRUPTS(CLBR_NONE)
@@ -1467,7 +1467,7 @@ paranoid_userspace:
 paranoid_schedule:
 	TRACE_IRQS_ON
 	ENABLE_INTERRUPTS(CLBR_ANY)
-	call schedule
+	call schedule_user
 	DISABLE_INTERRUPTS(CLBR_ANY)
 	TRACE_IRQS_OFF
 	jmp paranoid_userspace
Signature · 1 line
1.7.5.4
#10 lore raw

PATCH 10/11 x86: Exit RCU extended QS on notify resume

In reply to Frederic Weisbecker

do_notify_resume() may be called on irq or exception exit. But at that time the exception has already called rcu_user_enter() and the irq has already called rcu_irq_exit().

Since it can use RCU read side critical section, we must call rcu_user_exit() before doing anything there. Then we must call back rcu_user_enter() after this function because we know we are going to userspace from there.

This complete support for userspace RCU extended quiescent state in x86-64.

Cc Alessio Igor Bogani <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Max Krasnyansky <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Sven-Thorsten Dietrich <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/x86/Kconfig         |    1 +
 arch/x86/kernel/signal.c |    4 ++++
 2 files changed, 5 insertions(+), 0 deletions(-)
arch/x86/Kconfig +1 -0
index c70684f..38dfcc2 100644
@@ -95,6 +95,7 @@ config X86
 	select KTIME_SCALAR if X86_32
 	select GENERIC_STRNCPY_FROM_USER
 	select GENERIC_STRNLEN_USER
+	select HAVE_RCU_USER_QS if X86_64
 
 config INSTRUCTION_DECODER
 	def_bool (KPROBES || PERF_EVENTS || UPROBES)
arch/x86/kernel/signal.c +4 -0
index 21af737..5cc2579 100644
@@ -776,6 +776,8 @@ static void do_signal(struct pt_regs *regs)
 void
 do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
 {
+	rcu_user_exit();
+
 #ifdef CONFIG_X86_MCE
 	/* notify userspace of pending MCEs */
 	if (thread_info_flags & _TIF_MCE_NOTIFY)
@@ -801,6 +803,8 @@ do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
 #ifdef CONFIG_X86_32
 	clear_thread_flag(TIF_IRET);
 #endif /* CONFIG_X86_32 */
+
+	rcu_user_enter();
 }
 
 void signal_fault(struct pt_regs *regs, void __user *frame, char *where)
Signature · 1 line
1.7.5.4
#11 lore raw

PATCH 11/11 rcu: Userspace RCU extended QS selftest

In reply to Frederic Weisbecker

Provide a config option that enables the userspace RCU extended quiescent state on every CPUs by default.

This is for testing purpose.

Cc Alessio Igor Bogani <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Max Krasnyansky <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Sven-Thorsten Dietrich <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 init/Kconfig     |    8 ++++++++
 kernel/rcutree.c |    2 +-
 2 files changed, 9 insertions(+), 1 deletions(-)
init/Kconfig +8 -0
index 3a4af8f..7d1db2e 100644
@@ -451,6 +451,14 @@ config RCU_USER_QS
 	  excluded from the global RCU state machine and thus doesn't
 	  to keep the timer tick on for RCU.
 
+config RCU_USER_QS_FORCE
+	bool "Force userspace extended QS by default"
+	depends on RCU_USER_QS
+	help
+	  Set the hooks in user/kernel boundaries by default in order to
+	  test this feature that treats userspace as an extended quiescent
+	  state until we have a real user like a full adaptive nohz option.
+
 config RCU_FANOUT
 	int "Tree-based hierarchical RCU fanout value"
 	range 2 64 if 64BIT
kernel/rcutree.c +1 -1
index 2d79308..9427aba 100644
@@ -209,7 +209,7 @@ EXPORT_SYMBOL_GPL(rcu_note_context_switch);
 DEFINE_PER_CPU(struct rcu_dynticks, rcu_dynticks) = {
 	.dynticks_nesting = DYNTICK_TASK_EXIT_IDLE,
 	.dynticks = ATOMIC_INIT(1),
-#ifdef CONFIG_RCU_USER_QS
+#if defined(CONFIG_RCU_USER_QS) && !defined(CONFIG_RCU_USER_QS_FORCE)
 	.ignore_user_qs = true,
 #endif
 };
Signature · 1 line
1.7.5.4
#8 lore raw

PATCH 8/11 rcu: Exit RCU extended QS on user preemption

In reply to Frederic Weisbecker

When exceptions or irq are about to resume userspace, if the task needs to be rescheduled, the arch low level code calls schedule() directly.

At that time we may be in extended quiescent state from RCU
POV: the exception is not anymore protected inside rcu_user_exit() - rcu_user_enter() and the irq has called rcu_irq_exit() already.

Create a new API schedule_user() that calls schedule() inside rcu_user_exit()-rcu_user_enter() in order to protect it. Archs will need to rely on it now to implement user preemption safely.

Cc Alessio Igor Bogani <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Avi Kivity <[email protected]>
Cc Chris Metcalf <[email protected]>
Cc Christoph Lameter <[email protected]>
Cc Geoff Levand <[email protected]>
Cc Gilad Ben Yossef <[email protected]>
Cc Hakan Akkan <[email protected]>
Cc H. Peter Anvin <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Josh Triplett <[email protected]>
Cc Kevin Hilman <[email protected]>
Cc Max Krasnyansky <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Stephen Hemminger <[email protected]>
Cc Steven Rostedt <[email protected]>
Cc Sven-Thorsten Dietrich <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 kernel/sched/core.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
kernel/sched/core.c +7 -0
index 1e0fa5b..a37619a 100644
@@ -3332,6 +3332,13 @@ asmlinkage void __sched schedule(void)
 }
 EXPORT_SYMBOL(schedule);
 
+asmlinkage void __sched schedule_user(void)
+{
+	rcu_user_exit();
+	schedule();
+	rcu_user_enter();
+}
+
 /**
  * schedule_preempt_disabled - called with preemption disabled
  *
Signature · 1 line
1.7.5.4
#12 lore raw
In reply to Frederic Weisbecker
Quoted 10 lines · Frederic Weisbecker

Hi,

There are significant changes this time. I reverted back to using a TIF flag to hook on syscalls slow path and put the hooks on high level exception handlers instead of low level ones.

It makes the code more portable between x86-32 and x86-64, it makes the hooks clearer and easier to review and the overhead is lowered in the off-case. This can be even better if we use jump labels later.

Thank you, Frederic, I have queued these:

git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git rcu/idle

I had to rework patch 4 a bit to take into account that I dropped the rcu_switch_from() patch, please check it to make sure that I didn't rework it out of existence.

Thanx, Paul

Quoted 40 lines

Thanks.

git://github.com/fweisbec/linux-dynticks.git

	rcu/user-2

Frederic Weisbecker (11):
rcu: Settle config for userspace extended quiescent state
rcu: Allow rcu_user_enter()/exit() to nest
rcu: Ignore userspace extended quiescent state by default
rcu: Switch task's syscall hooks on context switch
x86: Syscall hooks for userspace RCU extended QS
x86: Exception hooks for userspace RCU extended QS
rcu: Exit RCU extended QS on kernel preemption after irq/exception
rcu: Exit RCU extended QS on user preemption
x86: Use the new schedule_user API on userspace preemption
x86: Exit RCU extended QS on notify resume
rcu: Userspace RCU extended QS selftest

 arch/Kconfig                       |   10 ++++++
 arch/um/drivers/mconsole_kern.c    |    2 +-
 arch/x86/Kconfig                   |    1 +
 arch/x86/include/asm/rcu.h         |   20 +++++++++++
 arch/x86/include/asm/thread_info.h |   10 ++++--
 arch/x86/kernel/entry_64.S         |    8 ++--
 arch/x86/kernel/ptrace.c           |    5 +++
 arch/x86/kernel/signal.c           |    4 ++
 arch/x86/kernel/traps.c            |   30 ++++++++++++----
 arch/x86/mm/fault.c                |   13 ++++++-
 include/linux/rcupdate.h           |   10 ++++++
 include/linux/sched.h              |   20 ++++++-----
 init/Kconfig                       |   18 ++++++++++
 kernel/rcutree.c                   |   64 +++++++++++++++++++++++++++++++-----
 kernel/rcutree.h                   |    4 ++
 kernel/sched/core.c                |   10 +++++-
 16 files changed, 192 insertions(+), 37 deletions(-)
 create mode 100644 arch/x86/include/asm/rcu.h
Signature · 1 line
1.7.5.4
#13 lore raw
Quoted 14 lines · Paul E. McKenney
Quoted 10 lines · Frederic Weisbecker

Hi,

There are significant changes this time. I reverted back to using a TIF flag to hook on syscalls slow path and put the hooks on high level exception handlers instead of low level ones.

It makes the code more portable between x86-32 and x86-64, it makes the hooks clearer and easier to review and the overhead is lowered in the off-case. This can be even better if we use jump labels later.

Thank you, Frederic, I have queued these:

Quoted 7 lines

git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git rcu/idle

I had to rework patch 4 a bit to take into account that I dropped the rcu_switch_from() patch, please check it to make sure that I didn't rework it out of existence.

Thanx, Paul

Ok so it crashed once and I got 3 successful reboots afterward. Not sure what was the issue, not sure that's even due to my patches.

Anyway, I'll tell you if I see the crash again.