lkml.org 
[lkml]   [2019]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 0/3] tracing: introduce TRACE_EVENT_NONE and use it
On Tue, 26 Mar 2019 09:40:04 +0800
Yafang Shao <laoar.shao@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.


> 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

\
 
 \ /
  Last update: 2019-03-26 03:18    [W:0.182 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site