Commit 07046958 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
  ...
parents 66fd704d 9c80e443
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -334,7 +334,7 @@ If the system-call audit module were to ever need to reject stale data, one way
to accomplish this would be to add a ``deleted`` flag and a ``lock`` spinlock to the
``audit_entry`` structure, and modify audit_filter_task() as follows::

	static enum audit_state audit_filter_task(struct task_struct *tsk)
	static struct audit_entry *audit_filter_task(struct task_struct *tsk, char **key)
	{
		struct audit_entry *e;
		enum audit_state   state;
@@ -346,16 +346,18 @@ to accomplish this would be to add a ``deleted`` flag and a ``lock`` spinlock to
				if (e->deleted) {
					spin_unlock(&e->lock);
					rcu_read_unlock();
					return AUDIT_BUILD_CONTEXT;
					return NULL;
				}
				rcu_read_unlock();
				if (state == AUDIT_STATE_RECORD)
					*key = kstrdup(e->rule.filterkey, GFP_ATOMIC);
				return state;
				/* As long as e->lock is held, e is valid and
				 * its value is not stale */
				return e;
			}
		}
		rcu_read_unlock();
		return AUDIT_BUILD_CONTEXT;
		return NULL;
	}

The ``audit_del_rule()`` function would need to set the ``deleted`` flag under the
+3 −0
Original line number Diff line number Diff line
@@ -15,6 +15,9 @@ to start learning about RCU:
|	2014 Big API Table           https://lwn.net/Articles/609973/
| 6.	The RCU API, 2019 Edition    https://lwn.net/Articles/777036/
|	2019 Big API Table           https://lwn.net/Articles/777165/
| 7.	The RCU API, 2024 Edition    https://lwn.net/Articles/988638/
|       2024 Background Information  https://lwn.net/Articles/988641/
|	2024 Big API Table           https://lwn.net/Articles/988666/

For those preferring video:

+25 −0
Original line number Diff line number Diff line
@@ -5672,6 +5672,31 @@
			are zero, rcutorture acts as if is interpreted
			they are all non-zero.

	rcutorture.gpwrap_lag= [KNL]
			Enable grace-period wrap lag testing. Setting
			to false prevents the gpwrap lag test from
			running. Default is true.

	rcutorture.gpwrap_lag_gps= [KNL]
			Set the value for grace-period wrap lag during
			active lag testing periods. This controls how many
			grace periods differences we tolerate between
			rdp and rnp's gp_seq before setting overflow flag.
			The default is always set to 8.

	rcutorture.gpwrap_lag_cycle_mins= [KNL]
			Set the total cycle duration for gpwrap lag
			testing in minutes. This is the total time for
			one complete cycle of active and inactive
			testing periods. Default is 30 minutes.

	rcutorture.gpwrap_lag_active_mins= [KNL]
			Set the duration for which gpwrap lag is active
			within each cycle, in minutes. During this time,
			the grace-period wrap lag will be set to the
			value specified by gpwrap_lag_gps. Default is
			5 minutes.

	rcutorture.irqreader= [KNL]
			Run RCU readers from irq handlers, or, more
			accurately, from a timer handler.  Not all RCU
+4 −4
Original line number Diff line number Diff line
@@ -1682,7 +1682,7 @@ M: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
M:	Arve Hjønnevåg <arve@android.com>
M:	Todd Kjos <tkjos@android.com>
M:	Martijn Coenen <maco@android.com>
M:	Joel Fernandes <joel@joelfernandes.org>
M:	Joel Fernandes <joelagnelf@nvidia.com>
M:	Christian Brauner <christian@brauner.io>
M:	Carlos Llamas <cmllamas@google.com>
M:	Suren Baghdasaryan <surenb@google.com>
@@ -13746,7 +13746,7 @@ M: Luc Maranget <luc.maranget@inria.fr>
M:	"Paul E. McKenney" <paulmck@kernel.org>
R:	Akira Yokosawa <akiyks@gmail.com>
R:	Daniel Lustig <dlustig@nvidia.com>
R:	Joel Fernandes <joel@joelfernandes.org>
R:	Joel Fernandes <joelagnelf@nvidia.com>
L:	linux-kernel@vger.kernel.org
L:	linux-arch@vger.kernel.org
L:	lkmm@lists.linux.dev
@@ -20514,14 +20514,14 @@ READ-COPY UPDATE (RCU)
M:	"Paul E. McKenney" <paulmck@kernel.org>
M:	Frederic Weisbecker <frederic@kernel.org> (kernel/rcu/tree_nocb.h)
M:	Neeraj Upadhyay <neeraj.upadhyay@kernel.org> (kernel/rcu/tasks.h)
M:	Joel Fernandes <joel@joelfernandes.org>
M:	Joel Fernandes <joelagnelf@nvidia.com>
M:	Josh Triplett <josh@joshtriplett.org>
M:	Boqun Feng <boqun.feng@gmail.com>
M:	Uladzislau Rezki <urezki@gmail.com>
R:	Steven Rostedt <rostedt@goodmis.org>
R:	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
R:	Lai Jiangshan <jiangshanlai@gmail.com>
R:	Zqiang <qiang.zhang1211@gmail.com>
R:	Zqiang <qiang.zhang@linux.dev>
L:	rcu@vger.kernel.org
S:	Supported
W:	http://www.rdrop.com/users/paulmck/RCU/
+17 −1
Original line number Diff line number Diff line
@@ -57,6 +57,9 @@
/* Low-order bit definition for polled grace-period APIs. */
#define RCU_GET_STATE_COMPLETED	0x1

/* A complete grace period count */
#define RCU_SEQ_GP (RCU_SEQ_STATE_MASK + 1)

extern int sysctl_sched_rt_runtime;

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

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

/*
@@ -572,6 +584,8 @@ void do_trace_rcu_torture_read(const char *rcutorturename,
			       unsigned long c_old,
			       unsigned long c);
void rcu_gp_set_torture_wait(int duration);
void rcu_set_gpwrap_lag(unsigned long lag);
int rcu_get_gpwrap_count(int cpu);
#else
static inline void rcutorture_get_gp_data(int *flags, unsigned long *gp_seq)
{
@@ -589,6 +603,8 @@ void do_trace_rcu_torture_read(const char *rcutorturename,
	do { } while (0)
#endif
static inline void rcu_gp_set_torture_wait(int duration) { }
static inline void rcu_set_gpwrap_lag(unsigned long lag) { }
static inline int rcu_get_gpwrap_count(int cpu) { return 0; }
#endif
unsigned long long rcutorture_gather_gp_seqs(void);
void rcutorture_format_gp_seqs(unsigned long long seqs, char *cp, size_t len);
Loading