Re: [PATCH 08/16] tracing: have event_trace_printk use statictracer

From: Steven Rostedt
Date: Thu Mar 12 2009 - 23:08:37 EST



On Thu, 12 Mar 2009, Andrew Morton wrote:

> On Thu, 12 Mar 2009 22:37:12 -0400 Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> > + static const char *trace_printk_fmt \
> > + __attribute__((section("__trace_printk_fmt"))) = \
> > + __builtin_constant_p(fmt) ? fmt : NULL; \
>
> hm. Does this put trace_printk_fmt into the __trace_printk_fmt
> section, or does it put *trace_printk_fmt in there?

We save the pointer into that section:

0xc0432100: "my format is to print this number %d\n"

[...]

section <__trace_printk_fmt>:
[...]
0xc0483210: 0xc0432100 (trace_printk_fmt)


It would be difficult to make the string be located in the section when
the caller simply does:

trace_printk("my format is to print this number %d\n", mynum);

Although I guess we could try by using [] = fmt, but the pointer just
seemed easier.

Note, for modules, we have a hash of all strings/pointers. When a module
is loaded, we copy the strings into the hash (if it is not already there)
and keep it loaded, even if the module is removed. This is because the
pointer to this string would still be around inside the trace buffer.

-- Steve

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/