RCU torture changes for v6.15
Subsystems (6)
cover RCU torture changes for v6.15
Hi,
Please find the upcoming changes in rcutorture for v6.15. The changes can also be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git torture.2025.02.05a
Regards,
Boqun
Paul E. McKenney (11):
torture: Add get_torture_init_jiffies() for test-start time
rcutorture: Add a test_boost_holdoff module parameter
rcutorture: Include grace-period sequence numbers in
failure/close-call
rcutorture: Expand failure/close-call grace-period output
rcu: Trace expedited grace-period numbers in hexadecimal
rcutorture: Add ftrace-compatible timestamp to GP# failure/close-call
output
rcutorture: Make cur_ops->format_gp_seqs take buffer length
rcutorture: Move RCU_TORTURE_TEST_{CHK_RDR_STATE,LOG_CPU} to bool
rcutorture: Complain when invalid SRCU reader_flavor is specified
srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
torture: Make SRCU lockdep testing use srcu_read_lock_nmisafe()
.../admin-guide/kernel-parameters.txt | 5 ++ include/linux/torture.h | 1 + include/trace/events/rcu.h | 2 +- kernel/rcu/Kconfig | 11 ++++ kernel/rcu/Kconfig.debug | 18 ++++- kernel/rcu/rcu.h | 2 + kernel/rcu/rcutorture.c | 65 +++++++++++++++++-- kernel/rcu/tiny.c | 14 ++++ kernel/rcu/tree.c | 20 ++++++ kernel/torture.c | 12 ++++ .../selftests/rcutorture/bin/srcu_lockdep.sh | 2 +- 11 files changed, 144 insertions(+), 8 deletions(-)
Signature · 1 line
2.39.5 (Apple Git-154)
PATCH 1/11 torture: Add get_torture_init_jiffies() for test-start time
From: "Paul E. McKenney" <[email protected]>
This commit adds a get_torture_init_jiffies() function that returns the value of the jiffies counter at the start of the test, that is, at the point where torture_init_begin() was invoked.
This will be used to enable torture-test holdoffs for tests implemented using per-CPU kthreads, which are created and deleted by CPU-hotplug operations, and thus (unlike normal kthreads) don't automatically know when the test started.
--- include/linux/torture.h | 1 + kernel/torture.c | 12 ++++++++++++ 2 files changed, 13 insertions(+)
include/linux/torture.h +1 -0
@@ -104,6 +104,7 @@ int torture_stutter_init(int s, int sgap);/* Initialization and cleanup. */ bool torture_init_begin (char *ttype,int v);void torture_init_end (void ); +unsigned long get_torture_init_jiffies (void );bool torture_cleanup_begin (void );void torture_cleanup_end (void );bool torture_must_stop (void );
kernel/torture.c +12 -0
@@ -792,6 +792,8 @@ static void torture_stutter_cleanup(void) stutter_task =NULL ; } +static unsigned long torture_init_jiffies; +static void torture_print_module_parms (void ) {
@@ -821,6 +823,7 @@ bool torture_init_begin(char *ttype, int v) torture_type = ttype; verbose = v; fullstop =FULLSTOP_DONTSTOP ; +WRITE_ONCE (torture_init_jiffies, jiffies);// Lockless reads. torture_print_module_parms ();return true; }
@@ -836,6 +839,15 @@ void torture_init_end(void) }EXPORT_SYMBOL_GPL (torture_init_end); +/* +* Get the torture_init_begin()-time value of the jiffies counter. +*/ +unsigned long get_torture_init_jiffies (void ) +{ +return READ_ONCE (torture_init_jiffies); +} +EXPORT_SYMBOL_GPL (get_torture_init_jiffies); +/* * Clean up torture module. Please note that this is -not- invoked via * the usual module_exit() mechanism, but rather by an explicit call from
Signature · 1 line
2.39.5 (Apple Git-154)
PATCH 2/11 rcutorture: Add a test_boost_holdoff module parameter
In reply to Boqun FengFrom: "Paul E. McKenney" <[email protected]>
This commit adds a test_boost_holdoff module parameter that tells the RCU priority-boosting tests to wait for the specified number of seconds past the start of the rcutorture test. This can be useful when rcutorture is built into the kernel (as opposed to being modprobed), especially on large systems where early start of RCU priority boosting can delay the boot sequence, which adds a full CPU's worth of load onto the system. This can in turn result in pointless stall warnings.
--- .../admin-guide/kernel-parameters.txt | 5 +++++ kernel/rcu/rcutorture.c | 19 ++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +5 -0
@@ -5758,6 +5758,11 @@ rcutorture.test_boost_duration= [KNL] Duration (s) of each individual boost test. + rcutorture.test_boost_holdoff= [KNL] + Holdoff time (s) from start of test to the start + of RCU priority-boost testing. Defaults to zero, + that is, no holdoff. + rcutorture.test_boost_interval= [KNL] Interval (s) between each boost test.
kernel/rcu/rcutorture.c +16 -3
@@ -135,6 +135,7 @@ torture_param(int, stat_interval, 60, "Number of seconds between stats printk()storture_param (int, stutter,5 ,"Number of seconds to run/halt test" );torture_param (int, test_boost,1 ,"Test RCU prio boost: 0=no, 1=maybe, 2=yes." );torture_param (int, test_boost_duration,4 ,"Duration of each boost test, seconds." ); +torture_param (int, test_boost_holdoff,0 ,"Holdoff time from rcutorture start, seconds." );torture_param (int, test_boost_interval,7 ,"Interval between boost tests, seconds." );torture_param (int, test_nmis,0 ,"End-test NMI tests, 0 to disable." );torture_param (bool, test_no_idle_hz, true,"Test support for tickless idle CPUs" );
@@ -1148,8 +1149,19 @@ static int rcu_torture_boost(void *arg)unsigned long gp_state;unsigned long gp_state_time;unsigned long oldstarttime; +unsigned long booststarttime =get_torture_init_jiffies () + test_boost_holdoff *HZ ; -VERBOSE_TOROUT_STRING ("rcu_torture_boost started" ); +if (test_boost_holdoff <=0 ||time_after (jiffies, booststarttime)) { +VERBOSE_TOROUT_STRING ("rcu_torture_boost started" ); + }else { +VERBOSE_TOROUT_STRING ("rcu_torture_boost started holdoff period" ); +while (time_before (jiffies, booststarttime)) { +schedule_timeout_idle (HZ ); +if (kthread_should_stop ()) + goto cleanup; + } +VERBOSE_TOROUT_STRING ("rcu_torture_boost finished holdoff period" ); + }/* Set real-time priority. */ sched_set_fifo_low (current);
@@ -1225,6 +1237,7 @@ checkwait: if (stutter_wait("rcu_torture_boost"))sched_set_fifo_low (current); }while (!torture_must_stop ()); +cleanup:/* Clean up and exit. */ while (!kthread_should_stop ()) {torture_shutdown_absorb ("rcu_torture_boost" );
@@ -2512,7 +2525,7 @@ rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag)"shuffle_interval=%d stutter=%d irqreader=%d " "fqs_duration=%d fqs_holdoff=%d fqs_stutter=%d " "test_boost=%d/%d test_boost_interval=%d " -"test_boost_duration=%d shutdown_secs=%d " +"test_boost_duration=%d test_boost_holdoff=%d shutdown_secs=%d " "stall_cpu=%d stall_cpu_holdoff=%d stall_cpu_irqsoff=%d " "stall_cpu_block=%d stall_cpu_repeat=%d " "n_barrier_cbs=%d "
@@ -2526,7 +2539,7 @@ rcu_torture_print_module_parms(struct rcu_torture_ops *cur_ops, const char *tag) stat_interval, verbose, test_no_idle_hz, shuffle_interval, stutter, irqreader, fqs_duration, fqs_holdoff, fqs_stutter, test_boost, cur_ops->can_boost, - test_boost_interval, test_boost_duration, shutdown_secs, + test_boost_interval, test_boost_duration, test_boost_holdoff, shutdown_secs, stall_cpu, stall_cpu_holdoff, stall_cpu_irqsoff, stall_cpu_block, stall_cpu_repeat, n_barrier_cbs,
Signature · 1 line
2.39.5 (Apple Git-154)
PATCH 3/11 rcutorture: Include grace-period sequence numbers in failure/close-call
In reply to Boqun FengFrom: "Paul E. McKenney" <[email protected]>
This commit includes the grace-period sequence numbers at the beginning and end of each segment in the "Failure/close-call rcutorture reader segments" list. These are in hexadecimal, and only the bottom byte. Currently, only RCU is supported, with its three sequence numbers (normal, expedited, and polled).
Note that if all the grace-period sequence numbers remain the same across a given reader segment, only one copy of the number will be printed. Of course, if there is a change, both sets of values will be printed.
Because the overhead of collecting this information can suppress heisenbugs, this information is collected and printed only in kernels built with CONFIG_RCU_TORTURE_TEST_LOG_GP=y.
[ paulmck: Apply Nathan Chancellor feedback for IS_ENABLED(). ] [ paulmck: Apply feedback from kernel test robot. ]
--- kernel/rcu/Kconfig.debug | 14 ++++++++++++++ kernel/rcu/rcu.h | 2 ++ kernel/rcu/rcutorture.c | 34 ++++++++++++++++++++++++++++++++++ kernel/rcu/tiny.c | 14 ++++++++++++++ kernel/rcu/tree.c | 20 ++++++++++++++++++++ 5 files changed, 84 insertions(+)
kernel/rcu/Kconfig.debug +14 -0
@@ -84,6 +84,20 @@ config RCU_TORTURE_TEST_LOG_CPU Say Y here if you want CPU IDs logged. Say N if you are unsure. +config RCU_TORTURE_TEST_LOG_GP + bool "Log grace-period numbers for rcutorture failures" + depends on RCU_TORTURE_TEST + default n + help + This option causes rcutorture to decorate each entry of its + log of failure/close-call rcutorture reader segments with the + corresponding grace-period sequence numbers. This information + can be useful, but it does incur additional overhead, overhead + that can make both failures and close calls less probable. + + Say Y here if you want grace-period sequence numbers logged. + Say N if you are unsure. + config RCU_REF_SCALE_TEST tristate "Scalability tests for read-side synchronization (RCU and others)" depends on DEBUG_KERNEL
kernel/rcu/rcu.h +2 -0
@@ -590,6 +590,8 @@ void do_trace_rcu_torture_read(const char *rcutorturename,#endif static inline void rcu_gp_set_torture_wait (int duration) { }#endif +unsigned long rcutorture_gather_gp_seqs (void ); +void rcutorture_format_gp_seqs (unsigned long seqs,char *cp);#ifdef CONFIG_TINY_SRCU
kernel/rcu/rcutorture.c +34 -0
@@ -273,6 +273,8 @@ struct rt_read_seg {bool rt_preempted;int rt_cpu;int rt_end_cpu; +unsigned long rt_gp_seq; +unsigned long rt_gp_seq_end; };static int err_segs_recorded;static struct rt_read_seg err_segs[RCUTORTURE_RDR_MAX_SEGS ];
@@ -407,6 +409,8 @@ struct rcu_torture_ops {void (*gp_slow_register)(atomic_t *rgssp);void (*gp_slow_unregister)(atomic_t *rgssp);bool (*reader_blocked)(void ); +unsigned long (*gather_gp_seqs)(void ); +void (*format_gp_seqs)(unsigned long seqs,char *cp);long cbflood_max;int irq_capable;int can_boost;
@@ -611,6 +615,8 @@ static struct rcu_torture_ops rcu_ops = { .reader_blocked = IS_ENABLED(CONFIG_RCU_TORTURE_TEST_LOG_CPU) ? has_rcu_reader_blocked : NULL, + .gather_gp_seqs = rcutorture_gather_gp_seqs, + .format_gp_seqs = rcutorture_format_gp_seqs, .irq_capable = 1, .can_boost = IS_ENABLED(CONFIG_RCU_BOOST), .extendables = RCUTORTURE_MAX_EXTEND,
@@ -656,6 +662,8 @@ static struct rcu_torture_ops rcu_busted_ops = { .sync = synchronize_rcu_busted, .exp_sync = synchronize_rcu_busted, .call = call_rcu_busted, + .gather_gp_seqs = rcutorture_gather_gp_seqs, + .format_gp_seqs = rcutorture_format_gp_seqs, .irq_capable = 1, .extendables =RCUTORTURE_MAX_EXTEND , .name = "busted"
@@ -1978,6 +1986,12 @@ static void rcutorture_one_extend(int *readstate, int newstate, bool insoftirq, rtrsp[-1 ].rt_preempted = cur_ops->reader_blocked (); } } +// Sample grace-period sequence number, as good a place as any. +if (IS_ENABLED (CONFIG_RCU_TORTURE_TEST_LOG_GP ) && cur_ops->gather_gp_seqs) { + rtrsp->rt_gp_seq = cur_ops->gather_gp_seqs (); +if (!first) + rtrsp[-1 ].rt_gp_seq_end = rtrsp->rt_gp_seq; + }/* * Next, remove old protection, in decreasing order of strength
@@ -3566,6 +3580,7 @@ rcu_torture_cleanup(void)int flags =0 ;unsigned long gp_seq =0 ;int i; +int j;if (torture_cleanup_begin ()) {if (cur_ops->cb_barrier !=NULL ) {
@@ -3661,6 +3676,25 @@ rcu_torture_cleanup(void)else pr_cont (" ..." ); } +if (IS_ENABLED (CONFIG_RCU_TORTURE_TEST_LOG_GP ) && + cur_ops->gather_gp_seqs && cur_ops->format_gp_seqs) { +char buf1[16 +1 ]; +char buf2[16 +1 ]; +char sepchar ='-' ; + + cur_ops->format_gp_seqs (err_segs[i].rt_gp_seq, buf1); + cur_ops->format_gp_seqs (err_segs[i].rt_gp_seq_end, buf2); +if (err_segs[i].rt_gp_seq == err_segs[i].rt_gp_seq_end) { +if (buf2[0 ]) { +for (j =0 ; buf2[j]; j++) + buf2[j] ='.' ; +if (j) + buf2[j -1 ] =' ' ; + } + sepchar =' ' ; + } +pr_cont (" %s%c%s" , buf1, sepchar, buf2); + }if (err_segs[i].rt_delay_ms !=0 ) {pr_cont (" %s%ldms" , firsttime ?"" :"+" , err_segs[i].rt_delay_ms);
kernel/rcu/tiny.c +14 -0
@@ -257,6 +257,20 @@ void kvfree_call_rcu(struct rcu_head *head, void *ptr)EXPORT_SYMBOL_GPL (kvfree_call_rcu);#endif +#if IS_ENABLED (CONFIG_RCU_TORTURE_TEST ) +unsigned long rcutorture_gather_gp_seqs (void ) +{ +return READ_ONCE (rcu_ctrlblk.gp_seq) &0xff ; +} +EXPORT_SYMBOL_GPL (rcutorture_gather_gp_seqs); + +void rcutorture_format_gp_seqs (unsigned long seqs,char *cp) +{ +snprintf (cp,8 ,"g%02lx" , seqs &0xff ); +} +EXPORT_SYMBOL_GPL (rcutorture_format_gp_seqs); +#endif +void __init rcu_init (void ) {open_softirq (RCU_SOFTIRQ , rcu_process_callbacks);
kernel/rcu/tree.c +20 -0
@@ -538,6 +538,26 @@ void rcutorture_get_gp_data(int *flags, unsigned long *gp_seq) }EXPORT_SYMBOL_GPL (rcutorture_get_gp_data); +/* Gather grace-period sequence numbers for rcutorture diagnostics. */ +unsigned long rcutorture_gather_gp_seqs (void ) +{ +return ((READ_ONCE (rcu_state.gp_seq) &0xff ) <<16 ) | + ((READ_ONCE (rcu_state.expedited_sequence) &0xff ) <<8 ) | + (READ_ONCE (rcu_state.gp_seq_polled) &0xff ); +} +EXPORT_SYMBOL_GPL (rcutorture_gather_gp_seqs); + +/* Format grace-period sequence numbers for rcutorture diagnostics. */ +void rcutorture_format_gp_seqs (unsigned long seqs,char *cp) +{ +unsigned int egp = (seqs >>8 ) &0xff ; +unsigned int ggp = (seqs >>16 ) &0xff ; +unsigned int pgp = seqs &0xff ; + +snprintf (cp,16 ,"g%02x:e%02x:p%02x" , ggp, egp, pgp); +} +EXPORT_SYMBOL_GPL (rcutorture_format_gp_seqs); +#if defined(CONFIG_NO_HZ_FULL ) && (!defined(CONFIG_GENERIC_ENTRY ) || !defined(CONFIG_KVM_XFER_TO_GUEST_WORK ))/* * An empty function that will trigger a reschedule on
Signature · 1 line
2.39.5 (Apple Git-154)
PATCH 4/11 rcutorture: Expand failure/close-call grace-period output
In reply to Boqun FengFrom: "Paul E. McKenney" <[email protected]>
With only eight bits per grace-period sequence number, wrap can happen in 64 grace periods. This commit therefore increases this to sixteen bits for normal grace-period sequence numbers and the combined short-form polling sequence numbers, thus deferring wrap for at least 16,384 grace periods. Because expedited grace periods go faster, expand these to 24 bits, deferring wrap for at least 4,194,304 expedited grace periods. These longer wrap times makes it easier to correlate these numbers to trace-event output.
Note that the low-order two bits are reserved for intra-grace-period state, hence the above wrap numbers being a factor of four smaller than you might expect.
--- kernel/rcu/rcu.h | 4 ++-- kernel/rcu/rcutorture.c | 12 ++++++------ kernel/rcu/tiny.c | 8 ++++---- kernel/rcu/tree.c | 18 +++++++++--------- 4 files changed, 21 insertions(+), 21 deletions(-)
kernel/rcu/rcu.h +2 -2
@@ -590,8 +590,8 @@ void do_trace_rcu_torture_read(const char *rcutorturename,#endif static inline void rcu_gp_set_torture_wait (int duration) { }#endif -unsigned long rcutorture_gather_gp_seqs (void ); -void rcutorture_format_gp_seqs (unsigned long seqs,char *cp); +unsigned long long rcutorture_gather_gp_seqs (void ); +void rcutorture_format_gp_seqs (unsigned long long seqs,char *cp);#ifdef CONFIG_TINY_SRCU
kernel/rcu/rcutorture.c +6 -6
@@ -273,8 +273,8 @@ struct rt_read_seg {bool rt_preempted;int rt_cpu;int rt_end_cpu; -unsigned long rt_gp_seq; -unsigned long rt_gp_seq_end; +unsigned long long rt_gp_seq; +unsigned long long rt_gp_seq_end; };static int err_segs_recorded;static struct rt_read_seg err_segs[RCUTORTURE_RDR_MAX_SEGS ];
@@ -409,8 +409,8 @@ struct rcu_torture_ops {void (*gp_slow_register)(atomic_t *rgssp);void (*gp_slow_unregister)(atomic_t *rgssp);bool (*reader_blocked)(void ); -unsigned long (*gather_gp_seqs)(void ); -void (*format_gp_seqs)(unsigned long seqs,char *cp); +unsigned long long (*gather_gp_seqs)(void ); +void (*format_gp_seqs)(unsigned long long seqs,char *cp);long cbflood_max;int irq_capable;int can_boost;
@@ -3678,8 +3678,8 @@ rcu_torture_cleanup(void) }if (IS_ENABLED (CONFIG_RCU_TORTURE_TEST_LOG_GP ) && cur_ops->gather_gp_seqs && cur_ops->format_gp_seqs) { -char buf1[16 +1 ]; -char buf2[16 +1 ]; +char buf1[20 +1 ]; +char buf2[20 +1 ];char sepchar ='-' ; cur_ops->format_gp_seqs (err_segs[i].rt_gp_seq, buf1);
kernel/rcu/tiny.c +4 -4
@@ -258,15 +258,15 @@ EXPORT_SYMBOL_GPL(kvfree_call_rcu);#endif #if IS_ENABLED (CONFIG_RCU_TORTURE_TEST ) -unsigned long rcutorture_gather_gp_seqs (void ) +unsigned long long rcutorture_gather_gp_seqs (void ) { -return READ_ONCE (rcu_ctrlblk.gp_seq) &0xff ; +return READ_ONCE (rcu_ctrlblk.gp_seq) &0xffffULL ; }EXPORT_SYMBOL_GPL (rcutorture_gather_gp_seqs); -void rcutorture_format_gp_seqs (unsigned long seqs,char *cp) +void rcutorture_format_gp_seqs (unsigned long long seqs,char *cp) { -snprintf (cp,8 ,"g%02lx" , seqs &0xff ); +snprintf (cp,8 ,"g%04llx" , seqs &0xffffULL ); }EXPORT_SYMBOL_GPL (rcutorture_format_gp_seqs);#endif
kernel/rcu/tree.c +9 -9
@@ -539,22 +539,22 @@ void rcutorture_get_gp_data(int *flags, unsigned long *gp_seq)EXPORT_SYMBOL_GPL (rcutorture_get_gp_data);/* Gather grace-period sequence numbers for rcutorture diagnostics. */ -unsigned long rcutorture_gather_gp_seqs (void ) +unsigned long long rcutorture_gather_gp_seqs (void ) { -return ((READ_ONCE (rcu_state.gp_seq) &0xff ) <<16 ) | - ((READ_ONCE (rcu_state.expedited_sequence) &0xff ) <<8 ) | - (READ_ONCE (rcu_state.gp_seq_polled) &0xff ); +return ((READ_ONCE (rcu_state.gp_seq) &0xffffULL ) <<40 ) | + ((READ_ONCE (rcu_state.expedited_sequence) &0xffffffULL ) <<16 ) | + (READ_ONCE (rcu_state.gp_seq_polled) &0xffffULL ); }EXPORT_SYMBOL_GPL (rcutorture_gather_gp_seqs);/* Format grace-period sequence numbers for rcutorture diagnostics. */ -void rcutorture_format_gp_seqs (unsigned long seqs,char *cp) +void rcutorture_format_gp_seqs (unsigned long long seqs,char *cp) { -unsigned int egp = (seqs >>8 ) &0xff ; -unsigned int ggp = (seqs >>16 ) &0xff ; -unsigned int pgp = seqs &0xff ; +unsigned int egp = (seqs >>16 ) &0xffffffULL ; +unsigned int ggp = (seqs >>40 ) &0xffffULL ; +unsigned int pgp = seqs &0xffffULL ; -snprintf (cp,16 ,"g%02x:e%02x:p%02x" , ggp, egp, pgp); +snprintf (cp,20 ,"g%04x:e%06x:p%04x" , ggp, egp, pgp); }EXPORT_SYMBOL_GPL (rcutorture_format_gp_seqs);
Signature · 1 line
2.39.5 (Apple Git-154)
PATCH 5/11 rcu: Trace expedited grace-period numbers in hexadecimal
In reply to Boqun FengFrom: "Paul E. McKenney" <[email protected]>
This commit reformats the expedited grace-period numbers into hexadecimal for easier decoding and comparison. The normal grace-period numbers remain in decimal for the time being.
--- include/trace/events/rcu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/trace/events/rcu.h +1 -1
@@ -207,7 +207,7 @@ TRACE_EVENT_RCU(rcu_exp_grace_period, __entry->gpevent = gpevent; ), -TP_printk ("%s %ld %s" , +TP_printk ("%s %#lx %s" , __entry->rcuname, __entry->gpseq, __entry->gpevent) );
Signature · 1 line
2.39.5 (Apple Git-154)
PATCH 6/11 rcutorture: Add ftrace-compatible timestamp to GP# failure/close-call output
In reply to Boqun FengFrom: "Paul E. McKenney" <[email protected]>
This commit adds an ftrace-compatible microsecond-scale timestamp to the failure/close-call output, but only in kernels built with CONFIG_RCU_TORTURE_TEST_LOG_GP=y.
--- kernel/rcu/rcutorture.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/rcu/rcutorture.c +7 -1
@@ -275,6 +275,7 @@ struct rt_read_seg {int rt_end_cpu;unsigned long long rt_gp_seq;unsigned long long rt_gp_seq_end; +u64 rt_ts; };static int err_segs_recorded;static struct rt_read_seg err_segs[RCUTORTURE_RDR_MAX_SEGS ];
@@ -1989,6 +1990,7 @@ static void rcutorture_one_extend(int *readstate, int newstate, bool insoftirq,// Sample grace-period sequence number, as good a place as any. if (IS_ENABLED (CONFIG_RCU_TORTURE_TEST_LOG_GP ) && cur_ops->gather_gp_seqs) { rtrsp->rt_gp_seq = cur_ops->gather_gp_seqs (); + rtrsp->rt_ts =ktime_get_mono_fast_ns ();if (!first) rtrsp[-1 ].rt_gp_seq_end = rtrsp->rt_gp_seq; }
@@ -3663,7 +3665,11 @@ rcu_torture_cleanup(void)pr_alert ("\t: No segments recorded!!!\n" ); firsttime =1 ;for (i =0 ; i < rt_read_nsegs; i++) { -pr_alert ("\t%d: %#4x" , i, err_segs[i].rt_readstate); +if (IS_ENABLED (CONFIG_RCU_TORTURE_TEST_LOG_GP )) +pr_alert ("\t%lluus " ,div64_u64 (err_segs[i].rt_ts,1000ULL )); +else +pr_alert ("\t" ); +pr_cont ("%d: %#4x" , i, err_segs[i].rt_readstate);if (err_segs[i].rt_delay_jiffies !=0 ) {pr_cont ("%s%ldjiffies" , firsttime ?"" :"+" , err_segs[i].rt_delay_jiffies);
Signature · 1 line
2.39.5 (Apple Git-154)
PATCH 7/11 rcutorture: Make cur_ops->format_gp_seqs take buffer length
In reply to Boqun FengFrom: "Paul E. McKenney" <[email protected]>
The Tree and Tiny implementations of rcutorture_format_gp_seqs() use hard-coded constants for the length of the buffer that they format into. This is of course an accident waiting to happen, so this commit therefore makes them take a length argument. The rcutorture calling code uses ARRAY_SIZE() to safely compute this new argument.
--- kernel/rcu/rcu.h | 2 +- kernel/rcu/rcutorture.c | 8 +++++--- kernel/rcu/tiny.c | 4 ++-- kernel/rcu/tree.c | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-)
kernel/rcu/rcu.h +1 -1
@@ -591,7 +591,7 @@ void do_trace_rcu_torture_read(const char *rcutorturename,static inline void rcu_gp_set_torture_wait (int duration) { }#endif unsigned long long rcutorture_gather_gp_seqs (void ); -void rcutorture_format_gp_seqs (unsigned long long seqs,char *cp); +void rcutorture_format_gp_seqs (unsigned long long seqs,char *cp,size_t len);#ifdef CONFIG_TINY_SRCU
kernel/rcu/rcutorture.c +5 -3
@@ -411,7 +411,7 @@ struct rcu_torture_ops {void (*gp_slow_unregister)(atomic_t *rgssp);bool (*reader_blocked)(void );unsigned long long (*gather_gp_seqs)(void ); -void (*format_gp_seqs)(unsigned long long seqs,char *cp); +void (*format_gp_seqs)(unsigned long long seqs,char *cp,size_t len);long cbflood_max;int irq_capable;int can_boost;
@@ -3688,8 +3688,10 @@ rcu_torture_cleanup(void)char buf2[20 +1 ];char sepchar ='-' ; - cur_ops->format_gp_seqs (err_segs[i].rt_gp_seq, buf1); - cur_ops->format_gp_seqs (err_segs[i].rt_gp_seq_end, buf2); + cur_ops->format_gp_seqs (err_segs[i].rt_gp_seq, + buf1,ARRAY_SIZE (buf1)); + cur_ops->format_gp_seqs (err_segs[i].rt_gp_seq_end, + buf2,ARRAY_SIZE (buf2));if (err_segs[i].rt_gp_seq == err_segs[i].rt_gp_seq_end) {if (buf2[0 ]) {for (j =0 ; buf2[j]; j++)
kernel/rcu/tiny.c +2 -2
@@ -264,9 +264,9 @@ unsigned long long rcutorture_gather_gp_seqs(void) }EXPORT_SYMBOL_GPL (rcutorture_gather_gp_seqs); -void rcutorture_format_gp_seqs (unsigned long long seqs,char *cp) +void rcutorture_format_gp_seqs (unsigned long long seqs,char *cp,size_t len) { -snprintf (cp,8 ,"g%04llx" , seqs &0xffffULL ); +snprintf (cp, len,"g%04llx" , seqs &0xffffULL ); }EXPORT_SYMBOL_GPL (rcutorture_format_gp_seqs);#endif
kernel/rcu/tree.c +2 -2
@@ -548,13 +548,13 @@ unsigned long long rcutorture_gather_gp_seqs(void)EXPORT_SYMBOL_GPL (rcutorture_gather_gp_seqs);/* Format grace-period sequence numbers for rcutorture diagnostics. */ -void rcutorture_format_gp_seqs (unsigned long long seqs,char *cp) +void rcutorture_format_gp_seqs (unsigned long long seqs,char *cp,size_t len) {unsigned int egp = (seqs >>16 ) &0xffffffULL ;unsigned int ggp = (seqs >>40 ) &0xffffULL ;unsigned int pgp = seqs &0xffffULL ; -snprintf (cp,20 ,"g%04x:e%06x:p%04x" , ggp, egp, pgp); +snprintf (cp, len,"g%04x:e%06x:p%04x" , ggp, egp, pgp); }EXPORT_SYMBOL_GPL (rcutorture_format_gp_seqs);
Signature · 1 line
2.39.5 (Apple Git-154)
PATCH 8/11 rcutorture: Move RCU_TORTURE_TEST_{CHK_RDR_STATE,LOG_CPU} to bool
In reply to Boqun FengFrom: "Paul E. McKenney" <[email protected]>
The RCU_TORTURE_TEST_CHK_RDR_STATE and RCU_TORTURE_TEST_LOG_CPU Kconfig options are pointlessly defined as tristate. This commit therefore converts them to bool.
--- kernel/rcu/Kconfig.debug | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/rcu/Kconfig.debug +2 -2
@@ -54,7 +54,7 @@ config RCU_TORTURE_TEST Say N if you are unsure. config RCU_TORTURE_TEST_CHK_RDR_STATE - tristate "Check rcutorture reader state" + bool "Check rcutorture reader state" depends on RCU_TORTURE_TEST default n help
@@ -70,7 +70,7 @@ config RCU_TORTURE_TEST_CHK_RDR_STATE Say N if you are unsure. config RCU_TORTURE_TEST_LOG_CPU - tristate "Log CPU for rcutorture failures" + bool "Log CPU for rcutorture failures" depends on RCU_TORTURE_TEST default n help
Signature · 1 line
2.39.5 (Apple Git-154)
PATCH 9/11 rcutorture: Complain when invalid SRCU reader_flavor is specified
In reply to Boqun FengFrom: "Paul E. McKenney" <[email protected]>
Currently, rcutorture ignores reader_flavor bits that are not in the SRCU_READ_FLAVOR_ALL bitmask, which could confuse rcutorture users into believing buggy patches had been fully tested. This commit therefore produces a splat in this case.
--- kernel/rcu/rcutorture.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/rcu/rcutorture.c +2 -0
@@ -689,6 +689,8 @@ static int srcu_torture_read_lock(void)int idx;int ret =0 ; +WARN_ON_ONCE (reader_flavor & ~SRCU_READ_FLAVOR_ALL ); +if ((reader_flavor &SRCU_READ_FLAVOR_NORMAL ) || !(reader_flavor &SRCU_READ_FLAVOR_ALL )) { idx =srcu_read_lock (srcu_ctlp);WARN_ON_ONCE (idx & ~0x1 );
Signature · 1 line
2.39.5 (Apple Git-154)
PATCH 10/11 srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
In reply to Boqun FengFrom: "Paul E. McKenney" <[email protected]>
The srcu_read_lock_nmisafe() and srcu_read_unlock_nmisafe() functions map to __srcu_read_lock() and __srcu_read_unlock() on systems like x86 that have NMI-safe this_cpu_inc() operations. This makes the underlying __srcu_read_lock_nmisafe() and __srcu_read_unlock_nmisafe() functions difficult to test on (for example) x86 systems, allowing bugs to creep in.
This commit therefore creates a FORCE_NEED_SRCU_NMI_SAFE Kconfig that forces those underlying functions to be used even on systems where they are not needed, thus providing better testing coverage.
--- kernel/rcu/Kconfig | 11 +++++++++++ 1 file changed, 11 insertions(+)
kernel/rcu/Kconfig +11 -0
@@ -65,6 +65,17 @@ config TREE_SRCU help This option selects the full-fledged version of SRCU. +config FORCE_NEED_SRCU_NMI_SAFE + bool "Force selection of NEED_SRCU_NMI_SAFE" + depends on !TINY_SRCU + select NEED_SRCU_NMI_SAFE + default n + help + This option forces selection of the NEED_SRCU_NMI_SAFE + Kconfig option, allowing testing of srcu_read_lock_nmisafe() + and srcu_read_unlock_nmisafe() on architectures (like x86) + that select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option. + config NEED_SRCU_NMI_SAFE def_bool HAVE_NMI && !ARCH_HAS_NMI_SAFE_THIS_CPU_OPS && !TINY_SRCU
Signature · 1 line
2.39.5 (Apple Git-154)
Re: [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
Hi Boqun, Paul,
Quoted 8 lines · Boqun Feng
From: "Paul E. McKenney" <[email protected]>
The
srcu_read_lock_nmisafe()andsrcu_read_unlock_nmisafe()functions map to__srcu_read_lock()and__srcu_read_unlock()on systems like x86 that have NMI-safethis_cpu_inc()operations. This makes the underlying__srcu_read_lock_nmisafe()and__srcu_read_unlock_nmisafe()functions difficult to test on (for example) x86 systems, allowing bugs to creep in.
Quoted 6 lines
This commit therefore creates a
FORCE_NEED_SRCU_NMI_SAFEKconfigthat forces those underlying functions to be used even on systems where they are not needed, thus providing better testing coverage.Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Boqun Feng <[email protected]>
Thanks for your patch, which is now commit 536e8b9b80bc7a0a ("srcu:
Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing") in linus/master
kernel/rcu/Kconfig config TREE_SRCU · line 69
Quoted 8 lines
kernel/rcu/Kconfig +2
-0@@ -65,6 +65,17 @@ config TREE_SRCU help This option selects the full-fledged version of SRCU. +config FORCE_NEED_SRCU_NMI_SAFE + bool "Force selection of NEED_SRCU_NMI_SAFE"
What am I supposed to answer here? "n" I guess.
What about distro and allmodconfig kernels?
kernel/rcu/Kconfig config TREE_SRCU · line 77
Quoted 8 lines
kernel/rcu/Kconfig +8
-0+ depends on !TINY_SRCU + select NEED_SRCU_NMI_SAFE + default n + help + This option forces selection of the NEED_SRCU_NMI_SAFE + Kconfig option, allowing testing of srcu_read_lock_nmisafe() + and srcu_read_unlock_nmisafe() on architectures (like x86) + that select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.
Perhaps this should depend on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS?
kernel/rcu/Kconfig config TREE_SRCU · line 80
Quoted 3 lines
kernel/rcu/Kconfig +1
-0+ config NEED_SRCU_NMI_SAFE def_bool HAVE_NMI && !ARCH_HAS_NMI_SAFE_THIS_CPU_OPS && !TINY_SRCU
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Paul E. McKenney
maintainerRe: [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
Quoted 27 lines · Geert Uytterhoeven
Hi Boqun, Paul,
Quoted 8 lines · Boqun Feng
From: "Paul E. McKenney" <[email protected]>
The
srcu_read_lock_nmisafe()andsrcu_read_unlock_nmisafe()functions map to__srcu_read_lock()and__srcu_read_unlock()on systems like x86 that have NMI-safethis_cpu_inc()operations. This makes the underlying__srcu_read_lock_nmisafe()and__srcu_read_unlock_nmisafe()functions difficult to test on (for example) x86 systems, allowing bugs to creep in.Quoted 6 lines
This commit therefore creates a
FORCE_NEED_SRCU_NMI_SAFEKconfigthat forces those underlying functions to be used even on systems where they are not needed, thus providing better testing coverage.Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Boqun Feng <[email protected]>Thanks for your patch, which is now commit
536e8b9b80bc7a0a("srcu:
AddFORCE_NEED_SRCU_NMI_SAFEKconfigfor testing") in linus/masterQuoted 6 lines
kernel/rcu/Kconfig +0
-0@@ -65,6 +65,17 @@ config TREE_SRCU help This option selects the full-fledged version of SRCU.
Quoted 5 lines
kernel/rcu/Kconfig config TREE_SRCU · line 69
Quoted 2 lines
kernel/rcu/Kconfig +2
-0+config FORCE_NEED_SRCU_NMI_SAFE + bool "Force selection of NEED_SRCU_NMI_SAFE"What am I supposed to answer here? "n" I guess.
What about distro and allmodconfig kernels?
Yes, you should select "n" unless ...
Quoted 10 lines
kernel/rcu/Kconfig config TREE_SRCU · line 77
Quoted 8 lines
kernel/rcu/Kconfig +8
-0+ depends on !TINY_SRCU + select NEED_SRCU_NMI_SAFE + default n + help + This option forces selection of the NEED_SRCU_NMI_SAFE + Kconfig option, allowing testing of srcu_read_lock_nmisafe() + and srcu_read_unlock_nmisafe() on architectures (like x86) + that select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.Perhaps this should depend on
ARCH_HAS_NMI_SAFE_THIS_CPU_OPS?
... you are on a system selecting ARCH_HAS_NMI_SAFE_THIS_CPU_OPS and you would like to test the SRCU setup that needed only by systems that do not select ARCH_HAS_NMI_SAFE_THIS_CPU_OPS.
Ah. I forgot to add "depends on RCU_EXPERT".
Apologies, I will fix this. Does the patch show below do the trick?
Thanx, Paul
------------------------------------------------------------------------
commit b5c8c6f89c6d7ac778e961ad4b883eada0c1f42a
Author: Paul E. McKenney <[email protected]> Date: Tue Mar 25 07:31:45 2025 -0700
srcu: Make FORCE_NEED_SRCU_NMI_SAFE depend on RCU_EXPERT
The FORCE_NEED_SRCU_NMI_SAFE is useful only for those wishing to test the SRCU code paths that accommodate architectures that do not have NMI-safe per-CPU operations, that is, those architectures that do not select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option. As such, this is a specialized Kconfig option that is not intended for casual users.
This commit therefore hides it behind the RCU_EXPERT Kconfig option.
kernel/rcu/Kconfig +1 -0
@@ -68,6 +68,7 @@ config TREE_SRCU config FORCE_NEED_SRCU_NMI_SAFE bool "Force selection of NEED_SRCU_NMI_SAFE" depends on !TINY_SRCU + depends on RCU_EXPERT select NEED_SRCU_NMI_SAFE default n help
Re: [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
Hi Paul,
Quoted 43 lines · Paul E. McKenney
Quoted 25 lines · Geert Uytterhoeven
Quoted 8 lines · Boqun Feng
From: "Paul E. McKenney" <[email protected]>
The
srcu_read_lock_nmisafe()andsrcu_read_unlock_nmisafe()functions map to__srcu_read_lock()and__srcu_read_unlock()on systems like x86 that have NMI-safethis_cpu_inc()operations. This makes the underlying__srcu_read_lock_nmisafe()and__srcu_read_unlock_nmisafe()functions difficult to test on (for example) x86 systems, allowing bugs to creep in.Quoted 6 lines
This commit therefore creates a
FORCE_NEED_SRCU_NMI_SAFEKconfigthat forces those underlying functions to be used even on systems where they are not needed, thus providing better testing coverage.Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Boqun Feng <[email protected]>Thanks for your patch, which is now commit
536e8b9b80bc7a0a("srcu:
AddFORCE_NEED_SRCU_NMI_SAFEKconfigfor testing") in linus/masterQuoted 6 lines
kernel/rcu/Kconfig +0
-0@@ -65,6 +65,17 @@ config TREE_SRCU help This option selects the full-fledged version of SRCU.Quoted 5 lines
kernel/rcu/Kconfig config TREE_SRCU · line 69
Quoted 2 lines
kernel/rcu/Kconfig +2
-0+config FORCE_NEED_SRCU_NMI_SAFE + bool "Force selection of NEED_SRCU_NMI_SAFE"What am I supposed to answer here? "n" I guess.
What about distro and allmodconfig kernels?Yes, you should select "n" unless ...
Quoted 9 lines
Quoted 8 lines
kernel/rcu/Kconfig +8
-0+ depends on !TINY_SRCU + select NEED_SRCU_NMI_SAFE + default n + help + This option forces selection of the NEED_SRCU_NMI_SAFE + Kconfig option, allowing testing of srcu_read_lock_nmisafe() + and srcu_read_unlock_nmisafe() on architectures (like x86) + that select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.
Quoted 3 lines
Quoted 1 line
Perhaps this should depend on
ARCH_HAS_NMI_SAFE_THIS_CPU_OPS?... you are on a system selecting
ARCH_HAS_NMI_SAFE_THIS_CPU_OPSand
So a dependency on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS does make sense, doesn't it?
Quoted 4 lines
you would like to test the SRCU setup that needed only by systems that do not select
ARCH_HAS_NMI_SAFE_THIS_CPU_OPS.Ah. I forgot to add "depends on
RCU_EXPERT".
Yes, that makes sense.
Quoted 29 lines
Apologies, I will fix this. Does the patch show below do the trick?
Thanx, Paul
------------------------------------------------------------------------
commit
b5c8c6f89c6d7ac778e961ad4b883eada0c1f42aAuthor: Paul E. McKenney <[email protected]> Date: Tue Mar 25 07:31:45 2025 -0700srcu: Make
FORCE_NEED_SRCU_NMI_SAFEdepend onRCU_EXPERTThe
FORCE_NEED_SRCU_NMI_SAFEis useful only for those wishing to test the SRCU code paths that accommodate architectures that do not have NMI-safe per-CPU operations, that is, those architectures that do not select theARCH_HAS_NMI_SAFE_THIS_CPU_OPSKconfigoption. As such, this is a specializedKconfigoption that is not intended for casual users.This commit therefore hides it behind the
RCU_EXPERTKconfigoption.Reported-by Geert Uytterhoeven <[email protected]>Closes https://lore.kernel.org/all/CAMuHMdX6dy9_tmpLkpcnGzxyRbe6qSWYukcPp=H1GzZdyd3qBQ@mail.gmail.com/ open hereSigned-off-by Paul E. McKenney <[email protected]>kernel/rcu/Kconfig +0
-0
kernel/rcu/Kconfig config TREE_SRCU · line 74
Quoted 7 lines
kernel/rcu/Kconfig +1
-0@@ -68,6 +68,7 @@ config TREE_SRCU config FORCE_NEED_SRCU_NMI_SAFE bool "Force selection of NEED_SRCU_NMI_SAFE" depends on !TINY_SRCU + depends on RCU_EXPERT select NEED_SRCU_NMI_SAFE default n help
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Paul E. McKenney
maintainerRe: [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
Quoted 46 lines · Geert Uytterhoeven
Hi Paul,
Quoted 43 lines · Paul E. McKenney
Quoted 25 lines · Geert Uytterhoeven
Quoted 8 lines · Boqun Feng
From: "Paul E. McKenney" <[email protected]>
The
srcu_read_lock_nmisafe()andsrcu_read_unlock_nmisafe()functions map to__srcu_read_lock()and__srcu_read_unlock()on systems like x86 that have NMI-safethis_cpu_inc()operations. This makes the underlying__srcu_read_lock_nmisafe()and__srcu_read_unlock_nmisafe()functions difficult to test on (for example) x86 systems, allowing bugs to creep in.Quoted 6 lines
This commit therefore creates a
FORCE_NEED_SRCU_NMI_SAFEKconfigthat forces those underlying functions to be used even on systems where they are not needed, thus providing better testing coverage.Signed-off-by Paul E. McKenney <[email protected]>Signed-off-by Boqun Feng <[email protected]>Thanks for your patch, which is now commit
536e8b9b80bc7a0a("srcu:
AddFORCE_NEED_SRCU_NMI_SAFEKconfigfor testing") in linus/masterQuoted 6 lines
kernel/rcu/Kconfig +0
-0@@ -65,6 +65,17 @@ config TREE_SRCU help This option selects the full-fledged version of SRCU.Quoted 5 lines
kernel/rcu/Kconfig config TREE_SRCU · line 69
Quoted 2 lines
kernel/rcu/Kconfig +2
-0+config FORCE_NEED_SRCU_NMI_SAFE + bool "Force selection of NEED_SRCU_NMI_SAFE"What am I supposed to answer here? "n" I guess.
What about distro and allmodconfig kernels?Yes, you should select "n" unless ...
Quoted 9 lines
Quoted 8 lines
kernel/rcu/Kconfig +8
-0+ depends on !TINY_SRCU + select NEED_SRCU_NMI_SAFE + default n + help + This option forces selection of the NEED_SRCU_NMI_SAFE + Kconfig option, allowing testing of srcu_read_lock_nmisafe() + and srcu_read_unlock_nmisafe() on architectures (like x86) + that select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
Perhaps this should depend on
ARCH_HAS_NMI_SAFE_THIS_CPU_OPS?... you are on a system selecting
ARCH_HAS_NMI_SAFE_THIS_CPU_OPSandSo a dependency on
ARCH_HAS_NMI_SAFE_THIS_CPU_OPSdoes make sense, doesn't it?
The FORCE_NEED_SRCU_NMI_SAFE has no effect otherwise, so it cannot hurt. Again, please see below.
Thanx, Paul
Quoted 10 lines
Quoted 4 lines
you would like to test the SRCU setup that needed only by systems that do not select
ARCH_HAS_NMI_SAFE_THIS_CPU_OPS.Ah. I forgot to add "depends on
RCU_EXPERT".Yes, that makes sense.
Quoted 3 lines
Apologies, I will fix this. Does the patch show below do the trick?
Thanx, Paul
-----------------------------------------------------------------------
commit 2245ef8605a80726548253d885b4cadd97f69f3b
Author: Paul E. McKenney <[email protected]> Date: Tue Mar 25 07:31:45 2025 -0700
srcu: Make FORCE_NEED_SRCU_NMI_SAFE depend on RCU_EXPERT
The FORCE_NEED_SRCU_NMI_SAFE is useful only for those wishing to test the SRCU code paths that accommodate architectures that do not have NMI-safe per-CPU operations, that is, those architectures that do not select the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option. As such, this is a specialized Kconfig option that is not intended for casual users.
This commit therefore hides it behind the RCU_EXPERT Kconfig option. Given that this new FORCE_NEED_SRCU_NMI_SAFE Kconfig option has no effect unless the ARCH_HAS_NMI_SAFE_THIS_CPU_OPS Kconfig option is also selected, it also depends on this Kconfig option.
[ paulmck: Apply Geert Uytterhoeven feedback. ]
kernel/rcu/Kconfig +2 -0
@@ -68,6 +68,8 @@ config TREE_SRCU config FORCE_NEED_SRCU_NMI_SAFE bool "Force selection of NEED_SRCU_NMI_SAFE" depends on !TINY_SRCU + depends on RCU_EXPERT + depends on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS select NEED_SRCU_NMI_SAFE default n help
Geert Uytterhoeven
Reviewed-byRe: [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
Hi Paul,
Quoted 28 lines · Paul E. McKenney
commit
2245ef8605a80726548253d885b4cadd97f69f3bAuthor: Paul E. McKenney <[email protected]> Date: Tue Mar 25 07:31:45 2025 -0700srcu: Make
FORCE_NEED_SRCU_NMI_SAFEdepend onRCU_EXPERTThe
FORCE_NEED_SRCU_NMI_SAFEis useful only for those wishing to test the SRCU code paths that accommodate architectures that do not have NMI-safe per-CPU operations, that is, those architectures that do not select theARCH_HAS_NMI_SAFE_THIS_CPU_OPSKconfigoption. As such, this is a specializedKconfigoption that is not intended for casual users.This commit therefore hides it behind the
RCU_EXPERTKconfigoption. Given that this newFORCE_NEED_SRCU_NMI_SAFEKconfigoption has no effect unless theARCH_HAS_NMI_SAFE_THIS_CPU_OPSKconfigoption is also selected, it also depends on thisKconfigoption.[ paulmck: Apply Geert Uytterhoeven feedback. ]
Reported-by Geert Uytterhoeven <[email protected]>Closes https://lore.kernel.org/all/CAMuHMdX6dy9_tmpLkpcnGzxyRbe6qSWYukcPp=H1GzZdyd3qBQ@mail.gmail.com/ open hereSigned-off-by Paul E. McKenney <[email protected]>kernel/rcu/Kconfig +0
-0
kernel/rcu/Kconfig config TREE_SRCU · line 75
Quoted 8 lines
kernel/rcu/Kconfig +2
-0@@ -68,6 +68,8 @@ config TREE_SRCU config FORCE_NEED_SRCU_NMI_SAFE bool "Force selection of NEED_SRCU_NMI_SAFE" depends on !TINY_SRCU + depends on RCU_EXPERT + depends on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS select NEED_SRCU_NMI_SAFE default n help
LGTM, so
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
Quoted 41 lines · Geert Uytterhoeven
Hi Paul,
Quoted 28 lines · Paul E. McKenney
commit
2245ef8605a80726548253d885b4cadd97f69f3bAuthor: Paul E. McKenney <[email protected]> Date: Tue Mar 25 07:31:45 2025 -0700srcu: Make
FORCE_NEED_SRCU_NMI_SAFEdepend onRCU_EXPERTThe
FORCE_NEED_SRCU_NMI_SAFEis useful only for those wishing to test the SRCU code paths that accommodate architectures that do not have NMI-safe per-CPU operations, that is, those architectures that do not select theARCH_HAS_NMI_SAFE_THIS_CPU_OPSKconfigoption. As such, this is a specializedKconfigoption that is not intended for casual users.This commit therefore hides it behind the
RCU_EXPERTKconfigoption. Given that this newFORCE_NEED_SRCU_NMI_SAFEKconfigoption has no effect unless theARCH_HAS_NMI_SAFE_THIS_CPU_OPSKconfigoption is also selected, it also depends on thisKconfigoption.[ paulmck: Apply Geert Uytterhoeven feedback. ]
Reported-by Geert Uytterhoeven <[email protected]>Closes https://lore.kernel.org/all/CAMuHMdX6dy9_tmpLkpcnGzxyRbe6qSWYukcPp=H1GzZdyd3qBQ@mail.gmail.com/ open hereSigned-off-by Paul E. McKenney <[email protected]>kernel/rcu/Kconfig +0
-0kernel/rcu/Kconfig config TREE_SRCU · line 75
Quoted 8 lines
kernel/rcu/Kconfig +2
-0@@ -68,6 +68,8 @@ config TREE_SRCU config FORCE_NEED_SRCU_NMI_SAFE bool "Force selection of NEED_SRCU_NMI_SAFE" depends on !TINY_SRCU + depends on RCU_EXPERT + depends on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS select NEED_SRCU_NMI_SAFE default n helpLGTM, so
Quoted 1 line
Reviewed-by Geert Uytterhoeven <[email protected]>
Applied, and thank you very much for both the review and the report!
Thanx, Paul
Re: [PATCH rcu 10/11] srcu: Add FORCE_NEED_SRCU_NMI_SAFE Kconfig for testing
Quoted 44 lines · Paul E. McKenney
Quoted 41 lines · Geert Uytterhoeven
Hi Paul,
Quoted 28 lines · Paul E. McKenney
commit
2245ef8605a80726548253d885b4cadd97f69f3bAuthor: Paul E. McKenney <[email protected]> Date: Tue Mar 25 07:31:45 2025 -0700srcu: Make
FORCE_NEED_SRCU_NMI_SAFEdepend onRCU_EXPERTThe
FORCE_NEED_SRCU_NMI_SAFEis useful only for those wishing to test the SRCU code paths that accommodate architectures that do not have NMI-safe per-CPU operations, that is, those architectures that do not select theARCH_HAS_NMI_SAFE_THIS_CPU_OPSKconfigoption. As such, this is a specializedKconfigoption that is not intended for casual users.This commit therefore hides it behind the
RCU_EXPERTKconfigoption. Given that this newFORCE_NEED_SRCU_NMI_SAFEKconfigoption has no effect unless theARCH_HAS_NMI_SAFE_THIS_CPU_OPSKconfigoption is also selected, it also depends on thisKconfigoption.[ paulmck: Apply Geert Uytterhoeven feedback. ]
Reported-by Geert Uytterhoeven <[email protected]>Closes https://lore.kernel.org/all/CAMuHMdX6dy9_tmpLkpcnGzxyRbe6qSWYukcPp=H1GzZdyd3qBQ@mail.gmail.com/ open hereSigned-off-by Paul E. McKenney <[email protected]>kernel/rcu/Kconfig +0
-0kernel/rcu/Kconfig config TREE_SRCU · line 75
Quoted 8 lines
kernel/rcu/Kconfig +2
-0@@ -68,6 +68,8 @@ config TREE_SRCU config FORCE_NEED_SRCU_NMI_SAFE bool "Force selection of NEED_SRCU_NMI_SAFE" depends on !TINY_SRCU + depends on RCU_EXPERT + depends on ARCH_HAS_NMI_SAFE_THIS_CPU_OPS select NEED_SRCU_NMI_SAFE default n helpLGTM, so
Quoted 1 line
Reviewed-by Geert Uytterhoeven <[email protected]>
Quoted 2 lines
Applied, and thank you very much for both the review and the report!
Queued for further testing, thank you both!
Regards,
Boqun
Quoted 1 line
Thanx, Paul
PATCH 11/11 torture: Make SRCU lockdep testing use srcu_read_lock_nmisafe()
In reply to Boqun FengFrom: "Paul E. McKenney" <[email protected]>
Recent experience shows that the srcu_read_lock_nmisafe() and srcu_read_unlock_nmisafe() functions are not sufficiently tested. This commit therefore causes the torture.sh script's SRCU lockdep testing to use these two functions. This will cause these two functions to be regularly tested by several developers (myself included) who use torture.sh as an RCU acceptance test.
--- tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/rcutorture/bin/srcu_lockdep.sh +1 -1
@@ -49,7 +49,7 @@ do do err= val=$((d*1000+t*10+c)) - tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 5s --configs "SRCU-P" --bootargs "rcutorture.test_srcu_lockdep=$val" --trust-make --datestamp "$ds/$val" > "$T/kvm.sh.out" 2>&1 + tools/testing/selftests/rcutorture/bin/kvm.sh --allcpus --duration 5s --configs "SRCU-P" --kconfig "CONFIG_FORCE_NEED_SRCU_NMI_SAFE=y" --bootargs "rcutorture.test_srcu_lockdep=$val rcutorture.reader_flavor=0x2" --trust-make --datestamp "$ds/$val" > "$T/kvm.sh.out" 2>&1 ret=$? mv "$T/kvm.sh.out" "$RCUTORTURE/res/$ds/$val" if test "$d" -ne 0 && test "$ret" -eq 0
Signature · 1 line
2.39.5 (Apple Git-154)