Commit 9f3ee94e authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull RCU updates from Uladzislau Rezki:
 "Misc fixes:
   - check if IRQs are disabled in rcu_exp_need_qs()
   - instrument KCSAN exclusive-writer assertions
   - add extra WARN_ON_ONCE() check
   - set the cpu_no_qs.b.exp under lock
   - warn if callback enqueued on offline CPU

  Torture-test updates:
   - add rcutorture.preempt_duration kernel module parameter
   - make the TREE03 scenario do preemption
   - improve pooling timeouts for rcu_torture_writer()
   - improve output of "Failure/close-call rcutorture reader segments"
   - add some reader-state debugging checks
   - update doc of polled APIs
   - add extra diagnostics for per-reader-segment preemption
   - add an extra test for sched_clock()
   - improve testing on unresponsive systems

  SRCU updates:
   - improve doc for srcu_read_lock() in terms of return value
   - fix typo in comments
   - remove redundant GP sequence checks in the srcu_funnel_gp_start"

* tag 'rcu.release.v6.14' of git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux: (31 commits)
  srcu: Remove redundant GP sequence checks in srcu_funnel_gp_start
  srcu: Fix typo s/srcu_check_read_flavor()/__srcu_check_read_flavor()/
  srcu: Guarantee non-negative return value from srcu_read_lock()
  MAINTAINERS: Update RCU git tree
  rcu: Add lockdep_assert_irqs_disabled() to rcu_exp_need_qs()
  rcu: Add KCSAN exclusive-writer assertions for rdp->cpu_no_qs.b.exp
  rcu: Make preemptible rcu_exp_handler() check idempotency
  rcu: Replace open-coded rcu_exp_need_qs() from rcu_exp_handler() with call
  rcu: Move rcu_report_exp_rdp() setting of ->cpu_no_qs.b.exp under lock
  rcu: Make rcu_report_exp_cpu_mult() caller acquire lock
  rcu: Report callbacks enqueued on offline CPU blind spot
  rcutorture: Use symbols for SRCU reader flavors
  rcutorture: Add per-reader-segment preemption diagnostics
  rcutorture: Read CPU ID for decoration protected by both reader types
  rcutorture: Add preempt_count() to rcutorture_one_extend_check() diagnostics
  rcutorture: Add parameters to control polled/conditional wait interval
  rcutorture: Add documentation for recent conditional and polled APIs
  rcutorture: Ignore attempts to test preemption and forward progress
  rcutorture: Make rcutorture_one_extend() check reader state
  rcutorture: Pretty-print rcutorture reader segments
  ...
parents ad37df3b 4b5c2205
Loading
Loading
Loading
Loading
+89 −1
Original line number Diff line number Diff line
@@ -5524,7 +5524,42 @@

	rcutorture.gp_cond= [KNL]
			Use conditional/asynchronous update-side
			primitives, if available.
			normal-grace-period primitives, if available.

	rcutorture.gp_cond_exp= [KNL]
			Use conditional/asynchronous update-side
			expedited-grace-period primitives, if available.

	rcutorture.gp_cond_full= [KNL]
			Use conditional/asynchronous update-side
			normal-grace-period primitives that also take
			concurrent expedited grace periods into account,
			if available.

	rcutorture.gp_cond_exp_full= [KNL]
			Use conditional/asynchronous update-side
			expedited-grace-period primitives that also take
			concurrent normal grace periods into account,
			if available.

	rcutorture.gp_cond_wi= [KNL]
			Nominal wait interval for normal conditional
			grace periods (specified by rcutorture's
			gp_cond and gp_cond_full module parameters),
			in microseconds.  The actual wait interval will
			be randomly selected to nanosecond granularity up
			to this wait interval.	Defaults to 16 jiffies,
			for example, 16,000 microseconds on a system
			with HZ=1000.

	rcutorture.gp_cond_wi_exp= [KNL]
			Nominal wait interval for expedited conditional
			grace periods (specified by rcutorture's
			gp_cond_exp and gp_cond_exp_full module
			parameters), in microseconds.  The actual wait
			interval will be randomly selected to nanosecond
			granularity up to this wait interval.  Defaults to
			128 microseconds.

	rcutorture.gp_exp= [KNL]
			Use expedited update-side primitives, if available.
@@ -5533,6 +5568,43 @@
			Use normal (non-expedited) asynchronous
			update-side primitives, if available.

	rcutorture.gp_poll= [KNL]
			Use polled update-side normal-grace-period
			primitives, if available.

	rcutorture.gp_poll_exp= [KNL]
			Use polled update-side expedited-grace-period
			primitives, if available.

	rcutorture.gp_poll_full= [KNL]
			Use polled update-side normal-grace-period
			primitives that also take concurrent expedited
			grace periods into account, if available.

	rcutorture.gp_poll_exp_full= [KNL]
			Use polled update-side expedited-grace-period
			primitives that also take concurrent normal
			grace periods into account, if available.

	rcutorture.gp_poll_wi= [KNL]
			Nominal wait interval for normal conditional
			grace periods (specified by rcutorture's
			gp_poll and gp_poll_full module parameters),
			in microseconds.  The actual wait interval will
			be randomly selected to nanosecond granularity up
			to this wait interval.	Defaults to 16 jiffies,
			for example, 16,000 microseconds on a system
			with HZ=1000.

	rcutorture.gp_poll_wi_exp= [KNL]
			Nominal wait interval for expedited conditional
			grace periods (specified by rcutorture's
			gp_poll_exp and gp_poll_exp_full module
			parameters), in microseconds.  The actual wait
			interval will be randomly selected to nanosecond
			granularity up to this wait interval.  Defaults to
			128 microseconds.

	rcutorture.gp_sync= [KNL]
			Use normal (non-expedited) synchronous
			update-side primitives, if available.  If all
@@ -5586,6 +5658,22 @@
			Set time (jiffies) between CPU-hotplug operations,
			or zero to disable CPU-hotplug testing.

	rcutorture.preempt_duration= [KNL]
			Set duration (in milliseconds) of preemptions
			by a high-priority FIFO real-time task.  Set to
			zero (the default) to disable.	The CPUs to
			preempt are selected randomly from the set that
			are online at a given point in time.  Races with
			CPUs going offline are ignored, with that attempt
			at preemption skipped.

	rcutorture.preempt_interval= [KNL]
			Set interval (in milliseconds, defaulting to one
			second) between preemptions by a high-priority
			FIFO real-time task.  This delay is mediated
			by an hrtimer and is further fuzzed to avoid
			inadvertent synchronizations.

	rcutorture.read_exit_burst= [KNL]
			The number of times in a given read-then-exit
			episode that a set of read-then-exit kthreads
+5 −5
Original line number Diff line number Diff line
@@ -13315,7 +13315,7 @@ L: linux-kernel@vger.kernel.org
L:	linux-arch@vger.kernel.org
L:	lkmm@lists.linux.dev
S:	Supported
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git rcu/dev
F:	Documentation/atomic_bitops.txt
F:	Documentation/atomic_t.txt
F:	Documentation/core-api/refcount-vs-atomic.rst
@@ -19629,7 +19629,7 @@ R: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
R:	Lai Jiangshan <jiangshanlai@gmail.com>
L:	rcu@vger.kernel.org
S:	Supported
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git rcu/dev
F:	tools/testing/selftests/rcutorture
RDACM20 Camera Sensor
@@ -19708,7 +19708,7 @@ R: Zqiang <qiang.zhang1211@gmail.com>
L:	rcu@vger.kernel.org
S:	Supported
W:	http://www.rdrop.com/users/paulmck/RCU/
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git rcu/dev
F:	Documentation/RCU/
F:	include/linux/rcu*
F:	kernel/rcu/
@@ -21606,7 +21606,7 @@ R: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
L:	rcu@vger.kernel.org
S:	Supported
W:	http://www.rdrop.com/users/paulmck/RCU/
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git rcu/dev
F:	include/linux/srcu*.h
F:	kernel/rcu/srcu*.c
@@ -23731,7 +23731,7 @@ M: "Paul E. McKenney" <paulmck@kernel.org>
M:	Josh Triplett <josh@joshtriplett.org>
L:	linux-kernel@vger.kernel.org
S:	Supported
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git dev
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/rcu/linux.git rcu/dev
F:	Documentation/RCU/torture.rst
F:	kernel/locking/locktorture.c
F:	kernel/rcu/rcuscale.c
+11 −0
Original line number Diff line number Diff line
@@ -65,4 +65,15 @@ static inline void cond_resched_rcu(void)
#endif
}

// Has the current task blocked within its current RCU read-side
// critical section?
static inline bool has_rcu_reader_blocked(void)
{
#ifdef CONFIG_PREEMPT_RCU
	return !list_empty(&current->rcu_node_entry);
#else
	return false;
#endif
}

#endif /* _LINUX_SCHED_RCUPDATE_WAIT_H */
+14 −7
Original line number Diff line number Diff line
@@ -43,6 +43,12 @@ int init_srcu_struct(struct srcu_struct *ssp);
#define __SRCU_DEP_MAP_INIT(srcu_name)
#endif /* #else #ifdef CONFIG_DEBUG_LOCK_ALLOC */

/* Values for SRCU Tree srcu_data ->srcu_reader_flavor, but also used by rcutorture. */
#define SRCU_READ_FLAVOR_NORMAL	0x1		// srcu_read_lock().
#define SRCU_READ_FLAVOR_NMI	0x2		// srcu_read_lock_nmisafe().
#define SRCU_READ_FLAVOR_LITE	0x4		// srcu_read_lock_lite().
#define SRCU_READ_FLAVOR_ALL	0x7		// All of the above.

#ifdef CONFIG_TINY_SRCU
#include <linux/srcutiny.h>
#elif defined(CONFIG_TREE_SRCU)
@@ -232,13 +238,14 @@ static inline int srcu_read_lock_held(const struct srcu_struct *ssp)
 * a mutex that is held elsewhere while calling synchronize_srcu() or
 * synchronize_srcu_expedited().
 *
 * The return value from srcu_read_lock() must be passed unaltered
 * to the matching srcu_read_unlock().  Note that srcu_read_lock() and
 * the matching srcu_read_unlock() must occur in the same context, for
 * example, it is illegal to invoke srcu_read_unlock() in an irq handler
 * if the matching srcu_read_lock() was invoked in process context.  Or,
 * for that matter to invoke srcu_read_unlock() from one task and the
 * matching srcu_read_lock() from another.
 * The return value from srcu_read_lock() is guaranteed to be
 * non-negative.  This value must be passed unaltered to the matching
 * srcu_read_unlock().  Note that srcu_read_lock() and the matching
 * srcu_read_unlock() must occur in the same context, for example, it is
 * illegal to invoke srcu_read_unlock() in an irq handler if the matching
 * srcu_read_lock() was invoked in process context.  Or, for that matter to
 * invoke srcu_read_unlock() from one task and the matching srcu_read_lock()
 * from another.
 */
static inline int srcu_read_lock(struct srcu_struct *ssp) __acquires(ssp)
{
+2 −6
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ struct srcu_data {
	atomic_long_t srcu_lock_count[2];	/* Locks per CPU. */
	atomic_long_t srcu_unlock_count[2];	/* Unlocks per CPU. */
	int srcu_reader_flavor;			/* Reader flavor for srcu_struct structure? */
						/* Values: SRCU_READ_FLAVOR_.*  */

	/* Update-side state. */
	spinlock_t __private lock ____cacheline_internodealigned_in_smp;
@@ -43,11 +44,6 @@ struct srcu_data {
	struct srcu_struct *ssp;
};

/* Values for ->srcu_reader_flavor. */
#define SRCU_READ_FLAVOR_NORMAL	0x1		// srcu_read_lock().
#define SRCU_READ_FLAVOR_NMI	0x2		// srcu_read_lock_nmisafe().
#define SRCU_READ_FLAVOR_LITE	0x4		// srcu_read_lock_lite().

/*
 * Node in SRCU combining tree, similar in function to rcu_data.
 */
@@ -258,7 +254,7 @@ static inline void srcu_check_read_flavor_lite(struct srcu_struct *ssp)
	if (likely(READ_ONCE(sdp->srcu_reader_flavor) & SRCU_READ_FLAVOR_LITE))
		return;

	// Note that the cmpxchg() in srcu_check_read_flavor() is fully ordered.
	// Note that the cmpxchg() in __srcu_check_read_flavor() is fully ordered.
	__srcu_check_read_flavor(ssp, SRCU_READ_FLAVOR_LITE);
}

Loading