RCU/lock torture updates for v6.7
Subsystems (6)
Frederic Weisbecker
maintainercover RCU/lock torture updates for v6.7
Hello,
Please find below the updates for RCU torture, locktorture and the generic torture infrastructure.
Arnd Bergmann (1):
rcu: Include torture_sched_setaffinity() declaration
Dan Carpenter (1):
locktorture: Check the correct variable for allocation failure
Joel Fernandes (Google) (3):
rcutorture: Fix stuttering races and other issues
rcutorture: Copy out ftrace into its own console file
rcutorture: Replace schedule_timeout*() 1-jiffy waits with HZ/20
Paul E. McKenney (17):
torture: Share torture_random_state with torture_shuffle_tasks()
torture: Make kvm-recheck.sh use mktemp
torture: Make torture_hrtimeout_ns() take an hrtimer mode parameter
torture: Move rcutorture_sched_setaffinity() out of rcutorture
locktorture: Add readers_bind and writers_bind module parameters
rcutorture: Add CONFIG_DEBUG_OBJECTS to RCU Tasks testing
locktorture: Alphabetize torture_param() entries
locktorture: Consolidate "if" statements in lock_torture_writer()
locktorture: Add acq_writer_lim to complain about long acquistion
times
torture: Print out torture module parameters
torture: Make torture.sh refscale testing qualify verbose_batched
locktorture: Add new module parameters to
lock_torture_print_module_parms()
locktorture: Add call_rcu_chains module parameter
doc: Catch-up update for locktorture module parameters
locktorture: Rename readers_bind/writers_bind to
bind_readers/bind_writers
torture: Add kvm.sh --debug-info argument
torture: Convert parse-console.sh to mktemp
Zqiang (1):
rcutorture: Traverse possible cpu to set maxcpu in rcu_nocb_toggle()
Thanks,
Frederic.
.../admin-guide/kernel-parameters.txt | 57 ++++- include/linux/torture.h | 8 +- kernel/locking/locktorture.c | 216 +++++++++++++----- kernel/rcu/rcu.h | 4 - kernel/rcu/rcutorture.c | 16 +- kernel/rcu/update.c | 9 +- kernel/torture.c | 75 +++--- .../selftests/rcutorture/bin/functions.sh | 29 +++ .../selftests/rcutorture/bin/kvm-recheck.sh | 2 +- tools/testing/selftests/rcutorture/bin/kvm.sh | 17 +- .../selftests/rcutorture/bin/parse-console.sh | 9 +- .../selftests/rcutorture/bin/torture.sh | 2 +- .../selftests/rcutorture/configs/rcu/TRACE02 | 1 + 13 files changed, 322 insertions(+), 123 deletions(-) mode change 100644 => 100755 tools/testing/selftests/rcutorture/bin/functions.sh
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 1/23 torture: Share torture_random_state with torture_shuffle_tasks()
From: "Paul E. McKenney" <[email protected]>
Both torture_shuffle_tasks() and its caller torture_shuffle() define a torture_random_state structure. This is suboptimal given that torture_shuffle_tasks() runs for a very short period of time. This commit therefore causes torture_shuffle() to pass a pointer to its torture_random_state structure down to torture_shuffle_tasks().
--- kernel/torture.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
kernel/torture.c +4 -5
@@ -520,9 +520,8 @@ static void torture_shuffle_task_unregister_all(void)* A special case is when shuffle_idle_cpu = -1, in which case we allow * the tasks to run on all CPUs. */ -static void torture_shuffle_tasks (void ) +static void torture_shuffle_tasks (struct torture_random_state *trp) { -DEFINE_TORTURE_RANDOM (rand);struct shuffle_task *stp;cpumask_setall (shuffle_tmp_mask);
@@ -543,7 +542,7 @@ static void torture_shuffle_tasks(void)mutex_lock (&shuffle_task_mutex);list_for_each_entry (stp, &shuffle_task_list, st_l) { -if (!random_shuffle ||torture_random (&rand) &0x1 ) +if (!random_shuffle ||torture_random (trp) &0x1 )set_cpus_allowed_ptr (stp->st_t, shuffle_tmp_mask); }mutex_unlock (&shuffle_task_mutex);
@@ -562,7 +561,7 @@ static int torture_shuffle(void *arg)VERBOSE_TOROUT_STRING ("torture_shuffle task started" );do {torture_hrtimeout_jiffies (shuffle_interval, &rand); -torture_shuffle_tasks (); +torture_shuffle_tasks (&rand);torture_shutdown_absorb ("torture_shuffle" ); }while (!torture_must_stop ());torture_kthread_stopping ("torture_shuffle" );
@@ -673,7 +672,7 @@ int torture_shutdown_init(int ssecs, void (*cleanup)(void))if (ssecs >0 ) { shutdown_time =ktime_add (ktime_get (),ktime_set (ssecs,0 ));return torture_create_kthread (torture_shutdown,NULL , - shutdown_task); + shutdown_task); }return 0 ; }
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 2/23 torture: Make kvm-recheck.sh use mktemp
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
This commit switches from the old "/tmp/kvm-recheck.sh.$$" approach to the newer and now reliable "mktemp" approach.
--- tools/testing/selftests/rcutorture/bin/kvm-recheck.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/rcutorture/bin/kvm-recheck.sh +1 -1
@@ -13,7 +13,7 @@ # # Authors: Paul E. McKenney <[email protected]> -T=/tmp/kvm-recheck.sh.$$ +T="`mktemp ${TMPDIR-/tmp}/kvm-recheck.sh.XXXXXX`" trap 'rm -f $T' 0 2 configerrors=0
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 3/23 torture: Make torture_hrtimeout_ns() take an hrtimer mode parameter
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
The current torture-test sleeps are waiting for a duration, but there are situations where it is better to wait for an absolute time, for example, when ending a stutter interval. This commit therefore adds an hrtimer mode parameter to torture_hrtimeout_ns(). Why not also the other torture_hrtimeout_*() functions? The theory is that most absolute times will be in nanoseconds, especially not (say) jiffies.
--- include/linux/torture.h | 3 ++- kernel/torture.c | 13 +++++++------ 2 files changed, 9 insertions(+), 7 deletions(-)
include/linux/torture.h +2 -1
@@ -81,7 +81,8 @@ static inline void torture_random_init(struct torture_random_state *trsp) }/* Definitions for high-resolution-timer sleeps. */ -int torture_hrtimeout_ns (ktime_t baset_ns,u32 fuzzt_ns,struct torture_random_state *trsp); +int torture_hrtimeout_ns (ktime_t baset_ns,u32 fuzzt_ns,const enum hrtimer_mode mode, +struct torture_random_state *trsp);int torture_hrtimeout_us (u32 baset_us,u32 fuzzt_ns,struct torture_random_state *trsp);int torture_hrtimeout_ms (u32 baset_ms,u32 fuzzt_us,struct torture_random_state *trsp);int torture_hrtimeout_jiffies (u32 baset_j,struct torture_random_state *trsp);
kernel/torture.c +7 -6
@@ -87,14 +87,15 @@ EXPORT_SYMBOL_GPL(verbose_torout_sleep);* nanosecond random fuzz. This function and its friends desynchronize * testing from the timer wheel. */ -int torture_hrtimeout_ns (ktime_t baset_ns,u32 fuzzt_ns,struct torture_random_state *trsp) +int torture_hrtimeout_ns (ktime_t baset_ns,u32 fuzzt_ns,const enum hrtimer_mode mode, +struct torture_random_state *trsp) {ktime_t hto = baset_ns;if (trsp) hto +=torture_random (trsp) % fuzzt_ns;set_current_state (TASK_IDLE ); -return schedule_hrtimeout (&hto,HRTIMER_MODE_REL ); +return schedule_hrtimeout (&hto, mode); }EXPORT_SYMBOL_GPL (torture_hrtimeout_ns);
@@ -106,7 +107,7 @@ int torture_hrtimeout_us(u32 baset_us, u32 fuzzt_ns, struct torture_random_state {ktime_t baset_ns = baset_us *NSEC_PER_USEC ; -return torture_hrtimeout_ns (baset_ns, fuzzt_ns, trsp); +return torture_hrtimeout_ns (baset_ns, fuzzt_ns,HRTIMER_MODE_REL , trsp); }EXPORT_SYMBOL_GPL (torture_hrtimeout_us);
@@ -123,7 +124,7 @@ int torture_hrtimeout_ms(u32 baset_ms, u32 fuzzt_us, struct torture_random_state fuzzt_ns = (u32 )~0U ; else fuzzt_ns = fuzzt_us *NSEC_PER_USEC ; -return torture_hrtimeout_ns (baset_ns, fuzzt_ns, trsp); +return torture_hrtimeout_ns (baset_ns, fuzzt_ns,HRTIMER_MODE_REL , trsp); }EXPORT_SYMBOL_GPL (torture_hrtimeout_ms);
@@ -136,7 +137,7 @@ int torture_hrtimeout_jiffies(u32 baset_j, struct torture_random_state *trsp) {ktime_t baset_ns =jiffies_to_nsecs (baset_j); -return torture_hrtimeout_ns (baset_ns,jiffies_to_nsecs (1 ), trsp); +return torture_hrtimeout_ns (baset_ns,jiffies_to_nsecs (1 ),HRTIMER_MODE_REL , trsp); }EXPORT_SYMBOL_GPL (torture_hrtimeout_jiffies);
@@ -153,7 +154,7 @@ int torture_hrtimeout_s(u32 baset_s, u32 fuzzt_ms, struct torture_random_state * fuzzt_ns = (u32 )~0U ; else fuzzt_ns = fuzzt_ms *NSEC_PER_MSEC ; -return torture_hrtimeout_ns (baset_ns, fuzzt_ns, trsp); +return torture_hrtimeout_ns (baset_ns, fuzzt_ns,HRTIMER_MODE_REL , trsp); }EXPORT_SYMBOL_GPL (torture_hrtimeout_s);
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 4/23 rcu: Include torture_sched_setaffinity() declaration
In reply to Frederic WeisbeckerFrom: Arnd Bergmann <[email protected]>
The prototype for torture_sched_setaffinity() will be moved to a different header, which will need to be included from update.c to avoid this W=1 warning:
kernel/rcu/update.c:529:6: error: no previous prototype for 'torture_sched_setaffinity' [-Werror=missing-prototypes]
529 | long torture_sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
--- kernel/rcu/update.c | 1 + 1 file changed, 1 insertion(+)
kernel/rcu/update.c +1 -0
@@ -25,6 +25,7 @@#include <linux/interrupt.h> #include <linux/sched/signal.h> #include <linux/sched/debug.h> +#include <linux/torture.h> #include <linux/atomic.h> #include <linux/bitops.h> #include <linux/percpu.h>
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 5/23 torture: Move rcutorture_sched_setaffinity() out of rcutorture
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
The rcutorture_sched_setaffinity() function is needed by locktorture, so move its declaration from rcu.h to torture.h and rename it to the more generic torture_sched_setaffinity() name.
Please note that use of this function is still restricted to torture tests, and of those, currently only rcutorture and locktorture.
--- include/linux/torture.h | 5 +++++ kernel/rcu/rcu.h | 4 ---- kernel/rcu/rcutorture.c | 2 +- kernel/rcu/update.c | 8 ++++---- 4 files changed, 10 insertions(+), 9 deletions(-)
include/linux/torture.h +5 -0
@@ -121,10 +121,15 @@ void _torture_stop_kthread(char *m, struct task_struct **tp);#define torture_stop_kthread (n, tp) \ _torture_stop_kthread("Stopping " #n " task", &(tp)) +/* Scheduler-related definitions. */ #ifdef CONFIG_PREEMPTION #define torture_preempt_schedule () __preempt_schedule()#else #define torture_preempt_schedule () do { } while (0)#endif +#if IS_ENABLED (CONFIG_RCU_TORTURE_TEST ) ||IS_MODULE (CONFIG_RCU_TORTURE_TEST ) ||IS_ENABLED (CONFIG_LOCK_TORTURE_TEST ) ||IS_MODULE (CONFIG_LOCK_TORTURE_TEST ) +long torture_sched_setaffinity (pid_t pid,const struct cpumask *in_mask); +#endif +#endif /* __LINUX_TORTURE_H */
kernel/rcu/rcu.h +0 -4
@@ -568,10 +568,6 @@ void do_trace_rcu_torture_read(const char *rcutorturename,static inline void rcu_gp_set_torture_wait (int duration) { }#endif -#if IS_ENABLED (CONFIG_RCU_TORTURE_TEST ) ||IS_MODULE (CONFIG_RCU_TORTURE_TEST ) -long rcutorture_sched_setaffinity (pid_t pid,const struct cpumask *in_mask); -#endif -#ifdef CONFIG_TINY_SRCU static inline void srcutorture_get_gp_data(enum rcutorture_type test_type,
kernel/rcu/rcutorture.c +1 -1
@@ -810,7 +810,7 @@ static void synchronize_rcu_trivial(void)int cpu;for_each_online_cpu (cpu) { -rcutorture_sched_setaffinity (current->pid,cpumask_of (cpu)); +torture_sched_setaffinity (current->pid,cpumask_of (cpu));WARN_ON_ONCE (raw_smp_processor_id () != cpu); } }
kernel/rcu/update.c +4 -4
@@ -525,17 +525,17 @@ EXPORT_SYMBOL_GPL(do_trace_rcu_torture_read); do { } while (0)#endif -#if IS_ENABLED (CONFIG_RCU_TORTURE_TEST ) ||IS_MODULE (CONFIG_RCU_TORTURE_TEST ) +#if IS_ENABLED (CONFIG_RCU_TORTURE_TEST ) ||IS_MODULE (CONFIG_RCU_TORTURE_TEST ) ||IS_ENABLED (CONFIG_LOCK_TORTURE_TEST ) ||IS_MODULE (CONFIG_LOCK_TORTURE_TEST )/* Get rcutorture access to sched_setaffinity(). */ -long rcutorture_sched_setaffinity (pid_t pid,const struct cpumask *in_mask) +long torture_sched_setaffinity (pid_t pid,const struct cpumask *in_mask) {int ret; ret =sched_setaffinity (pid, in_mask); -WARN_ONCE (ret,"%s: sched_setaffinity() returned %d\n" , __func__, ret); +WARN_ONCE (ret,"%s: sched_setaffinity(%d) returned %d\n" , __func__, pid, ret);return ret; } -EXPORT_SYMBOL_GPL (rcutorture_sched_setaffinity); +EXPORT_SYMBOL_GPL (torture_sched_setaffinity);#endif #ifdef CONFIG_RCU_STALL_COMMON
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 6/23 locktorture: Add readers_bind and writers_bind module parameters
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
This commit adds readers_bind and writers_bind module parameters to locktorture in order to skew tests across socket boundaries. This skewing is intended to provide additional variable-latency stress on the primitive under test.
--- kernel/locking/locktorture.c | 64 ++++++++++++++++++++++++++++++++++-- 1 file changed, 62 insertions(+), 2 deletions(-)
kernel/locking/locktorture.c +62 -2
@@ -56,6 +56,55 @@ module_param(torture_type, charp, 0444);MODULE_PARM_DESC (torture_type,"Type of lock to torture (spin_lock, spin_lock_irq, mutex_lock, ...)" ); +static cpumask_var_t readers_bind;// Bind the readers to the specified set of CPUs. +static cpumask_var_t writers_bind;// Bind the writers to the specified set of CPUs. + +// Parse a cpumask kernel parameter. If there are more users later on, +// this might need to got to a more central location. +static int param_set_cpumask (const char *val,const struct kernel_param *kp) +{ +cpumask_var_t *cm_bind = kp->arg; +int ret; +char *s; + +if (!alloc_cpumask_var (cm_bind,GFP_KERNEL )) { + s ="Out of memory" ; + ret = -ENOMEM ; + goto out_err; + } + ret =cpulist_parse (val, *cm_bind); +if (!ret) +return ret; + s ="Bad CPU range" ; +out_err: +pr_warn ("%s: %s, all CPUs set\n" , kp->name, s); +cpumask_setall (*cm_bind); +return ret; +} + +// Output a cpumask kernel parameter. +static int param_get_cpumask (char *buffer,const struct kernel_param *kp) +{ +cpumask_var_t *cm_bind = kp->arg; + +return sprintf (buffer,"%*pbl" ,cpumask_pr_args (*cm_bind)); +} + +static bool cpumask_nonempty (cpumask_var_t mask) +{ +return cpumask_available (mask) && !cpumask_empty (mask); +} + +static const struct kernel_param_ops lt_bind_ops = { + .set = param_set_cpumask, + .get = param_get_cpumask, +}; + +module_param_cb (readers_bind, <_bind_ops, &readers_bind,0644 ); +module_param_cb (writers_bind, <_bind_ops, &writers_bind,0644 ); + +long torture_sched_setaffinity (pid_t pid,const struct cpumask *in_mask); +static struct task_struct *stats_task;static struct task_struct **writer_tasks;static struct task_struct **reader_tasks;
@@ -986,16 +1035,23 @@ static int lock_torture_stats(void *arg)return 0 ; } +static inline void lock_torture_print_module_parms (struct lock_torture_ops *cur_ops,const char *tag) { +static cpumask_t cpumask_all; +cpumask_t *rcmp =cpumask_nonempty (readers_bind) ? readers_bind : &cpumask_all; +cpumask_t *wcmp =cpumask_nonempty (writers_bind) ? writers_bind : &cpumask_all; + +cpumask_setall (&cpumask_all);pr_alert ("%s" TORTURE_FLAG -"--- %s%s: nwriters_stress=%d nreaders_stress=%d nested_locks=%d stat_interval=%d verbose=%d shuffle_interval=%d stutter=%d shutdown_secs=%d onoff_interval=%d onoff_holdoff=%d\n" , +"--- %s%s: nwriters_stress=%d nreaders_stress=%d nested_locks=%d stat_interval=%d verbose=%d shuffle_interval=%d stutter=%d shutdown_secs=%d onoff_interval=%d onoff_holdoff=%d readers_bind=%*pbl writers_bind=%*pbl\n" , torture_type, tag, cxt.debug_lock ?" [debug]" :"" , cxt.nrealwriters_stress, cxt.nrealreaders_stress, nested_locks, stat_interval, verbose, shuffle_interval, - stutter, shutdown_secs, onoff_interval, onoff_holdoff); + stutter, shutdown_secs, onoff_interval, onoff_holdoff, +cpumask_pr_args (rcmp),cpumask_pr_args (wcmp)); }static void lock_torture_cleanup (void )
@@ -1250,6 +1306,8 @@ static int __init lock_torture_init(void) writer_fifo ? sched_set_fifo : NULL);if (torture_init_error (firsterr)) goto unwind; +if (cpumask_nonempty (writers_bind)) +torture_sched_setaffinity (writer_tasks[i]->pid, writers_bind); create_reader:if (cxt.cur_ops->readlock ==NULL || (j >= cxt.nrealreaders_stress))
@@ -1259,6 +1317,8 @@ static int __init lock_torture_init(void) reader_tasks[j]);if (torture_init_error (firsterr)) goto unwind; +if (cpumask_nonempty (readers_bind)) +torture_sched_setaffinity (reader_tasks[j]->pid, readers_bind); }if (stat_interval >0 ) { firsterr = torture_create_kthread(lock_torture_stats, NULL,
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 7/23 rcutorture: Add CONFIG_DEBUG_OBJECTS to RCU Tasks testing
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
This commit adds CONFIG_DEBUG_OBJECTS=y to the TRACE02 rcutorture scenario to catch any further RCU Tasks bugs involving this Kconfig option.
--- tools/testing/selftests/rcutorture/configs/rcu/TRACE02 | 1 + 1 file changed, 1 insertion(+)
tools/testing/selftests/rcutorture/configs/rcu/TRACE02 +1 -0
@@ -11,3 +11,4 @@ CONFIG_FORCE_TASKS_TRACE_RCU=y #CHECK#CONFIG_TASKS_TRACE_RCU=y CONFIG_TASKS_TRACE_RCU_READ_MB=n CONFIG_RCU_EXPERT=y +CONFIG_DEBUG_OBJECTS=y
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 8/23 rcutorture: Fix stuttering races and other issues
In reply to Frederic WeisbeckerFrom: "Joel Fernandes (Google)" <[email protected]>
The stuttering code isn't functioning as expected. Ideally, it should pause the torture threads for a designated period before resuming. Yet, it fails to halt the test for the correct duration. Additionally, a race condition exists, potentially causing the stuttering code to pause for an extended period if the 'spt' variable is non-zero due to the stutter orchestration thread's inadequate CPU time.
Moreover, over-stuttering can hinder RCU's progress on TREE07 kernels. This happens as the stuttering code may run within a softirq due to RCU callbacks. Consequently, ksoftirqd keeps a CPU busy for several seconds, thus obstructing RCU's progress. This situation triggers a warning message in the logs:
[ 2169.481783] rcu_torture_writer: rtort_pipe_count: 9
This warning suggests that an RCU torture object, although invisible to RCU readers, couldn't make it past the pipe array and be freed -- a strong indication that there weren't enough grace periods during the stutter interval.
To address these issues, this patch sets the "stutter end" time to an absolute point in the future set by the main stutter thread. This is then used for waiting in stutter_wait(). While the stutter thread still defines this absolute time, the waiters' waiting logic doesn't rely on the stutter thread receiving sufficient CPU time to halt the stuttering as the halting is now self-controlled.
--- kernel/torture.c | 45 ++++++++++++--------------------------------- 1 file changed, 12 insertions(+), 33 deletions(-)
kernel/torture.c +12 -33
@@ -720,7 +720,7 @@ static void torture_shutdown_cleanup(void)* suddenly applied to or removed from the system. */ static struct task_struct *stutter_task; -static int stutter_pause_test; +static ktime_t stutter_till_abs_time;static int stutter;static int stutter_gap;
@@ -730,30 +730,16 @@ static int stutter_gap;*/ bool stutter_wait (const char *title) { -unsigned int i =0 ;bool ret = false; -int spt; +ktime_t till_ns;cond_resched_tasks_rcu_qs (); - spt =READ_ONCE (stutter_pause_test); -for (; spt; spt =READ_ONCE (stutter_pause_test)) { -if (!ret && !rt_task (current)) { -sched_set_normal (current,MAX_NICE ); - ret = true; - } -if (spt ==1 ) { -torture_hrtimeout_jiffies (1 ,NULL ); - }else if (spt ==2 ) { -while (READ_ONCE (stutter_pause_test)) { -if (!(i++ &0xffff )) -torture_hrtimeout_us (10 ,0 ,NULL ); -cond_resched (); - } - }else { -torture_hrtimeout_jiffies (round_jiffies_relative (HZ ),NULL ); - } -torture_shutdown_absorb (title); + till_ns =READ_ONCE (stutter_till_abs_time); +if (till_ns &&ktime_before (ktime_get (), till_ns)) { +torture_hrtimeout_ns (till_ns,0 ,HRTIMER_MODE_ABS ,NULL ); + ret = true; } +torture_shutdown_absorb (title);return ret; }EXPORT_SYMBOL_GPL (stutter_wait);
@@ -764,23 +750,16 @@ EXPORT_SYMBOL_GPL(stutter_wait);*/ static int torture_stutter (void *arg) { -DEFINE_TORTURE_RANDOM (rand); -int wtime; +ktime_t till_ns;VERBOSE_TOROUT_STRING ("torture_stutter task started" ); do { if (!torture_must_stop() && stutter > 1) { - wtime = stutter; - if (stutter > 2) { - WRITE_ONCE(stutter_pause_test, 1); - wtime = stutter - 3; - torture_hrtimeout_jiffies(wtime, &rand); - wtime = 2; - } - WRITE_ONCE(stutter_pause_test, 2); - torture_hrtimeout_jiffies(wtime, NULL); + till_ns = ktime_add_ns(ktime_get(), + jiffies_to_nsecs(stutter)); + WRITE_ONCE(stutter_till_abs_time, till_ns); + torture_hrtimeout_jiffies(stutter - 1, NULL); } - WRITE_ONCE(stutter_pause_test, 0); if (!torture_must_stop()) torture_hrtimeout_jiffies(stutter_gap, NULL); torture_shutdown_absorb("torture_stutter");
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 9/23 locktorture: Alphabetize torture_param() entries
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
There are getting to be too many module parameters for a random list to be comfortable, so this commit alphabetizes the list. Strictly code motion.
--- kernel/locking/locktorture.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/locking/locktorture.c +6 -6
@@ -33,21 +33,21 @@MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Paul E. McKenney <[email protected]>" ); -torture_param (int, nwriters_stress,-1 ,"Number of write-locking stress-test threads" ); -torture_param (int, nreaders_stress,-1 ,"Number of read-locking stress-test threads" );torture_param (int, long_hold,100 ,"Do occasional long hold of lock (ms), 0=disable" ); +torture_param (int, nested_locks,0 ,"Number of nested locks (max = 8)" ); +torture_param (int, nreaders_stress,-1 ,"Number of read-locking stress-test threads" ); +torture_param (int, nwriters_stress,-1 ,"Number of write-locking stress-test threads" );torture_param (int, onoff_holdoff,0 ,"Time after boot before CPU hotplugs (s)" );torture_param (int, onoff_interval,0 ,"Time between CPU hotplugs (s), 0=disable" ); +torture_param (int, rt_boost,2 , +"Do periodic rt-boost. 0=Disable, 1=Only for rt_mutex, 2=For all lock types." ); +torture_param (int, rt_boost_factor,50 ,"A factor determining how often rt-boost happens." );torture_param (int, shuffle_interval,3 ,"Number of jiffies between shuffles, 0=disable" );torture_param (int, shutdown_secs,0 ,"Shutdown time (j), <= zero to disable." );torture_param (int, stat_interval,60 ,"Number of seconds between stats printk()s" );torture_param (int, stutter,5 ,"Number of jiffies to run/halt test, 0=disable" ); -torture_param (int, rt_boost,2 , -"Do periodic rt-boost. 0=Disable, 1=Only for rt_mutex, 2=For all lock types." ); -torture_param (int, rt_boost_factor,50 ,"A factor determining how often rt-boost happens." );torture_param (int, writer_fifo,0 ,"Run writers at sched_set_fifo() priority" );torture_param (int, verbose,1 ,"Enable verbose debugging printk()s" ); -torture_param (int, nested_locks,0 ,"Number of nested locks (max = 8)" );/* Going much higher trips "BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!" errors */ #define MAX_NESTED_LOCKS 8
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 10/23 locktorture: Consolidate "if" statements in lock_torture_writer()
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
There is a pair of adjacent "if" statements with identical conditions in the lock_torture_writer() function. This commit therefore combines them.
--- kernel/locking/locktorture.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
kernel/locking/locktorture.c +2 -3
@@ -889,11 +889,10 @@ static int lock_torture_writer(void *arg) lock_is_write_held = true;if (WARN_ON_ONCE (atomic_read (&lock_is_read_held))) lwsp->n_lock_fail++;/* rare, but... */ - lwsp->n_lock_acquired++; - } -if (!skip_main_lock) { + cxt.cur_ops->write_delay (&rand); + lock_is_write_held = false;WRITE_ONCE (last_lock_release, jiffies); cxt.cur_ops->writeunlock (tid);
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 11/23 locktorture: Add acq_writer_lim to complain about long acquistion times
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
This commit adds a locktorture.acq_writer_lim module parameter that specifies the maximum number of jiffies that is expected to be consumed by write-side lock acquisition. If this limit is exceeded, a WARN_ONCE() causes a splat. Note that this limit applies to the main lock acquisition only, not to any nested acquisitions.
--- kernel/locking/locktorture.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
kernel/locking/locktorture.c +14 -3
@@ -33,6 +33,7 @@MODULE_LICENSE ("GPL" );MODULE_AUTHOR ("Paul E. McKenney <[email protected]>" ); +torture_param (int, acq_writer_lim,0 ,"Write_acquisition time limit (jiffies)." );torture_param (int, long_hold,100 ,"Do occasional long hold of lock (ms), 0=disable" );torture_param (int, nested_locks,0 ,"Number of nested locks (max = 8)" );torture_param (int, nreaders_stress,-1 ,"Number of read-locking stress-test threads" );
@@ -852,11 +853,13 @@ static struct lock_torture_ops percpu_rwsem_lock_ops = {*/ static int lock_torture_writer (void *arg) { -struct lock_stress_stats *lwsp = arg; -int tid = lwsp - cxt.lwsa; -DEFINE_TORTURE_RANDOM (rand); +unsigned long j; +unsigned long j1;u32 lockset_mask; +struct lock_stress_stats *lwsp = arg; +DEFINE_TORTURE_RANDOM (rand);bool skip_main_lock; +int tid = lwsp - cxt.lwsa;VERBOSE_TOROUT_STRING ("lock_torture_writer task started" );if (!rt_task (current))
@@ -883,12 +886,20 @@ static int lock_torture_writer(void *arg) cxt.cur_ops->nested_lock (tid, lockset_mask);if (!skip_main_lock) { +if (acq_writer_lim >0 ) + j = jiffies; cxt.cur_ops->writelock (tid);if (WARN_ON_ONCE (lock_is_write_held)) lwsp->n_lock_fail++; lock_is_write_held = true;if (WARN_ON_ONCE (atomic_read (&lock_is_read_held))) lwsp->n_lock_fail++;/* rare, but... */ +if (acq_writer_lim >0 ) { + j1 = jiffies; +WARN_ONCE (time_after (j1, j + acq_writer_lim), +"%s: Lock acquisition took %lu jiffies.\n" , + __func__, j1 - j); + } lwsp->n_lock_acquired++; cxt.cur_ops->write_delay (&rand);
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 12/23 rcutorture: Copy out ftrace into its own console file
In reply to Frederic WeisbeckerFrom: "Joel Fernandes (Google)" <[email protected]>
When debugging, it can be difficult to quickly find the ftrace dump within the console log, which in turn makes it difficult to process it independent of the rest of the console output. This commit therefore copies the contents of the buffers into its own file to make it easier to locate and process the ftrace dump. The original ftrace dump is still available in the console log in cases because it can be more convenient to process it in situ, for example, for scripts that process console output as well as ftrace-dump data.
Also handle the case of multiple ftrace dumps potentially showing up in the log. Example for a file like [1], it will extract as [2].
[1]:
foo
foo
Dumping ftrace buffer:
---------------------------------
blah
blah
---------------------------------
more
bar
baz
Dumping ftrace buffer:
---------------------------------
blah2
blah2
---------------------------------
bleh
bleh
[2]:
Ftrace dump 1:
blah
blah
Ftrace dump 2:
blah2
blah2
[ paulmck: Fixed awk indentation, input up front. ]
--- .../selftests/rcutorture/bin/functions.sh | 29 +++++++++++++++++++ .../selftests/rcutorture/bin/parse-console.sh | 7 +++++ 2 files changed, 36 insertions(+) mode change 100644 => 100755 tools/testing/selftests/rcutorture/bin/functions.sh
tools/testing/selftests/rcutorture/bin/functions.sh +29 -0
@@ -331,3 +331,32 @@ specify_qemu_net () { echo $1 -net none fi } + +# Extract the ftrace output from the console log output +# The ftrace output in the original logs look like: +# Dumping ftrace buffer: +# --------------------------------- +# [...] +# --------------------------------- +extract_ftrace_from_console() { + awk < "$1" ' + + /Dumping ftrace buffer:/ { + buffer_count++ + print "Ftrace dump " buffer_count ":" + capture = 1 + next + } + + /---------------------------------/ { + if(capture == 1) { + capture = 2 + next + } else if(capture == 2) { + capture = 0 + print "" + } + } + + capture == 2' +}
tools/testing/selftests/rcutorture/bin/parse-console.sh +7 -0
@@ -182,3 +182,10 @@ if ! test -s $file.diags then rm -f $file.diags fi + +# Call extract_ftrace_from_console function, if the output is empty, +# don't create $file.ftrace. Otherwise output the results to $file.ftrace +extract_ftrace_from_console $file > $file.ftrace +if [ ! -s $file.ftrace ]; then + rm -f $file.ftrace +fi
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 13/23 torture: Print out torture module parameters
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
The kernel/torture.c module now has several module parameters, so this commit causes them to be printed out.
--- kernel/torture.c | 8 ++++++++ 1 file changed, 8 insertions(+)
kernel/torture.c +8 -0
@@ -791,6 +791,13 @@ static void torture_stutter_cleanup(void) stutter_task =NULL ; } +static void +torture_print_module_parms (void ) +{ +pr_alert ("torture module --- %s: disable_onoff_at_boot=%d ftrace_dump_at_shutdown=%d verbose_sleep_frequency=%d verbose_sleep_duration=%d random_shuffle=%d\n" , + torture_type, disable_onoff_at_boot, ftrace_dump_at_shutdown, verbose_sleep_frequency, verbose_sleep_duration, random_shuffle); +} +/* * Initialize torture module. Please note that this is -not- invoked via * the usual module_init() mechanism, but rather by an explicit call from
@@ -813,6 +820,7 @@ bool torture_init_begin(char *ttype, int v) torture_type = ttype; verbose = v; fullstop =FULLSTOP_DONTSTOP ; +torture_print_module_parms ();return true; }EXPORT_SYMBOL_GPL (torture_init_begin);
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 14/23 torture: Make torture.sh refscale testing qualify verbose_batched
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
In torture.sh, the testing of refscale incorrectly used verbose_batched as a kernel boot parameter, which causes this parameter to be passed to the init process. This commit therefore prefixes it with refscale, so that refscale.verbose_batched is passed to the kernel.
--- tools/testing/selftests/rcutorture/bin/torture.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/rcutorture/bin/torture.sh +1 -1
@@ -472,7 +472,7 @@ do if test -n "$firsttime" then torture_bootargs="refscale.scale_type="$prim" refscale.nreaders=$HALF_ALLOTED_CPUS refscale.loops=10000 refscale.holdoff=20 torture.disable_onoff_at_boot" - torture_set "refscale-$prim" tools/testing/selftests/rcutorture/bin/kvm.sh --torture refscale --allcpus --duration 5 --kconfig "CONFIG_TASKS_TRACE_RCU=y CONFIG_NR_CPUS=$HALF_ALLOTED_CPUS" --bootargs "verbose_batched=$VERBOSE_BATCH_CPUS torture.verbose_sleep_frequency=8 torture.verbose_sleep_duration=$VERBOSE_BATCH_CPUS" --trust-make + torture_set "refscale-$prim" tools/testing/selftests/rcutorture/bin/kvm.sh --torture refscale --allcpus --duration 5 --kconfig "CONFIG_TASKS_TRACE_RCU=y CONFIG_NR_CPUS=$HALF_ALLOTED_CPUS" --bootargs "refscale.verbose_batched=$VERBOSE_BATCH_CPUS torture.verbose_sleep_frequency=8 torture.verbose_sleep_duration=$VERBOSE_BATCH_CPUS" --trust-make mv $T/last-resdir-nodebug $T/first-resdir-nodebug || : if test -f "$T/last-resdir-kasan" then
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 15/23 locktorture: Add new module parameters to lock_torture_print_module_parms()
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
This commit adds new module parameters to lock_torture_print_module_parms, and alphabetizes things while in the area. This change makes locktorture test results more useful and self-contained.
--- kernel/locking/locktorture.c | 64 +++++++++++++----------------------- 1 file changed, 23 insertions(+), 41 deletions(-)
kernel/locking/locktorture.c +23 -41
@@ -47,8 +47,8 @@ torture_param(int, shuffle_interval, 3, "Number of jiffies between shuffles, 0=dtorture_param (int, shutdown_secs,0 ,"Shutdown time (j), <= zero to disable." );torture_param (int, stat_interval,60 ,"Number of seconds between stats printk()s" );torture_param (int, stutter,5 ,"Number of jiffies to run/halt test, 0=disable" ); -torture_param (int, writer_fifo,0 ,"Run writers at sched_set_fifo() priority" );torture_param (int, verbose,1 ,"Enable verbose debugging printk()s" ); +torture_param (int, writer_fifo,0 ,"Run writers at sched_set_fifo() priority" );/* Going much higher trips "BUG: MAX_LOCKDEP_CHAIN_HLOCKS too low!" errors */ #define MAX_NESTED_LOCKS 8
@@ -166,12 +166,9 @@ static int torture_lock_busted_write_lock(int tid __maybe_unused)static void torture_lock_busted_write_delay (struct torture_random_state *trsp) { -const unsigned long longdelay_ms = long_hold ? long_hold :ULONG_MAX ; -/* We want a long delay occasionally to force massive contention. */ -if (!(torture_random (trsp) % - (cxt.nrealwriters_stress *2000 * longdelay_ms))) -mdelay (longdelay_ms); +if (long_hold && !(torture_random (trsp) % (cxt.nrealwriters_stress *2000 * long_hold))) +mdelay (long_hold);if (!(torture_random (trsp) % (cxt.nrealwriters_stress *20000 )))torture_preempt_schedule ();/* Allow test to be preempted. */ }
@@ -244,15 +241,14 @@ __acquires(torture_spinlock)static void torture_spin_lock_write_delay (struct torture_random_state *trsp) {const unsigned long shortdelay_us =2 ; -const unsigned long longdelay_ms = long_hold ? long_hold :ULONG_MAX ;unsigned long j;/* We want a short delay mostly to emulate likely code, and * we want a long delay occasionally to force massive contention. */ -if (!(torture_random (trsp) % (cxt.nrealwriters_stress *2000 * longdelay_ms))) { +if (long_hold && !(torture_random (trsp) % (cxt.nrealwriters_stress *2000 * long_hold))) { j = jiffies; -mdelay (longdelay_ms); +mdelay (long_hold);pr_alert ("%s: delay = %lu jiffies.\n" , __func__, jiffies - j); }if (!(torture_random (trsp) % (cxt.nrealwriters_stress *200 * shortdelay_us)))
@@ -370,14 +366,12 @@ __acquires(torture_rwlock)static void torture_rwlock_write_delay (struct torture_random_state *trsp) {const unsigned long shortdelay_us =2 ; -const unsigned long longdelay_ms = long_hold ? long_hold :ULONG_MAX ;/* We want a short delay mostly to emulate likely code, and * we want a long delay occasionally to force massive contention. */ -if (!(torture_random (trsp) % - (cxt.nrealwriters_stress *2000 * longdelay_ms))) -mdelay (longdelay_ms); +if (long_hold && !(torture_random (trsp) % (cxt.nrealwriters_stress *2000 * long_hold))) +mdelay (long_hold);else udelay (shortdelay_us); }
@@ -398,14 +392,12 @@ __acquires(torture_rwlock)static void torture_rwlock_read_delay (struct torture_random_state *trsp) {const unsigned long shortdelay_us =10 ; -const unsigned long longdelay_ms =100 ;/* We want a short delay mostly to emulate likely code, and * we want a long delay occasionally to force massive contention. */ -if (!(torture_random (trsp) % - (cxt.nrealreaders_stress *2000 * longdelay_ms))) -mdelay (longdelay_ms); +if (long_hold && !(torture_random (trsp) % (cxt.nrealreaders_stress *2000 * long_hold))) +mdelay (long_hold);else udelay (shortdelay_us); }
@@ -503,12 +495,9 @@ __acquires(torture_mutex)static void torture_mutex_delay (struct torture_random_state *trsp) { -const unsigned long longdelay_ms = long_hold ? long_hold :ULONG_MAX ; -/* We want a long delay occasionally to force massive contention. */ -if (!(torture_random (trsp) % - (cxt.nrealwriters_stress *2000 * longdelay_ms))) -mdelay (longdelay_ms *5 ); +if (long_hold && !(torture_random (trsp) % (cxt.nrealwriters_stress *2000 * long_hold))) +mdelay (long_hold *5 );if (!(torture_random (trsp) % (cxt.nrealwriters_stress *20000 )))torture_preempt_schedule ();/* Allow test to be preempted. */ }
@@ -676,15 +665,13 @@ __acquires(torture_rtmutex)static void torture_rtmutex_delay (struct torture_random_state *trsp) {const unsigned long shortdelay_us =2 ; -const unsigned long longdelay_ms = long_hold ? long_hold :ULONG_MAX ;/* * We want a short delay mostly to emulate likely code, and * we want a long delay occasionally to force massive contention. */ -if (!(torture_random (trsp) % - (cxt.nrealwriters_stress *2000 * longdelay_ms))) -mdelay (longdelay_ms); +if (long_hold && !(torture_random (trsp) % (cxt.nrealwriters_stress *2000 * long_hold))) +mdelay (long_hold);if (!(torture_random (trsp) % (cxt.nrealwriters_stress *200 * shortdelay_us)))udelay (shortdelay_us);
@@ -741,12 +728,9 @@ __acquires(torture_rwsem)static void torture_rwsem_write_delay (struct torture_random_state *trsp) { -const unsigned long longdelay_ms = long_hold ? long_hold :ULONG_MAX ; -/* We want a long delay occasionally to force massive contention. */ -if (!(torture_random (trsp) % - (cxt.nrealwriters_stress *2000 * longdelay_ms))) -mdelay (longdelay_ms *10 ); +if (long_hold && !(torture_random (trsp) % (cxt.nrealwriters_stress *2000 * long_hold))) +mdelay (long_hold *10 );if (!(torture_random (trsp) % (cxt.nrealwriters_stress *20000 )))torture_preempt_schedule ();/* Allow test to be preempted. */ }
@@ -766,14 +750,11 @@ __acquires(torture_rwsem)static void torture_rwsem_read_delay (struct torture_random_state *trsp) { -const unsigned long longdelay_ms =100 ; -/* We want a long delay occasionally to force massive contention. */ -if (!(torture_random (trsp) % - (cxt.nrealreaders_stress *2000 * longdelay_ms))) -mdelay (longdelay_ms *2 ); +if (long_hold && !(torture_random (trsp) % (cxt.nrealreaders_stress *2000 * long_hold))) +mdelay (long_hold *2 );else -mdelay (longdelay_ms /2 ); +mdelay (long_hold /2 );if (!(torture_random (trsp) % (cxt.nrealreaders_stress *20000 )))torture_preempt_schedule ();/* Allow test to be preempted. */ }
@@ -1056,11 +1037,12 @@ lock_torture_print_module_parms(struct lock_torture_ops *cur_ops,cpumask_setall (&cpumask_all);pr_alert ("%s" TORTURE_FLAG -"--- %s%s: nwriters_stress=%d nreaders_stress=%d nested_locks=%d stat_interval=%d verbose=%d shuffle_interval=%d stutter=%d shutdown_secs=%d onoff_interval=%d onoff_holdoff=%d readers_bind=%*pbl writers_bind=%*pbl\n" , +"--- %s%s: acq_writer_lim=%d long_hold=%d nested_locks=%d nreaders_stress=%d nwriters_stress=%d onoff_holdoff=%d onoff_interval=%d rt_boost=%d rt_boost_factor=%d shuffle_interval=%d shutdown_secs=%d stat_interval=%d stutter=%d verbose=%d writer_fifo=%d readers_bind=%*pbl writers_bind=%*pbl\n" , torture_type, tag, cxt.debug_lock ?" [debug]" :"" , - cxt.nrealwriters_stress, cxt.nrealreaders_stress, - nested_locks, stat_interval, verbose, shuffle_interval, - stutter, shutdown_secs, onoff_interval, onoff_holdoff, + acq_writer_lim, long_hold, nested_locks, cxt.nrealreaders_stress, + cxt.nrealwriters_stress, onoff_holdoff, onoff_interval, rt_boost, + rt_boost_factor, shuffle_interval, shutdown_secs, stat_interval, stutter, + verbose, writer_fifo,cpumask_pr_args (rcmp),cpumask_pr_args (wcmp)); }
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 16/23 locktorture: Add call_rcu_chains module parameter
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
When running locktorture on large systems, there will normally be enough RCU activity to ensure that there is a grace period in flight at all times. However, on smaller systems, RCU might well be idle the majority of the time. This situation can be inconvenient in cases where the RCU CPU stall warning is part of the debugging process.
This commit therefore adds an call_rcu_chains module parameter to locktorture, allowing the user to specify the desired number of self-propagating call_rcu() chains. For good measure, immediately before invoking call_rcu(), the self-propagating RCU callback invokes start_poll_synchronize_rcu() to force the immediate start of a grace period, with the call_rcu() forcing another to start shortly thereafter.
Booting with locktorture.call_rcu_chains=2 increases the probability of a stuck locking primitive resulting in an RCU CPU stall warning from about 25% to nearly 100%.
--- .../admin-guide/kernel-parameters.txt | 7 +++ kernel/locking/locktorture.c | 62 ++++++++++++++++++- 2 files changed, 67 insertions(+), 2 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +7 -0
@@ -2913,6 +2913,13 @@ to extract confidential information from the kernel are also disabled. + locktorture.call_rcu_chains= [KNL] + Specify the number of self-propagating call_rcu() + chains to set up. These are used to ensure that + there is a high probability of an RCU grace period + in progress at any given time. Defaults to 0, + which disables these call_rcu() chains. + locktorture.nreaders_stress= [KNL] Set the number of locking read-acquisition kthreads. Defaults to being automatically set based on the
kernel/locking/locktorture.c +60 -2
99 lines not on this page · raw message
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 17/23 doc: Catch-up update for locktorture module parameters
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
This commit documents recently added locktorture module parameters.
--- .../admin-guide/kernel-parameters.txt | 50 +++++++++++++++++-- 1 file changed, 47 insertions(+), 3 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +47 -3
@@ -2913,6 +2913,11 @@ to extract confidential information from the kernel are also disabled. + locktorture.acq_writer_lim= [KNL] + Set the time limit in jiffies for a lock + acquisition. Acquisitions exceeding this limit + will result in a splat once they do complete. + locktorture.call_rcu_chains= [KNL] Specify the number of self-propagating call_rcu() chains to set up. These are used to ensure that
@@ -2920,6 +2925,18 @@ in progress at any given time. Defaults to 0, which disables these call_rcu() chains. + locktorture.long_hold= [KNL] + Specify the duration in milliseconds for the + occasional long-duration lock hold time. Defaults + to 100 milliseconds. Select 0 to disable. + + locktorture.nested_locks= [KNL] + Specify the maximum lock nesting depth that + locktorture is to exercise, up to a limit of 8 + (MAX_NESTED_LOCKS). Specify zero to disable. + Note that this parameter is ineffective on types + of locks that do not support nested acquisition. + locktorture.nreaders_stress= [KNL] Set the number of locking read-acquisition kthreads. Defaults to being automatically set based on the
@@ -2935,6 +2952,29 @@ Set time (s) between CPU-hotplug operations, or zero to disable CPU-hotplug testing. + locktorture.readers_bind= [KNL] + Specify the list of CPUs to which the readers are + to be bound. + + locktorture.rt_boost= [KNL] + Do periodic testing of real-time lock priority + boosting. Select 0 to disable, 1 to boost + only rt_mutex, and 2 to boost unconditionally. + Defaults to 2, which might seem to be an + odd choice, but which should be harmless for + non-real-time spinlocks, due to their disabling + of preemption. Note that non-realtime mutexes + disable boosting. + + locktorture.rt_boost_factor= [KNL] + Number that determines how often and for how + long priority boosting is exercised. This is + scaled down by the number of writers, so that the + number of boosts per unit time remains roughly + constant as the number of writers increases. + On the other hand, the duration of each boost + increases with the number of writers. + locktorture.shuffle_interval= [KNL] Set task-shuffle interval (jiffies). Shuffling tasks allows some CPUs to go into dyntick-idle
@@ -2957,13 +2997,17 @@ locktorture.torture_type= [KNL] Specify the locking implementation to test. + locktorture.verbose= [KNL] + Enable additional printk() statements. + + locktorture.writers_bind= [KNL] + Specify the list of CPUs to which the writers are + to be bound. + locktorture.writer_fifo= [KNL] Run the write-side locktorture kthreads at sched_set_fifo() real-time priority. - locktorture.verbose= [KNL] - Enable additional printk() statements. - logibm.irq= [HW,MOUSE] Logitech Bus Mouse Driver Format: <irq>
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 18/23 locktorture: Rename readers_bind/writers_bind to bind_readers/bind_writers
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
This commit renames the readers_bind and writers_bind module parameters to bind_readers and bind_writers, respectively. This provides added clarity via the imperative mode and better organizes the documentation.
--- .../admin-guide/kernel-parameters.txt | 16 +++++------ kernel/locking/locktorture.c | 28 +++++++++---------- 2 files changed, 22 insertions(+), 22 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +8 -8
@@ -2918,6 +2918,14 @@ acquisition. Acquisitions exceeding this limit will result in a splat once they do complete. + locktorture.bind_readers= [KNL] + Specify the list of CPUs to which the readers are + to be bound. + + locktorture.bind_writers= [KNL] + Specify the list of CPUs to which the writers are + to be bound. + locktorture.call_rcu_chains= [KNL] Specify the number of self-propagating call_rcu() chains to set up. These are used to ensure that
@@ -2952,10 +2960,6 @@ Set time (s) between CPU-hotplug operations, or zero to disable CPU-hotplug testing. - locktorture.readers_bind= [KNL] - Specify the list of CPUs to which the readers are - to be bound. - locktorture.rt_boost= [KNL] Do periodic testing of real-time lock priority boosting. Select 0 to disable, 1 to boost
@@ -3000,10 +3004,6 @@ locktorture.verbose= [KNL] Enable additional printk() statements. - locktorture.writers_bind= [KNL] - Specify the list of CPUs to which the writers are - to be bound. - locktorture.writer_fifo= [KNL] Run the write-side locktorture kthreads at sched_set_fifo() real-time priority.
kernel/locking/locktorture.c +14 -14
@@ -58,8 +58,8 @@ module_param(torture_type, charp, 0444);MODULE_PARM_DESC (torture_type,"Type of lock to torture (spin_lock, spin_lock_irq, mutex_lock, ...)" ); -static cpumask_var_t readers_bind;// Bind the readers to the specified set of CPUs. -static cpumask_var_t writers_bind;// Bind the writers to the specified set of CPUs. +static cpumask_var_t bind_readers;// Bind the readers to the specified set of CPUs. +static cpumask_var_t bind_writers;// Bind the writers to the specified set of CPUs. // Parse a cpumask kernel parameter. If there are more users later on, // this might need to got to a more central location.
@@ -102,8 +102,8 @@ static const struct kernel_param_ops lt_bind_ops = { .get = param_get_cpumask, }; -module_param_cb (readers_bind, <_bind_ops, &readers_bind,0644 ); -module_param_cb (writers_bind, <_bind_ops, &writers_bind,0644 ); +module_param_cb (bind_readers, <_bind_ops, &bind_readers,0644 ); +module_param_cb (bind_writers, <_bind_ops, &bind_writers,0644 );long torture_sched_setaffinity (pid_t pid,const struct cpumask *in_mask);
@@ -1039,18 +1039,18 @@ lock_torture_print_module_parms(struct lock_torture_ops *cur_ops, const char *tag) {static cpumask_t cpumask_all; -cpumask_t *rcmp =cpumask_nonempty (readers_bind) ? readers_bind : &cpumask_all; -cpumask_t *wcmp =cpumask_nonempty (writers_bind) ? writers_bind : &cpumask_all; +cpumask_t *rcmp =cpumask_nonempty (bind_readers) ? bind_readers : &cpumask_all; +cpumask_t *wcmp =cpumask_nonempty (bind_writers) ? bind_writers : &cpumask_all;cpumask_setall (&cpumask_all);pr_alert ("%s" TORTURE_FLAG -"--- %s%s: acq_writer_lim=%d call_rcu_chains=%d long_hold=%d nested_locks=%d nreaders_stress=%d nwriters_stress=%d onoff_holdoff=%d onoff_interval=%d rt_boost=%d rt_boost_factor=%d shuffle_interval=%d shutdown_secs=%d stat_interval=%d stutter=%d verbose=%d writer_fifo=%d readers_bind=%*pbl writers_bind=%*pbl\n" , +"--- %s%s: acq_writer_lim=%d bind_readers=%*pbl bind_writers=%*pbl call_rcu_chains=%d long_hold=%d nested_locks=%d nreaders_stress=%d nwriters_stress=%d onoff_holdoff=%d onoff_interval=%d rt_boost=%d rt_boost_factor=%d shuffle_interval=%d shutdown_secs=%d stat_interval=%d stutter=%d verbose=%d writer_fifo=%d\n" , torture_type, tag, cxt.debug_lock ?" [debug]" :"" , - acq_writer_lim, call_rcu_chains, long_hold, nested_locks, cxt.nrealreaders_stress, + acq_writer_lim,cpumask_pr_args (rcmp),cpumask_pr_args (wcmp), + call_rcu_chains, long_hold, nested_locks, cxt.nrealreaders_stress, cxt.nrealwriters_stress, onoff_holdoff, onoff_interval, rt_boost, rt_boost_factor, shuffle_interval, shutdown_secs, stat_interval, stutter, - verbose, writer_fifo, -cpumask_pr_args (rcmp),cpumask_pr_args (wcmp)); + verbose, writer_fifo); }// If requested, maintain call_rcu() chains to keep a grace period always
@@ -1356,8 +1356,8 @@ static int __init lock_torture_init(void) writer_fifo ? sched_set_fifo : NULL);if (torture_init_error (firsterr)) goto unwind; -if (cpumask_nonempty (writers_bind)) -torture_sched_setaffinity (writer_tasks[i]->pid, writers_bind); +if (cpumask_nonempty (bind_writers)) +torture_sched_setaffinity (writer_tasks[i]->pid, bind_writers); create_reader:if (cxt.cur_ops->readlock ==NULL || (j >= cxt.nrealreaders_stress))
@@ -1367,8 +1367,8 @@ static int __init lock_torture_init(void) reader_tasks[j]);if (torture_init_error (firsterr)) goto unwind; -if (cpumask_nonempty (readers_bind)) -torture_sched_setaffinity (reader_tasks[j]->pid, readers_bind); +if (cpumask_nonempty (bind_readers)) +torture_sched_setaffinity (reader_tasks[j]->pid, bind_readers); }if (stat_interval >0 ) { firsterr = torture_create_kthread(lock_torture_stats, NULL,
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 19/23 torture: Add kvm.sh --debug-info argument
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
This commit adds a --debug-info argument to kvm.sh in order to ease interpretation of addresses printed on the console and the like. This argument also disables KASLR.
--- tools/testing/selftests/rcutorture/bin/kvm.sh | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
tools/testing/selftests/rcutorture/bin/kvm.sh +14 -3
@@ -49,6 +49,7 @@ TORTURE_SHUTDOWN_GRACE=180 TORTURE_SUITE=rcu TORTURE_MOD=rcutorture TORTURE_TRUST_MAKE="" +debuginfo="CONFIG_DEBUG_INFO_NONE=n CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y" resdir="" configs="" cpus=0
@@ -68,6 +69,7 @@ usage () { echo " --cpus N" echo " --datestamp string" echo " --defconfig string" + echo " --debug-info" echo " --dryrun batches|scenarios|sched|script" echo " --duration minutes | <seconds>s | <hours>h | <days>d" echo " --gdb"
@@ -135,6 +137,15 @@ do ds=$2 shift ;; + --debug-info|--debuginfo) + if test -z "$TORTURE_KCONFIG_KCSAN_ARG" && test -z "$TORTURE_BOOT_GDB_ARG" + then + TORTURE_KCONFIG_KCSAN_ARG="$debuginfo"; export TORTURE_KCONFIG_KCSAN_ARG + TORTURE_BOOT_GDB_ARG="nokaslr"; export TORTURE_BOOT_GDB_ARG + else + echo "Ignored redundant --debug-info (implied by --kcsan &c)" + fi + ;; --defconfig) checkarg --defconfig "defconfigtype" "$#" "$2" '^[^/][^/]*$' '^--' TORTURE_DEFCONFIG=$2
@@ -163,7 +174,7 @@ do shift ;; --gdb) - TORTURE_KCONFIG_GDB_ARG="CONFIG_DEBUG_INFO_NONE=n CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y"; export TORTURE_KCONFIG_GDB_ARG + TORTURE_KCONFIG_GDB_ARG="$debuginfo"; export TORTURE_KCONFIG_GDB_ARG TORTURE_BOOT_GDB_ARG="nokaslr"; export TORTURE_BOOT_GDB_ARG TORTURE_QEMU_GDB_ARG="-s -S"; export TORTURE_QEMU_GDB_ARG ;;
@@ -179,7 +190,7 @@ do shift ;; --kasan) - TORTURE_KCONFIG_KASAN_ARG="CONFIG_DEBUG_INFO_NONE=n CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y CONFIG_KASAN=y"; export TORTURE_KCONFIG_KASAN_ARG + TORTURE_KCONFIG_KASAN_ARG="$debuginfo CONFIG_KASAN=y"; export TORTURE_KCONFIG_KASAN_ARG if test -n "$torture_qemu_mem_default" then TORTURE_QEMU_MEM=2G
@@ -191,7 +202,7 @@ do shift ;; --kcsan) - TORTURE_KCONFIG_KCSAN_ARG="CONFIG_DEBUG_INFO_NONE=n CONFIG_DEBUG_INFO_DWARF_TOOLCHAIN_DEFAULT=y CONFIG_KCSAN=y CONFIG_KCSAN_STRICT=y CONFIG_KCSAN_REPORT_ONCE_IN_MS=100000 CONFIG_KCSAN_VERBOSE=y CONFIG_DEBUG_LOCK_ALLOC=y CONFIG_PROVE_LOCKING=y"; export TORTURE_KCONFIG_KCSAN_ARG + TORTURE_KCONFIG_KCSAN_ARG="$debuginfo CONFIG_KCSAN=y CONFIG_KCSAN_STRICT=y CONFIG_KCSAN_REPORT_ONCE_IN_MS=100000 CONFIG_KCSAN_VERBOSE=y CONFIG_DEBUG_LOCK_ALLOC=y CONFIG_PROVE_LOCKING=y"; export TORTURE_KCONFIG_KCSAN_ARG ;; --kmake-arg|--kmake-args) checkarg --kmake-arg "(kernel make arguments)" $# "$2" '.*' '^error$'
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 20/23 rcutorture: Replace schedule_timeout*() 1-jiffy waits with HZ/20
In reply to Frederic WeisbeckerFrom: "Joel Fernandes (Google)" <[email protected]>
In the past, spinning on schedule_timeout* with a wait of 1 jiffy has hung the kernel. See for example d52d3a2bf408 ("torture: Fix hang during kthread shutdown phase").
This issue recently recurred in torture's stutter code. The result is that the function instantly returns and never goes to sleep, preempting whatever might otherwise make useful forward progress.
To prevent future issues, apply the commit-d52d3a2bf408 fix throughout rcutorture, moving from a 1-jiffy wait to a 50-millisecond wait.
--- kernel/rcu/rcutorture.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/rcu/rcutorture.c +6 -6
@@ -1149,7 +1149,7 @@ static int rcu_torture_boost(void *arg)mutex_unlock (&boost_mutex);break ; } -schedule_timeout_uninterruptible (1 ); +schedule_timeout_uninterruptible (HZ /20 ); }/* Go do the stutter. */
@@ -1160,7 +1160,7 @@ checkwait: if (stutter_wait("rcu_torture_boost"))/* Clean up and exit. */ while (!kthread_should_stop ()) {torture_shutdown_absorb ("rcu_torture_boost" ); -schedule_timeout_uninterruptible (1 ); +schedule_timeout_uninterruptible (HZ /20 ); }torture_kthread_stopping ("rcu_torture_boost" );return 0 ;
@@ -1183,7 +1183,7 @@ rcu_torture_fqs(void *arg) fqs_resume_time = jiffies + fqs_stutter *HZ ;while (time_before (jiffies, fqs_resume_time) && !kthread_should_stop ()) { -schedule_timeout_interruptible (1 ); +schedule_timeout_interruptible (HZ /20 ); } fqs_burst_remaining = fqs_duration; while (fqs_burst_remaining > 0 &&
@@ -2899,7 +2899,7 @@ static int rcu_torture_fwd_prog(void *args)WRITE_ONCE (rcu_fwd_seq, rcu_fwd_seq +1 ); }else {while (READ_ONCE (rcu_fwd_seq) == oldseq && !torture_must_stop ()) -schedule_timeout_interruptible (1 ); +schedule_timeout_interruptible (HZ /20 ); oldseq =READ_ONCE (rcu_fwd_seq); }pr_alert ("%s: Starting forward-progress test %d\n" , __func__, rfp->rcu_fwd_id);
@@ -3200,7 +3200,7 @@ static int rcu_torture_read_exit_child(void *trsp_in)set_user_nice (current,MAX_NICE );// Minimize time between reading and exiting. while (!kthread_should_stop ()) -schedule_timeout_uninterruptible (1 ); +schedule_timeout_uninterruptible (HZ /20 ); (void )rcu_torture_one_read (trsp,-1 );return 0 ; }
@@ -3248,7 +3248,7 @@ static int rcu_torture_read_exit(void *unused)smp_mb ();// Store before wakeup. wake_up (&read_exit_wq);while (!torture_must_stop ()) -schedule_timeout_uninterruptible (1 ); +schedule_timeout_uninterruptible (HZ /20 );torture_kthread_stopping ("rcu_torture_read_exit" );return 0 ; }
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 21/23 rcutorture: Traverse possible cpu to set maxcpu in rcu_nocb_toggle()
In reply to Frederic WeisbeckerFrom: Zqiang <[email protected]>
Currently, the maxcpu is set by traversing online CPUs, however, if the rcutorture.onoff_holdoff is set zero and onoff_interval is set non-zero, and the some CPUs with larger cpuid has been offline before setting maxcpu, for these CPUs, even if they are online again, also cannot be offload or deoffload. This can result in rcutorture attempting to (de-)offload CPUs that have never been online, but the (de-)offload code handles this.
This commit therefore use for_each_possible_cpu() instead of for_each_online_cpu() in rcu_nocb_toggle().
--- kernel/rcu/rcutorture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/rcutorture.c +1 -1
@@ -2126,7 +2126,7 @@ static int rcu_nocb_toggle(void *arg)VERBOSE_TOROUT_STRING ("rcu_nocb_toggle task started" );while (!rcu_inkernel_boot_has_ended ())schedule_timeout_interruptible (HZ /10 ); -for_each_online_cpu (cpu) +for_each_possible_cpu (cpu) maxcpu = cpu;WARN_ON (maxcpu <0 );if (toggle_interval >ULONG_MAX )
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 22/23 torture: Convert parse-console.sh to mktemp
In reply to Frederic WeisbeckerFrom: "Paul E. McKenney" <[email protected]>
This commit does the long-overdue conversion of the parse-console.sh file to use mktemp to create its temporary directory.
--- tools/testing/selftests/rcutorture/bin/parse-console.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/rcutorture/bin/parse-console.sh +1 -1
@@ -11,7 +11,7 @@ # # Authors: Paul E. McKenney <[email protected]> -T=${TMPDIR-/tmp}/parse-console.sh.$$ +T="`mktemp -d ${TMPDIR-/tmp}/parse-console.sh.XXXXXX`" file="$1" title="$2"
Signature · 1 line
2.34.1
Frederic Weisbecker
maintainerPATCH 23/23 locktorture: Check the correct variable for allocation failure
In reply to Frederic WeisbeckerFrom: Dan Carpenter <[email protected]>
There is a typo so this checks the wrong variable. "chains" plural vs "chain" singular. We already know that "chains" is non-zero.
--- kernel/locking/locktorture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/locking/locktorture.c +1 -1
@@ -1075,7 +1075,7 @@ static int call_rcu_chain_init(void)if (call_rcu_chains <=0 )return 0 ; call_rcu_chain =kcalloc (call_rcu_chains,sizeof (*call_rcu_chain),GFP_KERNEL ); -if (!call_rcu_chains) +if (!call_rcu_chain)return -ENOMEM ;for (i =0 ; i < call_rcu_chains; i++) { call_rcu_chain[i].crc_stop = false;
Signature · 1 line
2.34.1
Re: [PATCH 23/23] locktorture: Check the correct variable for allocation failure
Quoted 8 lines · Frederic Weisbecker
From: Dan Carpenter <[email protected]>
There is a typo so this checks the wrong variable. "chains" plural vs "chain" singular. We already know that "chains" is non-zero.
Fixes 7f993623e9eb ("locktorture: Add call_rcu_chains module parameter")Signed-off-by Dan Carpenter <[email protected]>Signed-off-by Frederic Weisbecker <[email protected]>
A name change to increase the Hamming distance would of course also be good, though less urgent. ;-)
Quoted 20 lines
--- kernel/locking/locktorture.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/locking/locktorture.c +1
-1@@ -1075,7 +1075,7 @@ static int call_rcu_chain_init(void)if (call_rcu_chains <=0 )return 0 ; call_rcu_chain =kcalloc (call_rcu_chains,sizeof (*call_rcu_chain),GFP_KERNEL ); -if (!call_rcu_chains) +if (!call_rcu_chain)return -ENOMEM ;for (i =0 ; i < call_rcu_chains; i++) { call_rcu_chain[i].crc_stop = false;Signature · 1 line
2.34.1
Re: [PATCH 23/23] locktorture: Check the correct variable for allocation failure
Quoted 6 lines · Paul E. McKenney
Quoted 5 lines · Frederic Weisbecker
From: Dan Carpenter <[email protected]>
There is a typo so this checks the wrong variable. "chains" plural vs "chain" singular. We already know that "chains" is non-zero.
Quoted 8 lines
Quoted 3 lines
Fixes 7f993623e9eb ("locktorture: Add call_rcu_chains module parameter")Signed-off-by Dan Carpenter <[email protected]>Signed-off-by Frederic Weisbecker <[email protected]>Reviewed-by Paul E. McKenney <[email protected]>A name change to increase the Hamming distance would of course also be good, though less urgent. ;-)
"Hamming distance" is such a great phrase. I'm going to use that every time I complain about confusingly similar variable names going forward.
regards,
dan carpenter
Paul E. McKenney
maintainerRe: [PATCH 23/23] locktorture: Check the correct variable for allocation failure
Quoted 11 lines · Dan Carpenter
Quoted 10 lines · Paul E. McKenney
Quoted 8 lines · Frederic Weisbecker
From: Dan Carpenter <[email protected]>
There is a typo so this checks the wrong variable. "chains" plural vs "chain" singular. We already know that "chains" is non-zero.
Fixes 7f993623e9eb ("locktorture: Add call_rcu_chains module parameter")Signed-off-by Dan Carpenter <[email protected]>Signed-off-by Frederic Weisbecker <[email protected]>
Quoted 7 lines
Quoted 4 lines
Reviewed-by Paul E. McKenney <[email protected]>A name change to increase the Hamming distance would of course also be good, though less urgent. ;-)
"Hamming distance" is such a great phrase. I'm going to use that every time I complain about confusingly similar variable names going forward.
Glad you like it!
But the horrible thing is that I first heard that phrase back in the 1970s, and I am the guilty party who created these particular too-similar variable names. (Why has the phrase fallen out of favor? No idea, really, but one guess has to do with the fact that current error-correcting codes must deal with different probabilities of different bits flipping in different directions, so you would instead needs a weirdly weighted variant of Hamming distance to accomplish anything with modern error-correcting codes.)
But how about something like the following?
Thanx, paul
------------------------------------------------------------------------
kernel/locking/locktorture.c +9 -9
@@ -126,7 +126,7 @@ struct call_rcu_chain {struct rcu_head crc_rh;bool crc_stop; }; -struct call_rcu_chain *call_rcu_chain; +struct call_rcu_chain *call_rcu_chain_list;/* Forward reference. */ static void lock_torture_cleanup (void );
@@ -1106,12 +1106,12 @@ static int call_rcu_chain_init(void)if (call_rcu_chains <=0 )return 0 ; - call_rcu_chain =kcalloc (call_rcu_chains,sizeof (*call_rcu_chain),GFP_KERNEL ); -if (!call_rcu_chain) + call_rcu_chain_list =kcalloc (call_rcu_chains,sizeof (*call_rcu_chain_list),GFP_KERNEL ); +if (!call_rcu_chain_list)return -ENOMEM ;for (i =0 ; i < call_rcu_chains; i++) { - call_rcu_chain[i].crc_stop = false; -call_rcu (&call_rcu_chain[i].crc_rh, call_rcu_chain_cb); + call_rcu_chain_list[i].crc_stop = false; +call_rcu (&call_rcu_chain_list[i].crc_rh, call_rcu_chain_cb); }return 0 ; }
@@ -1121,13 +1121,13 @@ static void call_rcu_chain_cleanup(void) {int i; -if (!call_rcu_chain) +if (!call_rcu_chain_list)return ;for (i =0 ; i < call_rcu_chains; i++) -smp_store_release (&call_rcu_chain[i].crc_stop, true); +smp_store_release (&call_rcu_chain_list[i].crc_stop, true);rcu_barrier (); -kfree (call_rcu_chain); - call_rcu_chain =NULL ; +kfree (call_rcu_chain_list); + call_rcu_chain_list =NULL ; }static struct notifier_block lock_torture_stall_block;
Re: [PATCH 23/23] locktorture: Check the correct variable for allocation failure
Quoted 31 lines · Paul E. McKenney
Quoted 11 lines · Dan Carpenter
Quoted 10 lines · Paul E. McKenney
Quoted 8 lines · Frederic Weisbecker
From: Dan Carpenter <[email protected]>
There is a typo so this checks the wrong variable. "chains" plural vs "chain" singular. We already know that "chains" is non-zero.
Fixes 7f993623e9eb ("locktorture: Add call_rcu_chains module parameter")Signed-off-by Dan Carpenter <[email protected]>Signed-off-by Frederic Weisbecker <[email protected]>Quoted 7 lines
Quoted 4 lines
Reviewed-by Paul E. McKenney <[email protected]>A name change to increase the Hamming distance would of course also be good, though less urgent. ;-)
"Hamming distance" is such a great phrase. I'm going to use that every time I complain about confusingly similar variable names going forward.
Glad you like it!
But the horrible thing is that I first heard that phrase back in the 1970s, and I am the guilty party who created these particular too-similar variable names. (Why has the phrase fallen out of favor? No idea, really, but one guess has to do with the fact that current error-correcting codes must deal with different probabilities of different bits flipping in different directions, so you would instead needs a weirdly weighted variant of Hamming distance to accomplish anything with modern error-correcting codes.)
Quoted 2 lines
But how about something like the following?
Looks good!
regards,
dan carpenter