tracing: Updates for 4.4
Subsystems (3)
Steven Rostedt
maintainercover tracing: Updates for 4.4
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next
Head SHA1: ddd70280bf0e92ad81a9526971409603fba21679
Dmitry Safonov (5):
ftrace: Remove redundant strsep in mod_callback
ftrace: Clarify code for mod command
ftrace: Introduce ftrace_glob structure
ftrace: add module globbing
Documentation: ftrace: Module globbing usage
Rasmus Villemoes (2):
tracing: Use kstrdup_const instead of private implementation
ftrace: Remove redundant swap function
Tal Shorer (2):
tracing: Allow disabling compilation of specific trace systems
tracing: gpio: Add Kconfig option for enabling/disabling trace events
----
Documentation/trace/ftrace.txt | 17 ++++ include/linux/tracepoint.h | 17 +++- include/trace/define_trace.h | 2 +- include/trace/events/gpio.h | 4 + kernel/trace/Kconfig | 7 ++ kernel/trace/ftrace.c | 178 ++++++++++++++++++++--------------------- kernel/trace/trace_events.c | 24 ++---- 7 files changed, 138 insertions(+), 111 deletions(-)
Steven Rostedt
maintainerPATCH 1/9 tracing: Use kstrdup_const instead of private implementation
From: Rasmus Villemoes <[email protected]>
The kernel now has kstrdup_const/kfree_const for reusing .rodata (typically string literals) when possible; there's no reason to duplicate that logic in the tracing system. Moreover, as the comment above core_kernel_data states, it may not always return true for .rodata - that is for example the case on x86_64, where we thus end up kstrdup'ing all the passed-in strings.
Arguably, testing for .rodata explicitly (as kstrdup_const does) is also more correct: I don't think one is supposed to be able to change the name after creating the event_subsystem by passing the address of a static char (but non-const) array.
--- kernel/trace/trace_events.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)
kernel/trace/trace_events.c +8 -16
@@ -38,21 +38,19 @@ static LIST_HEAD(ftrace_common_fields);static struct kmem_cache *field_cachep;static struct kmem_cache *file_cachep; -#define SYSTEM_FL_FREE_NAME (1 << 31) -static inline int system_refcount (struct event_subsystem *system) { -return system->ref_count & ~SYSTEM_FL_FREE_NAME ; +return system->ref_count; }static int system_refcount_inc (struct event_subsystem *system) { -return (system->ref_count++) & ~SYSTEM_FL_FREE_NAME ; +return system->ref_count++; }static int system_refcount_dec (struct event_subsystem *system) { -return (--system->ref_count) & ~SYSTEM_FL_FREE_NAME ; +return --system->ref_count; }/* Double loops, do not use break, only goto's work */
@@ -461,8 +459,7 @@ static void __put_system(struct event_subsystem *system)kfree (filter->filter_string);kfree (filter); } -if (system->ref_count &SYSTEM_FL_FREE_NAME ) -kfree (system->name); +kfree_const (system->name);kfree (system); }
@@ -1493,13 +1490,9 @@ create_new_subsystem(const char *name) system->ref_count =1 ;/* Only allocate if dynamic (kprobes and modules) */ -if (!core_kernel_data ((unsigned long )name)) { - system->ref_count |=SYSTEM_FL_FREE_NAME ; - system->name =kstrdup (name,GFP_KERNEL ); -if (!system->name) - goto out_free; - }else - system->name = name; + system->name =kstrdup_const (name,GFP_KERNEL ); +if (!system->name) + goto out_free; system->filter =NULL ;
@@ -1512,8 +1505,7 @@ create_new_subsystem(const char *name)return system; out_free: -if (system->ref_count &SYSTEM_FL_FREE_NAME ) -kfree (system->name); +kfree_const (system->name);kfree (system);return NULL ; }
Signature · 1 line
2.6.1
Steven Rostedt
maintainerPATCH 2/9 ftrace: Remove redundant swap function
In reply to Steven RostedtFrom: Rasmus Villemoes <[email protected]>
To cover the common case of sorting an array of pointers, Daniel Wagner recently modified the library sort() to use a specific swap function for size==8, in addition to the size==4 case which was already handled. Since sizeof(long) is either 4 or 8, ftrace_swap_ips() is redundant and we can just let sort() pick an appropriate and fast swap callback.
--- kernel/trace/ftrace.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-)
kernel/trace/ftrace.c +1 -12
@@ -4788,17 +4788,6 @@ static int ftrace_cmp_ips(const void *a, const void *b)return 0 ; } -static void ftrace_swap_ips (void *a,void *b,int size) -{ -unsigned long *ipa = a; -unsigned long *ipb = b; -unsigned long t; - - t = *ipa; - *ipa = *ipb; - *ipb = t; -} -static int ftrace_process_locs (struct module *mod,unsigned long *start,unsigned long *end)
@@ -4818,7 +4807,7 @@ static int ftrace_process_locs(struct module *mod,return 0 ;sort (start, count,sizeof (*start), - ftrace_cmp_ips, ftrace_swap_ips); + ftrace_cmp_ips,NULL ); start_pg =ftrace_allocate_pages (count);if (!start_pg)
Signature · 1 line
2.6.1
Steven Rostedt
maintainerPATCH 3/9 ftrace: Remove redundant strsep in mod_callback
In reply to Steven RostedtFrom: Dmitry Safonov <[email protected]>
By now there isn't any subcommand for mod.
Before:
sh$ echo '*:mod:ipv6:a' > set_ftrace_filter sh$ echo '*:mod:ipv6' > set_ftrace_filter had the same results, but now first will result in: sh$ echo '*:mod:ipv6:a' > set_ftrace_filter -bash: echo: write error: Invalid argument
Also, I clarified ftrace_mod_callback code a little.
--- kernel/trace/ftrace.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-)
kernel/trace/ftrace.c +5 -10
@@ -3569,8 +3569,7 @@ static int ftrace_mod_callback(struct ftrace_hash *hash, char *func, char *cmd, char *param, int enable) { - char *mod; -int ret = -EINVAL ; + int ret;/* * cmd == 'mod' because we only registered this func
@@ -3581,16 +3580,12 @@ ftrace_mod_callback(struct ftrace_hash *hash,*/ /* we must have a module name */ -if (!param) -return ret; - - mod =strsep (¶m,":" ); -if (!strlen (mod)) -return ret; +if (!param || !strlen (param)) +return -EINVAL ; - ret =ftrace_match_module_records (hash, func, mod); + ret =ftrace_match_module_records (hash, func, param);if (!ret) - ret = -EINVAL ; +return -EINVAL ;if (ret <0 )return ret;
Signature · 1 line
2.6.1
Steven Rostedt
maintainerPATCH 4/9 ftrace: Clarify code for mod command
In reply to Steven RostedtFrom: Dmitry Safonov <[email protected]>
"Not" is too abstract variable name - changed to clear_filter. Removed ftrace_match_module_records function: comparison with !* or * not does the general code in filter_parse_regex() as it works without mod command for
sh# echo '!*' > /sys/kernel/debug/tracing/set_ftrace_filter
--- kernel/trace/ftrace.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-)
kernel/trace/ftrace.c +10 -27
@@ -3454,13 +3454,13 @@ static int ftrace_match(char *str, char *regex, int len, int type) }static int -enter_record (struct ftrace_hash *hash,struct dyn_ftrace *rec,int not) +enter_record (struct ftrace_hash *hash,struct dyn_ftrace *rec,int clear_filter) {struct ftrace_func_entry *entry;int ret =0 ; entry =ftrace_lookup_ip (hash, rec->ip); -if (not) { +if (clear_filter) {/* Do nothing if it doesn't exist */ if (!entry)return 0 ;
@@ -3499,8 +3499,7 @@ ftrace_match_record(struct dyn_ftrace *rec, char *mod, }static int -match_records (struct ftrace_hash *hash,char *buff, -int len,char *mod,int not) +match_records (struct ftrace_hash *hash,char *buff,int len,char *mod) {unsigned search_len =0 ;struct ftrace_page *pg;
@@ -3509,9 +3508,10 @@ match_records(struct ftrace_hash *hash, char *buff,char *search = buff;int found =0 ;int ret; +int clear_filter;if (len) { - type =filter_parse_regex (buff, len, &search, ¬); + type =filter_parse_regex (buff, len, &search, &clear_filter); search_len =strlen (search); }
@@ -3522,7 +3522,7 @@ match_records(struct ftrace_hash *hash, char *buff,do_for_each_ftrace_rec (pg, rec) {if (ftrace_match_record (rec, mod, search, search_len, type)) { - ret =enter_record (hash, rec, not); + ret =enter_record (hash, rec, clear_filter);if (ret <0 ) { found = ret; goto out_unlock;
@@ -3539,26 +3539,9 @@ match_records(struct ftrace_hash *hash, char *buff,static int ftrace_match_records (struct ftrace_hash *hash,char *buff,int len) { -return match_records (hash, buff, len,NULL ,0 ); +return match_records (hash, buff, len,NULL ); } -static int -ftrace_match_module_records (struct ftrace_hash *hash,char *buff,char *mod) -{ -int not =0 ; - -/* blank or '*' mean the same */ -if (strcmp (buff,"*" ) ==0 ) - buff[0 ] =0 ; - -/* handle the case of 'dont filter this module' */ -if (strcmp (buff,"!" ) ==0 ||strcmp (buff,"!*" ) ==0 ) { - buff[0 ] =0 ; - not =1 ; - } - -return match_records (hash, buff,strlen (buff), mod, not); -}/* * We register the module command as a template to show others how
@@ -3567,7 +3550,7 @@ ftrace_match_module_records(struct ftrace_hash *hash, char *buff, char *mod)static int ftrace_mod_callback (struct ftrace_hash *hash, -char *func,char *cmd,char *param,int enable) +char *func,char *cmd,char *module,int enable) {int ret;
@@ -3580,10 +3563,10 @@ ftrace_mod_callback(struct ftrace_hash *hash,*/ /* we must have a module name */ -if (!param || !strlen (param)) +if (!module || !strlen (module))return -EINVAL ; - ret =ftrace_match_module_records (hash, func, param); + ret =match_records (hash, func,strlen (func), module);if (!ret)return -EINVAL ;if (ret <0 )
Signature · 1 line
2.6.1
Steven Rostedt
maintainerPATCH 5/9 ftrace: Introduce ftrace_glob structure
In reply to Steven RostedtFrom: Dmitry Safonov <[email protected]>
ftrace_match parameters are very related and I reduce the number of local variables & parameters with it.
This is also preparation for module globbing as it would introduce more realated variables & parameters.
--- kernel/trace/ftrace.c | 84 ++++++++++++++++++++++++++++----------------------- 1 file changed, 46 insertions(+), 38 deletions(-)
kernel/trace/ftrace.c +46 -38
@@ -3425,27 +3425,35 @@ ftrace_notrace_open(struct inode *inode, struct file *file) inode, file); } -static int ftrace_match (char *str,char *regex,int len,int type) +/* Type for quick search ftrace basic regexes (globs) from filter_parse_regex */ +struct ftrace_glob { +char *search; +unsigned len; +int type; +}; + +static int ftrace_match (char *str,struct ftrace_glob *g) {int matched =0 ;int slen; -switch (type) { +switch (g->type) {case MATCH_FULL : -if (strcmp (str, regex) ==0 ) +if (strcmp (str, g->search) ==0 ) matched =1 ;break ;case MATCH_FRONT_ONLY : -if (strncmp (str, regex, len) ==0 ) +if (strncmp (str, g->search, g->len) ==0 ) matched =1 ;break ;case MATCH_MIDDLE_ONLY : -if (strstr (str, regex)) +if (strstr (str, g->search)) matched =1 ;break ;case MATCH_END_ONLY : slen =strlen (str); -if (slen >= len &&memcmp (str + slen - len, regex, len) ==0 ) +if (slen >= g->len && +memcmp (str + slen - g->len, g->search, g->len) ==0 ) matched =1 ;break ; }
@@ -3477,8 +3485,8 @@ enter_record(struct ftrace_hash *hash, struct dyn_ftrace *rec, int clear_filter) }static int -ftrace_match_record (struct dyn_ftrace *rec,char *mod, -char *regex,int len,int type) +ftrace_match_record (struct dyn_ftrace *rec, +char *mod,struct ftrace_glob *func_g) {char str[KSYM_SYMBOL_LEN ];char *modname;
@@ -3491,28 +3499,27 @@ ftrace_match_record(struct dyn_ftrace *rec, char *mod,return 0 ;/* blank search means to match all funcs in the mod */ -if (!len) +if (!func_g->len)return 1 ; } -return ftrace_match (str, regex, len, type); +return ftrace_match (str, func_g); }static int -match_records (struct ftrace_hash *hash,char *buff,int len,char *mod) +match_records (struct ftrace_hash *hash,char *func,int len,char *mod) { -unsigned search_len =0 ;struct ftrace_page *pg;struct dyn_ftrace *rec; -int type =MATCH_FULL ; -char *search = buff; +struct ftrace_glob func_g = { .type =MATCH_FULL };int found =0 ;int ret;int clear_filter;if (len) { - type =filter_parse_regex (buff, len, &search, &clear_filter); - search_len =strlen (search); + func_g.type =filter_parse_regex (func, len, &func_g.search, + &clear_filter); + func_g.len =strlen (func_g.search); }mutex_lock (&ftrace_lock);
@@ -3521,7 +3528,7 @@ match_records(struct ftrace_hash *hash, char *buff, int len, char *mod) goto out_unlock;do_for_each_ftrace_rec (pg, rec) { -if (ftrace_match_record (rec, mod, search, search_len, type)) { +if (ftrace_match_record (rec, mod, &func_g)) { ret =enter_record (hash, rec, clear_filter);if (ret <0 ) { found = ret;
@@ -3682,19 +3689,20 @@ register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops, {struct ftrace_ops_hash old_hash_ops;struct ftrace_func_probe *entry; +struct ftrace_glob func_g;struct ftrace_hash **orig_hash = &trace_probe_ops.func_hash->filter_hash;struct ftrace_hash *old_hash = *orig_hash;struct ftrace_hash *hash;struct ftrace_page *pg;struct dyn_ftrace *rec; -int type, len, not; +int not;unsigned long key;int count =0 ; -char *search;int ret; - type =filter_parse_regex (glob,strlen (glob), &search, ¬); - len =strlen (search); + func_g.type =filter_parse_regex (glob,strlen (glob), + &func_g.search, ¬); + func_g.len =strlen (func_g.search);/* we do not support '!' for function probes */ if (WARN_ON (not))
@@ -3721,7 +3729,7 @@ register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,do_for_each_ftrace_rec (pg, rec) { -if (!ftrace_match_record (rec,NULL , search, len, type)) +if (!ftrace_match_record (rec,NULL , &func_g))continue ; entry =kmalloc (sizeof (*entry),GFP_KERNEL );
@@ -3794,24 +3802,24 @@ __unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,struct ftrace_func_entry *rec_entry;struct ftrace_func_probe *entry;struct ftrace_func_probe *p; +struct ftrace_glob func_g;struct ftrace_hash **orig_hash = &trace_probe_ops.func_hash->filter_hash;struct ftrace_hash *old_hash = *orig_hash;struct list_head free_list;struct ftrace_hash *hash;struct hlist_node *tmp;char str[KSYM_SYMBOL_LEN ]; -int type =MATCH_FULL ; -int i, len =0 ; -char *search; -int ret; +int i, ret;if (glob && (strcmp (glob,"*" ) ==0 || !strlen (glob))) - glob =NULL ; + func_g.search =NULL ;else if (glob) {int not; - type =filter_parse_regex (glob,strlen (glob), &search, ¬); - len =strlen (search); + func_g.type =filter_parse_regex (glob,strlen (glob), + &func_g.search, ¬); + func_g.len =strlen (func_g.search); + func_g.search = glob;/* we do not support '!' for function probes */ if (WARN_ON (not))
@@ -3840,10 +3848,10 @@ __unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,continue ;/* do this last, since it is the most expensive */ -if (glob) { +if (func_g.search) {kallsyms_lookup (entry->ip,NULL ,NULL ,NULL , str); -if (!ftrace_match (str, glob, len, type)) +if (!ftrace_match (str, &func_g))continue ; }
@@ -3872,7 +3880,7 @@ __unregister_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,ftrace_free_entry (entry); }mutex_unlock (&ftrace_lock); - + out_unlock:mutex_unlock (&trace_probe_ops.func_hash->regex_lock);free_ftrace_hash (hash);
@@ -4588,21 +4596,21 @@ ftrace_graph_release(struct inode *inode, struct file *file)static int ftrace_set_func (unsigned long *array,int *idx,int size,char *buffer) { +struct ftrace_glob func_g;struct dyn_ftrace *rec;struct ftrace_page *pg; -int search_len;int fail =1 ; -int type, not; -char *search; +int not;bool exists;int i;/* decode regex */ - type =filter_parse_regex (buffer,strlen (buffer), &search, ¬); + func_g.type =filter_parse_regex (buffer,strlen (buffer), + &func_g.search, ¬);if (!not && *idx >= size)return -EBUSY ; - search_len =strlen (search); + func_g.len =strlen (func_g.search);mutex_lock (&ftrace_lock);
@@ -4613,7 +4621,7 @@ ftrace_set_func(unsigned long *array, int *idx, int size, char *buffer)do_for_each_ftrace_rec (pg, rec) { -if (ftrace_match_record (rec,NULL , search, search_len, type)) { +if (ftrace_match_record (rec,NULL , &func_g)) {/* if it is in the array */ exists = false;for (i =0 ; i < *idx; i++) {
Signature · 1 line
2.6.1
Steven Rostedt
maintainerPATCH 6/9 ftrace: add module globbing
In reply to Steven RostedtFrom: Dmitry Safonov <[email protected]>
Extend module command for function filter selection with globbing. It uses the same globbing as function filter.
sh# echo '*alloc*:mod:*' > set_ftrace_filter
Will trace any function with the letters 'alloc' in the name in any module but not in kernel.
sh# echo '!*alloc*:mod:ipv6' >> set_ftrace_filter
Will prevent from tracing functions with 'alloc' in the name from module ipv6 (do not forget to append to set_ftrace_filter file).
sh# echo '*alloc*:mod:!ipv6' > set_ftrace_filter
Will trace functions with 'alloc' in the name from kernel and any module except ipv6.
sh# echo '*alloc*:mod:!*' > set_ftrace_filter
Will trace any function with the letters 'alloc' in the name only from kernel, but not from any module.
sh# echo '*:mod:!*' > set_ftrace_filter
or
sh# echo ':mod:!' > set_ftrace_filter
Will trace every function in the kernel, but will not trace functions from any module.
sh# echo '*:mod:*' > set_ftrace_filter
or
sh# echo ':mod:' > set_ftrace_filter
As the opposite will trace all functions from all modules, but not from kernel.
sh# echo '*:mod:*snd*' > set_ftrace_filter
Will trace your sound drivers only (if any).
--- kernel/trace/ftrace.c | 51 ++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 15 deletions(-)
kernel/trace/ftrace.c +36 -15
@@ -3485,19 +3485,37 @@ enter_record(struct ftrace_hash *hash, struct dyn_ftrace *rec, int clear_filter) }static int -ftrace_match_record (struct dyn_ftrace *rec, -char *mod,struct ftrace_glob *func_g) +ftrace_match_record (struct dyn_ftrace *rec,struct ftrace_glob *func_g, +struct ftrace_glob *mod_g,int exclude_mod) {char str[KSYM_SYMBOL_LEN ];char *modname;kallsyms_lookup (rec->ip,NULL ,NULL , &modname, str); -if (mod) { -/* module lookup requires matching the module */ -if (!modname ||strcmp (modname, mod)) +if (mod_g) { +int mod_matches = (modname) ?ftrace_match (modname, mod_g) :0 ; + +/* blank module name to match all modules */ +if (!mod_g->len) { +/* blank module globbing: modname xor exclude_mod */ +if ((!exclude_mod) != (!modname)) + goto func_match; +return 0 ; + } + +/* not matching the module */ +if (!modname || !mod_matches) { +if (exclude_mod) + goto func_match; +else +return 0 ; + } + +if (mod_matches && exclude_mod)return 0 ; +func_match:/* blank search means to match all funcs in the mod */ if (!func_g->len)return 1 ;
@@ -3512,23 +3530,32 @@ match_records(struct ftrace_hash *hash, char *func, int len, char *mod)struct ftrace_page *pg;struct dyn_ftrace *rec;struct ftrace_glob func_g = { .type =MATCH_FULL }; +struct ftrace_glob mod_g = { .type =MATCH_FULL }; +struct ftrace_glob *mod_match = (mod) ? &mod_g :NULL ; +int exclude_mod =0 ;int found =0 ;int ret;int clear_filter; -if (len) { +if (func) { func_g.type =filter_parse_regex (func, len, &func_g.search, &clear_filter); func_g.len =strlen (func_g.search); } +if (mod) { + mod_g.type =filter_parse_regex (mod,strlen (mod), + &mod_g.search, &exclude_mod); + mod_g.len =strlen (mod_g.search); + } +mutex_lock (&ftrace_lock);if (unlikely (ftrace_disabled)) goto out_unlock;do_for_each_ftrace_rec (pg, rec) { -if (ftrace_match_record (rec, mod, &func_g)) { +if (ftrace_match_record (rec, &func_g, mod_match, exclude_mod)) { ret =enter_record (hash, rec, clear_filter);if (ret <0 ) { found = ret;
@@ -3568,17 +3595,11 @@ ftrace_mod_callback(struct ftrace_hash *hash,* you can tell which command was used by the cmd * parameter. */ - -/* we must have a module name */ -if (!module || !strlen (module)) -return -EINVAL ; - ret =match_records (hash, func,strlen (func), module);if (!ret)return -EINVAL ;if (ret <0 )return ret; -return 0 ; }
@@ -3729,7 +3750,7 @@ register_ftrace_function_probe(char *glob, struct ftrace_probe_ops *ops,do_for_each_ftrace_rec (pg, rec) { -if (!ftrace_match_record (rec,NULL , &func_g)) +if (!ftrace_match_record (rec, &func_g,NULL ,0 ))continue ; entry =kmalloc (sizeof (*entry),GFP_KERNEL );
@@ -4621,7 +4642,7 @@ ftrace_set_func(unsigned long *array, int *idx, int size, char *buffer)do_for_each_ftrace_rec (pg, rec) { -if (ftrace_match_record (rec,NULL , &func_g)) { +if (ftrace_match_record (rec, &func_g,NULL ,0 )) {/* if it is in the array */ exists = false;for (i =0 ; i < *idx; i++) {
Signature · 1 line
2.6.1
Steven Rostedt
maintainerPATCH 7/9 Documentation: ftrace: Module globbing usage
In reply to Steven RostedtFrom: Dmitry Safonov <[email protected]>
--- Documentation/trace/ftrace.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
Documentation/trace/ftrace.txt +17 -0
@@ -2437,6 +2437,23 @@ The following commands are supported: echo '!writeback*:mod:ext3' >> set_ftrace_filter + Mod command supports module globbing. Disable tracing for all + functions except a specific module: + + echo '!*:mod:!ext3' >> set_ftrace_filter + + Disable tracing for all modules, but still trace kernel: + + echo '!*:mod:*' >> set_ftrace_filter + + Enable filter only for kernel: + + echo '*write*:mod:!*' >> set_ftrace_filter + + Enable filter for module globbing: + + echo '*write*:mod:*snd*' >> set_ftrace_filter + - traceon/traceoff These commands turn tracing on and off when the specified functions are hit. The parameter determines how many times the
Signature · 1 line
2.6.1
Steven Rostedt
maintainerPATCH 8/9 tracing: Allow disabling compilation of specific trace systems
In reply to Steven RostedtFrom: Tal Shorer <[email protected]>
Allow a trace events header file to disable compilation of its trace events by defining the preprocessor macro NOTRACE.
This could be done, for example, according to a Kconfig option.
--- include/linux/tracepoint.h | 17 ++++++++++++++--- include/trace/define_trace.h | 2 +- 2 files changed, 15 insertions(+), 4 deletions(-)
include/linux/tracepoint.h +14 -3
@@ -111,7 +111,18 @@ extern void syscall_unregfunc(void); #define TP_ARGS(args...) args #define TP_CONDITION(args...) args -#ifdef CONFIG_TRACEPOINTS +/* +* Individual subsystem my have a separate configuration to +* enable their tracepoints. By default, this file will create +* the tracepoints if CONFIG_TRACEPOINT is defined. If a subsystem +* wants to be able to disable its tracepoints from being created +* it can define NOTRACE before including the tracepoint headers. +*/ +#if defined(CONFIG_TRACEPOINTS ) && !defined(NOTRACE ) +#define TRACEPOINTS_ENABLED +#endif + +#ifdef TRACEPOINTS_ENABLED /* * it_func[0] is never NULL because there is at least one element in the array
@@ -234,7 +245,7 @@ extern void syscall_unregfunc(void);#define EXPORT_TRACEPOINT_SYMBOL (name) \ EXPORT_SYMBOL(__tracepoint_##name) -#else /* !CONFIG_TRACEPOINTS */ +#else /* !TRACEPOINTS_ENABLED */ #define __DECLARE_TRACE (name, proto, args, cond, data_proto, data_args) \ static inline void trace_##name(proto) \ { } \
@@ -266,7 +277,7 @@ extern void syscall_unregfunc(void);#define EXPORT_TRACEPOINT_SYMBOL_GPL (name)#define EXPORT_TRACEPOINT_SYMBOL (name) -#endif /* CONFIG_TRACEPOINTS */ +#endif /* TRACEPOINTS_ENABLED */ #ifdef CONFIG_TRACING /**
include/trace/define_trace.h +1 -1
@@ -86,7 +86,7 @@#undef DECLARE_TRACE#define DECLARE_TRACE (name, proto, args) -#ifdef CONFIG_EVENT_TRACING +#ifdef TRACEPOINTS_ENABLED #include <trace/trace_events.h> #include <trace/perf.h> #endif
Signature · 1 line
2.6.1
Steven Rostedt
maintainerPATCH 9/9 tracing: gpio: Add Kconfig option for enabling/disabling trace events
In reply to Steven RostedtFrom: Tal Shorer <[email protected]>
Add a new options to trace Kconfig, CONFIG_TRACING_EVENTS_GPIO, that is used for enabling/disabling compilation of gpio function trace events.
--- include/trace/events/gpio.h | 4 ++++ kernel/trace/Kconfig | 7 +++++++ 2 files changed, 11 insertions(+)
include/trace/events/gpio.h +4 -0
@@ -1,6 +1,10 @@#undef TRACE_SYSTEM#define TRACE_SYSTEM gpio +#ifndef CONFIG_TRACING_EVENTS_GPIO +#define NOTRACE +#endif +#if !defined(_TRACE_GPIO_H) || defined(TRACE_HEADER_MULTI_READ )#define _TRACE_GPIO_H
kernel/trace/Kconfig +7 -0
@@ -635,6 +635,13 @@ config TRACE_ENUM_MAP_FILE If unsure, say N +config TRACING_EVENTS_GPIO + bool "Trace gpio events" + depends on GPIOLIB + default y + help + Enable tracing events for gpio subsystem + endif # FTRACE endif # TRACING_SUPPORT
Signature · 1 line
2.6.1