tracepoint: Use struct pointer instead of name hash for reg/unreg tracepoints
Register/unregister tracepoint probes with struct tracepoint pointer rather than tracepoint name. This change, which vastly simplifies tracepoint.c, has been proposed by Steven Rostedt. It also removes 8.8kB (mostly of text) to the vmlinux size. From this point on, the tracers need to pass a struct tracepoint pointer to probe register/unregister. A probe can now only be connected to a tracepoint that exists. Moreover, tracers are responsible for unregistering the probe before the module containing its associated tracepoint is unloaded. text data bss dec hex filename 10443444 4282528 10391552 25117524 17f4354 vmlinux.orig 10434930 4282848 10391552 25109330 17f2352 vmlinux Link: http://lkml.kernel.org/r/1396992381-23785-2-git-send-email-mathieu.desnoyers@efficios.com CC: Ingo Molnar <mingo@kernel.org> CC: Frederic Weisbecker <fweisbec@gmail.com> CC: Andrew Morton <akpm@linux-foundation.org> CC: Frank Ch. Eigler <fche@redhat.com> CC: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> [ SDR - fixed return val in void func in tracepoint_module_going() ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
parent
68114e5eb8
commit
de7b297390
9 changed files with 333 additions and 354 deletions
|
@ -7,6 +7,7 @@
|
|||
#include <linux/percpu.h>
|
||||
#include <linux/hardirq.h>
|
||||
#include <linux/perf_event.h>
|
||||
#include <linux/tracepoint.h>
|
||||
|
||||
struct trace_array;
|
||||
struct trace_buffer;
|
||||
|
@ -232,6 +233,7 @@ enum {
|
|||
TRACE_EVENT_FL_IGNORE_ENABLE_BIT,
|
||||
TRACE_EVENT_FL_WAS_ENABLED_BIT,
|
||||
TRACE_EVENT_FL_USE_CALL_FILTER_BIT,
|
||||
TRACE_EVENT_FL_TRACEPOINT_BIT,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -244,6 +246,7 @@ enum {
|
|||
* (used for module unloading, if a module event is enabled,
|
||||
* it is best to clear the buffers that used it).
|
||||
* USE_CALL_FILTER - For ftrace internal events, don't use file filter
|
||||
* TRACEPOINT - Event is a tracepoint
|
||||
*/
|
||||
enum {
|
||||
TRACE_EVENT_FL_FILTERED = (1 << TRACE_EVENT_FL_FILTERED_BIT),
|
||||
|
@ -252,12 +255,17 @@ enum {
|
|||
TRACE_EVENT_FL_IGNORE_ENABLE = (1 << TRACE_EVENT_FL_IGNORE_ENABLE_BIT),
|
||||
TRACE_EVENT_FL_WAS_ENABLED = (1 << TRACE_EVENT_FL_WAS_ENABLED_BIT),
|
||||
TRACE_EVENT_FL_USE_CALL_FILTER = (1 << TRACE_EVENT_FL_USE_CALL_FILTER_BIT),
|
||||
TRACE_EVENT_FL_TRACEPOINT = (1 << TRACE_EVENT_FL_TRACEPOINT_BIT),
|
||||
};
|
||||
|
||||
struct ftrace_event_call {
|
||||
struct list_head list;
|
||||
struct ftrace_event_class *class;
|
||||
char *name;
|
||||
union {
|
||||
char *name;
|
||||
/* Set TRACE_EVENT_FL_TRACEPOINT flag when using "tp" */
|
||||
struct tracepoint *tp;
|
||||
};
|
||||
struct trace_event event;
|
||||
const char *print_fmt;
|
||||
struct event_filter *filter;
|
||||
|
@ -271,6 +279,7 @@ struct ftrace_event_call {
|
|||
* bit 3: ftrace internal event (do not enable)
|
||||
* bit 4: Event was enabled by module
|
||||
* bit 5: use call filter rather than file filter
|
||||
* bit 6: Event is a tracepoint
|
||||
*/
|
||||
int flags; /* static flags of different events */
|
||||
|
||||
|
@ -283,6 +292,15 @@ struct ftrace_event_call {
|
|||
#endif
|
||||
};
|
||||
|
||||
static inline const char *
|
||||
ftrace_event_name(struct ftrace_event_call *call)
|
||||
{
|
||||
if (call->flags & TRACE_EVENT_FL_TRACEPOINT)
|
||||
return call->tp ? call->tp->name : NULL;
|
||||
else
|
||||
return call->name;
|
||||
}
|
||||
|
||||
struct trace_array;
|
||||
struct ftrace_subsystem_dir;
|
||||
|
||||
|
@ -353,7 +371,7 @@ struct ftrace_event_file {
|
|||
#define __TRACE_EVENT_FLAGS(name, value) \
|
||||
static int __init trace_init_flags_##name(void) \
|
||||
{ \
|
||||
event_##name.flags = value; \
|
||||
event_##name.flags |= value; \
|
||||
return 0; \
|
||||
} \
|
||||
early_initcall(trace_init_flags_##name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue