diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2013-02-04 13:36:13 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2013-02-04 15:18:20 -0500 |
commit | e4aa0da39b6a69f3442ebc33500c21176c5eb560 (patch) | |
tree | 0acc73d7aa64e1f825c515346622f0d5eb04126a /kernel/rcutorture.c | |
parent | 40393f525fe698e2b639cf1851ef0a40e7e158a8 (diff) |
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>
Diffstat (limited to 'kernel/rcutorture.c')
-rw-r--r-- | kernel/rcutorture.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index cd4c35d097a4..e1f3a8c96724 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c | |||
@@ -208,6 +208,20 @@ MODULE_PARM_DESC(rcutorture_runnable, "Start rcutorture at boot"); | |||
208 | #define rcu_can_boost() 0 | 208 | #define rcu_can_boost() 0 |
209 | #endif /* #else #if defined(CONFIG_RCU_BOOST) && !defined(CONFIG_HOTPLUG_CPU) */ | 209 | #endif /* #else #if defined(CONFIG_RCU_BOOST) && !defined(CONFIG_HOTPLUG_CPU) */ |
210 | 210 | ||
211 | #ifdef CONFIG_RCU_TRACE | ||
212 | static u64 notrace rcu_trace_clock_local(void) | ||
213 | { | ||
214 | u64 ts = trace_clock_local(); | ||
215 | unsigned long __maybe_unused ts_rem = do_div(ts, NSEC_PER_USEC); | ||
216 | return ts; | ||
217 | } | ||
218 | #else /* #ifdef CONFIG_RCU_TRACE */ | ||
219 | static u64 notrace rcu_trace_clock_local(void) | ||
220 | { | ||
221 | return 0ULL; | ||
222 | } | ||
223 | #endif /* #else #ifdef CONFIG_RCU_TRACE */ | ||
224 | |||
211 | static unsigned long shutdown_time; /* jiffies to system shutdown. */ | 225 | static unsigned long shutdown_time; /* jiffies to system shutdown. */ |
212 | static unsigned long boost_starttime; /* jiffies of next boost test start. */ | 226 | static unsigned long boost_starttime; /* jiffies of next boost test start. */ |
213 | DEFINE_MUTEX(boost_mutex); /* protect setting boost_starttime */ | 227 | DEFINE_MUTEX(boost_mutex); /* protect setting boost_starttime */ |
@@ -1051,7 +1065,7 @@ static void rcu_torture_timer(unsigned long unused) | |||
1051 | 1065 | ||
1052 | idx = cur_ops->readlock(); | 1066 | idx = cur_ops->readlock(); |
1053 | completed = cur_ops->completed(); | 1067 | completed = cur_ops->completed(); |
1054 | ts = trace_clock_local(); | 1068 | ts = rcu_trace_clock_local(); |
1055 | p = rcu_dereference_check(rcu_torture_current, | 1069 | p = rcu_dereference_check(rcu_torture_current, |
1056 | rcu_read_lock_bh_held() || | 1070 | rcu_read_lock_bh_held() || |
1057 | rcu_read_lock_sched_held() || | 1071 | rcu_read_lock_sched_held() || |
@@ -1075,8 +1089,6 @@ static void rcu_torture_timer(unsigned long unused) | |||
1075 | } | 1089 | } |
1076 | completed_end = cur_ops->completed(); | 1090 | completed_end = cur_ops->completed(); |
1077 | if (pipe_count > 1) { | 1091 | if (pipe_count > 1) { |
1078 | unsigned long __maybe_unused ts_rem = do_div(ts, NSEC_PER_USEC); | ||
1079 | |||
1080 | do_trace_rcu_torture_read(cur_ops->name, &p->rtort_rcu, ts, | 1092 | do_trace_rcu_torture_read(cur_ops->name, &p->rtort_rcu, ts, |
1081 | completed, completed_end); | 1093 | completed, completed_end); |
1082 | rcutorture_trace_dump(); | 1094 | rcutorture_trace_dump(); |
@@ -1122,7 +1134,7 @@ rcu_torture_reader(void *arg) | |||
1122 | } | 1134 | } |
1123 | idx = cur_ops->readlock(); | 1135 | idx = cur_ops->readlock(); |
1124 | completed = cur_ops->completed(); | 1136 | completed = cur_ops->completed(); |
1125 | ts = trace_clock_local(); | 1137 | ts = rcu_trace_clock_local(); |
1126 | p = rcu_dereference_check(rcu_torture_current, | 1138 | p = rcu_dereference_check(rcu_torture_current, |
1127 | rcu_read_lock_bh_held() || | 1139 | rcu_read_lock_bh_held() || |
1128 | rcu_read_lock_sched_held() || | 1140 | rcu_read_lock_sched_held() || |
@@ -1144,9 +1156,6 @@ rcu_torture_reader(void *arg) | |||
1144 | } | 1156 | } |
1145 | completed_end = cur_ops->completed(); | 1157 | completed_end = cur_ops->completed(); |
1146 | if (pipe_count > 1) { | 1158 | if (pipe_count > 1) { |
1147 | unsigned long __maybe_unused ts_rem = | ||
1148 | do_div(ts, NSEC_PER_USEC); | ||
1149 | |||
1150 | do_trace_rcu_torture_read(cur_ops->name, &p->rtort_rcu, | 1159 | do_trace_rcu_torture_read(cur_ops->name, &p->rtort_rcu, |
1151 | ts, completed, completed_end); | 1160 | ts, completed, completed_end); |
1152 | rcutorture_trace_dump(); | 1161 | rcutorture_trace_dump(); |