SRCU updates for v5.1
Subsystems (2)
cover SRCU updates for v5.1
Hello!
This series contains SRCU updates:
1. Check for invalid idx argument in srcu_read_unlock().
2. Remove srcu_queue_delayed_work_on(), courtesy of Sebastian
Andrzej Siewior.
Thanx, Paul
------------------------------------------------------------------------
include/linux/srcu.h | 1 include/linux/srcutree.h | 3 +- kernel/rcu/srcutree.c | 55 ++++++++++++++++++++--------------------------- kernel/rcu/tree.c | 4 --- kernel/rcu/tree.h | 8 ------ 5 files changed, 27 insertions(+), 44 deletions(-)
PATCH 1/2 srcu: Check for invalid idx argument in srcu_read_unlock()
The current SRCU implementation has an idx argument of zero or one, and never anything else. This commit therefore adds a WARN_ON_ONCE() to complain if this restriction is violated.
--- include/linux/srcu.h | 1 + 1 file changed, 1 insertion(+)
include/linux/srcu.h +1 -0
@@ -223,6 +223,7 @@ srcu_read_lock_notrace(struct srcu_struct *ssp) __acquires(ssp)static inline void srcu_read_unlock (struct srcu_struct *ssp,int idx)__releases (ssp) { +WARN_ON_ONCE (idx & ~0x1 );rcu_lock_release (&(ssp)->dep_map);__srcu_read_unlock (ssp, idx); }
Signature · 1 line
2.17.1
PATCH 2/2 srcu: Remove srcu_queue_delayed_work_on()
In reply to Paul E. McKenneyFrom: Sebastian Andrzej Siewior <[email protected]>
srcu_queue_delayed_work_on() disables preemption (and therefore CPU hotplug in RCU's case) and then checks based on its own accounting if a CPU is online. If the CPU is online it uses queue_delayed_work_on() otherwise it fallbacks to queue_delayed_work().
The problem here is that queue_work() on -RT does not work with disabled preemption.
queue_work_on() works also on an offlined CPU. queue_delayed_work_on() has the problem that it is possible to program a timer on an offlined CPU. This timer will fire once the CPU is online again. But until then, the timer remains programmed and nothing will happen.
Add a local timer which will fire (as requested per delay) on the local CPU and then enqueue the work on the specific CPU.
RCUtorture testing with SRCU-P for 24h showed no problems.
--- include/linux/srcutree.h | 3 ++- kernel/rcu/srcutree.c | 55 ++++++++++++++++++---------------------- kernel/rcu/tree.c | 4 --- kernel/rcu/tree.h | 8 ------ 4 files changed, 26 insertions(+), 44 deletions(-)
include/linux/srcutree.h +2 -1
@@ -45,7 +45,8 @@ struct srcu_data {unsigned long srcu_gp_seq_needed;/* Furthest future GP needed. */ unsigned long srcu_gp_seq_needed_exp;/* Furthest future exp GP. */ bool srcu_cblist_invoking;/* Invoking these CBs? */ -struct delayed_work work;/* Context for CB invoking. */ +struct timer_list delay_work;/* Delay for CB invoking */ +struct work_struct work;/* Context for CB invoking. */ struct rcu_head srcu_barrier_head;/* For srcu_barrier() use. */ struct srcu_node *mynode;/* Leaf srcu_node. */ unsigned long grpmask;/* Mask for leaf srcu_node */
kernel/rcu/srcutree.c +24 -31
103 lines not on this page · raw message
kernel/rcu/tree.c +0 -4
@@ -3329,8 +3329,6 @@ int rcutree_online_cpu(unsigned int cpu)raw_spin_lock_irqsave_rcu_node (rnp, flags); rnp->ffmask |= rdp->grpmask;raw_spin_unlock_irqrestore_rcu_node (rnp, flags); -if (IS_ENABLED (CONFIG_TREE_SRCU )) -srcu_online_cpu (cpu);if (rcu_scheduler_active ==RCU_SCHEDULER_INACTIVE )return 0 ;/* Too early in boot for scheduler work. */ sync_sched_exp_online_cleanup (cpu);
@@ -3355,8 +3353,6 @@ int rcutree_offline_cpu(unsigned int cpu)raw_spin_unlock_irqrestore_rcu_node (rnp, flags);rcutree_affinity_setting (cpu, cpu); -if (IS_ENABLED (CONFIG_TREE_SRCU )) -srcu_offline_cpu (cpu);return 0 ; }
kernel/rcu/tree.h +0 -8
@@ -462,11 +462,3 @@ static void rcu_bind_gp_kthread(void);static bool rcu_nohz_full_cpu (void );static void rcu_dynticks_task_enter (void );static void rcu_dynticks_task_exit (void ); - -#ifdef CONFIG_SRCU -void srcu_online_cpu (unsigned int cpu); -void srcu_offline_cpu (unsigned int cpu); -#else /* #ifdef CONFIG_SRCU */ -void srcu_online_cpu (unsigned int cpu) { } -void srcu_offline_cpu (unsigned int cpu) { } -#endif /* #else #ifdef CONFIG_SRCU */
Signature · 1 line
2.17.1