public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] tracing: introduce TRACE_EVENT_NONE and use it
@ 2019-03-26  1:40 Yafang Shao
  2019-03-26  1:40 ` [PATCH 1/3] tracing: introduce TRACE_EVENT_NONE() Yafang Shao
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Yafang Shao @ 2019-03-26  1:40 UTC (permalink / raw)
  To: rostedt, mingo, peterz, paulmck, josh, mathieu.desnoyers,
	jiangshanlai, joel
  Cc: shaoyafang, linux-kernel, Yafang Shao

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;				\
		}

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.
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

 include/linux/tracepoint.h   |  8 +++++
 include/trace/define_trace.h |  4 +++
 include/trace/events/rcu.h   | 84 ++++++++++++++++++++++++++++----------------
 include/trace/events/sched.h | 14 ++++++++
 kernel/rcu/rcu.h             |  9 ++---
 kernel/rcu/tree.c            |  8 ++---
 6 files changed, 86 insertions(+), 41 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-03-26 14:33 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-26  1:40 [PATCH 0/3] tracing: introduce TRACE_EVENT_NONE and use it Yafang Shao
2019-03-26  1:40 ` [PATCH 1/3] tracing: introduce TRACE_EVENT_NONE() Yafang Shao
2019-03-26  1:40 ` [PATCH 2/3] sched/fair: do not expose some tracepoints to user if CONFIG_SCHEDSTATS is not set Yafang Shao
2019-03-26  2:21   ` Steven Rostedt
2019-03-26  2:23     ` Yafang Shao
2019-03-26  1:40 ` [PATCH 3/3] rcu: validate arguments for rcu tracepoints Yafang Shao
2019-03-26 14:32   ` Paul E. McKenney
2019-03-26  2:17 ` [PATCH 0/3] tracing: introduce TRACE_EVENT_NONE and use it Steven Rostedt
2019-03-26  2:24   ` Yafang Shao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox