Skip to content

Commit 0704695

Browse files
committed
Merge tag 'next.2025.05.17a' of git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux
Pull RCU updates from Joel Fernandes: - Removed swake_up_one_online() workaround - Reverted an incorrect rcuog wake-up fix from offline softirq - Rust RCU Guard methods marked as inline - Updated MAINTAINERS with Joel’s and Zqiang's new email address - Replaced magic constant in rcu_seq_done_exact() with named constant - Added warning mechanism to validate rcu_seq_done_exact() - Switched SRCU polling API to use rcu_seq_done_exact() - Commented on redundant delta check in rcu_seq_done_exact() - Made ->gpwrap tests in rcutorture more frequent - Fixed reuse of ARM64 images in rcutorture - rcutorture improved to check Kconfig and reader conflict handling - Extracted logic from rcu_torture_one_read() for clarity - Updated LWN RCU API documentation links - Enabled --do-rt in torture.sh for CONFIG_PREEMPT_RT - Added tests for SRCU up/down reader primitives - Added comments and delays checks in rcutorture - Deprecated srcu_read_lock_lite() and srcu_read_unlock_lite() via checkpatch - Added --do-normal and --do-no-normal to torture.sh - Added RCU Rust binding tests to torture.sh - Reduced CPU overcommit and removed MAXSMP/CPUMASK_OFFSTACK in TREE01 - Replaced kmalloc() with kcalloc() in rcuscale - Refined listRCU example code for stale data elimination - Fixed hardirq count bug for x86 in cpu_stall_cputime - Added safety checks in rcu/nocb for offloaded rdp access - Other miscellaneous changes * tag 'next.2025.05.17a' of git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux: (27 commits) rcutorture: Fix issue with re-using old images on ARM64 rcutorture: Remove MAXSMP and CPUMASK_OFFSTACK from TREE01 rcutorture: Reduce TREE01 CPU overcommit torture: Check for "Call trace:" as well as "Call Trace:" rcutorture: Perform more frequent testing of ->gpwrap torture: Add testing of RCU's Rust bindings to torture.sh torture: Add --do-{,no-}normal to torture.sh checkpatch: Deprecate srcu_read_lock_lite() and srcu_read_unlock_lite() rcutorture: Comment invocations of tick_dep_set_task() rcu/nocb: Add Safe checks for access offloaded rdp rcuscale: using kcalloc() to relpace kmalloc() doc/RCU/listRCU: refine example code for eliminating stale data doc: Update LWN RCU API links in whatisRCU.rst Revert "rcu/nocb: Fix rcuog wake-up from offline softirq" rust: sync: rcu: Mark Guard methods as inline rcu/cpu_stall_cputime: fix the hardirq count for x86 architecture rcu: Remove swake_up_one_online() bandaid MAINTAINERS: Update Zqiang's email address rcutorture: Make torture.sh --do-rt use CONFIG_PREEMPT_RT srcu: Use rcu_seq_done_exact() for polling API ...
2 parents 66fd704 + 9c80e44 commit 0704695

File tree

23 files changed

+403
-124
lines changed

23 files changed

+403
-124
lines changed

Documentation/RCU/listRCU.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ If the system-call audit module were to ever need to reject stale data, one way
334334
to accomplish this would be to add a ``deleted`` flag and a ``lock`` spinlock to the
335335
``audit_entry`` structure, and modify audit_filter_task() as follows::
336336

337-
static enum audit_state audit_filter_task(struct task_struct *tsk)
337+
static struct audit_entry *audit_filter_task(struct task_struct *tsk, char **key)
338338
{
339339
struct audit_entry *e;
340340
enum audit_state state;
@@ -346,16 +346,18 @@ to accomplish this would be to add a ``deleted`` flag and a ``lock`` spinlock to
346346
if (e->deleted) {
347347
spin_unlock(&e->lock);
348348
rcu_read_unlock();
349-
return AUDIT_BUILD_CONTEXT;
349+
return NULL;
350350
}
351351
rcu_read_unlock();
352352
if (state == AUDIT_STATE_RECORD)
353353
*key = kstrdup(e->rule.filterkey, GFP_ATOMIC);
354-
return state;
354+
/* As long as e->lock is held, e is valid and
355+
* its value is not stale */
356+
return e;
355357
}
356358
}
357359
rcu_read_unlock();
358-
return AUDIT_BUILD_CONTEXT;
360+
return NULL;
359361
}
360362

361363
The ``audit_del_rule()`` function would need to set the ``deleted`` flag under the

Documentation/RCU/whatisRCU.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ to start learning about RCU:
1515
| 2014 Big API Table https://lwn.net/Articles/609973/
1616
| 6. The RCU API, 2019 Edition https://lwn.net/Articles/777036/
1717
| 2019 Big API Table https://lwn.net/Articles/777165/
18+
| 7. The RCU API, 2024 Edition https://lwn.net/Articles/988638/
19+
| 2024 Background Information https://lwn.net/Articles/988641/
20+
| 2024 Big API Table https://lwn.net/Articles/988666/
1821
1922
For those preferring video:
2023

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5672,6 +5672,31 @@
56725672
are zero, rcutorture acts as if is interpreted
56735673
they are all non-zero.
56745674

5675+
rcutorture.gpwrap_lag= [KNL]
5676+
Enable grace-period wrap lag testing. Setting
5677+
to false prevents the gpwrap lag test from
5678+
running. Default is true.
5679+
5680+
rcutorture.gpwrap_lag_gps= [KNL]
5681+
Set the value for grace-period wrap lag during
5682+
active lag testing periods. This controls how many
5683+
grace periods differences we tolerate between
5684+
rdp and rnp's gp_seq before setting overflow flag.
5685+
The default is always set to 8.
5686+
5687+
rcutorture.gpwrap_lag_cycle_mins= [KNL]
5688+
Set the total cycle duration for gpwrap lag
5689+
testing in minutes. This is the total time for
5690+
one complete cycle of active and inactive
5691+
testing periods. Default is 30 minutes.
5692+
5693+
rcutorture.gpwrap_lag_active_mins= [KNL]
5694+
Set the duration for which gpwrap lag is active
5695+
within each cycle, in minutes. During this time,
5696+
the grace-period wrap lag will be set to the
5697+
value specified by gpwrap_lag_gps. Default is
5698+
5 minutes.
5699+
56755700
rcutorture.irqreader= [KNL]
56765701
Run RCU readers from irq handlers, or, more
56775702
accurately, from a timer handler. Not all RCU

MAINTAINERS

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1682,7 +1682,7 @@ M: Greg Kroah-Hartman <[email protected]>
16821682
M: Arve Hjønnevåg <[email protected]>
16831683
M: Todd Kjos <[email protected]>
16841684
M: Martijn Coenen <[email protected]>
1685-
M: Joel Fernandes <[email protected]>
1685+
M: Joel Fernandes <[email protected]>
16861686
M: Christian Brauner <[email protected]>
16871687
M: Carlos Llamas <[email protected]>
16881688
M: Suren Baghdasaryan <[email protected]>
@@ -13746,7 +13746,7 @@ M: Luc Maranget <[email protected]>
1374613746
M: "Paul E. McKenney" <[email protected]>
1374713747
R: Akira Yokosawa <[email protected]>
1374813748
R: Daniel Lustig <[email protected]>
13749-
R: Joel Fernandes <[email protected]>
13749+
R: Joel Fernandes <[email protected]>
1375013750
1375113751
1375213752
@@ -20514,14 +20514,14 @@ READ-COPY UPDATE (RCU)
2051420514
M: "Paul E. McKenney" <[email protected]>
2051520515
M: Frederic Weisbecker <[email protected]> (kernel/rcu/tree_nocb.h)
2051620516
M: Neeraj Upadhyay <[email protected]> (kernel/rcu/tasks.h)
20517-
M: Joel Fernandes <[email protected]>
20517+
M: Joel Fernandes <[email protected]>
2051820518
M: Josh Triplett <[email protected]>
2051920519
M: Boqun Feng <[email protected]>
2052020520
M: Uladzislau Rezki <[email protected]>
2052120521
R: Steven Rostedt <[email protected]>
2052220522
R: Mathieu Desnoyers <[email protected]>
2052320523
R: Lai Jiangshan <[email protected]>
20524-
R: Zqiang <qiang.[email protected]>
20524+
R: Zqiang <qiang.[email protected]>
2052520525
2052620526
S: Supported
2052720527
W: http://www.rdrop.com/users/paulmck/RCU/

kernel/rcu/rcu.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
/* Low-order bit definition for polled grace-period APIs. */
5858
#define RCU_GET_STATE_COMPLETED 0x1
5959

60+
/* A complete grace period count */
61+
#define RCU_SEQ_GP (RCU_SEQ_STATE_MASK + 1)
62+
6063
extern int sysctl_sched_rt_runtime;
6164

6265
/*
@@ -157,12 +160,21 @@ static inline bool rcu_seq_done(unsigned long *sp, unsigned long s)
157160
* Given a snapshot from rcu_seq_snap(), determine whether or not a
158161
* full update-side operation has occurred, but do not allow the
159162
* (ULONG_MAX / 2) safety-factor/guard-band.
163+
*
164+
* The token returned by get_state_synchronize_rcu_full() is based on
165+
* rcu_state.gp_seq but it is tested in poll_state_synchronize_rcu_full()
166+
* against the root rnp->gp_seq. Since rcu_seq_start() is first called
167+
* on rcu_state.gp_seq and only later reflected on the root rnp->gp_seq,
168+
* it is possible that rcu_seq_snap(rcu_state.gp_seq) returns 2 full grace
169+
* periods ahead of the root rnp->gp_seq. To prevent false-positives with the
170+
* full polling API that a wrap around instantly completed the GP, when nothing
171+
* like that happened, adjust for the 2 GPs in the ULONG_CMP_LT().
160172
*/
161173
static inline bool rcu_seq_done_exact(unsigned long *sp, unsigned long s)
162174
{
163175
unsigned long cur_s = READ_ONCE(*sp);
164176

165-
return ULONG_CMP_GE(cur_s, s) || ULONG_CMP_LT(cur_s, s - (3 * RCU_SEQ_STATE_MASK + 1));
177+
return ULONG_CMP_GE(cur_s, s) || ULONG_CMP_LT(cur_s, s - (2 * RCU_SEQ_GP));
166178
}
167179

168180
/*
@@ -572,6 +584,8 @@ void do_trace_rcu_torture_read(const char *rcutorturename,
572584
unsigned long c_old,
573585
unsigned long c);
574586
void rcu_gp_set_torture_wait(int duration);
587+
void rcu_set_gpwrap_lag(unsigned long lag);
588+
int rcu_get_gpwrap_count(int cpu);
575589
#else
576590
static inline void rcutorture_get_gp_data(int *flags, unsigned long *gp_seq)
577591
{
@@ -589,6 +603,8 @@ void do_trace_rcu_torture_read(const char *rcutorturename,
589603
do { } while (0)
590604
#endif
591605
static inline void rcu_gp_set_torture_wait(int duration) { }
606+
static inline void rcu_set_gpwrap_lag(unsigned long lag) { }
607+
static inline int rcu_get_gpwrap_count(int cpu) { return 0; }
592608
#endif
593609
unsigned long long rcutorture_gather_gp_seqs(void);
594610
void rcutorture_format_gp_seqs(unsigned long long seqs, char *cp, size_t len);

kernel/rcu/rcuscale.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -762,7 +762,7 @@ kfree_scale_thread(void *arg)
762762
}
763763

764764
for (i = 0; i < kfree_alloc_num; i++) {
765-
alloc_ptr = kmalloc(kfree_mult * sizeof(struct kfree_obj), GFP_KERNEL);
765+
alloc_ptr = kcalloc(kfree_mult, sizeof(struct kfree_obj), GFP_KERNEL);
766766
if (!alloc_ptr)
767767
return -ENOMEM;
768768

0 commit comments

Comments
 (0)