Re: [PATCH] context_tracking: New context tracking susbsystem
On Thu, Nov 29, 2012 at 11:30:19AM +0100, Frederic Weisbecker wrote: > 2012/11/29 Li Zhong : > > On Tue, 2012-11-27 at 19:33 +0100, Frederic Weisbecker wrote: > > [] > >> - > >> - WARN_ON_ONCE(!current->mm); > >> - > >> - local_irq_save(flags); > >> - rdtp = &__get_cpu_var(rcu_dynticks); > >> - if (!rdtp->ignore_user_qs && !rdtp->in_user) { > >> - rdtp->in_user = true; > >> - rcu_eqs_enter(true); > >> - } > > > > It seems to me that ignore_user_qs and in_user defined in struct > > rcu_dynticks are no longer needed? > > > > If so, then maybe we could remove them, code below: > > > > == > > diff --git a/kernel/rcutree.c b/kernel/rcutree.c > > index e441b77..b8fae5d 100644 > > --- a/kernel/rcutree.c > > +++ b/kernel/rcutree.c > > @@ -2719,9 +2719,6 @@ 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; > > rcu_boot_init_nocb_percpu_data(rdp); > > diff --git a/kernel/rcutree.h b/kernel/rcutree.h > > index 4b69291..6f21f2e 100644 > > --- a/kernel/rcutree.h > > +++ b/kernel/rcutree.h > > @@ -102,10 +102,6 @@ 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 ignore_user_qs;/* Treat userspace as extended QS or > > not */ > > - bool in_user; /* Is the CPU in userland from RCU POV? > > */ > > -#endif > > }; > > > > /* RCU's kthread states for tracing. */ > > > > > > Good point. Paul, do you prefer to fold these changes into my patch or > do we add a new one? In any case Li we need your Signed-off-by tag. A separate patch works fine here because there should be no complaints from compilers or tests about these. Zhong, please do send with your Signed-off-by, and I will queue them. Thanx, Paul -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] context_tracking: New context tracking susbsystem
2012/11/29 Li Zhong : > On Tue, 2012-11-27 at 19:33 +0100, Frederic Weisbecker wrote: > [] >> - >> - WARN_ON_ONCE(!current->mm); >> - >> - local_irq_save(flags); >> - rdtp = &__get_cpu_var(rcu_dynticks); >> - if (!rdtp->ignore_user_qs && !rdtp->in_user) { >> - rdtp->in_user = true; >> - rcu_eqs_enter(true); >> - } > > It seems to me that ignore_user_qs and in_user defined in struct > rcu_dynticks are no longer needed? > > If so, then maybe we could remove them, code below: > > == > diff --git a/kernel/rcutree.c b/kernel/rcutree.c > index e441b77..b8fae5d 100644 > --- a/kernel/rcutree.c > +++ b/kernel/rcutree.c > @@ -2719,9 +2719,6 @@ 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; > rcu_boot_init_nocb_percpu_data(rdp); > diff --git a/kernel/rcutree.h b/kernel/rcutree.h > index 4b69291..6f21f2e 100644 > --- a/kernel/rcutree.h > +++ b/kernel/rcutree.h > @@ -102,10 +102,6 @@ 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 ignore_user_qs;/* Treat userspace as extended QS or not > */ > - bool in_user; /* Is the CPU in userland from RCU POV? */ > -#endif > }; > > /* RCU's kthread states for tracing. */ > > Good point. Paul, do you prefer to fold these changes into my patch or do we add a new one? In any case Li we need your Signed-off-by tag. Thanks. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] context_tracking: New context tracking susbsystem
On Tue, 2012-11-27 at 19:33 +0100, Frederic Weisbecker wrote: [] > - > - WARN_ON_ONCE(!current->mm); > - > - local_irq_save(flags); > - rdtp = &__get_cpu_var(rcu_dynticks); > - if (!rdtp->ignore_user_qs && !rdtp->in_user) { > - rdtp->in_user = true; > - rcu_eqs_enter(true); > - } It seems to me that ignore_user_qs and in_user defined in struct rcu_dynticks are no longer needed? If so, then maybe we could remove them, code below: == diff --git a/kernel/rcutree.c b/kernel/rcutree.c index e441b77..b8fae5d 100644 --- a/kernel/rcutree.c +++ b/kernel/rcutree.c @@ -2719,9 +2719,6 @@ 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; rcu_boot_init_nocb_percpu_data(rdp); diff --git a/kernel/rcutree.h b/kernel/rcutree.h index 4b69291..6f21f2e 100644 --- a/kernel/rcutree.h +++ b/kernel/rcutree.h @@ -102,10 +102,6 @@ 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 ignore_user_qs;/* Treat userspace as extended QS or not */ - bool in_user; /* Is the CPU in userland from RCU POV? */ -#endif }; /* RCU's kthread states for tracing. */ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] context_tracking: New context tracking susbsystem
On Tue, Nov 27, 2012 at 08:50:38PM -0500, Steven Rostedt wrote: > On Tue, 2012-11-27 at 16:59 -0800, Paul E. McKenney wrote: > > On Tue, Nov 27, 2012 at 07:33:25PM +0100, Frederic Weisbecker wrote: > > > Create a new subsystem that probes on kernel boundaries > > > to keep track of the transitions between level contexts > > > with two basic initial contexts: user or kernel. > > > > > > This is an abstraction of some RCU code that use such tracking > > > to implement its userspace extended quiescent state. > > > > > > We need to pull this up from RCU into this new level of indirection > > > because this tracking is also going to be used to implement an "on > > > demand" generic virtual cputime accounting. A necessary step to > > > shutdown the tick while still accounting the cputime. > > > > I have queued this, and if it passes tests and inspection will try > > pushing it for 3.8. > > > > You can add my Reviewed-by: Steven Rostedt if you > like. Very happy to do so! ;-) Thanx, Paul -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] context_tracking: New context tracking susbsystem
On Tue, 2012-11-27 at 16:59 -0800, Paul E. McKenney wrote: > On Tue, Nov 27, 2012 at 07:33:25PM +0100, Frederic Weisbecker wrote: > > Create a new subsystem that probes on kernel boundaries > > to keep track of the transitions between level contexts > > with two basic initial contexts: user or kernel. > > > > This is an abstraction of some RCU code that use such tracking > > to implement its userspace extended quiescent state. > > > > We need to pull this up from RCU into this new level of indirection > > because this tracking is also going to be used to implement an "on > > demand" generic virtual cputime accounting. A necessary step to > > shutdown the tick while still accounting the cputime. > > I have queued this, and if it passes tests and inspection will try > pushing it for 3.8. > You can add my Reviewed-by: Steven Rostedt if you like. -- Steve -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] context_tracking: New context tracking susbsystem
On Tue, Nov 27, 2012 at 07:33:25PM +0100, Frederic Weisbecker wrote: > Create a new subsystem that probes on kernel boundaries > to keep track of the transitions between level contexts > with two basic initial contexts: user or kernel. > > This is an abstraction of some RCU code that use such tracking > to implement its userspace extended quiescent state. > > We need to pull this up from RCU into this new level of indirection > because this tracking is also going to be used to implement an "on > demand" generic virtual cputime accounting. A necessary step to > shutdown the tick while still accounting the cputime. I have queued this, and if it passes tests and inspection will try pushing it for 3.8. Thanx, Paul > Signed-off-by: Frederic Weisbecker > Cc: Andrew Morton > Cc: H. Peter Anvin > Cc: Ingo Molnar > Cc: Paul E. McKenney > Cc: Peter Zijlstra > Cc: Steven Rostedt > Cc: Thomas Gleixner > Cc: Li Zhong > Cc: Gilad Ben-Yossef gi...@benyossef.com > --- > Changes since last version address Gilad's comments and include ifdef fixes. > Also CONTEXT_TRACKING_FORCE option has been moved below RCU user mode config > as it's the only user for now. > > arch/Kconfig | 15 ++-- > arch/x86/Kconfig |2 +- > arch/x86/include/asm/{rcu.h => context_tracking.h} | 15 ++-- > arch/x86/kernel/entry_64.S |2 +- > arch/x86/kernel/ptrace.c |8 +- > arch/x86/kernel/signal.c |5 +- > arch/x86/kernel/traps.c|2 +- > arch/x86/mm/fault.c|2 +- > include/linux/context_tracking.h | 18 > include/linux/rcupdate.h |2 - > init/Kconfig | 28 > kernel/Makefile|1 + > kernel/context_tracking.c | 83 > > kernel/rcutree.c | 64 +--- > kernel/sched/core.c| 11 ++- > 15 files changed, 150 insertions(+), 108 deletions(-) > rename arch/x86/include/asm/{rcu.h => context_tracking.h} (63%) > create mode 100644 include/linux/context_tracking.h > create mode 100644 kernel/context_tracking.c > > diff --git a/arch/Kconfig b/arch/Kconfig > index 366ec06..cc74aae 100644 > --- a/arch/Kconfig > +++ b/arch/Kconfig > @@ -300,15 +300,16 @@ config SECCOMP_FILTER > > See Documentation/prctl/seccomp_filter.txt for details. > > -config HAVE_RCU_USER_QS > +config HAVE_CONTEXT_TRACKING > 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. > + Provide kernel/user boundaries probes necessary for subsystems > + that need it, such as userspace RCU extended quiescent state. > + Syscalls need to be wrapped inside user_exit()-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. > > config HAVE_VIRT_CPU_ACCOUNTING > bool > diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig > index 46c3bff..110cfad 100644 > --- a/arch/x86/Kconfig > +++ b/arch/x86/Kconfig > @@ -106,7 +106,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 > + select HAVE_CONTEXT_TRACKING if X86_64 > select HAVE_IRQ_TIME_ACCOUNTING > select GENERIC_KERNEL_THREAD > select GENERIC_KERNEL_EXECVE > diff --git a/arch/x86/include/asm/rcu.h > b/arch/x86/include/asm/context_tracking.h > similarity index 63% > rename from arch/x86/include/asm/rcu.h > rename to arch/x86/include/asm/context_tracking.h > index d1ac07a..1616562 100644 > --- a/arch/x86/include/asm/rcu.h > +++ b/arch/x86/include/asm/context_tracking.h > @@ -1,27 +1,26 @@ > -#ifndef _ASM_X86_RCU_H > -#define _ASM_X86_RCU_H > +#ifndef _ASM_X86_CONTEXT_TRACKING_H > +#define _ASM_X86_CONTEXT_TRACKING_H > > #ifndef __ASSEMBLY__ > - > -#include > +#include > #include > > static inline void exception_enter(struct pt_regs *regs) > { > - rcu_user_exit(); > + user_exit(); > } > > static inline void exception_exit(struct pt_regs *regs) > { > -#ifdef CONFIG_RCU_USER_QS >