]>
Commit | Line | Data |
---|---|---|
353de598 GKH |
1 | From af06d4f74a7d2132c805339bfd5ab771b5706f42 Mon Sep 17 00:00:00 2001 |
2 | From: Boqun Feng <boqun.feng@gmail.com> | |
3 | Date: Wed, 25 May 2016 09:25:33 +0800 | |
4 | Subject: rcuperf: Don't treat gp_exp mis-setting as a WARN | |
5 | ||
6 | From: Boqun Feng <boqun.feng@gmail.com> | |
7 | ||
8 | commit af06d4f74a7d2132c805339bfd5ab771b5706f42 upstream. | |
9 | ||
10 | 0day found a boot warning triggered in rcu_perf_writer() on !SMP kernel: | |
11 | ||
12 | WARN_ON(rcu_gp_is_normal() && gp_exp); | |
13 | ||
14 | , the root cause of which is trying to measure expedited grace | |
15 | periods(by setting gp_exp to true by default) when all the grace periods | |
16 | are normal(TINY RCU only has normal grace periods). | |
17 | ||
18 | However, such a mis-setting would only result in failing to measure the | |
19 | performance for a specific kind of grace periods, therefore using a | |
20 | WARN_ON to check this is a little overkilling. We could handle this | |
21 | inside rcuperf module via some error messages to tell users about the | |
22 | mis-settings. | |
23 | ||
24 | Therefore this patch removes the WARN_ON in rcu_perf_writer() and | |
25 | handles those checkings in rcu_perf_init() with plain if() code. | |
26 | ||
27 | Moreover, this patch changes the default value of gp_exp to 1) align | |
28 | with rcutorture tests and 2) make the default setting work for all RCU | |
29 | implementations by default. | |
30 | ||
31 | Suggested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> | |
32 | Signed-off-by: Boqun Feng <boqun.feng@gmail.com> | |
33 | Fixes: http://lkml.kernel.org/r/57411b10.mFvG0+AgcrMXGtcj%fengguang.wu@intel.com | |
34 | Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com> | |
35 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
36 | ||
37 | --- | |
38 | kernel/rcu/rcuperf.c | 14 +++++++++++--- | |
39 | 1 file changed, 11 insertions(+), 3 deletions(-) | |
40 | ||
41 | --- a/kernel/rcu/rcuperf.c | |
42 | +++ b/kernel/rcu/rcuperf.c | |
43 | @@ -58,7 +58,7 @@ MODULE_AUTHOR("Paul E. McKenney <paulmck | |
44 | #define VERBOSE_PERFOUT_ERRSTRING(s) \ | |
45 | do { if (verbose) pr_alert("%s" PERF_FLAG "!!! %s\n", perf_type, s); } while (0) | |
46 | ||
47 | -torture_param(bool, gp_exp, true, "Use expedited GP wait primitives"); | |
48 | +torture_param(bool, gp_exp, false, "Use expedited GP wait primitives"); | |
49 | torture_param(int, holdoff, 10, "Holdoff time before test start (s)"); | |
50 | torture_param(int, nreaders, -1, "Number of RCU reader threads"); | |
51 | torture_param(int, nwriters, -1, "Number of RCU updater threads"); | |
52 | @@ -363,8 +363,6 @@ rcu_perf_writer(void *arg) | |
53 | u64 *wdpp = writer_durations[me]; | |
54 | ||
55 | VERBOSE_PERFOUT_STRING("rcu_perf_writer task started"); | |
56 | - WARN_ON(rcu_gp_is_expedited() && !rcu_gp_is_normal() && !gp_exp); | |
57 | - WARN_ON(rcu_gp_is_normal() && gp_exp); | |
58 | WARN_ON(!wdpp); | |
59 | set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids)); | |
60 | sp.sched_priority = 1; | |
61 | @@ -631,6 +629,16 @@ rcu_perf_init(void) | |
62 | firsterr = -ENOMEM; | |
63 | goto unwind; | |
64 | } | |
65 | + if (rcu_gp_is_expedited() && !rcu_gp_is_normal() && !gp_exp) { | |
66 | + VERBOSE_PERFOUT_ERRSTRING("All grace periods expedited, no normal ones to measure!"); | |
67 | + firsterr = -EINVAL; | |
68 | + goto unwind; | |
69 | + } | |
70 | + if (rcu_gp_is_normal() && gp_exp) { | |
71 | + VERBOSE_PERFOUT_ERRSTRING("All grace periods normal, no expedited ones to measure!"); | |
72 | + firsterr = -EINVAL; | |
73 | + goto unwind; | |
74 | + } | |
75 | for (i = 0; i < nrealwriters; i++) { | |
76 | writer_durations[i] = | |
77 | kcalloc(MAX_MEAS, sizeof(*writer_durations[i]), |