Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af06d4f7 authored by Boqun Feng's avatar Boqun Feng Committed by Paul E. McKenney
Browse files

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: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: default avatarBoqun Feng <boqun.feng@gmail.com>
Fixes: http://lkml.kernel.org/r/57411b10.mFvG0+AgcrMXGtcj%fengguang.wu@intel.com


Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
parent 5ef20f87
Loading
Loading
Loading
Loading
+11 −3
Original line number Original line Diff line number Diff line
@@ -58,7 +58,7 @@ MODULE_AUTHOR("Paul E. McKenney <paulmck@linux.vnet.ibm.com>");
#define VERBOSE_PERFOUT_ERRSTRING(s) \
#define VERBOSE_PERFOUT_ERRSTRING(s) \
	do { if (verbose) pr_alert("%s" PERF_FLAG "!!! %s\n", perf_type, s); } while (0)
	do { if (verbose) pr_alert("%s" PERF_FLAG "!!! %s\n", perf_type, s); } while (0)


torture_param(bool, gp_exp, true, "Use expedited GP wait primitives");
torture_param(bool, gp_exp, false, "Use expedited GP wait primitives");
torture_param(int, holdoff, 10, "Holdoff time before test start (s)");
torture_param(int, holdoff, 10, "Holdoff time before test start (s)");
torture_param(int, nreaders, -1, "Number of RCU reader threads");
torture_param(int, nreaders, -1, "Number of RCU reader threads");
torture_param(int, nwriters, -1, "Number of RCU updater threads");
torture_param(int, nwriters, -1, "Number of RCU updater threads");
@@ -358,8 +358,6 @@ rcu_perf_writer(void *arg)
	u64 *wdpp = writer_durations[me];
	u64 *wdpp = writer_durations[me];


	VERBOSE_PERFOUT_STRING("rcu_perf_writer task started");
	VERBOSE_PERFOUT_STRING("rcu_perf_writer task started");
	WARN_ON(rcu_gp_is_expedited() && !rcu_gp_is_normal() && !gp_exp);
	WARN_ON(rcu_gp_is_normal() && gp_exp);
	WARN_ON(!wdpp);
	WARN_ON(!wdpp);
	set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids));
	set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids));
	sp.sched_priority = 1;
	sp.sched_priority = 1;
@@ -626,6 +624,16 @@ rcu_perf_init(void)
		firsterr = -ENOMEM;
		firsterr = -ENOMEM;
		goto unwind;
		goto unwind;
	}
	}
	if (rcu_gp_is_expedited() && !rcu_gp_is_normal() && !gp_exp) {
		VERBOSE_PERFOUT_ERRSTRING("All grace periods expedited, no normal ones to measure!");
		firsterr = -EINVAL;
		goto unwind;
	}
	if (rcu_gp_is_normal() && gp_exp) {
		VERBOSE_PERFOUT_ERRSTRING("All grace periods normal, no expedited ones to measure!");
		firsterr = -EINVAL;
		goto unwind;
	}
	for (i = 0; i < nrealwriters; i++) {
	for (i = 0; i < nrealwriters; i++) {
		writer_durations[i] =
		writer_durations[i] =
			kcalloc(MAX_MEAS, sizeof(*writer_durations[i]),
			kcalloc(MAX_MEAS, sizeof(*writer_durations[i]),