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: Add srcu_read_lock_fast_notrace() and srcu_read_unlock_fast_notrace()

This commit adds no-trace variants of the srcu_read_lock_fast() and
srcu_read_unlock_fast() functions for tracing use.

[ paulmck: Apply notrace feedback from Joel Fernandes, Steven Rostedt, and Mathieu Desnoyers. ]
[ paulmck: Apply excess-notrace feedback from Boqun Feng. ]

Link: https://lore.kernel.org/all/20250721162433.10454-1-paulmck@kernel.org
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>

+28 -2
+25
include/linux/srcu.h
··· 282 282 return retval; 283 283 } 284 284 285 + /* 286 + * Used by tracing, cannot be traced and cannot call lockdep. 287 + * See srcu_read_lock_fast() for more information. 288 + */ 289 + static inline struct srcu_ctr __percpu *srcu_read_lock_fast_notrace(struct srcu_struct *ssp) 290 + __acquires(ssp) 291 + { 292 + struct srcu_ctr __percpu *retval; 293 + 294 + srcu_check_read_flavor_force(ssp, SRCU_READ_FLAVOR_FAST); 295 + retval = __srcu_read_lock_fast(ssp); 296 + return retval; 297 + } 298 + 285 299 /** 286 300 * srcu_down_read_fast - register a new reader for an SRCU-protected structure. 287 301 * @ssp: srcu_struct in which to register the new reader. ··· 406 392 srcu_lock_release(&ssp->dep_map); 407 393 __srcu_read_unlock_fast(ssp, scp); 408 394 RCU_LOCKDEP_WARN(!rcu_is_watching(), "RCU must be watching srcu_read_unlock_fast()."); 395 + } 396 + 397 + /* 398 + * Used by tracing, cannot be traced and cannot call lockdep. 399 + * See srcu_read_unlock_fast() for more information. 400 + */ 401 + static inline void srcu_read_unlock_fast_notrace(struct srcu_struct *ssp, 402 + struct srcu_ctr __percpu *scp) __releases(ssp) 403 + { 404 + srcu_check_read_flavor(ssp, SRCU_READ_FLAVOR_FAST); 405 + __srcu_read_unlock_fast(ssp, scp); 409 406 } 410 407 411 408 /**
+3 -2
include/linux/srcutree.h
··· 240 240 * on architectures that support NMIs but do not supply NMI-safe 241 241 * implementations of this_cpu_inc(). 242 242 */ 243 - static inline struct srcu_ctr __percpu *__srcu_read_lock_fast(struct srcu_struct *ssp) 243 + static inline struct srcu_ctr __percpu notrace *__srcu_read_lock_fast(struct srcu_struct *ssp) 244 244 { 245 245 struct srcu_ctr __percpu *scp = READ_ONCE(ssp->srcu_ctrp); 246 246 ··· 267 267 * on architectures that support NMIs but do not supply NMI-safe 268 268 * implementations of this_cpu_inc(). 269 269 */ 270 - static inline void __srcu_read_unlock_fast(struct srcu_struct *ssp, struct srcu_ctr __percpu *scp) 270 + static inline void notrace 271 + __srcu_read_unlock_fast(struct srcu_struct *ssp, struct srcu_ctr __percpu *scp) 271 272 { 272 273 barrier(); /* Avoid leaking the critical section. */ 273 274 if (!IS_ENABLED(CONFIG_NEED_SRCU_NMI_SAFE))