hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/include/linux/tracepoint.h
....@@ -234,12 +234,11 @@
234234 * not add unwanted padding between the beginning of the section and the
235235 * structure. Force alignment to the same alignment as the section start.
236236 *
237
- * When lockdep is enabled, we make sure to always do the RCU portions of
238
- * the tracepoint code, regardless of whether tracing is on. However,
239
- * don't check if the condition is false, due to interaction with idle
240
- * instrumentation. This lets us find RCU issues triggered with tracepoints
241
- * even when this tracepoint is off. This code has no purpose other than
242
- * poking RCU a bit.
237
+ * When lockdep is enabled, we make sure to always test if RCU is
238
+ * "watching" regardless if the tracepoint is enabled or not. Tracepoints
239
+ * require RCU to be active, and it should always warn at the tracepoint
240
+ * site if it is not watching, as it will need to be active when the
241
+ * tracepoint is enabled.
243242 */
244243 #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
245244 extern int __traceiter_##name(data_proto); \
....@@ -253,9 +252,7 @@
253252 TP_ARGS(data_args), \
254253 TP_CONDITION(cond), 0); \
255254 if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \
256
- rcu_read_lock_sched_notrace(); \
257
- rcu_dereference_sched(__tracepoint_##name.funcs);\
258
- rcu_read_unlock_sched_notrace(); \
255
+ WARN_ON_ONCE(!rcu_is_watching()); \
259256 } \
260257 } \
261258 __DECLARE_TRACE_RCU(name, PARAMS(proto), PARAMS(args), \