Torture-test updates for v7.2
Subsystems (4)
Paul E. McKenney
maintainercover Torture-test updates for v7.2
Hello!
This series contains torture-test updates for v7.2:
1. Fully test lazy RCU.
2. Add torture_sched_set_normal() for user-specified nice values.
3. Improve kvm-series.sh header comment.
4. Allow "norm" abbreviation for "normal".
Thanx, Paul
------------------------------------------------------------------------
b/include/linux/torture.h | 1 b/kernel/rcu/rcu.h | 7 b/kernel/rcu/rcutorture.c | 21 +- b/kernel/rcu/tree_plugin.h | 32 +++ b/kernel/torture.c | 16 + b/tools/testing/selftests/rcutorture/bin/kvm-series.sh | 11 - b/tools/testing/selftests/rcutorture/bin/torture.sh | 2 kernel/rcu/rcutorture.c | 160 +++++++++-------- 8 files changed, 168 insertions(+), 82 deletions(-)
Paul E. McKenney
maintainerPATCH 1/6 rcutorture: Fully test lazy RCU
Currently, rcutorture bypasses lazy RCU by using call_rcu_hurry(). This works, avoiding the dreaded rtort_pipe_count WARN(), but fails to fully test lazy RCU. The rtort_pipe_count WARN() splats because lazy RCU could delay the start of an RCU grace period for a full stutter period, which defaults to only three seconds.
This commit therefore reverts the call_rcu_hurry() instances back to call_rcu(), but, in kernels built with CONFIG_RCU_LAZY=y, queues a workqueue handler just before the call to stutter_wait() in rcu_torture_writer(). This workqueue handler invokes rcu_barrier(), which motivates any lingering lazy callbacks, thus avoiding the splat.
Questions for review:
1. Should we avoid queueing work for RCU implementations not
supporting lazy callbacks?
2. Should we avoid queueing work in kernels built with
CONFIG_RCU_LAZY=y, but that were not booted with the rcutree.enable_rcu_lazy kernel boot parameter set? (Note that this requires some ugliness to access this parameter, and must also handle Tiny RCU.)
3. Does the rcu_torture_ops structure need a ->call_hurry() field,
and if so, why? If not, why not?
4. Your additional questions here!
--- kernel/rcu/rcutorture.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-)
kernel/rcu/rcutorture.c +18 -3
@@ -572,7 +572,7 @@ static unsigned long rcu_no_completed(void)static void rcu_torture_deferred_free (struct rcu_torture *p) { -call_rcu_hurry (&p->rtort_rcu, rcu_torture_cb); +call_rcu (&p->rtort_rcu, rcu_torture_cb); }static void rcu_sync_torture_init (void )
@@ -619,7 +619,7 @@ static struct rcu_torture_ops rcu_ops = { .poll_gp_state_exp = poll_state_synchronize_rcu, .cond_sync_exp = cond_synchronize_rcu_expedited, .cond_sync_exp_full = cond_synchronize_rcu_expedited_full, - .call = call_rcu_hurry, + .call = call_rcu, .cb_barrier = rcu_barrier, .fqs = rcu_force_quiescent_state, .gp_kthread_dbg = show_rcu_gp_kthreads,
@@ -1145,7 +1145,7 @@ static void rcu_tasks_torture_deferred_free(struct rcu_torture *p)static void synchronize_rcu_mult_test (void ) { -synchronize_rcu_mult (call_rcu_tasks, call_rcu_hurry); +synchronize_rcu_mult (call_rcu_tasks, call_rcu); }static struct rcu_torture_ops tasks_ops = {
@@ -1631,6 +1631,17 @@ static void do_rtws_sync(struct torture_random_state *trsp, void (*sync)(void))cpus_read_unlock (); } +/* +* Do an rcu_barrier() to motivate lazy callbacks during a stutter +* pause. Without this, we can get false-positives rtort_pipe_count +* splats. +*/ +static void rcu_torture_writer_work (struct work_struct *work) +{ +if (cur_ops->cb_barrier) + cur_ops->cb_barrier (); +} +/* * RCU torture writer kthread. Repeatedly substitutes a new structure * for that pointed to by rcu_torture_current, freeing the old structure
@@ -1651,6 +1662,7 @@ rcu_torture_writer(void *arg)int i;int idx;unsigned long j; +struct work_struct lazy_work;int oldnice =task_nice (current);struct rcu_gp_oldstate *rgo =NULL ;int rgo_size =0 ;
@@ -1667,6 +1679,7 @@ rcu_torture_writer(void *arg) stallsdone += (stall_cpu_holdoff + stall_gp_kthread + stall_cpu +60 ) *HZ * (stall_cpu_repeat +1 );VERBOSE_TOROUT_STRING ("rcu_torture_writer task started" ); +INIT_WORK_ONSTACK (&lazy_work, rcu_torture_writer_work);if (!can_expedite) pr_alert("%s" TORTURE_FLAG " GP expediting controlled from boot/sysfs for %s.\n",
@@ -1895,6 +1908,8 @@ rcu_torture_writer(void *arg) !rcu_gp_is_normal (); } rcu_torture_writer_state =RTWS_STUTTER ; +if (IS_ENABLED (CONFIG_RCU_LAZY )) +queue_work (system_percpu_wq, &lazy_work); stutter_waited =stutter_wait ("rcu_torture_writer" ); if (stutter_waited && !atomic_read(&rcu_fwd_cb_nodelay) &&
Signature · 1 line
2.40.1
Paul E. McKenney
maintainerPATCH 2/6 torture: Add torture_sched_set_normal() for user-specified nice values
In reply to Paul E. McKenneyThis new torture_sched_set_normal() function clamps the nice value at the MIN_NICE..MAX_NICE limits, splatting it these limits are exceeded. It then invokes sched_set_normal() to set the new value. This prevents more difficult-to-debug failures within the scheduler.
--- include/linux/torture.h | 1 + kernel/torture.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+)
include/linux/torture.h +1 -0
@@ -129,6 +129,7 @@ void _torture_stop_kthread(char *m, struct task_struct **tp);#else #define torture_preempt_schedule () do { } while (0)#endif +void torture_sched_set_normal (struct task_struct *t,int nice);#if IS_ENABLED (CONFIG_RCU_TORTURE_TEST ) ||IS_ENABLED (CONFIG_LOCK_TORTURE_TEST ) ||IS_ENABLED (CONFIG_HAZPTR_TORTURE_TEST )long torture_sched_setaffinity (pid_t pid,const struct cpumask *in_mask,bool dowarn);
kernel/torture.c +16 -0
@@ -972,3 +972,19 @@ void _torture_stop_kthread(char *m, struct task_struct **tp) *tp =NULL ; }EXPORT_SYMBOL_GPL (_torture_stop_kthread); + +/* +* Set the specified task's niceness value, saturating at limits. +* Saturating noisily, but saturating. +*/ +void torture_sched_set_normal (struct task_struct *t,int nice) +{ +int realnice = nice; + +if (WARN_ON_ONCE (realnice >MAX_NICE )) + realnice =MAX_NICE ; +if (WARN_ON_ONCE (realnice <MIN_NICE )) + realnice =MIN_NICE ; +sched_set_normal (t, realnice); +} +EXPORT_SYMBOL_GPL (torture_sched_set_normal);
Signature · 1 line
2.40.1
Paul E. McKenney
maintainerPATCH 3/6 torture: Improve kvm-series.sh header comment
In reply to Paul E. McKenneyThe constraints on the arguments to kvm-series.sh are easy to forget, so this commit adds examples in the header comment.
--- tools/testing/selftests/rcutorture/bin/kvm-series.sh | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
tools/testing/selftests/rcutorture/bin/kvm-series.sh +6 -5
@@ -1,12 +1,13 @@ #!/bin/bash # SPDX-License-Identifier: GPL-2.0+ # -# Usage: kvm-series.sh config-list commit-id-list [ kvm.sh parameters ] +# Usage: kvm-series.sh config-list commit-id-range [ kvm.sh parameters ] # -# Tests the specified list of unadorned configs ("TREE01 SRCU-P" but not -# "CFLIST" or "3*TRACE01") and an indication of a set of commits to test, -# then runs each commit through the specified list of commits using kvm.sh. -# The runs are grouped into a -series/config/commit directory tree. +# Tests the specified list of unadorned configs ("TREE01 SRCU-P" but +# not "CFLIST" or "3*TRACE01") and an indication of a range of commits +# ("v7.0-rc1..rcu/dev", but not "cd0ce7bab0408 ff74db28df623 17c52d7b31a1f") +# to test, then runs each commit through the specified list of commits using +# kvm.sh. The runs are grouped into a -series/config/commit directory tree. # Each run defaults to a duration of one minute. # # Run in top-level Linux source directory. Please note that this is in
Signature · 1 line
2.40.1
Paul E. McKenney
maintainerPATCH 4/6 torture: Allow "norm" abbreviation for "normal"
In reply to Paul E. McKenneyThis adds "--do-norm", --do-no-norm", and "--no-norm" synonyms for the "--do-normal" group of torture.sh command-line arguments.
--- tools/testing/selftests/rcutorture/bin/torture.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/rcutorture/bin/torture.sh +1 -1
@@ -184,7 +184,7 @@ do do_clocksourcewd=no do_srcu_lockdep=no ;; - --do-normal|--do-no-normal|--no-normal) + --do-normal|--do-norm|--do-no-normal|--do-no-norm|--no-normal|--no-norm) do_normal=`doyesno "$1" --do-normal` explicit_normal=yes ;;
Signature · 1 line
2.40.1
Uladzislau Rezki
maintainerQuoted 16 lines · Paul E. McKenney
Hello!
This series contains torture-test updates for v7.2:
1. Fully test lazy RCU.
2. Add
torture_sched_set_normal()for user-specified nice values.3. Improve
kvm-series.shheader comment.4. Allow "norm" abbreviation for "normal".
Thanx, Paul
------------------------------------------------------------------------
Quoted 10 lines
b/include/linux/torture.h | 1 b/kernel/rcu/rcu.h | 7 b/kernel/rcu/rcutorture.c | 21 +- b/kernel/rcu/tree_plugin.h | 32 +++ b/kernel/torture.c | 16 + b/tools/testing/selftests/rcutorture/bin/kvm-series.sh | 11 - b/tools/testing/selftests/rcutorture/bin/torture.sh | 2 kernel/rcu/rcutorture.c | 160 +++++++++-------- 8 files changed, 168 insertions(+), 82 deletions(-)
This i took.
--
Uladzislau Rezki