lkml.org 
[lkml]   [2008]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 08/17] LTTng instrumentation - kernel
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: 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: 'Ingo Molnar' <mingo@elte.hu>
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 | 5 +++++
kernel/printk.c | 6 ++++++
3 files changed, 30 insertions(+)
Index: linux-2.6-lttng/kernel/printk.c
===================================================================
--- linux-2.6-lttng.orig/kernel/printk.c 2008-07-15 14:51:50.000000000 -0400
+++ linux-2.6-lttng/kernel/printk.c 2008-07-15 15:14:31.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
@@ -601,6 +603,7 @@ asmlinkage int printk(const char *fmt, .
int r;

va_start(args, fmt);
+ trace_kernel_printk(__builtin_return_address(0));
r = vprintk(fmt, args);
va_end(args);

@@ -677,6 +680,9 @@ asmlinkage int vprintk(const char *fmt,
raw_local_irq_save(flags);
this_cpu = smp_processor_id();

+ trace_kernel_vprintk(__builtin_return_address(0),
+ printk_buf, printed_len);
+
/*
* Ouch, printk recursed into itself!
*/
Index: linux-2.6-lttng/kernel/module.c
===================================================================
--- linux-2.6-lttng.orig/kernel/module.c 2008-07-15 15:12:09.000000000 -0400
+++ linux-2.6-lttng/kernel/module.c 2008-07-15 15:14:31.000000000 -0400
@@ -48,6 +48,7 @@
#include <linux/license.h>
#include <asm/sections.h>
#include <linux/tracepoint.h>
+#include <trace/kernel.h>

#if 0
#define DEBUGP printk
@@ -1429,6 +1430,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);
@@ -2244,6 +2247,8 @@ static struct module *load_module(void _
/* Get rid of temporary copy */
vfree(hdr);

+ 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 2008-07-15 15:14:31.000000000 -0400
@@ -0,0 +1,19 @@
+#ifndef _TRACE_KERNEL_H
+#define _TRACE_KERNEL_H
+
+#include <linux/tracepoint.h>
+
+DEFINE_TRACE(kernel_printk,
+ TPPROTO(void *retaddr),
+ TPARGS(retaddr));
+DEFINE_TRACE(kernel_vprintk,
+ TPPROTO(void *retaddr, char *buf, int len),
+ TPARGS(retaddr, buf, len));
+DEFINE_TRACE(kernel_module_free,
+ TPPROTO(struct module *mod),
+ TPARGS(mod));
+DEFINE_TRACE(kernel_module_load,
+ TPPROTO(struct module *mod),
+ TPARGS(mod));
+
+#endif
--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68


\
 
 \ /
  Last update: 2008-07-16 00:31    [from the cache]
©2003-2011 Jasper Spaans