Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

srcu: Move rcu_is_watching() checks to srcu_read_{,un}lock_fast()

The rcu_is_watching() warnings are currently in the SRCU-tree
implementations of __srcu_read_lock_fast() and __srcu_read_unlock_fast().
However, this makes it difficult to create _notrace variants of
srcu_read_lock_fast() and srcu_read_unlock_fast(). This commit therefore
moves these checks to srcu_read_lock_fast(), srcu_read_unlock_fast(),
srcu_down_read_fast(), and srcu_up_read_fast().

Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Joel Fernandes <joelagnelf@nvidia.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: <bpf@vger.kernel.org>

+4 -2
+4
include/linux/srcu.h
··· 275 275 { 276 276 struct srcu_ctr __percpu *retval; 277 277 278 + RCU_LOCKDEP_WARN(!rcu_is_watching(), "RCU must be watching srcu_read_lock_fast()."); 278 279 srcu_check_read_flavor_force(ssp, SRCU_READ_FLAVOR_FAST); 279 280 retval = __srcu_read_lock_fast(ssp); 280 281 rcu_try_lock_acquire(&ssp->dep_map); ··· 296 295 static inline struct srcu_ctr __percpu *srcu_down_read_fast(struct srcu_struct *ssp) __acquires(ssp) 297 296 { 298 297 WARN_ON_ONCE(IS_ENABLED(CONFIG_PROVE_RCU) && in_nmi()); 298 + RCU_LOCKDEP_WARN(!rcu_is_watching(), "RCU must be watching srcu_down_read_fast()."); 299 299 srcu_check_read_flavor_force(ssp, SRCU_READ_FLAVOR_FAST); 300 300 return __srcu_read_lock_fast(ssp); 301 301 } ··· 391 389 srcu_check_read_flavor(ssp, SRCU_READ_FLAVOR_FAST); 392 390 srcu_lock_release(&ssp->dep_map); 393 391 __srcu_read_unlock_fast(ssp, scp); 392 + RCU_LOCKDEP_WARN(!rcu_is_watching(), "RCU must be watching srcu_read_unlock_fast()."); 394 393 } 395 394 396 395 /** ··· 408 405 WARN_ON_ONCE(IS_ENABLED(CONFIG_PROVE_RCU) && in_nmi()); 409 406 srcu_check_read_flavor(ssp, SRCU_READ_FLAVOR_FAST); 410 407 __srcu_read_unlock_fast(ssp, scp); 408 + RCU_LOCKDEP_WARN(!rcu_is_watching(), "RCU must be watching srcu_up_read_fast()."); 411 409 } 412 410 413 411 /**
-2
include/linux/srcutree.h
··· 244 244 { 245 245 struct srcu_ctr __percpu *scp = READ_ONCE(ssp->srcu_ctrp); 246 246 247 - RCU_LOCKDEP_WARN(!rcu_is_watching(), "RCU must be watching srcu_read_lock_fast()."); 248 247 if (!IS_ENABLED(CONFIG_NEED_SRCU_NMI_SAFE)) 249 248 this_cpu_inc(scp->srcu_locks.counter); /* Y */ 250 249 else ··· 274 275 this_cpu_inc(scp->srcu_unlocks.counter); /* Z */ 275 276 else 276 277 atomic_long_inc(raw_cpu_ptr(&scp->srcu_unlocks)); /* Z */ 277 - RCU_LOCKDEP_WARN(!rcu_is_watching(), "RCU must be watching srcu_read_unlock_fast()."); 278 278 } 279 279 280 280 void __srcu_check_read_flavor(struct srcu_struct *ssp, int read_flavor);