Commit e76506f0 authored by Paul E. McKenney's avatar Paul E. McKenney
Browse files

refscale: Allow summarization of verbose output



The refscale test prints enough per-kthread console output to provoke RCU
CPU stall warnings on large systems.  This commit therefore allows this
output to be summarized.  For example, the refscale.verbose_batched=32
boot parameter would causes only every 32nd line of output to be logged.

Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
parent f3ea978b
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -4557,6 +4557,12 @@
	refscale.verbose= [KNL]
			Enable additional printk() statements.

	refscale.verbose_batched= [KNL]
			Batch the additional printk() statements.  If zero
			(the default) or negative, print everything.  Otherwise,
			print every Nth verbose statement, where N is the value
			specified.

	relax_domain_level=
			[KNL, SMP] Set scheduler's default relax_domain_level.
			See Documentation/admin-guide/cgroup-v1/cpusets.rst.
+16 −5
Original line number Diff line number Diff line
@@ -46,6 +46,16 @@
#define VERBOSE_SCALEOUT(s, x...) \
	do { if (verbose) pr_alert("%s" SCALE_FLAG s, scale_type, ## x); } while (0)

static atomic_t verbose_batch_ctr;

#define VERBOSE_SCALEOUT_BATCH(s, x...)							\
do {											\
	if (verbose &&									\
	    (verbose_batched <= 0 ||							\
	     !(atomic_inc_return(&verbose_batch_ctr) % verbose_batched)))		\
		pr_alert("%s" SCALE_FLAG s, scale_type, ## x);				\
} while (0)

#define VERBOSE_SCALEOUT_ERRSTRING(s, x...) \
	do { if (verbose) pr_alert("%s" SCALE_FLAG "!!! " s, scale_type, ## x); } while (0)

@@ -57,6 +67,7 @@ module_param(scale_type, charp, 0444);
MODULE_PARM_DESC(scale_type, "Type of test (rcu, srcu, refcnt, rwsem, rwlock.");

torture_param(int, verbose, 0, "Enable verbose debugging printk()s");
torture_param(int, verbose_batched, 0, "Batch verbose debugging printk()s");

// Wait until there are multiple CPUs before starting test.
torture_param(int, holdoff, IS_BUILTIN(CONFIG_RCU_REF_SCALE_TEST) ? 10 : 0,
@@ -368,14 +379,14 @@ ref_scale_reader(void *arg)
	u64 start;
	s64 duration;

	VERBOSE_SCALEOUT("ref_scale_reader %ld: task started", me);
	VERBOSE_SCALEOUT_BATCH("ref_scale_reader %ld: task started", me);
	set_cpus_allowed_ptr(current, cpumask_of(me % nr_cpu_ids));
	set_user_nice(current, MAX_NICE);
	atomic_inc(&n_init);
	if (holdoff)
		schedule_timeout_interruptible(holdoff * HZ);
repeat:
	VERBOSE_SCALEOUT("ref_scale_reader %ld: waiting to start next experiment on cpu %d", me, smp_processor_id());
	VERBOSE_SCALEOUT_BATCH("ref_scale_reader %ld: waiting to start next experiment on cpu %d", me, smp_processor_id());

	// Wait for signal that this reader can start.
	wait_event(rt->wq, (atomic_read(&nreaders_exp) && smp_load_acquire(&rt->start_reader)) ||
@@ -392,7 +403,7 @@ ref_scale_reader(void *arg)
		while (atomic_read_acquire(&n_started))
			cpu_relax();

	VERBOSE_SCALEOUT("ref_scale_reader %ld: experiment %d started", me, exp_idx);
	VERBOSE_SCALEOUT_BATCH("ref_scale_reader %ld: experiment %d started", me, exp_idx);


	// To reduce noise, do an initial cache-warming invocation, check
@@ -421,7 +432,7 @@ ref_scale_reader(void *arg)
	if (atomic_dec_and_test(&nreaders_exp))
		wake_up(&main_wq);

	VERBOSE_SCALEOUT("ref_scale_reader %ld: experiment %d ended, (readers remaining=%d)",
	VERBOSE_SCALEOUT_BATCH("ref_scale_reader %ld: experiment %d ended, (readers remaining=%d)",
				me, exp_idx, atomic_read(&nreaders_exp));

	if (!torture_must_stop())