jump label: Tracepoint support for jump labels
Make use of the jump label infrastructure for tracepoints. Signed-off-by: Jason Baron <jbaron@redhat.com> LKML-Reference: <a9ba2056e2c9cf332c3c300b577463ce66ff23a8.1284733808.git.jbaron@redhat.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
parent
4c3ef6d793
commit
8f7b50c514
2 changed files with 16 additions and 3 deletions
|
@ -17,6 +17,7 @@
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/rcupdate.h>
|
#include <linux/rcupdate.h>
|
||||||
|
#include <linux/jump_label.h>
|
||||||
|
|
||||||
struct module;
|
struct module;
|
||||||
struct tracepoint;
|
struct tracepoint;
|
||||||
|
@ -145,7 +146,9 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin,
|
||||||
extern struct tracepoint __tracepoint_##name; \
|
extern struct tracepoint __tracepoint_##name; \
|
||||||
static inline void trace_##name(proto) \
|
static inline void trace_##name(proto) \
|
||||||
{ \
|
{ \
|
||||||
if (unlikely(__tracepoint_##name.state)) \
|
JUMP_LABEL(&__tracepoint_##name.state, do_trace); \
|
||||||
|
return; \
|
||||||
|
do_trace: \
|
||||||
__DO_TRACE(&__tracepoint_##name, \
|
__DO_TRACE(&__tracepoint_##name, \
|
||||||
TP_PROTO(data_proto), \
|
TP_PROTO(data_proto), \
|
||||||
TP_ARGS(data_args)); \
|
TP_ARGS(data_args)); \
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/sched.h>
|
#include <linux/sched.h>
|
||||||
|
#include <linux/jump_label.h>
|
||||||
|
|
||||||
extern struct tracepoint __start___tracepoints[];
|
extern struct tracepoint __start___tracepoints[];
|
||||||
extern struct tracepoint __stop___tracepoints[];
|
extern struct tracepoint __stop___tracepoints[];
|
||||||
|
@ -263,7 +264,13 @@ static void set_tracepoint(struct tracepoint_entry **entry,
|
||||||
* is used.
|
* is used.
|
||||||
*/
|
*/
|
||||||
rcu_assign_pointer(elem->funcs, (*entry)->funcs);
|
rcu_assign_pointer(elem->funcs, (*entry)->funcs);
|
||||||
|
if (!elem->state && active) {
|
||||||
|
enable_jump_label(&elem->state);
|
||||||
elem->state = active;
|
elem->state = active;
|
||||||
|
} else if (elem->state && !active) {
|
||||||
|
disable_jump_label(&elem->state);
|
||||||
|
elem->state = active;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -277,7 +284,10 @@ static void disable_tracepoint(struct tracepoint *elem)
|
||||||
if (elem->unregfunc && elem->state)
|
if (elem->unregfunc && elem->state)
|
||||||
elem->unregfunc();
|
elem->unregfunc();
|
||||||
|
|
||||||
|
if (elem->state) {
|
||||||
|
disable_jump_label(&elem->state);
|
||||||
elem->state = 0;
|
elem->state = 0;
|
||||||
|
}
|
||||||
rcu_assign_pointer(elem->funcs, NULL);
|
rcu_assign_pointer(elem->funcs, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue