Torture-test updates
Subsystems (4)
cover Torture-test updates
Hello!
This series provides torture-test updates:
1. Replace multi-instance kzalloc() with kcalloc().
2. Use __func__ instead of hard-coded function names.
3. Avoid fake-writer use of undefined primitives, which are
represented with NULL in the structure referenced by cur_ops.
4. Re-enable testing of dynamic expediting.
5. Record which grace-period primitives are tested.
6. Update kvm.sh header comment.
7. Add basic ARM64 support to run scripts, courtesy of Lihao Liang.
8. Specify qemu memory size with --memory argument.
9. Default jitter off when running rcuperf.
10. Adjust rcuperf trace processing to allow for workqueues.
11. Grace periods do not piggyback off of themselves, so make
rcuperf understand this.
12. Provide more sensible nreader/nwriter defaults for rcuperf.
Thanx, Paul
------------------------------------------------------------------------
kernel/rcu/rcuperf.c | 21 ++ kernel/rcu/rcutorture.c | 72 +++++----- tools/testing/selftests/rcutorture/bin/functions.sh | 17 ++ tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf-ftrace.sh | 11 - tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh | 4 tools/testing/selftests/rcutorture/bin/kvm.sh | 22 ++- tools/testing/selftests/rcutorture/configs/rcuperf/ver_functions.sh | 24 --- 7 files changed, 102 insertions(+), 69 deletions(-)
PATCH 1/12 rcutorture: Replace multi-instance kzalloc() with kcalloc()
This commit replaces array-allocation calls to kzalloc() with equivalent calls to kcalloc().
--- kernel/rcu/rcutorture.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
kernel/rcu/rcutorture.c +4 -5
@@ -1557,11 +1557,10 @@ static int rcu_torture_barrier_init(void)atomic_set (&barrier_cbs_count,0 );atomic_set (&barrier_cbs_invoked,0 ); barrier_cbs_tasks = -kzalloc (n_barrier_cbs *sizeof (barrier_cbs_tasks[0 ]), +kcalloc (n_barrier_cbs,sizeof (barrier_cbs_tasks[0 ]),GFP_KERNEL ); barrier_cbs_wq = -kzalloc (n_barrier_cbs *sizeof (barrier_cbs_wq[0 ]), -GFP_KERNEL ); +kcalloc (n_barrier_cbs,sizeof (barrier_cbs_wq[0 ]),GFP_KERNEL );if (barrier_cbs_tasks ==NULL || !barrier_cbs_wq)return -ENOMEM ;for (i =0 ; i < n_barrier_cbs; i++) {
@@ -1799,7 +1798,7 @@ rcu_torture_init(void)if (firsterr) goto unwind;if (nfakewriters >0 ) { - fakewriter_tasks =kzalloc (nfakewriters * + fakewriter_tasks =kcalloc (nfakewriters,sizeof (fakewriter_tasks[0 ]),GFP_KERNEL );if (fakewriter_tasks ==NULL ) {
@@ -1814,7 +1813,7 @@ rcu_torture_init(void)if (firsterr) goto unwind; } - reader_tasks =kzalloc (nrealreaders *sizeof (reader_tasks[0 ]), + reader_tasks =kcalloc (nrealreaders,sizeof (reader_tasks[0 ]),GFP_KERNEL );if (reader_tasks ==NULL ) {VERBOSE_TOROUT_ERRSTRING ("out of memory" );
Signature · 1 line
2.5.2
PATCH 2/12 rcutorture: Abstract function and module names
In reply to Paul E. McKenneyThis commit moves to __func__ for function names and for KBUILD_MODNAME for module names, all in the name of better resilience to change.
--- kernel/rcu/rcutorture.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
kernel/rcu/rcutorture.c +8 -8
@@ -924,19 +924,19 @@ rcu_torture_writer(void *arg)if (gp_cond1 && cur_ops->get_state && cur_ops->cond_sync) synctype[nsynctypes++] =RTWS_COND_GET ;else if (gp_cond && (!cur_ops->get_state || !cur_ops->cond_sync)) -pr_alert ("rcu_torture_writer: gp_cond without primitives.\n" ); +pr_alert ("%s: gp_cond without primitives.\n" , __func__);if (gp_exp1 && cur_ops->exp_sync) synctype[nsynctypes++] =RTWS_EXP_SYNC ;else if (gp_exp && !cur_ops->exp_sync) -pr_alert ("rcu_torture_writer: gp_exp without primitives.\n" ); +pr_alert ("%s: gp_exp without primitives.\n" , __func__);if (gp_normal1 && cur_ops->deferred_free) synctype[nsynctypes++] =RTWS_DEF_FREE ;else if (gp_normal && !cur_ops->deferred_free) -pr_alert ("rcu_torture_writer: gp_normal without primitives.\n" ); +pr_alert ("%s: gp_normal without primitives.\n" , __func__);if (gp_sync1 && cur_ops->sync) synctype[nsynctypes++] =RTWS_SYNC ;else if (gp_sync && !cur_ops->sync) -pr_alert ("rcu_torture_writer: gp_sync without primitives.\n" ); +pr_alert ("%s: gp_sync without primitives.\n" , __func__);if (WARN_ONCE (nsynctypes ==0 ,"rcu_torture_writer: No update-side primitives.\n" )) {/*
@@ -1673,7 +1673,7 @@ static void rcu_torture_err_cb(struct rcu_head *rhp)* next grace period. Unlikely, but can happen. If it * does happen, the debug-objects subsystem won't have splatted. */ - pr_alert("rcutorture: duplicated callback was invoked.\n"); + pr_alert("%s: duplicated callback was invoked.\n", KBUILD_MODNAME); }#endif /* #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD */
@@ -1690,7 +1690,7 @@ static void rcu_test_debug_objects(void)init_rcu_head_on_stack (&rh1);init_rcu_head_on_stack (&rh2); -pr_alert ("rcutorture: WARN: Duplicate call_rcu() test starting.\n" ); +pr_alert ("%s: WARN: Duplicate call_rcu() test starting.\n" ,KBUILD_MODNAME );/* Try to queue the rh2 pair of callbacks for the same grace period. */ preempt_disable ();/* Prevent preemption from interrupting test. */
@@ -1705,11 +1705,11 @@ static void rcu_test_debug_objects(void)/* Wait for them all to get done so we can safely return. */ rcu_barrier (); -pr_alert ("rcutorture: WARN: Duplicate call_rcu() test complete.\n" ); +pr_alert ("%s: WARN: Duplicate call_rcu() test complete.\n" ,KBUILD_MODNAME );destroy_rcu_head_on_stack (&rh1);destroy_rcu_head_on_stack (&rh2);#else /* #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD */ -pr_alert ("rcutorture: !CONFIG_DEBUG_OBJECTS_RCU_HEAD, not testing duplicate call_rcu()\n" ); +pr_alert ("%s: !CONFIG_DEBUG_OBJECTS_RCU_HEAD, not testing duplicate call_rcu()\n" ,KBUILD_MODNAME );#endif /* #else #ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD */ }
Signature · 1 line
2.5.2
PATCH 3/12 rcutorture: Avoid fake-writer use of undefined primitives
In reply to Paul E. McKenneyCurrently the rcu_torture_fakewriter() function invokes cur_ops->sync() and cur_ops->exp_sync() without first checking to see if they are in fact non-NULL. This results in kernel NULL pointer dereferences when testing RCU implementations that choose not to provide the full set of primitives. Given that it is perfectly reasonable to have specialized RCU implementations that provide only a subset of the RCU API, this is a bug in rcutorture.
This commit therefore makes rcu_torture_fakewriter() check function pointers before invoking them, thus allowing it to test subsetted RCU implementations.
--- kernel/rcu/rcutorture.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
kernel/rcu/rcutorture.c +4 -4
@@ -1045,13 +1045,13 @@ rcu_torture_fakewriter(void *arg) torture_random(&rand) % (nfakewriters * 8) == 0) { cur_ops->cb_barrier (); } else if (gp_normal == gp_exp) { -if (torture_random (&rand) &0x80 ) +if (cur_ops->sync &&torture_random (&rand) &0x80 ) cur_ops->sync (); -else +else if (cur_ops->exp_sync) cur_ops->exp_sync (); - } else if (gp_normal) { + } else if (gp_normal && cur_ops->sync) { cur_ops->sync (); - } else { + } else if (cur_ops->exp_sync) { cur_ops->exp_sync (); }stutter_wait ("rcu_torture_fakewriter" );
Signature · 1 line
2.5.2
PATCH 4/12 rcutorture: Re-enable testing of dynamic expediting
In reply to Paul E. McKenneyDuring boot, normal grace periods are processed as expedited. When rcutorture is built into the kernel, it starts during boot and thus detects that normal grace periods are unconditionally expedited. Therefore, rcutorture concludes that there is no point in trying to dynamically enable expediting, do it disables this aspect of testing, which is a bit of an overreaction to the temporary boot-time expediting.
This commit therefore rechecks forced expediting throughout the test, enabling dynamic expediting if normal grace periods are processed normally at any point.
--- kernel/rcu/rcutorture.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
kernel/rcu/rcutorture.c +9 -6
@@ -909,14 +909,10 @@ rcu_torture_writer(void *arg)int nsynctypes =0 ;VERBOSE_TOROUT_STRING ("rcu_torture_writer task started" ); -if (!can_expedite) { +if (!can_expedite)pr_alert ("%s" TORTURE_FLAG -" GP expediting controlled from boot/sysfs for %s,\n" , +" GP expediting controlled from boot/sysfs for %s.\n" , torture_type, cur_ops->name); -pr_alert ("%s" TORTURE_FLAG -" Disabled dynamic grace-period expediting.\n" , - torture_type); - }/* Initialize synctype[] array. If none set, take default. */ if (!gp_cond1 && !gp_exp1 && !gp_normal1 && !gp_sync1)
@@ -1011,6 +1007,9 @@ rcu_torture_writer(void *arg)rcu_unexpedite_gp ();if (++expediting >3 ) expediting = -expediting; + }else if (!can_expedite) {/* Disabled during boot, recheck. */ + can_expedite = !rcu_gp_is_expedited () && + !rcu_gp_is_normal (); } rcu_torture_writer_state =RTWS_STUTTER ;stutter_wait ("rcu_torture_writer" );
@@ -1021,6 +1020,10 @@ rcu_torture_writer(void *arg)while (can_expedite && expediting++ <0 )rcu_unexpedite_gp ();WARN_ON_ONCE (can_expedite &&rcu_gp_is_expedited ()); +if (!can_expedite) +pr_alert ("%s" TORTURE_FLAG +" Dynamic grace-period expediting was disabled.\n" , + torture_type); rcu_torture_writer_state =RTWS_STOPPING ;torture_kthread_stopping ("rcu_torture_writer" );return 0 ;
Signature · 1 line
2.5.2
PATCH 5/12 rcutorture: Record which grace-period primitives are tested
In reply to Paul E. McKenneyThe rcu_torture_writer() function adapts to requested testing from module parameters as well as the function pointers in the structure referenced by cur_ops. However, as long as the module parameters do not conflict with the function pointers, this adaptation is silent. This silence can result in confusion as to exactly what was tested, which could in turn result in untested RCU code making its way into mainline.
This commit therefore makes rcu_torture_writer() announce exactly which portions of RCU's API it ends up testing.
--- kernel/rcu/rcutorture.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-)
kernel/rcu/rcutorture.c +16 -8
@@ -917,22 +917,30 @@ rcu_torture_writer(void *arg)/* Initialize synctype[] array. If none set, take default. */ if (!gp_cond1 && !gp_exp1 && !gp_normal1 && !gp_sync1) gp_cond1 = gp_exp1 = gp_normal1 = gp_sync1 = true; -if (gp_cond1 && cur_ops->get_state && cur_ops->cond_sync) +if (gp_cond1 && cur_ops->get_state && cur_ops->cond_sync) { synctype[nsynctypes++] =RTWS_COND_GET ; -else if (gp_cond && (!cur_ops->get_state || !cur_ops->cond_sync)) +pr_info ("%s: Testing conditional GPs.\n" , __func__); + }else if (gp_cond && (!cur_ops->get_state || !cur_ops->cond_sync)) {pr_alert ("%s: gp_cond without primitives.\n" , __func__); -if (gp_exp1 && cur_ops->exp_sync) + } +if (gp_exp1 && cur_ops->exp_sync) { synctype[nsynctypes++] =RTWS_EXP_SYNC ; -else if (gp_exp && !cur_ops->exp_sync) +pr_info ("%s: Testing expedited GPs.\n" , __func__); + }else if (gp_exp && !cur_ops->exp_sync) {pr_alert ("%s: gp_exp without primitives.\n" , __func__); -if (gp_normal1 && cur_ops->deferred_free) + } +if (gp_normal1 && cur_ops->deferred_free) { synctype[nsynctypes++] =RTWS_DEF_FREE ; -else if (gp_normal && !cur_ops->deferred_free) +pr_info ("%s: Testing asynchronous GPs.\n" , __func__); + }else if (gp_normal && !cur_ops->deferred_free) {pr_alert ("%s: gp_normal without primitives.\n" , __func__); -if (gp_sync1 && cur_ops->sync) + } +if (gp_sync1 && cur_ops->sync) { synctype[nsynctypes++] =RTWS_SYNC ; -else if (gp_sync && !cur_ops->sync) +pr_info ("%s: Testing normal GPs.\n" , __func__); + }else if (gp_sync && !cur_ops->sync) {pr_alert ("%s: gp_sync without primitives.\n" , __func__); + }if (WARN_ONCE (nsynctypes ==0 ,"rcu_torture_writer: No update-side primitives.\n" )) {/*
Signature · 1 line
2.5.2
PATCH 6/12 rcutorture: Update kvm.sh header comment
In reply to Paul E. McKenneyThe kvm.sh header comment is a bit of a relic, so this commit brings it up to date.
--- tools/testing/selftests/rcutorture/bin/kvm.sh | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
tools/testing/selftests/rcutorture/bin/kvm.sh +3 -5
@@ -1,10 +1,8 @@ #!/bin/bash # -# Run a series of 14 tests under KVM. These are not particularly -# well-selected or well-tuned, but are the current set. -# -# Edit the definitions below to set the locations of the various directories, -# as well as the test duration. +# Run a series of tests under KVM. By default, this series is specified +# by the relevant CFLIST file, but can be overridden by the --configs +# command-line argument. # # Usage: kvm.sh [ options ] #
Signature · 1 line
2.5.2
PATCH 7/12 rcutorture: Add basic ARM64 support to run scripts
In reply to Paul E. McKenneyFrom: Lihao Liang <[email protected]>
This commit adds support of the qemu command qemu-system-aarch64 to rcutorture.
--- tools/testing/selftests/rcutorture/bin/functions.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
tools/testing/selftests/rcutorture/bin/functions.sh +15 -2
@@ -136,6 +136,9 @@ identify_boot_image () { qemu-system-x86_64|qemu-system-i386) echo arch/x86/boot/bzImage ;; + qemu-system-aarch64) + echo arch/arm64/boot/Image + ;; *) echo vmlinux ;;
@@ -158,6 +161,9 @@ identify_qemu () { elif echo $u | grep -q "Intel 80386" then echo qemu-system-i386 + elif echo $u | grep -q aarch64 + then + echo qemu-system-aarch64 elif uname -a | grep -q ppc64 then echo qemu-system-ppc64
@@ -176,16 +182,20 @@ identify_qemu () { # Output arguments for the qemu "-append" string based on CPU type # and the TORTURE_QEMU_INTERACTIVE environment variable. identify_qemu_append () { + local console=ttyS0 case "$1" in qemu-system-x86_64|qemu-system-i386) echo noapic selinux=0 initcall_debug debug ;; + qemu-system-aarch64) + console=ttyAMA0 + ;; esac if test -n "$TORTURE_QEMU_INTERACTIVE" then echo root=/dev/sda else - echo console=ttyS0 + echo console=$console fi }
@@ -197,6 +207,9 @@ identify_qemu_args () { case "$1" in qemu-system-x86_64|qemu-system-i386) ;; + qemu-system-aarch64) + echo -machine virt,gic-version=host -cpu host + ;; qemu-system-ppc64) echo -enable-kvm -M pseries -nodefaults echo -device spapr-vscsi
@@ -254,7 +267,7 @@ specify_qemu_cpus () { echo $2 else case "$1" in - qemu-system-x86_64|qemu-system-i386) + qemu-system-x86_64|qemu-system-i386|qemu-system-aarch64) echo $2 -smp $3 ;; qemu-system-ppc64)
Signature · 1 line
2.5.2
PATCH 8/12 torture: Specify qemu memory size with --memory argument
In reply to Paul E. McKenneyThe 512 megabyte memory size has served quite well, but more memory is required when using large trace buffers on large systems. This commit therefore adds a --memory argument to the kvm.sh script, which allows the memory size to be specified on the command line, for example, "--memory 768", --memory 800M", or "--memory 2G".
--- tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh | 4 ++-- tools/testing/selftests/rcutorture/bin/kvm.sh | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-)
tools/testing/selftests/rcutorture/bin/kvm-test-1-run.sh +2 -2
@@ -177,8 +177,8 @@ then exit 0 fi echo "NOTE: $QEMU either did not run or was interactive" > $resdir/console.log -echo $QEMU $qemu_args -m 512 -kernel $KERNEL -append \"$qemu_append $boot_args\" > $resdir/qemu-cmd -( $QEMU $qemu_args -m 512 -kernel $KERNEL -append "$qemu_append $boot_args"& echo $! > $resdir/qemu_pid; wait `cat $resdir/qemu_pid`; echo $? > $resdir/qemu-retval ) & +echo $QEMU $qemu_args -m $TORTURE_QEMU_MEM -kernel $KERNEL -append \"$qemu_append $boot_args\" > $resdir/qemu-cmd +( $QEMU $qemu_args -m $TORTURE_QEMU_MEM -kernel $KERNEL -append "$qemu_append $boot_args"& echo $! > $resdir/qemu_pid; wait `cat $resdir/qemu_pid`; echo $? > $resdir/qemu-retval ) & commandcompleted=0 sleep 10 # Give qemu's pid a chance to reach the file if test -s "$resdir/qemu_pid"
tools/testing/selftests/rcutorture/bin/kvm.sh +8 -0
@@ -42,6 +42,7 @@ TORTURE_BOOT_IMAGE="" TORTURE_INITRD="$KVM/initrd"; export TORTURE_INITRD TORTURE_KCONFIG_ARG="" TORTURE_KMAKE_ARG="" +TORTURE_QEMU_MEM=512 TORTURE_SHUTDOWN_GRACE=180 TORTURE_SUITE=rcu resdir=""
@@ -68,6 +69,7 @@ usage () { echo " --kconfig Kconfig-options" echo " --kmake-arg kernel-make-arguments" echo " --mac nn:nn:nn:nn:nn:nn" + echo " --memory megabytes | nnnG" echo " --no-initrd" echo " --qemu-args qemu-arguments" echo " --qemu-cmd qemu-system-..."
@@ -145,6 +147,11 @@ do TORTURE_QEMU_MAC=$2 shift ;; + --memory) + checkarg --memory "(memory size)" $# "$2" '^[0-9]\+[MG]\?$' error + TORTURE_QEMU_MEM=$2 + shift + ;; --no-initrd) TORTURE_INITRD=""; export TORTURE_INITRD ;;
@@ -286,6 +293,7 @@ TORTURE_KMAKE_ARG="$TORTURE_KMAKE_ARG"; export TORTURE_KMAKE_ARG TORTURE_QEMU_CMD="$TORTURE_QEMU_CMD"; export TORTURE_QEMU_CMD TORTURE_QEMU_INTERACTIVE="$TORTURE_QEMU_INTERACTIVE"; export TORTURE_QEMU_INTERACTIVE TORTURE_QEMU_MAC="$TORTURE_QEMU_MAC"; export TORTURE_QEMU_MAC +TORTURE_QEMU_MEM="$TORTURE_QEMU_MEM"; export TORTURE_QEMU_MEM TORTURE_SHUTDOWN_GRACE="$TORTURE_SHUTDOWN_GRACE"; export TORTURE_SHUTDOWN_GRACE TORTURE_SUITE="$TORTURE_SUITE"; export TORTURE_SUITE if ! test -e $resdir
Signature · 1 line
2.5.2
PATCH 9/12 torture: Default jitter off when running rcuperf
In reply to Paul E. McKenneyThe purpose of jitter is to expose concurrency bugs due to invalid assumptions about forward progress. There is usually little point in jitter when measuring performance. This commit therefore defaults jitter off when running rcuperf. You can override this by specifying the kvm.sh "--jitter" argument -after- the "--torture rcuperf" argument. No idea why you would want this, but if you do, that is how you do it.
One example of a conccurrency bug that this jitter might expose is one in which the developer assumed that a given short region of code would be guaranteed to execute within some short time limit. Such assumptions are invalid in virtualized environments because the hupervisor can preempt the guest OS at any point, even when the guest OS thinks that it has disabled interrupts.
--- tools/testing/selftests/rcutorture/bin/kvm.sh | 6 ++++++ 1 file changed, 6 insertions(+)
tools/testing/selftests/rcutorture/bin/kvm.sh +6 -0
@@ -179,6 +179,12 @@ do checkarg --torture "(suite name)" "$#" "$2" '^\(lock\|rcu\|rcuperf\)$' '^--' TORTURE_SUITE=$2 shift + if test "$TORTURE_SUITE" = rcuperf + then + # If you really want jitter for rcuperf, specify + # it after specifying rcuperf. (But why?) + jitter=0 + fi ;; *) echo Unknown argument $1
Signature · 1 line
2.5.2
PATCH 10/12 torture: Adjust rcuperf trace processing to allow for workqueues
In reply to Paul E. McKenneyThe rcuperf event-trace processing assumes that expedited grace periods start and end on the same task, an assumption that was violated by moving expedited grace-period processing to workqueues. This commit removes this now-fallacious assumption from rcuperf's event-trace processing.
--- .../selftests/rcutorture/bin/kvm-recheck-rcuperf-ftrace.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf-ftrace.sh +4 -4
@@ -39,7 +39,7 @@ sed -e 's/us : / : /' | tr -d '\015' | awk ' $8 == "start" { - if (starttask != "") + if (startseq != "") nlost++; starttask = $1; starttime = $3;
@@ -47,17 +47,17 @@ $8 == "start" { } $8 == "end" { - if (starttask == $1 && startseq == $7) { + if (startseq == $7) { curgpdur = $3 - starttime; gptimes[++n] = curgpdur; gptaskcnt[starttask]++; sum += curgpdur; if (curgpdur > 1000) print "Long GP " starttime "us to " $3 "us (" curgpdur "us)"; - starttask = ""; + startseq = ""; } else { # Lost a message or some such, reset. - starttask = ""; + startseq = ""; nlost++; } }
Signature · 1 line
2.5.2
PATCH 11/12 torture: Grace periods do not piggyback off of themselves
In reply to Paul E. McKenneyThe rcuperf trace-event processing counted every "done" trace event as a piggyback, which is incorrect because the task that started the grace period didn't piggyback at all. This commit fixes this problem by recording the task that started a given grace period and ignoring that task's "done" record for that grace period.
--- tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf-ftrace.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/rcutorture/bin/kvm-recheck-rcuperf-ftrace.sh +2 -1
@@ -44,6 +44,7 @@ $8 == "start" { starttask = $1; starttime = $3; startseq = $7; + seqtask[startseq] = starttask; } $8 == "end" {
@@ -62,7 +63,7 @@ $8 == "end" { } } -$8 == "done" { +$8 == "done" && seqtask[$7] != $1 { piggybackcnt[$1]++; }
Signature · 1 line
2.5.2
PATCH 12/12 torture: Provide more sensible nreader/nwriter defaults for rcuperf
In reply to Paul E. McKenneyThe default values for nreader and nwriter are apparently not all that user-friendly, resulting in people doing scalability tests that ran all runs at large scale. This commit therefore makes both the nreaders and nwriters module default to the number of CPUs, and adds a comment to rcuperf.c stating that the number of CPUs should be specified using the nr_cpus kernel boot parameter. This commit also eliminates the redundant rcuperf scripting specification of default values for these parameters.
--- kernel/rcu/rcuperf.c | 21 ++++++++++++++++++- .../rcutorture/configs/rcuperf/ver_functions.sh | 24 +--------------------- 2 files changed, 21 insertions(+), 24 deletions(-)
kernel/rcu/rcuperf.c +20 -1
@@ -61,11 +61,30 @@ MODULE_AUTHOR("Paul E. McKenney <[email protected]>");#define VERBOSE_PERFOUT_ERRSTRING (s) \ do { if (verbose) pr_alert("%s" PERF_FLAG "!!! %s\n", perf_type, s); } while (0) +/* +* The intended use cases for the nreaders and nwriters module parameters +* are as follows: +* +* 1. Specify only the nr_cpus kernel boot parameter. This will +* set both nreaders and nwriters to the value specified by +* nr_cpus for a mixed reader/writer test. +* +* 2. Specify the nr_cpus kernel boot parameter, but set +* rcuperf.nreaders to zero. This will set nwriters to the +* value specified by nr_cpus for an update-only test. +* +* 3. Specify the nr_cpus kernel boot parameter, but set +* rcuperf.nwriters to zero. This will set nreaders to the +* value specified by nr_cpus for a read-only test. +* +* Various other use cases may of course be specified. +*/ +torture_param (bool, gp_async, false,"Use asynchronous GP wait primitives" );torture_param (int, gp_async_max,1000 ,"Max # outstanding waits per reader" );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, nreaders,0 ,"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 (bool, shutdown, !IS_ENABLED (MODULE ),"Shutdown at end of performance tests." );
tools/testing/selftests/rcutorture/configs/rcuperf/ver_functions.sh +1 -23
@@ -20,32 +20,10 @@ # # Authors: Paul E. McKenney <[email protected]> -# rcuperf_param_nreaders bootparam-string -# -# Adds nreaders rcuperf module parameter if not already specified. -rcuperf_param_nreaders () { - if ! echo "$1" | grep -q "rcuperf.nreaders" - then - echo rcuperf.nreaders=-1 - fi -} - -# rcuperf_param_nwriters bootparam-string -# -# Adds nwriters rcuperf module parameter if not already specified. -rcuperf_param_nwriters () { - if ! echo "$1" | grep -q "rcuperf.nwriters" - then - echo rcuperf.nwriters=-1 - fi -} - # per_version_boot_params bootparam-string config-file seconds # # Adds per-version torture-module parameters to kernels supporting them. per_version_boot_params () { - echo $1 `rcuperf_param_nreaders "$1"` \ - `rcuperf_param_nwriters "$1"` \ - rcuperf.shutdown=1 \ + echo $1 rcuperf.shutdown=1 \ rcuperf.verbose=1 }
Signature · 1 line
2.5.2