diff options
Diffstat (limited to 'include/linux/tracepoint.h')
| -rw-r--r-- | include/linux/tracepoint.h | 35 | 
1 files changed, 20 insertions, 15 deletions
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index c6814616653..97c84a58efb 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -33,12 +33,7 @@ struct tracepoint {  	void (*regfunc)(void);  	void (*unregfunc)(void);  	struct tracepoint_func __rcu *funcs; -} __attribute__((aligned(32)));		/* -					 * Aligned on 32 bytes because it is -					 * globally visible and gcc happily -					 * align these on the structure size. -					 * Keep in sync with vmlinux.lds.h. -					 */ +};  /*   * Connect a probe to a tracepoint. @@ -61,15 +56,15 @@ extern void tracepoint_probe_update_all(void);  struct tracepoint_iter {  	struct module *module; -	struct tracepoint *tracepoint; +	struct tracepoint * const *tracepoint;  };  extern void tracepoint_iter_start(struct tracepoint_iter *iter);  extern void tracepoint_iter_next(struct tracepoint_iter *iter);  extern void tracepoint_iter_stop(struct tracepoint_iter *iter);  extern void tracepoint_iter_reset(struct tracepoint_iter *iter); -extern int tracepoint_get_iter_range(struct tracepoint **tracepoint, -	struct tracepoint *begin, struct tracepoint *end); +extern int tracepoint_get_iter_range(struct tracepoint * const **tracepoint, +	struct tracepoint * const *begin, struct tracepoint * const *end);  /*   * tracepoint_synchronize_unregister must be called between the last tracepoint @@ -84,11 +79,13 @@ static inline void tracepoint_synchronize_unregister(void)  #define PARAMS(args...) args  #ifdef CONFIG_TRACEPOINTS -extern void tracepoint_update_probe_range(struct tracepoint *begin, -	struct tracepoint *end); +extern +void tracepoint_update_probe_range(struct tracepoint * const *begin, +	struct tracepoint * const *end);  #else -static inline void tracepoint_update_probe_range(struct tracepoint *begin, -	struct tracepoint *end) +static inline +void tracepoint_update_probe_range(struct tracepoint * const *begin, +	struct tracepoint * const *end)  { }  #endif /* CONFIG_TRACEPOINTS */ @@ -174,12 +171,20 @@ do_trace:								\  	{								\  	} +/* + * We have no guarantee that gcc and the linker won't up-align the tracepoint + * structures, so we create an array of pointers that will be used for iteration + * on the tracepoints. + */  #define DEFINE_TRACE_FN(name, reg, unreg)				\  	static const char __tpstrtab_##name[]				\  	__attribute__((section("__tracepoints_strings"))) = #name;	\  	struct tracepoint __tracepoint_##name				\ -	__attribute__((section("__tracepoints"), aligned(32))) =	\ -		{ __tpstrtab_##name, 0, reg, unreg, NULL } +	__attribute__((section("__tracepoints"))) =			\ +		{ __tpstrtab_##name, 0, reg, unreg, NULL };		\ +	static struct tracepoint * const __tracepoint_ptr_##name __used	\ +	__attribute__((section("__tracepoints_ptrs"))) =		\ +		&__tracepoint_##name;  #define DEFINE_TRACE(name)						\  	DEFINE_TRACE_FN(name, NULL, NULL);  |