Tracepoint API simplification, text size shrink
Mathieu Desnoyers
reviewerv10 cover Tracepoint API simplification, text size shrink
Here is v10 of the tracepoint register/unregister API simplification, submitted for 3.15.
This removes 8.8kB to the size of vmlinux (mostly text).
Changes since v1:
- Adapt ftrace/perf callers,
- Update tracepoint.h macro,
- Build tested.
Changes since v2:
- Introduce for_each_tracepoint() iterator to allow listing the currently loaded tracepoints, for modules using coming/going notifiers to track tracepoints.
Changes since v3:
- Introduce module coming and going notifiers each with their own priority to ensure that other coming notifiers are called after, and coming notifiers are called before the tracepoint notifiers.
- Fix: move for_each_tracepoint() outside of the CONFIG_MODULE ifdef.
Changes since v4:
- Split tracepoints_mutex into two locks: tp_modlist_mutex, which protects the tracepoint list of modules, and a tracepoint_mutex, which protects the tracepoints per se. tracepoint_mutex nests inside tp_modlist_mutex.
- Introduce a tracepoint module notifier, to ensure consistency between iteration on tracepoints with for_each_tracepoint() and module coming and going notifications. This consistency is ensured by holding tp_modlist_mutex when calling the notifier and when iterating on the tracepoint module list.
Changes since v5:
- Remove tracepoint_add_old_probes within "Tracepoint cleanup: remove unused API functions" rather than in later patch.
- Remove struct tp_probes "old probes" list within "Tracepoint cleanup:
remove unused API functions", as it is not needed anymore.
- Within "Tracepoint cleanup: remove unused API functions", simply add the new module to tail of list, since there is no need to keep it ordered anymore.
Changes since v6:
- Remove unused struct list_head list from struct tp_probes in patch "Tracepoint: register/unregister struct tracepoint",
- Rename for_each_tracepoint() to for_each_kernel_tracepoint(). Only iterate on kernel tracepoints,
- Registered tracepoint module notifiers now receive struct tp_module pointer rather than struct module pointer,
- register_tracepoint_module_notifier and unregister_tracepoint_module_notifier now iterate on all modules and call coming/going notifiers. This ensures notifier registration and listing of already loaded modules are done atomically (protected by tp_modlist_mutex).
Changes since v7:
- Coding style updates,
- Shrink size of ftrace/perf struct ftrace_event_call,
- Put back the original tracepoints_mutex name, keep an original comment layout that goes beyond 80 columns, put back original tracepoint_module_list name, and rename tp_modlist_mutex to tracepoint_module_list_mutex, so this patch does not introduce cosmetic changes to pre-existing code.
Changes since v8:
- Use anonymous union in struct ftrace_event_call,
- Check for NULL call->tp in ftrace_event_get_name().
Changes since v9:
- Fix __TRACE_EVENT_FLAGS() to add flag rather set it. This was triggering the WARN_ON() safety net added into ftrace_event_reg() by this patch.
Thanks!
Mathieu
Mathieu Desnoyers (1):
Tracepoint: register/unregister struct tracepoint
include/linux/ftrace_event.h | 22 +- include/linux/tracepoint.h | 41 +-- include/trace/ftrace.h | 9 +- kernel/trace/trace_events.c | 51 ++-- kernel/trace/trace_events_trigger.c | 2 +- kernel/trace/trace_kprobe.c | 21 +- kernel/trace/trace_output.c | 2 +- kernel/trace/trace_uprobe.c | 20 +- kernel/tracepoint.c | 509 +++++++++++++++-------------------- 9 files changed, 328 insertions(+), 349 deletions(-)
Signature · 1 line
1.7.10.4
Mathieu Desnoyers
reviewerPATCH v10 1/1 Tracepoint: register/unregister struct tracepoint
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.
Quoted 1 line
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.
--- include/linux/ftrace_event.h | 22 +- include/linux/tracepoint.h | 41 +-- include/trace/ftrace.h | 9 +- kernel/trace/trace_events.c | 51 ++-- kernel/trace/trace_events_trigger.c | 2 +- kernel/trace/trace_kprobe.c | 21 +- kernel/trace/trace_output.c | 2 +- kernel/trace/trace_uprobe.c | 20 +- kernel/tracepoint.c | 509 +++++++++++++++-------------------- 9 files changed, 328 insertions(+), 349 deletions(-)
include/linux/ftrace_event.h +20 -2
@@ -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_get_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);
include/linux/tracepoint.h +25 -16
82 lines not on this page · raw message
include/trace/ftrace.h +6 -3
@@ -470,10 +470,11 @@ static inline notrace int ftrace_get_offsets_##call( \* }; * * static struct ftrace_event_call event_<call> = { -* .name = "<call>", +* .tp = &__tracepoint_<call>, * .class = event_class_<template>, * .event = &ftrace_event_type_<call>, * .print_fmt = print_fmt_<call>, +* .flags = TRACE_EVENT_FL_TRACEPOINT, * }; * // its only safe to use pointers when doing linker tricks to * // create an array.
@@ -605,10 +606,11 @@ static struct ftrace_event_class __used __refdata event_class_##call = { \#define DEFINE_EVENT (template, call, proto, args) \ \ static struct ftrace_event_call __used event_##call = { \ - .name = #call, \ + .tp = &__tracepoint_##call, \ .class = &event_class_##template, \ .event.funcs = &ftrace_event_type_funcs_##template, \ .print_fmt = print_fmt_##template, \ + .flags = TRACE_EVENT_FL_TRACEPOINT, \ }; \ static struct ftrace_event_call __used \ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
@@ -619,10 +621,11 @@ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call static const char print_fmt_##call[] = print; \ \ static struct ftrace_event_call __used event_##call = { \ - .name = #call, \ + .tp = &__tracepoint_##call, \ .class = &event_class_##template, \ .event.funcs = &ftrace_event_type_funcs_##call, \ .print_fmt = print_fmt_##call, \ + .flags = TRACE_EVENT_FL_TRACEPOINT, \ }; \ static struct ftrace_event_call __used \ __attribute__((section("_ftrace_events"))) *__event_##call = &event_##call
kernel/trace/trace_events.c +30 -21
186 lines not on this page · raw message
kernel/trace/trace_events_trigger.c +1 -1
@@ -1095,7 +1095,7 @@ event_enable_trigger_print(struct seq_file *m, struct event_trigger_ops *ops,seq_printf (m,"%s:%s:%s" , enable_data->enable ?ENABLE_EVENT_STR :DISABLE_EVENT_STR , enable_data->file->event_call->class->system, - enable_data->file->event_call->name); +ftrace_event_get_name (enable_data->file->event_call));if (data->count ==-1 )seq_puts (m,":unlimited" );
kernel/trace/trace_kprobe.c +13 -8
@@ -341,7 +341,7 @@ static struct trace_kprobe *find_trace_kprobe(const char *event,struct trace_kprobe *tk;list_for_each_entry (tk, &probe_list, list) -if (strcmp (tk->tp.call.name, event) ==0 && +if (strcmp (ftrace_event_get_name (&tk->tp.call), event) ==0 &&strcmp (tk->tp.call.class->system, group) ==0 )return tk;return NULL ;
@@ -516,7 +516,8 @@ static int register_trace_kprobe(struct trace_kprobe *tk)mutex_lock (&probe_lock);/* Delete old (same name) event if exist */ - old_tk =find_trace_kprobe (tk->tp.call.name, tk->tp.call.class->system); + old_tk =find_trace_kprobe (ftrace_event_get_name (&tk->tp.call), + tk->tp.call.class->system);if (old_tk) { ret =unregister_trace_kprobe (old_tk);if (ret <0 )
@@ -564,7 +565,8 @@ static int trace_kprobe_module_callback(struct notifier_block *nb,if (ret)pr_warning ("Failed to re-register probe %s on" "%s: %d\n" , - tk->tp.call.name, mod->name, ret); +ftrace_event_get_name (&tk->tp.call), + mod->name, ret); } }mutex_unlock (&probe_lock);
@@ -818,7 +820,8 @@ static int probes_seq_show(struct seq_file *m, void *v)int i;seq_printf (m,"%c" ,trace_kprobe_is_return (tk) ?'r' :'p' ); -seq_printf (m,":%s/%s" , tk->tp.call.class->system, tk->tp.call.name); +seq_printf (m,":%s/%s" , tk->tp.call.class->system, +ftrace_event_get_name (&tk->tp.call));if (!tk->symbol)seq_printf (m," 0x%p" , tk->rp.kp.addr);
@@ -876,7 +879,8 @@ static int probes_profile_seq_show(struct seq_file *m, void *v) {struct trace_kprobe *tk = v; -seq_printf (m," %-44s %15lu %15lu\n" , tk->tp.call.name, tk->nhit, +seq_printf (m," %-44s %15lu %15lu\n" , +ftrace_event_get_name (&tk->tp.call), tk->nhit, tk->rp.kp.nmissed);return 0 ;
@@ -1011,7 +1015,7 @@ print_kprobe_event(struct trace_iterator *iter, int flags, field = (struct kprobe_trace_entry_head *)iter->ent; tp = container_of(event, struct trace_probe, call.event); -if (!trace_seq_printf (s,"%s: (" , tp->call.name)) +if (!trace_seq_printf (s,"%s: (" ,ftrace_event_get_name (&tp->call))) goto partial;if (!seq_print_ip_sym (s, field->ip, flags |TRACE_ITER_SYM_OFFSET ))
@@ -1047,7 +1051,7 @@ print_kretprobe_event(struct trace_iterator *iter, int flags, field = (struct kretprobe_trace_entry_head *)iter->ent; tp = container_of(event, struct trace_probe, call.event); -if (!trace_seq_printf (s,"%s: (" , tp->call.name)) +if (!trace_seq_printf (s,"%s: (" ,ftrace_event_get_name (&tp->call))) goto partial;if (!seq_print_ip_sym (s, field->ret_ip, flags |TRACE_ITER_SYM_OFFSET ))
@@ -1286,7 +1290,8 @@ static int register_kprobe_event(struct trace_kprobe *tk) call->data = tk; ret =trace_add_event_call (call);if (ret) { -pr_info ("Failed to register kprobe event: %s\n" , call->name); +pr_info ("Failed to register kprobe event: %s\n" , +ftrace_event_get_name (call));kfree (call->print_fmt);unregister_ftrace_event (&call->event); }
kernel/trace/trace_output.c +1 -1
@@ -431,7 +431,7 @@ int ftrace_raw_output_prep(struct trace_iterator *iter, }trace_seq_init (p); - ret =trace_seq_printf (s,"%s: " , event->name); + ret =trace_seq_printf (s,"%s: " ,ftrace_event_get_name (event));if (!ret)return TRACE_TYPE_PARTIAL_LINE ;
kernel/trace/trace_uprobe.c +13 -7
@@ -294,7 +294,7 @@ static struct trace_uprobe *find_probe_event(const char *event, const char *groustruct trace_uprobe *tu;list_for_each_entry (tu, &uprobe_list, list) -if (strcmp (tu->tp.call.name, event) ==0 && +if (strcmp (ftrace_event_get_name (&tu->tp.call), event) ==0 &&strcmp (tu->tp.call.class->system, group) ==0 )return tu;
@@ -324,7 +324,8 @@ static int register_trace_uprobe(struct trace_uprobe *tu)mutex_lock (&uprobe_lock);/* register as an event */ - old_tu =find_probe_event (tu->tp.call.name, tu->tp.call.class->system); + old_tu =find_probe_event (ftrace_event_get_name (&tu->tp.call), + tu->tp.call.class->system);if (old_tu) {/* delete old event */ ret =unregister_trace_uprobe (old_tu);
@@ -599,7 +600,8 @@ static int probes_seq_show(struct seq_file *m, void *v)char c =is_ret_probe (tu) ?'r' :'p' ;int i; -seq_printf (m,"%c:%s/%s" , c, tu->tp.call.class->system, tu->tp.call.name); +seq_printf (m,"%c:%s/%s" , c, tu->tp.call.class->system, +ftrace_event_get_name (&tu->tp.call));seq_printf (m," %s:0x%p" , tu->filename, (void *)tu->offset);for (i =0 ; i < tu->tp.nr_args; i++)
@@ -649,7 +651,8 @@ static int probes_profile_seq_show(struct seq_file *m, void *v) {struct trace_uprobe *tu = v; -seq_printf (m," %s %-44s %15lu\n" , tu->filename, tu->tp.call.name, tu->nhit); +seq_printf (m," %s %-44s %15lu\n" , tu->filename, +ftrace_event_get_name (&tu->tp.call), tu->nhit);return 0 ; }
@@ -844,12 +847,14 @@ print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *e tu = container_of(event, struct trace_uprobe, tp.call.event);if (is_ret_probe (tu)) { -if (!trace_seq_printf (s,"%s: (0x%lx <- 0x%lx)" , tu->tp.call.name, +if (!trace_seq_printf (s,"%s: (0x%lx <- 0x%lx)" , +ftrace_event_get_name (&tu->tp.call), entry->vaddr[1 ], entry->vaddr[0 ])) goto partial; data =DATAOF_TRACE_ENTRY (entry, true); }else { -if (!trace_seq_printf (s,"%s: (0x%lx)" , tu->tp.call.name, +if (!trace_seq_printf (s,"%s: (0x%lx)" , +ftrace_event_get_name (&tu->tp.call), entry->vaddr[0 ])) goto partial; data =DATAOF_TRACE_ENTRY (entry, false);
@@ -1275,7 +1280,8 @@ static int register_uprobe_event(struct trace_uprobe *tu) ret =trace_add_event_call (call);if (ret) { -pr_info ("Failed to register uprobe event: %s\n" , call->name); +pr_info ("Failed to register uprobe event: %s\n" , +ftrace_event_get_name (call));kfree (call->print_fmt);unregister_ftrace_event (&call->event); }
kernel/tracepoint.c +219 -290
699 lines not on this page · raw message
Signature · 1 line
1.7.10.4
Steven Rostedt
maintainerRe: [PATCH v10 1/1] Tracepoint: register/unregister struct tracepoint
Quoted 88 lines · On Fri, 4 Apr 2014 10:02:34 -0400 Mathieu Desnoyers…
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.Quoted 1 line
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.
Signed-off-by Mathieu Desnoyers <[email protected]>CC Steven Rostedt <[email protected]>CC Ingo Molnar <[email protected]>CC Frederic Weisbecker <[email protected]>CC Andrew Morton <[email protected]>CC Frank Ch. Eigler <[email protected]>CC Johannes Berg <[email protected]>--- include/linux/ftrace_event.h | 22 +- include/linux/tracepoint.h | 41 +-- include/trace/ftrace.h | 9 +- kernel/trace/trace_events.c | 51 ++-- kernel/trace/trace_events_trigger.c | 2 +- kernel/trace/trace_kprobe.c | 21 +- kernel/trace/trace_output.c | 2 +- kernel/trace/trace_uprobe.c | 20 +- kernel/tracepoint.c | 509 +++++++++++++++-------------------- 9 files changed, 328 insertions(+), 349 deletions(-)include/linux/ftrace_event.h +10
-1@@ -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 */
include/linux/ftrace_event.h struct ftrace_event_call { · line 296
Quoted 5 lines
include/linux/ftrace_event.h +2
-0@@ -283,6 +292,15 @@ struct ftrace_event_call {#endif }; +static inline const char * +ftrace_event_get_name (struct ftrace_event_call *call)
I was thinking about this, and it really should be called "ftrace_event_name()", the "get" implies that there should be an associated "put".
include/linux/ftrace_event.h struct ftrace_event_call { · line 302
Quoted 6 lines
include/linux/ftrace_event.h +6
-0+{ +if (call->flags &TRACE_EVENT_FL_TRACEPOINT ) +return call->tp ? call->tp->name :NULL ; +else +return call->name; +}
Also, you missed a bunch of conversions in trace_event.c file. Do a search for '->name' and you'll find them. The ones that shouldn't be converted are rather obvious (system, field, mod), but you'll see others that were missed. I'm a bit nervous about what other ones may be missed as well.
-- Steve
Mathieu Desnoyers
reviewerRe: [PATCH v10 1/1] Tracepoint: register/unregister struct tracepoint
----- Original Message -----
Quoted 105 lines
From: "Steven Rostedt" <[email protected]>
To: "Mathieu Desnoyers" <[email protected]>
Cc: [email protected], "Ingo Molnar" <[email protected]>, "Frederic Weisbecker" <[email protected]>, "Andrew Morton" <[email protected]>, "Frank Ch. Eigler" <[email protected]>, "Johannes Berg" <[email protected]>
Sent: Tuesday, April 8, 2014 1:56:00 PM
Subject: Re: [PATCH v10 1/1] Tracepoint: register/unregister struct tracepointQuoted 94 lines · On Fri, 4 Apr 2014 10:02:34 -0400 Mathieu Desnoyers…
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.Quoted 1 line
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.
Signed-off-by Mathieu Desnoyers <[email protected]>CC Steven Rostedt <[email protected]>CC Ingo Molnar <[email protected]>CC Frederic Weisbecker <[email protected]>CC Andrew Morton <[email protected]>CC Frank Ch. Eigler <[email protected]>CC Johannes Berg <[email protected]>--- include/linux/ftrace_event.h | 22 +- include/linux/tracepoint.h | 41 +-- include/trace/ftrace.h | 9 +- kernel/trace/trace_events.c | 51 ++-- kernel/trace/trace_events_trigger.c | 2 +- kernel/trace/trace_kprobe.c | 21 +- kernel/trace/trace_output.c | 2 +- kernel/trace/trace_uprobe.c | 20 +- kernel/tracepoint.c | 509 +++++++++++++++-------------------- 9 files changed, 328 insertions(+), 349 deletions(-)include/linux/ftrace_event.h +3
-0@@ -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 {include/linux/ftrace_event.h +6
-1TRACE_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;include/linux/ftrace_event.h +1
-0struct 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 };
Quoted 6 lines
include/linux/ftrace_event.h struct ftrace_event_call { · line 296
Quoted 2 lines
include/linux/ftrace_event.h +2
-0+static inline const char * +ftrace_event_get_name (struct ftrace_event_call *call)I was thinking about this, and it really should be called "
ftrace_event_name()", the "get" implies that there should be an associated "put".
OK. I'll change it.
Quoted 13 lines
include/linux/ftrace_event.h struct ftrace_event_call { · line 302
Quoted 7 lines
include/linux/ftrace_event.h +6
-0+{ +if (call->flags &TRACE_EVENT_FL_TRACEPOINT ) +return call->tp ? call->tp->name :NULL ; +else +return call->name; +}Also, you missed a bunch of conversions in
trace_event.cfile. Do a search for '->name' and you'll find them. The ones that shouldn't be converted are rather obvious (system, field, mod), but you'll see others that were missed. I'm a bit nervous about what other ones may be missed as well.
Got them. I noticed that I forgot to turn on CONFIG_DYNAMIC_FTRACE when I did the original swap from name to _name to find the sites to update.
I did test more recently with a config that has all the FTRACE and PERF features enabled, but that was after I swapped back from _name to name, so I did not catch those two sites.
I just swapped the field name to _name again, and did the build with all FTRACE and PERF config options enabled to be certain I did not miss any. Just to be extra sure, I'm doing a make allyesconfig too.
Then, I'm changing _name back to name, and I'll prepare this as v11.
Is that OK with you ?
Thanks,
Mathieu
Quoted 3 lines
-- Steve
Signature · 3 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com
Steven Rostedt
maintainerRe: [PATCH v10 1/1] Tracepoint: register/unregister struct tracepoint
Quoted 21 lines · On Tue, 8 Apr 2014 19:35:54 +0000 (UTC) Mathieu Desnoyers…
Quoted 13 lines
include/linux/ftrace_event.h struct ftrace_event_call { · line 302
Quoted 7 lines
include/linux/ftrace_event.h +6
-0+{ +if (call->flags &TRACE_EVENT_FL_TRACEPOINT ) +return call->tp ? call->tp->name :NULL ; +else +return call->name; +}Also, you missed a bunch of conversions in
trace_event.cfile. Do a search for '->name' and you'll find them. The ones that shouldn't be converted are rather obvious (system, field, mod), but you'll see others that were missed. I'm a bit nervous about what other ones may be missed as well.Got them. I noticed that I forgot to turn on
CONFIG_DYNAMIC_FTRACEwhen I did the original swap from name to_nameto find the sites to update.I did test more recently with a config that has all the FTRACE and PERF features enabled, but that was after I swapped back from
_nameto name, so I did not catch those two sites.
Quoted 8 lines
I just swapped the field name to
_nameagain, and did the build with all FTRACE and PERF config options enabled to be certain I did not miss any. Just to be extra sure, I'm doing a make allyesconfig too.Then, I'm changing
_nameback to name, and I'll prepare this as v11.Is that OK with you ?
Maybe you want to build with an allmodconfig to make sure. You probably did get everything, but just to be sure.
-- Steve