From: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
To: akpm@linux-foundation.org, Ingo Molnar <mingo@elte.hu>,
linux-kernel@vger.kernel.org, ltt-dev@lists.casi.polymtl.ca
Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>,
Frederic Weisbecker <fweisbec@gmail.com>,
Masami Hiramatsu <mhiramat@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
"Frank Ch. Eigler" <fche@redhat.com>,
Hideo AOKI <haoki@redhat.com>,
Takashi Nishiie <t-nishiie@np.css.fujitsu.com>,
Steven Rostedt <rostedt@goodmis.org>,
Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Subject: [patch 7/9] LTTng instrumentation - kernel
Date: Tue, 24 Mar 2009 11:56:32 -0400 [thread overview]
Message-ID: <20090324160148.872305963@polymtl.ca> (raw)
In-Reply-To: <20090324155625.420966314@polymtl.ca>
[-- Attachment #1: lttng-instrumentation-kernel.patch --]
[-- Type: text/plain, Size: 4832 bytes --]
Instrument the core kernel : module load/free and printk events. It helps the
tracer to keep track of module related events and to export valuable printk
information into the traces.
Those tracepoints are used by LTTng.
About the performance impact of tracepoints (which is comparable to markers),
even without immediate values optimizations, tests done by Hideo Aoki on ia64
show no regression. His test case was using hackbench on a kernel where
scheduler instrumentation (about 5 events in code scheduler code) was added.
See the "Tracepoints" patch header for performance result detail.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
CC: 'Ingo Molnar' <mingo@elte.hu>
CC: Frederic Weisbecker <fweisbec@gmail.com>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: Masami Hiramatsu <mhiramat@redhat.com>
CC: 'Peter Zijlstra' <peterz@infradead.org>
CC: "Frank Ch. Eigler" <fche@redhat.com>
CC: 'Hideo AOKI' <haoki@redhat.com>
CC: Takashi Nishiie <t-nishiie@np.css.fujitsu.com>
CC: 'Steven Rostedt' <rostedt@goodmis.org>
CC: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
---
include/trace/kernel.h | 19 +++++++++++++++++++
kernel/module.c | 8 ++++++++
kernel/printk.c | 7 +++++++
3 files changed, 34 insertions(+)
Index: linux-2.6-lttng/kernel/printk.c
===================================================================
--- linux-2.6-lttng.orig/kernel/printk.c 2009-03-24 09:09:52.000000000 -0400
+++ linux-2.6-lttng/kernel/printk.c 2009-03-24 09:31:53.000000000 -0400
@@ -32,6 +32,7 @@
#include <linux/security.h>
#include <linux/bootmem.h>
#include <linux/syscalls.h>
+#include <trace/kernel.h>
#include <asm/uaccess.h>
@@ -59,6 +60,7 @@ int console_printk[4] = {
MINIMUM_CONSOLE_LOGLEVEL, /* minimum_console_loglevel */
DEFAULT_CONSOLE_LOGLEVEL, /* default_console_loglevel */
};
+EXPORT_SYMBOL_GPL(console_printk);
/*
* Low level drivers may need that to know if they can schedule in
@@ -128,6 +130,9 @@ EXPORT_SYMBOL(console_set_on_cmdline);
/* Flag: console code may call schedule() */
static int console_may_schedule;
+DEFINE_TRACE(kernel_printk);
+DEFINE_TRACE(kernel_vprintk);
+
#ifdef CONFIG_PRINTK
static char __log_buf[__LOG_BUF_LEN];
@@ -560,6 +565,7 @@ asmlinkage int printk(const char *fmt, .
int r;
va_start(args, fmt);
+ trace_kernel_printk(_RET_IP_);
r = vprintk(fmt, args);
va_end(args);
@@ -667,6 +673,7 @@ asmlinkage int vprintk(const char *fmt,
printed_len += vscnprintf(printk_buf + printed_len,
sizeof(printk_buf) - printed_len, fmt, args);
+ trace_kernel_vprintk(_RET_IP_, printk_buf, printed_len);
/*
* Copy the output into log_buf. If the caller didn't provide
Index: linux-2.6-lttng/kernel/module.c
===================================================================
--- linux-2.6-lttng.orig/kernel/module.c 2009-03-24 09:09:59.000000000 -0400
+++ linux-2.6-lttng/kernel/module.c 2009-03-24 09:31:53.000000000 -0400
@@ -51,6 +51,7 @@
#include <linux/tracepoint.h>
#include <linux/ftrace.h>
#include <linux/async.h>
+#include <trace/kernel.h>
#if 0
#define DEBUGP printk
@@ -78,6 +79,9 @@ static BLOCKING_NOTIFIER_HEAD(module_not
/* Bounds of module allocation, for speeding __module_text_address */
static unsigned long module_addr_min = -1UL, module_addr_max = 0;
+DEFINE_TRACE(kernel_module_load);
+DEFINE_TRACE(kernel_module_free);
+
int register_module_notifier(struct notifier_block * nb)
{
return blocking_notifier_chain_register(&module_notify_list, nb);
@@ -1445,6 +1449,8 @@ static int __unlink_module(void *_mod)
/* Free a module, remove from lists, etc (must hold module_mutex). */
static void free_module(struct module *mod)
{
+ trace_kernel_module_free(mod);
+
/* Delete from various lists */
stop_machine(__unlink_module, mod, NULL);
remove_notes_attrs(mod);
@@ -2276,6 +2282,8 @@ static noinline struct module *load_modu
vfree(hdr);
stop_machine_destroy();
+
+ trace_kernel_module_load(mod);
/* Done! */
return mod;
Index: linux-2.6-lttng/include/trace/kernel.h
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ linux-2.6-lttng/include/trace/kernel.h 2009-03-24 09:32:03.000000000 -0400
@@ -0,0 +1,19 @@
+#ifndef _TRACE_KERNEL_H
+#define _TRACE_KERNEL_H
+
+#include <linux/tracepoint.h>
+
+DECLARE_TRACE(kernel_printk,
+ TPPROTO(unsigned long retaddr),
+ TPARGS(retaddr));
+DECLARE_TRACE(kernel_vprintk,
+ TPPROTO(unsigned long retaddr, char *buf, int len),
+ TPARGS(retaddr, buf, len));
+DECLARE_TRACE(kernel_module_free,
+ TPPROTO(struct module *mod),
+ TPARGS(mod));
+DECLARE_TRACE(kernel_module_load,
+ TPPROTO(struct module *mod),
+ TPARGS(mod));
+
+#endif
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
next prev parent reply other threads:[~2009-03-24 16:27 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-24 15:56 [patch 0/9] LTTng core kernel instrumentation Mathieu Desnoyers
2009-03-24 15:56 ` [patch 1/9] IRQ handle prepare for instrumentation Mathieu Desnoyers
2009-03-24 15:56 ` [patch 2/9] LTTng instrumentation - irq Mathieu Desnoyers
2009-03-24 17:33 ` Jason Baron
2009-03-24 17:50 ` Ingo Molnar
2009-03-24 17:57 ` Jason Baron
2009-03-24 19:12 ` Ingo Molnar
2009-03-24 20:11 ` Mathieu Desnoyers
2009-03-24 20:51 ` Ingo Molnar
2009-03-25 8:47 ` Ingo Molnar
2009-03-25 18:30 ` Mathieu Desnoyers
2009-03-25 2:00 ` Steven Rostedt
2009-03-26 18:27 ` Mathieu Desnoyers
2009-03-27 22:53 ` Steven Rostedt
2009-04-02 2:42 ` Mathieu Desnoyers
2009-03-25 2:09 ` Steven Rostedt
2009-03-26 18:28 ` Mathieu Desnoyers
2009-03-27 19:18 ` Jason Baron
2009-03-24 19:14 ` Ingo Molnar
2009-03-27 22:12 ` Thomas Gleixner
2009-03-24 15:56 ` [patch 3/9] LTTng instrumentation tasklets Mathieu Desnoyers
2009-03-24 17:56 ` Ingo Molnar
2009-03-25 13:52 ` Chetan.Loke
2009-03-25 14:17 ` Peter Zijlstra
2009-03-25 17:37 ` Chetan.Loke
2009-03-25 17:52 ` Steven Rostedt
2009-03-24 15:56 ` [patch 4/9] LTTng instrumentation softirq Mathieu Desnoyers
2009-03-24 18:01 ` Ingo Molnar
2009-03-24 15:56 ` [patch 5/9] LTTng instrumentation scheduler fix task migration Mathieu Desnoyers
2009-03-24 17:53 ` Ingo Molnar
2009-03-24 15:56 ` [patch 6/9] LTTng instrumentation - timer Mathieu Desnoyers
2009-03-24 18:21 ` Ingo Molnar
2009-03-24 19:14 ` Thomas Gleixner
2009-03-24 20:47 ` Ingo Molnar
2009-03-27 22:05 ` Thomas Gleixner
2009-03-24 15:56 ` Mathieu Desnoyers [this message]
2009-03-24 18:33 ` [patch 7/9] LTTng instrumentation - kernel Ingo Molnar
2009-03-25 1:13 ` Rusty Russell
2009-03-25 8:40 ` Ingo Molnar
2009-03-25 13:06 ` Frederic Weisbecker
2009-03-24 15:56 ` [patch 8/9] LTTng instrumentation - filemap Mathieu Desnoyers
2009-03-24 18:39 ` Ingo Molnar
2009-03-24 15:56 ` [patch 9/9] LTTng instrumentation - swap Mathieu Desnoyers
2009-03-24 18:51 ` Ingo Molnar
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=20090324160148.872305963@polymtl.ca \
--to=mathieu.desnoyers@polymtl.ca \
--cc=akpm@linux-foundation.org \
--cc=eduard.munteanu@linux360.ro \
--cc=fche@redhat.com \
--cc=fweisbec@gmail.com \
--cc=haoki@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ltt-dev@lists.casi.polymtl.ca \
--cc=mhiramat@redhat.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=t-nishiie@np.css.fujitsu.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome