Tracepoint API simplification, text size shrink
Mathieu Desnoyers
reviewerv9 cover Tracepoint API simplification, text size shrink
Here is v9 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().
Thanks!
Mathieu
Mathieu Desnoyers (1):
Tracepoint: register/unregister struct tracepoint
include/linux/ftrace_event.h | 20 +- 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, 327 insertions(+), 348 deletions(-)
Signature · 1 line
1.7.10.4
Mathieu Desnoyers
reviewerPATCH v9 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 | 20 +- 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, 327 insertions(+), 348 deletions(-)
include/linux/ftrace_event.h +19 -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 */
@@ -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 ;
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 v9 1/1] Tracepoint: register/unregister struct tracepoint
Quoted 7 lines · On Tue, 1 Apr 2014 18:31:48 -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 6 lines
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.
I applied this and kicked off my tests. It crashed horribly on the first stress test. Basically the test does this:
perf record -o perf-test.dat -a -- trace-cmd record -e all -p function \
hackbench 50
[ 86.299990] ------------[ cut here ]------------ [ 86.304631] WARNING: CPU: 3 PID: 2465 at /home/rostedt/work/git/linux-trace.git/kernel/trace/trace_events.c:226 ftrace_event_reg+0x29/0x92() [ 86.317233] Modules linked in: ipt_MASQUERADE sunrpc ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables uinput snd_hda_codec_idt snd_hda_codec_generic snd_h da_intel snd_hda_codec snd_hwdep snd_seq snd_seq_device kvm_intel snd_pcm kvm i2c_i801 shpchp snd_timer snd soundcore microcode pata_acpi firewire_ohci firewire_core ata_generic cr c_itu_t i915 drm_kms_helper drm i2c_algo_bit i2c_core video [ 86.354705] CPU: 3 PID: 2465 Comm: trace-cmd Not tainted 3.14.0-rc7-test+ #337 [ 86.361931] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./To be filled by O.E.M., BIOS SDBLI944.86P 05/08/2007 [ 86.373225] ffffffff81c9a630 ffff880077659de0 ffffffff814e556f 0000000000000000 [ 86.380739] ffff880077659e18 ffffffff8103c88f ffffffff810c8f04 ffffffff81a140c0 [ 86.388240] 0000000000000000 ffffffff81abb600 ffffffff81ab1290 ffff880077659e28 [ 86.395736] Call Trace: [ 86.398201] [<ffffffff814e556f>] dump_stack+0x4e/0x7a [ 86.403346] [<ffffffff8103c88f>] warn_slowpath_common+0x7f/0x98 [ 86.409359] [<ffffffff810c8f04>] ? ftrace_event_reg+0x29/0x92 [ 86.415198] [<ffffffff8103c956>] warn_slowpath_null+0x1a/0x1c [ 86.421037] [<ffffffff810c8f04>] ftrace_event_reg+0x29/0x92 [ 86.426702] [<ffffffff810ca4d9>] __ftrace_event_enable_disable+0xed/0x12e [ 86.433581] [<ffffffff810ca5e7>] __ftrace_set_clr_event_nolock+0xcd/0xee [ 86.440375] [<ffffffff810ca68b>] system_enable_write+0x83/0xb6 [ 86.446303] [<ffffffff811208b7>] vfs_write+0xab/0x108 [ 86.451445] [<ffffffff81120fd2>] SyS_write+0x49/0x80 [ 86.456509] [<ffffffff814f1092>] system_call_fastpath+0x16/0x1b [ 86.462517] ---[ end trace 543bc9f6b2135806 ]---
-- Steve
Mathieu Desnoyers
reviewerRe: [PATCH v9 1/1] Tracepoint: register/unregister struct tracepoint
----- Original Message -----
Quoted 25 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: Thursday, April 3, 2014 1:15:59 PM
Subject: Re: [PATCH v9 1/1] Tracepoint: register/unregister struct tracepointQuoted 7 lines · On Tue, 1 Apr 2014 18:31:48 -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 6 lines
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.
Quoted 5 lines
I applied this and kicked off my tests. It crashed horribly on the first stress test. Basically the test does this:
perf record -o perf-test.dat -a -- trace-cmd record -e all -p function \
hackbench 50
The warning below is a safety net I added. I assumed that:
kernel/trace/trace_events.c:ftrace_event_reg()
was meant to receive only struct ftrace_event_call defined by:
include/trace/ftrace.h:DEFINE_EVENT()
But it appears that other struct ftrace_event_call are passed to trace_events.c.
Looking at the backtrace, __ftrace_event_enable_disable() seems to only call ftrace_event_reg() with a TRACE_REG_REGISTER or TRACE_REG_UNREGISTER type, which ends up calling trace_probe_{register,unregister} directly. So It seems weird that it does that for a struct ftrace_event_call that is not a tracepoint. This is the reason why I did the assumption, but I added the WARN_ON() just in case.
But __ftrace_set_clr_event_nolock() calls ftrace_event_enable_disable() for all tr->events, which I'm starting to understand involves events that are not tracepoints too.
So my current thinking is that the pre-existing code was erroneously enabling tracepoints with the name of every event enabled (including e.g. function tracer, kprobes, etc). It was not failing because tracepoint.c silently accepted to enable tracepoints were not loaded yet.
If my analysis is correct, then a simple check like this at the beginning of ftrace_event_reg() should do the trick:
if (!(call->flags & TRACE_EVENT_FL_TRACEPOINT))
return 0;
Thoughts ?
Thanks,
Mathieu
Quoted 39 lines
[ 86.299990] ------------[ cut here ]------------ [ 86.304631] WARNING: CPU: 3 PID: 2465 at /home/rostedt/work/git/linux-trace.git/kernel/trace/trace_events.c:226 ftrace_event_reg+0x29/0x92() [ 86.317233] Modules linked in: ipt_MASQUERADE sunrpc ip6t_REJECT
nf_conntrack_ipv6nf_defrag_ipv6ip6table_filterip6_tablesuinputsnd_hda_codec_idtsnd_hda_codec_genericsnd_hda_intelsnd_hda_codecsnd_hwdepsnd_seqsnd_seq_devicekvm_intelsnd_pcmkvmi2c_i801shpchpsnd_timersnd soundcore microcodepata_acpifirewire_ohcifirewire_coreata_genericcrc_itu_ti915drm_kms_helperdrmi2c_algo_biti2c_corevideo[ 86.354705] CPU: 3 PID: 2465 Comm: trace-cmd Not tainted 3.14.0-rc7-test+ #337 [ 86.361931] Hardware name: To Be Filled By O.E.M. To Be Filled By O.E.M./To be filled by O.E.M., BIOS SDBLI944.86P 05/08/2007 [ 86.373225] ffffffff81c9a630 ffff880077659de0 ffffffff814e556f 0000000000000000 [ 86.380739] ffff880077659e18 ffffffff8103c88f ffffffff810c8f04 ffffffff81a140c0 [ 86.388240] 0000000000000000 ffffffff81abb600 ffffffff81ab1290 ffff880077659e28 [ 86.395736] Call Trace: [ 86.398201] [<ffffffff814e556f>] dump_stack+0x4e/0x7a [ 86.403346] [<ffffffff8103c88f>] warn_slowpath_common+0x7f/0x98 [ 86.409359] [<ffffffff810c8f04>] ? ftrace_event_reg+0x29/0x92 [ 86.415198] [<ffffffff8103c956>] warn_slowpath_null+0x1a/0x1c [ 86.421037] [<ffffffff810c8f04>] ftrace_event_reg+0x29/0x92 [ 86.426702] [<ffffffff810ca4d9>] __ftrace_event_enable_disable+0xed/0x12e [ 86.433581] [<ffffffff810ca5e7>] __ftrace_set_clr_event_nolock+0xcd/0xee [ 86.440375] [<ffffffff810ca68b>] system_enable_write+0x83/0xb6 [ 86.446303] [<ffffffff811208b7>] vfs_write+0xab/0x108 [ 86.451445] [<ffffffff81120fd2>] SyS_write+0x49/0x80 [ 86.456509] [<ffffffff814f1092>] system_call_fastpath+0x16/0x1b [ 86.462517] ---[ end trace 543bc9f6b2135806 ]----- Steve
Signature · 3 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com
Steven Rostedt
maintainerRe: [PATCH v9 1/1] Tracepoint: register/unregister struct tracepoint
Quoted 6 lines · On Thu, 3 Apr 2014 17:49:54 +0000 (UTC) Mathieu Desnoyers…
So my current thinking is that the pre-existing code was erroneously enabling tracepoints with the name of every event enabled (including e.g. function tracer, kprobes, etc). It was not failing because
tracepoint.csilently accepted to enable tracepoints were not loaded yet.
If that was true, than wouldn't the error code I added have returned an error?
-- Steve
Mathieu Desnoyers
reviewerRe: [PATCH v9 1/1] Tracepoint: register/unregister struct tracepoint
----- Original Message -----
Quoted 19 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: Thursday, April 3, 2014 2:54:41 PM
Subject: Re: [PATCH v9 1/1] Tracepoint: register/unregister struct tracepointQuoted 6 lines · On Thu, 3 Apr 2014 17:49:54 +0000 (UTC) Mathieu Desnoyers…
So my current thinking is that the pre-existing code was erroneously enabling tracepoints with the name of every event enabled (including e.g. function tracer, kprobes, etc). It was not failing because
tracepoint.csilently accepted to enable tracepoints were not loaded yet.
Quoted 2 lines
If that was true, than wouldn't the error code I added have returned an error?
Good point.
I found the culprit:
[ 0.560002] event_trace_enable: �GT����� call ffffffff81613930 (core) [ 0.564001] event_trace_enable: �GTȁ���� call ffffffff816139c0 (core)
compudj@ok:~/git/rostedt/linux-trace$ objdump -t vmlinux |grep ffffffff81613930 ffffffff81613930 l O .data 0000000000000090 event_sys_exit compudj@ok:~/git/rostedt/linux-trace$ objdump -t vmlinux |grep ffffffff816139c0 ffffffff816139c0 l O .data 0000000000000090 event_sys_enter
I'll look into those two sites tomorrow morning.
Thanks,
Mathieu
Quoted 3 lines
-- Steve
Signature · 3 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com
Mathieu Desnoyers
reviewerRe: [PATCH v9 1/1] Tracepoint: register/unregister struct tracepoint
----- Original Message -----
Quoted 41 lines
From: "Mathieu Desnoyers" <[email protected]>
To: "Steven Rostedt" <[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: Thursday, April 3, 2014 11:40:17 PM
Subject: Re: [PATCH v9 1/1] Tracepoint: register/unregister struct tracepoint----- Original Message -----
Quoted 22 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: Thursday, April 3, 2014 2:54:41 PM
Subject: Re: [PATCH v9 1/1] Tracepoint: register/unregister struct tracepointQuoted 6 lines · On Thu, 3 Apr 2014 17:49:54 +0000 (UTC) Mathieu Desnoyers…
So my current thinking is that the pre-existing code was erroneously enabling tracepoints with the name of every event enabled (including e.g. function tracer, kprobes, etc). It was not failing because
tracepoint.csilently accepted to enable tracepoints were not loaded yet.Quoted 2 lines
If that was true, than wouldn't the error code I added have returned an error?
Good point.
I found the culprit:
[ 0.560002] event_trace_enable: �GT����� call ffffffff81613930 (core) [ 0.564001] event_trace_enable: �GTȁ���� call ffffffff816139c0 (core)
Quoted 8 lines
compudj@ok:~/git/rostedt/linux-trace$ objdump -t vmlinux |grep ffffffff81613930 ffffffff81613930 l O .data 0000000000000090 event_sys_exit compudj@ok:~/git/rostedt/linux-trace$ objdump -t vmlinux |grep ffffffff816139c0 ffffffff816139c0 l O .data 0000000000000090 event_sys_enterI'll look into those two sites tomorrow morning.
And here is the fix:
include/linux/ftrace_event.h +1 -1
@@ -371,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);
I will respin a new version after some extra testing.
Thanks!
Mathieu
Quoted 14 lines
Thanks,
Mathieu
Quoted 3 lines
-- Steve
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Signature · 3 lines
Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com