On Tue, Mar 26, 2019 at 10:17 AM Steven Rostedt <rost...@goodmis.org> wrote: > > On Tue, 26 Mar 2019 09:40:04 +0800 > Yafang Shao <laoar.s...@gmail.com> wrote: > > > In this patchset, I introduce a new macro TRACE_EVENT_NONE(), which will > > define a tracepoint as a do-nothing inline function. > > #define TRACE_EVENT_NONE(name, proto) \ > > static inline void trace_##name(proto) \ > > { } \ > > static inline bool trace_##name##_enabled(void) \ > > { \ > > return false; \ > > } > > > > BTW, I prefer a name of TRACE_EVENT_DISABLED() > > Which shows that it is disabled, or TRACE_EVENT_UNDEF(), or > TRACE_EVENT_NOP(). Something that states it is turned off. When I first > saw NONE() I thought it was another attempt to introduce zero parameter > trace events. >
I prefer TRACE_EVENT_NOP. I will change it. Thanks Yafang > > > Let's take some example for why this macro is needed. > > > > - sched > > The tracepoints trace_sched_stat_{iowait, blocked, wait, sleep} should > > be not exposed to user if CONFIG_SCHEDSTATS is not set. > > We can place #ifdef in the kernel/sched/fair.c to fix it, but we > > don't want to sprinkle #ifdef. > > But you still sprinkle #ifdef in the header, but the part I don't like > is the need to duplicate the prototypes and the like. > > > > So with TRACE_EVENT_NONE(), we can fix it in > > include/trace/events/sched.h. > > > > - rcu > > When CONFIG_RCU_TRACE is not set, some rcu tracepoints are define as > > do-nothing macro without validating arguments, that is not proper. > > We should validate the arguments. > > > > Yafang Shao (3): > > tracing: introduce TRACE_EVENT_NONE() > > sched/fair: do not expose some tracepoints to user if > > CONFIG_SCHEDSTATS is not set > > rcu: validate arguments for rcu tracepoints > > > > See my reply in the next patch. > > -- Steve