public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rcu: Have rcu torture test select trace_clock
@ 2013-02-04 15:52 Steven Rostedt
  2013-02-04 16:59 ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2013-02-04 15:52 UTC (permalink / raw)
  To: LKML; +Cc: Paul E. McKenney, Ingo Molnar, Andrew Morton, Tetsuo Handa

The rcu torture test uses trace_clock, and requires that it be built
into the kernel. If it is not, then we get the following build error:

ERROR: "trace_clock_local" [kernel/rcutorture.ko] undefined!

Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 4057127..b542477 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -942,6 +942,7 @@ config SPARSE_RCU_POINTER
 config RCU_TORTURE_TEST
 	tristate "torture tests for RCU"
 	depends on DEBUG_KERNEL
+	select TRACE_CLOCK
 	default n
 	help
 	  This option provides a kernel module that runs torture tests



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] rcu: Have rcu torture test select trace_clock
  2013-02-04 15:52 [PATCH] rcu: Have rcu torture test select trace_clock Steven Rostedt
@ 2013-02-04 16:59 ` Paul E. McKenney
  2013-02-04 18:36   ` Steven Rostedt
  0 siblings, 1 reply; 4+ messages in thread
From: Paul E. McKenney @ 2013-02-04 16:59 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: LKML, Ingo Molnar, Andrew Morton, Tetsuo Handa

On Mon, Feb 04, 2013 at 10:52:21AM -0500, Steven Rostedt wrote:
> The rcu torture test uses trace_clock, and requires that it be built
> into the kernel. If it is not, then we get the following build error:
> 
> ERROR: "trace_clock_local" [kernel/rcutorture.ko] undefined!
> 
> Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

This would work, but would unnecessarily force trace_clock_local()
to be defined when RCU tracing is disabled.  So, would the alternative
patch I posted work for you?

							Thanx, Paul

> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 4057127..b542477 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -942,6 +942,7 @@ config SPARSE_RCU_POINTER
>  config RCU_TORTURE_TEST
>  	tristate "torture tests for RCU"
>  	depends on DEBUG_KERNEL
> +	select TRACE_CLOCK
>  	default n
>  	help
>  	  This option provides a kernel module that runs torture tests
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rcu: Have rcu torture test select trace_clock
  2013-02-04 16:59 ` Paul E. McKenney
@ 2013-02-04 18:36   ` Steven Rostedt
  2013-02-04 18:59     ` Paul E. McKenney
  0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2013-02-04 18:36 UTC (permalink / raw)
  To: paulmck; +Cc: LKML, Ingo Molnar, Andrew Morton, Tetsuo Handa

On Mon, 2013-02-04 at 08:59 -0800, Paul E. McKenney wrote:
> On Mon, Feb 04, 2013 at 10:52:21AM -0500, Steven Rostedt wrote:
> > The rcu torture test uses trace_clock, and requires that it be built
> > into the kernel. If it is not, then we get the following build error:
> > 
> > ERROR: "trace_clock_local" [kernel/rcutorture.ko] undefined!
> > 
> > Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> > Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> 
> This would work, but would unnecessarily force trace_clock_local()
> to be defined when RCU tracing is disabled.  So, would the alternative
> patch I posted work for you?
> 

Unfortunately the other patch wasn't Cc'd to LKML (I hate private
emails).

I would suggest the following to be complete, why keep that extra divide
around?

-- Steve

I started with your patch:


rcu: Allow rcutorture to be built at low optimization levels

The uses of trace_clock_local() are dead code when CONFIG_RCU_TRACE=n,
but some compilers might nevertheless generate code calling this function.
This commit therefore ensures that trace_clock_local() is invoked only
when CONFIG_RCU_TRACE=y.

Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

Index: linux-trace.git/kernel/rcutorture.c
===================================================================
--- linux-trace.git.orig/kernel/rcutorture.c
+++ linux-trace.git/kernel/rcutorture.c
@@ -208,6 +208,20 @@ MODULE_PARM_DESC(rcutorture_runnable, "S
 #define rcu_can_boost() 0
 #endif /* #else #if defined(CONFIG_RCU_BOOST) && !defined(CONFIG_HOTPLUG_CPU) */
 
+#ifdef CONFIG_RCU_TRACE
+static u64 notrace rcu_trace_clock_local(void)
+{
+	u64 ts = trace_clock_local();
+	unsigned long __maybe_unused ts_rem = do_div(ts, NSEC_PER_USEC);
+	return ts;
+}
+#else /* #ifdef CONFIG_RCU_TRACE */
+static u64 notrace rcu_trace_clock_local(void)
+{
+	return 0ULL;
+}
+#endif /* #else #ifdef CONFIG_RCU_TRACE */
+
 static unsigned long shutdown_time;	/* jiffies to system shutdown. */
 static unsigned long boost_starttime;	/* jiffies of next boost test start. */
 DEFINE_MUTEX(boost_mutex);		/* protect setting boost_starttime */
@@ -1051,7 +1065,7 @@ static void rcu_torture_timer(unsigned l
 
 	idx = cur_ops->readlock();
 	completed = cur_ops->completed();
-	ts = trace_clock_local();
+	ts = rcu_trace_clock_local();
 	p = rcu_dereference_check(rcu_torture_current,
 				  rcu_read_lock_bh_held() ||
 				  rcu_read_lock_sched_held() ||
@@ -1075,8 +1089,6 @@ static void rcu_torture_timer(unsigned l
 	}
 	completed_end = cur_ops->completed();
 	if (pipe_count > 1) {
-		unsigned long __maybe_unused ts_rem = do_div(ts, NSEC_PER_USEC);
-
 		do_trace_rcu_torture_read(cur_ops->name, &p->rtort_rcu, ts,
 					  completed, completed_end);
 		rcutorture_trace_dump();
@@ -1122,7 +1134,7 @@ rcu_torture_reader(void *arg)
 		}
 		idx = cur_ops->readlock();
 		completed = cur_ops->completed();
-		ts = trace_clock_local();
+		ts = rcu_trace_clock_local();
 		p = rcu_dereference_check(rcu_torture_current,
 					  rcu_read_lock_bh_held() ||
 					  rcu_read_lock_sched_held() ||
@@ -1144,9 +1156,6 @@ rcu_torture_reader(void *arg)
 		}
 		completed_end = cur_ops->completed();
 		if (pipe_count > 1) {
-			unsigned long __maybe_unused ts_rem =
-					do_div(ts, NSEC_PER_USEC);
-
 			do_trace_rcu_torture_read(cur_ops->name, &p->rtort_rcu,
 						  ts, completed, completed_end);
 			rcutorture_trace_dump();



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rcu: Have rcu torture test select trace_clock
  2013-02-04 18:36   ` Steven Rostedt
@ 2013-02-04 18:59     ` Paul E. McKenney
  0 siblings, 0 replies; 4+ messages in thread
From: Paul E. McKenney @ 2013-02-04 18:59 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: LKML, Ingo Molnar, Andrew Morton, Tetsuo Handa

On Mon, Feb 04, 2013 at 01:36:13PM -0500, Steven Rostedt wrote:
> On Mon, 2013-02-04 at 08:59 -0800, Paul E. McKenney wrote:
> > On Mon, Feb 04, 2013 at 10:52:21AM -0500, Steven Rostedt wrote:
> > > The rcu torture test uses trace_clock, and requires that it be built
> > > into the kernel. If it is not, then we get the following build error:
> > > 
> > > ERROR: "trace_clock_local" [kernel/rcutorture.ko] undefined!
> > > 
> > > Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> > > Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> > 
> > This would work, but would unnecessarily force trace_clock_local()
> > to be defined when RCU tracing is disabled.  So, would the alternative
> > patch I posted work for you?
> > 
> 
> Unfortunately the other patch wasn't Cc'd to LKML (I hate private
> emails).
> 
> I would suggest the following to be complete, why keep that extra divide
> around?

Good point, queued!

							Thanx, Paul

> -- Steve
> 
> I started with your patch:
> 
> 
> rcu: Allow rcutorture to be built at low optimization levels
> 
> The uses of trace_clock_local() are dead code when CONFIG_RCU_TRACE=n,
> but some compilers might nevertheless generate code calling this function.
> This commit therefore ensures that trace_clock_local() is invoked only
> when CONFIG_RCU_TRACE=y.
> 
> Reported-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> 
> Index: linux-trace.git/kernel/rcutorture.c
> ===================================================================
> --- linux-trace.git.orig/kernel/rcutorture.c
> +++ linux-trace.git/kernel/rcutorture.c
> @@ -208,6 +208,20 @@ MODULE_PARM_DESC(rcutorture_runnable, "S
>  #define rcu_can_boost() 0
>  #endif /* #else #if defined(CONFIG_RCU_BOOST) && !defined(CONFIG_HOTPLUG_CPU) */
> 
> +#ifdef CONFIG_RCU_TRACE
> +static u64 notrace rcu_trace_clock_local(void)
> +{
> +	u64 ts = trace_clock_local();
> +	unsigned long __maybe_unused ts_rem = do_div(ts, NSEC_PER_USEC);
> +	return ts;
> +}
> +#else /* #ifdef CONFIG_RCU_TRACE */
> +static u64 notrace rcu_trace_clock_local(void)
> +{
> +	return 0ULL;
> +}
> +#endif /* #else #ifdef CONFIG_RCU_TRACE */
> +
>  static unsigned long shutdown_time;	/* jiffies to system shutdown. */
>  static unsigned long boost_starttime;	/* jiffies of next boost test start. */
>  DEFINE_MUTEX(boost_mutex);		/* protect setting boost_starttime */
> @@ -1051,7 +1065,7 @@ static void rcu_torture_timer(unsigned l
> 
>  	idx = cur_ops->readlock();
>  	completed = cur_ops->completed();
> -	ts = trace_clock_local();
> +	ts = rcu_trace_clock_local();
>  	p = rcu_dereference_check(rcu_torture_current,
>  				  rcu_read_lock_bh_held() ||
>  				  rcu_read_lock_sched_held() ||
> @@ -1075,8 +1089,6 @@ static void rcu_torture_timer(unsigned l
>  	}
>  	completed_end = cur_ops->completed();
>  	if (pipe_count > 1) {
> -		unsigned long __maybe_unused ts_rem = do_div(ts, NSEC_PER_USEC);
> -
>  		do_trace_rcu_torture_read(cur_ops->name, &p->rtort_rcu, ts,
>  					  completed, completed_end);
>  		rcutorture_trace_dump();
> @@ -1122,7 +1134,7 @@ rcu_torture_reader(void *arg)
>  		}
>  		idx = cur_ops->readlock();
>  		completed = cur_ops->completed();
> -		ts = trace_clock_local();
> +		ts = rcu_trace_clock_local();
>  		p = rcu_dereference_check(rcu_torture_current,
>  					  rcu_read_lock_bh_held() ||
>  					  rcu_read_lock_sched_held() ||
> @@ -1144,9 +1156,6 @@ rcu_torture_reader(void *arg)
>  		}
>  		completed_end = cur_ops->completed();
>  		if (pipe_count > 1) {
> -			unsigned long __maybe_unused ts_rem =
> -					do_div(ts, NSEC_PER_USEC);
> -
>  			do_trace_rcu_torture_read(cur_ops->name, &p->rtort_rcu,
>  						  ts, completed, completed_end);
>  			rcutorture_trace_dump();
> 
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-02-04 19:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-04 15:52 [PATCH] rcu: Have rcu torture test select trace_clock Steven Rostedt
2013-02-04 16:59 ` Paul E. McKenney
2013-02-04 18:36   ` Steven Rostedt
2013-02-04 18:59     ` Paul E. McKenney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox