Skip to content

Commit bd2a634

Browse files
Andi KleenIngo Molnar
authored andcommitted
tracepoints: Move struct tracepoint to new tracepoint-defs.h header
Steven recommended open coding access to tracepoint->key to add trace points to headers. Unfortunately this is difficult for some headers (such as x86 asm/msr.h) because including tracepoint.h includes so many other headers that it causes include loops. The main problem is the include of linux/rcupdate.h, which pulls in a lot of other headers. The rcu header is only needed when actually defining trace points. Move the struct tracepoint into a separate tracepoint-defs.h header that can be included without pulling in all of RCU. Signed-off-by: Andi Kleen <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Acked-by: Steven Rostedt <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Vince Weaver <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 153a433 commit bd2a634

File tree

2 files changed

+28
-15
lines changed

2 files changed

+28
-15
lines changed

include/linux/tracepoint-defs.h

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#ifndef TRACEPOINT_DEFS_H
2+
#define TRACEPOINT_DEFS_H 1
3+
4+
/*
5+
* File can be included directly by headers who only want to access
6+
* tracepoint->key to guard out of line trace calls. Otherwise
7+
* linux/tracepoint.h should be used.
8+
*/
9+
10+
#include <linux/atomic.h>
11+
#include <linux/static_key.h>
12+
13+
struct tracepoint_func {
14+
void *func;
15+
void *data;
16+
int prio;
17+
};
18+
19+
struct tracepoint {
20+
const char *name; /* Tracepoint name */
21+
struct static_key key;
22+
void (*regfunc)(void);
23+
void (*unregfunc)(void);
24+
struct tracepoint_func __rcu *funcs;
25+
};
26+
27+
#endif

include/linux/tracepoint.h

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,12 @@
1717
#include <linux/errno.h>
1818
#include <linux/types.h>
1919
#include <linux/rcupdate.h>
20-
#include <linux/static_key.h>
20+
#include <linux/tracepoint-defs.h>
2121

2222
struct module;
2323
struct tracepoint;
2424
struct notifier_block;
2525

26-
struct tracepoint_func {
27-
void *func;
28-
void *data;
29-
int prio;
30-
};
31-
32-
struct tracepoint {
33-
const char *name; /* Tracepoint name */
34-
struct static_key key;
35-
void (*regfunc)(void);
36-
void (*unregfunc)(void);
37-
struct tracepoint_func __rcu *funcs;
38-
};
39-
4026
struct trace_enum_map {
4127
const char *system;
4228
const char *enum_string;

0 commit comments

Comments
 (0)