Skip to contentSkip to conversation

Fix printk instrumentation

RFC PATCH Yannick Brosseau 2 participants 3 messages Jul 4, 2013 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 20130704165855.GB31483@Krystal

#1 lore raw
Quoted 11 lines · Mathieu Desnoyers

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) 3.9: Works
3.2: Fail to enable with this error msg (will try to get more detailled info or fix)

root@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
Quoted 20 lines

Only built-tested on 3.5 kernel so far.

Thanks,

Mathieu

---

instrumentation/events/lttng-module/printk.h +4 -1
index 4c744f9..e22a2cc 100644
@@ -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),

instrumentation/events/lttng-module/printk.h line 23

Quoted 10 lines
instrumentation/events/lttng-module/printk.h +9 -0
+
+	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"

A message that is not in the archive (sent off-list or not yet received): [email protected]

#3 lore raw
Quoted 9 lines · * Yannick Brosseau ([email protected]) wrote:
Quoted 8 lines · Mathieu Desnoyers

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.

Quoted 5 lines
Quoted 3 lines

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.

Quoted 9 lines

3.9: Works
3.2: Fail to enable with this error msg (will try to get more detailled info or fix)

root@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 ?

Quoted 33 lines
Quoted 22 lines

Only built-tested on 3.5 kernel so far.

Thanks,

Mathieu

---

instrumentation/events/lttng-module/printk.h +4 -1
index 4c744f9..e22a2cc 100644
@@ -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),

instrumentation/events/lttng-module/printk.h line 23

Quoted 10 lines
instrumentation/events/lttng-module/printk.h +9 -0
+
+	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"

Signature · 3 lines
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

A message that is not in the archive (sent off-list or not yet received): 20130704182228.GA332@Krystal

#5 lore raw
Quoted 10 lines · Mathieu Desnoyers
Quoted 9 lines · * Yannick Brosseau ([email protected]) wrote:

3.9: Works
3.2: Fail to enable with this error msg (will try to get more detailled info or fix)

root@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
Quoted 2 lines

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

Ok, my bad, the printk_console traceport was added only in 3.4, which works well.

Yannick