[lttng-dev] [RFC PATCH lttng-tools] Fix printk instrumentation

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Thu Jul 4 14:22:28 EDT 2013


* Yannick Brosseau (yannick.brosseau at gmail.com) wrote:
> On 2013-07-04 12:58, Mathieu Desnoyers wrote:
> > This patch fixes the printk instrumentation.
> >
> > - It does not require a 2kB buffer on the stack anymore,
> > - It introduces __dynamic_array_enc_ext_2() and tp_memcpy_dyn_2(), which
> >   allow copying into a single variable-length buffer from two sources,
> >   useful for kernel < 3.5.
> > - It adds support for 3.10 kernel printk instrumentation.
> >
> > Yannick, can you try this out on 3.4, 3.5, 3.9 and 3.10 kernels ? When
> > you confirm that it works, I'll split it into two patches (one for
> > lttng-events.h and the other for printk.h), merge, and backport this.
> So far:
> 3.10: Works and compile when small typo fixed (see bellow)

ok, fixed.

> 3.9: Works
> 3.2: Fail to enable with this error msg (will try to get more detailled
> info or fix)
> root at debian-wheezy:/home/scientist# lttng enable-event -k console
> PERROR [6648/6745]: create event ioctl: Invalid argument (in
> kernel_create_event() at kernel.c:205)
> Error: Event console: Enable kernel event failed (channel channel0,
> session auto-20130630-135404)
> Warning: Some command(s) went wrong

Hrm, make sure the "condition" trace event actually exist in 3.2 ?

> 
> 
> > Only built-tested on 3.5 kernel so far.
> >
> > Thanks,
> >
> > Mathieu
> >
> > ---
> > diff --git a/instrumentation/events/lttng-module/printk.h b/instrumentation/events/lttng-module/printk.h
> > index 4c744f9..e22a2cc 100644
> > --- a/instrumentation/events/lttng-module/printk.h
> > +++ b/instrumentation/events/lttng-module/printk.h
> > @@ -7,7 +7,25 @@
> >  #include <linux/tracepoint.h>
> >  #include <linux/version.h>
> >  
> > -#define MSG_TRACE_MAX_LEN	2048
> > +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
> > +
> > +TRACE_EVENT(console,
> > +	TP_PROTO(const char *text, size_t len),
> > +
> > +	TP_ARGS(text, len),
> > +
> > +	TP_STRUCT__entry(
> > +		__dynamic_array_text(char, msg, len)
> > +	),
> > +
> > +	TP_fast_assign(
> > +		tp_memcpy_dyn(msg, msg)
> >
> second "msg" should be "text"

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com



More information about the lttng-dev mailing list