On Wed, 11 Mar 2026 20:53:10 +0100
Peter Zijlstra <[email protected]> wrote:

> > Which basically is just __do_trace_<event>(), but as a wrapper that can
> > handle updates that may be needed, but supplies a proper API where thing
> > wont randomly break when __do_trace_<event>() changes.  
> 
> That's like a 3 line patch, hardly worth the effort. Its not like it'll
> be hard to find and fix any users if you do ever change that.

No, but I prefer clean code, and not hacks that use internal functions with
underscores in their names. Not to mention, it properly handles different
cases:

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 22ca1c8b54f3..07219316a8e1 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -294,6 +294,10 @@ static inline struct tracepoint 
*tracepoint_ptr_deref(tracepoint_ptr_t *p)
                        WARN_ONCE(!rcu_is_watching(),                   \
                                  "RCU not watching for tracepoint");   \
                }                                                       \
+       }                                                               \
+       static inline void trace_invoke_##name(proto)                   \
+       {                                                               \
+               __do_trace_##name(args);                                \
        }
 
 #define __DECLARE_TRACE_SYSCALL(name, proto, args, data_proto)         \
@@ -313,6 +317,11 @@ static inline struct tracepoint 
*tracepoint_ptr_deref(tracepoint_ptr_t *p)
                        WARN_ONCE(!rcu_is_watching(),                   \
                                  "RCU not watching for tracepoint");   \
                }                                                       \
+       }                                                               \
+       static inline void trace_invoke_##name(proto)                   \
+       {                                                               \
+               might_fault();                                          \
+               __do_trace_##name(args);                                \
        }


Then it goes through and updates every location that has a:

        if (trace_<event>_enabled()) {
                [..]
                trace_<event>();
        }

With the new proper API.

-- Steve

Reply via email to