diff options
author | Boqun Feng <boqun.feng@gmail.com> | 2016-05-24 21:25:33 -0400 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2016-06-14 19:03:31 -0400 |
commit | af06d4f74a7d2132c805339bfd5ab771b5706f42 (patch) | |
tree | f815d4b93b35ee2688b328b95d06603e11231b4e | |
parent | 5ef20f872d10c695c30ee036f11c687a23944158 (diff) |
rcuperf: Don't treat gp_exp mis-setting as a WARN
0day found a boot warning triggered in rcu_perf_writer() on !SMP kernel:
WARN_ON(rcu_gp_is_normal() && gp_exp);
, the root cause of which is trying to measure expedited grace
periods(by setting gp_exp to true by default) when all the grace periods
are normal(TINY RCU only has normal grace periods).
However, such a mis-setting would only result in failing to measure the
performance for a specific kind of grace periods, therefore using a
WARN_ON to check this is a little overkilling. We could handle this
inside rcuperf module via some error messages to tell users about the
mis-settings.
Therefore this patch removes the WARN_ON in rcu_perf_writer() and
handles those checkings in rcu_perf_init() with plain if() code.
Moreover, this patch changes the default value of gp_exp to 1) align
with rcutorture tests and 2) make the default setting work for all RCU
implementations by default.
Suggested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Fixes: http://lkml.kernel.org/r/57411b10.mFvG0+AgcrMXGtcj%fengguang.wu@intel.com
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r-- | kernel/rcu/rcuperf.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/kernel/rcu/rcuperf.c b/kernel/rcu/rcuperf.c index afd174e901c3..7b2dbdffd791 100644 --- a/kernel/rcu/rcuperf.c +++ b/kernel/rcu/rcuperf.c | |||
@@ -58,7 +58,7 @@ MODULE_AUTHOR("Paul E. McKenney <paulmck@linux.vnet.ibm.com>"); | |||
58 | #define VERBOSE_PERFOUT_ERRSTRING(s) \ | 58 | #define VERBOSE_PERFOUT_ERRSTRING(s) \ |
59 | do { if (verbose) pr_alert("%s" PERF_FLAG "!!! %s\n", perf_type, s); } while (0) | 59 | do { if (verbose) pr_alert("%s" PERF_FLAG "!!! %s\n", perf_type, s); } while (0) |
60 | 60 | ||
61 | torture_param(bool, gp_exp, true, "Use expedited GP wait primitives"); | 61 | torture_param(bool, gp_exp, false, "Use expedited GP wait primitives"); |
62 | torture_param(int, holdoff, 10, "Holdoff time before test start (s)"); | 62 | torture_param(int, holdoff, 10, "Holdoff time before test start (s)"); |
63 | torture_param(int, nreaders, -1, "Number of RCU reader threads"); | 63 | torture_param(int, nreaders, -1, "Number of RCU reader threads"); |
64 | torture_param(int, nwriters, -1, "Number of RCU updater threads"); | 64 | torture_param(int, nwriters, -1, "Number of RCU updater threads"); |
@@ -358,8 +358,6 @@ rcu_perf_writer(void *arg) | |||
358 | u64 *wdpp = writer_durations[me]; | 358 | u64 *wdpp = writer_durations[me]; |
359 | 359 | ||
360 | VERBOSE_PERFOUT_STRING("rcu_perf_writer task started"); | 360 | VERBOSE_PERFOUT_STRING("rcu_perf_writer task started"); |
361 | WARN_ON(rcu_gp_is_expedited() && !rcu_gp_is_normal() && !gp_exp); | ||
362 | WARN_ON(rcu_gp_is_normal() && gp_exp); | ||
363 | WARN_ON(!wdpp); | 361 | WARN_ON(!wdpp); |
364 | set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids)); | 362 | set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids)); |
365 | sp.sched_priority = 1; | 363 | sp.sched_priority = 1; |
@@ -626,6 +624,16 @@ rcu_perf_init(void) | |||
626 | firsterr = -ENOMEM; | 624 | firsterr = -ENOMEM; |
627 | goto unwind; | 625 | goto unwind; |
628 | } | 626 | } |
627 | if (rcu_gp_is_expedited() && !rcu_gp_is_normal() && !gp_exp) { | ||
628 | VERBOSE_PERFOUT_ERRSTRING("All grace periods expedited, no normal ones to measure!"); | ||
629 | firsterr = -EINVAL; | ||
630 | goto unwind; | ||
631 | } | ||
632 | if (rcu_gp_is_normal() && gp_exp) { | ||
633 | VERBOSE_PERFOUT_ERRSTRING("All grace periods normal, no expedited ones to measure!"); | ||
634 | firsterr = -EINVAL; | ||
635 | goto unwind; | ||
636 | } | ||
629 | for (i = 0; i < nrealwriters; i++) { | 637 | for (i = 0; i < nrealwriters; i++) { |
630 | writer_durations[i] = | 638 | writer_durations[i] = |
631 | kcalloc(MAX_MEAS, sizeof(*writer_durations[i]), | 639 | kcalloc(MAX_MEAS, sizeof(*writer_durations[i]), |