From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: "Frank Ch. Eigler" <fche@redhat.com>,
Paul Mundt <lethal@linux-sh.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Jes Sorensen <jes@sgi.com>, Andrew Morton <akpm@osdl.org>,
Tom Zanussi <zanussi@us.ibm.com>,
Richard J Moore <richardj_moore@uk.ibm.com>,
Michel Dagenais <michel.dagenais@polymtl.ca>,
Christoph Hellwig <hch@infradead.org>,
Greg Kroah-Hartman <gregkh@suse.de>,
Thomas Gleixner <tglx@linutronix.de>,
William Cohen <wcohen@redhat.com>,
"Martin J. Bligh" <mbligh@mbligh.org>,
Ingo Molnar <mingo@elte.hu>,
ltt-dev@shafik.org, systemtap@sources.redhat.com
Subject: [PATCH] Linux Kernel Markers
Date: Mon, 18 Sep 2006 19:45:02 -0400 [thread overview]
Message-ID: <20060918234502.GA197@Krystal> (raw)
Hello,
Following this huge discussion thread, I tried to come with a marker mechanism
(which is something everyone seems to agree that is a necessity) that would be
useful to each kind of tracing (dynamic and static) (concerned projects :
SystemTAP, LKET, LKST, LTTng) and even combinations of those. Religious
considerations aside, I really think that this kind of generic markup is
necessary to fill *everybody*'s need. If I forgot about a specific genericity
aspect, please tell me.
I take for agreed that both static and dynamic tracing are useful for different
needs and that a full markup must support both and combinations, letting the
user or the distribution choose.
If you like it, please add the right menuconfig lines in arch/*/Kconfig and a
NOPS macro in include/asm-*/marker.h.
Comments are, as always, welcome.
Mathieu
--- BEGIN ---
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -1082,6 +1082,8 @@ config KPROBES
for kernel debugging, non-intrusive instrumentation and testing.
If in doubt, say "N".
+source "kernel/Kconfig.marker"
+
source "ltt/Kconfig"
endmenu
--- /dev/null
+++ b/include/asm-i386/marker.h
@@ -0,0 +1,12 @@
+/*****************************************************************************
+ * marker.h
+ *
+ * Code markup for dynamic and static tracing. i386 support.
+ *
+ * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
+ *
+ * September 2006
+ */
+
+#define JPROBE_TARGET \
+ __asm__ ( GENERIC_NOP5 )
--- /dev/null
+++ b/include/linux/marker.h
@@ -0,0 +1,77 @@
+/*****************************************************************************
+ * marker.h
+ *
+ * Code markup for dynamic and static tracing.
+ *
+ * Use either :
+ * MARK
+ * MARK_NOPRINT (will never call printk)
+ * MARK_STATIC (not dynamically instrumentable, will never call printk)
+ *
+ * Example :
+ *
+ * MARK(subsystem_event, "Event happened %d %s", someint, somestring);
+ * Where :
+ * - Subsystem is the name of your subsystem.
+ * - event is the name of the event to mark.
+ * - "Event happened %d %s" is the formatted string for printk.
+ * - someint is an integer.
+ * - somestring is a char *.
+ *
+ * Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
+ *
+ * September 2006
+ */
+
+#include <linux/config.h>
+#include <linux/kernel.h>
+
+#include <asm/marker.h>
+
+#define MARK_SYM(event) \
+ __asm__ ( "__mark_" KBUILD_BASENAME "_" #event ":" )
+
+#define MARK_INACTIVE(event, format, args...)
+
+#define MARK_PRINT(event, format, args...) printk(format, ##args);
+
+#define MARK_FPROBE(event, format, args...) fprobe_##event(args);
+
+#define MARK_KPROBE(event, format, args...) MARK_SYM(event);
+
+#define MARK_JPROBE(event, format, args...) \
+ do { \
+ MARK_SYM(event); \
+ JPROBE_TARGET; \
+ } while(0)
+
+/* Menu configured markers */
+#ifndef CONFIG_MARK
+#define MARK MARK_INACTIVE
+#elif defined(CONFIG_MARK_PRINT)
+#define MARK MARK_PRINT
+#elif defined(CONFIG_MARK_FPROBE)
+#define MARK MARK_FPROBE
+#elif defined(CONFIG_MARK_KPROBE)
+#define MARK MARK_KPROBE
+#elif defined(CONFIG_MARK_JPROBE)
+#define MARK MARK_JPROBE
+#endif
+
+#ifndef CONFIG_MARK_NOPRINT
+#define MARK_NOPRINT MARK_INACTIVE
+#elif defined(CONFIG_MARK_NOPRINT_FPROBE)
+#define MARK_NOPRINT MARK_FPROBE
+#elif defined(CONFIG_MARK_NOPRINT_KPROBE)
+#define MARK_NOPRINT MARK_KPROBE
+#elif defined(CONFIG_MARK_NOPRINT_JPROBE)
+#define MARK_NOPRINT MARK_JPROBE
+#endif
+
+#ifndef CONFIG_MARK_STATIC
+#define MARK_STATIC MARK_INACTIVE
+#else
+#define MARK_STATIC MARK_FPROBE
+#endif
+
+
--- /dev/null
+++ b/kernel/Kconfig.marker
@@ -0,0 +1,75 @@
+# Code markers configuration
+
+menu "Marker configuration"
+
+
+config MARK
+ bool "Enable MARK code markers"
+ default y
+ help
+ Activate markers that can call printk or can be instrumented
+ dynamically.
+
+choice
+ prompt "MARK code marker behavior"
+ default MARK_KPROBE
+ depends on MARK
+ help
+ Configuration of markers that can call printk or can be
+ instrumented dynamically.
+
+config MARK_KPROBE
+ bool "KPROBE"
+ ---help---
+ Change markers for a symbol "__mark_modulename_event".
+config MARK_JPROBE
+ bool "JPROBE"
+ ---help---
+ Change markers for a symbol "__mark_modulename_event"
+ and create a target for a high speed dynamic probe.
+config MARK_FPROBE
+ bool "FPROBE"
+ ---help---
+ Change markers for a function call.
+config MARK_PRINT
+ bool "PRINT"
+ ---help---
+ Call printk from the marker.
+endchoice
+
+config MARK_NOPRINT
+ bool "Enable MARK_NOPRINT code markers"
+ default y
+ help
+ Activate markers that cannot call printk.
+
+choice
+ prompt "MARK_NOPRINT code marker behavior"
+ default MARK_NOPRINT_KPROBE
+ depends on MARK_NOPRINT
+ help
+ Configuration of markers that cannot call printk.
+
+config MARK_NOPRINT_KPROBE
+ bool "KPROBE"
+ ---help---
+ Change markers for a symbol "__mark_modulename_event".
+config MARK_NOPRINT_JPROBE
+ bool "JPROBE"
+ ---help---
+ Change markers for a symbol "__mark_modulename_event"
+ and create a target for a high speed dynamic probe.
+config MARK_NOPRINT_FPROBE
+ bool "FPROBE"
+ ---help---
+ Change markers for a function call.
+endchoice
+
+config MARK_STATIC
+ bool "Enable MARK_STATIC code markers"
+ default y
+ help
+ Activate markers that cannot be instrumented dynamically. They will
+ generate function calls to each function-style probe.
+
+endmenu
--- END ---
OpenPGP public key: http://krystal.dyndns.org:8080/key/compudj.gpg
Key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
next reply other threads:[~2006-09-18 23:45 UTC|newest]
Thread overview: 74+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-18 23:45 Mathieu Desnoyers [this message]
2006-09-19 0:41 ` [PATCH] Linux Kernel Markers Alan Cox
2006-09-19 1:10 ` Dave Jones
2006-09-19 8:11 ` Ingo Molnar
2006-09-19 8:13 ` Ingo Molnar
2006-09-19 15:11 ` Martin J. Bligh
2006-09-19 15:31 ` Ingo Molnar
2006-09-20 11:19 ` Andi Kleen
2006-09-19 15:46 ` Frank Ch. Eigler
2006-09-19 16:04 ` Martin Bligh
2006-09-19 16:39 ` Andrew Morton
2006-09-19 16:41 ` Martin Bligh
2006-09-19 6:38 ` S. P. Prasanna
2006-09-19 17:17 ` Martin Bligh
2006-09-19 7:05 ` S. P. Prasanna
2006-09-19 18:02 ` Martin Bligh
2006-09-19 21:04 ` Karim Yaghmour
2006-09-20 13:27 ` Masami Hiramatsu
2006-09-20 17:21 ` Karim Yaghmour
2006-09-20 17:15 ` Mathieu Desnoyers
2006-09-20 17:35 ` Karim Yaghmour
2006-09-20 18:08 ` Frank Ch. Eigler
2006-09-20 18:22 ` Martin Bligh
2006-09-20 18:50 ` Karim Yaghmour
2006-09-20 19:22 ` Martin Bligh
2006-09-20 19:43 ` Karim Yaghmour
2006-09-20 19:40 ` Martin Bligh
2006-09-20 19:58 ` Karim Yaghmour
2006-09-20 18:25 ` Karim Yaghmour
2006-09-20 17:41 ` Karim Yaghmour
2006-09-19 17:54 ` Mathieu Desnoyers
2006-09-19 18:01 ` Martin Bligh
2006-09-19 18:11 ` Mathieu Desnoyers
2006-09-20 0:08 ` Alan Cox
2006-09-20 0:52 ` Karim Yaghmour
2006-09-20 10:44 ` Alan Cox
2006-09-20 23:00 ` Richard J Moore
2006-09-23 15:34 ` score-boarding [was Re: [PATCH] Linux Kernel Markers] Hugh Dickins
2006-09-26 8:43 ` Richard J Moore
2006-09-20 1:08 ` [PATCH] Linux Kernel Markers S. P. Prasanna
2006-09-20 8:18 ` Richard J Moore
2006-09-20 10:32 ` Alan Cox
2006-09-20 11:50 ` Andi Kleen
2006-09-20 13:45 ` Richard J Moore
2006-09-22 12:33 ` Pavel Machek
2006-09-20 1:09 ` Mathieu Desnoyers
2006-09-19 19:13 ` Vara Prasad
2006-09-19 19:16 ` Mathieu Desnoyers
2006-09-19 19:24 ` Martin Bligh
2006-09-19 22:27 ` Satoshi Oshima
2006-09-19 19:26 ` Martin Bligh
2006-09-19 9:30 ` S. P. Prasanna
2006-09-19 20:12 ` Mathieu Desnoyers
2006-09-20 11:00 ` Masami Hiramatsu
2006-09-20 9:39 ` Helge Hafting
2006-09-20 10:30 ` Alan Cox
2006-09-20 13:23 ` Masami Hiramatsu
2006-09-19 16:36 ` Ingo Molnar
2006-09-19 16:41 ` Richard J Moore
2006-09-19 16:49 ` Frank Ch. Eigler
2006-09-19 16:52 ` Martin Bligh
2006-09-19 17:02 ` Frank Ch. Eigler
2006-09-19 16:06 ` Vara Prasad
2006-09-19 16:14 ` Martin Bligh
2006-09-19 17:43 ` Mathieu Desnoyers
2006-09-19 16:23 ` Karim Yaghmour
2006-09-19 16:17 ` Martin Bligh
2006-09-19 16:29 ` Karim Yaghmour
2006-09-19 16:55 ` Karim Yaghmour
2006-09-19 17:41 ` Mathieu Desnoyers
2006-09-20 17:33 ` Karim Yaghmour
2006-09-19 15:21 ` Frank Ch. Eigler
2006-09-20 13:20 ` Masami Hiramatsu
2006-09-20 13:32 ` Mathieu Desnoyers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060918234502.GA197@Krystal \
--to=mathieu.desnoyers@polymtl.ca \
--cc=akpm@osdl.org \
--cc=fche@redhat.com \
--cc=gregkh@suse.de \
--cc=hch@infradead.org \
--cc=jes@sgi.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ltt-dev@shafik.org \
--cc=mbligh@mbligh.org \
--cc=michel.dagenais@polymtl.ca \
--cc=mingo@elte.hu \
--cc=richardj_moore@uk.ibm.com \
--cc=systemtap@sources.redhat.com \
--cc=tglx@linutronix.de \
--cc=wcohen@redhat.com \
--cc=zanussi@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.