* [PATCH 0/4] [GIT PULL] more updates for TRACE_EVENTS for modules
@ 2009-04-15 3:15 Steven Rostedt
2009-04-15 3:15 ` [PATCH 1/4] tracing/events: fix compile for modules disabled Steven Rostedt
` (4 more replies)
0 siblings, 5 replies; 17+ messages in thread
From: Steven Rostedt @ 2009-04-15 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Frederic Weisbecker, Theodore Tso, Arjan van de Ven,
Christoph Hellwig, Mathieu Desnoyers, Jeremy Fitzhardinge,
Lai Jiangshan, Zhaolei, Li Zefan, KOSAKI Motohiro,
Masami Hiramatsu, Frank Ch. Eigler, Tom Zanussi, Jiaying Zhang,
Michael Rubin, Martin Bligh
Ingo,
Please pull the latest tip/tracing/core tree, which can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
tip/tracing/core
Steven Rostedt (4):
tracing/events: fix compile for modules disabled
tracing/events: fix lockdep system name
tracing/events: move trace point headers into include/trace/events
tracing/events: add trace-events-sample
----
include/linux/kmemtrace.h | 2 +-
include/trace/define_trace.h | 2 +-
include/trace/events/irq.h | 57 +++++
include/trace/events/kmem.h | 194 ++++++++++++++++
include/trace/events/lockdep.h | 60 +++++
include/trace/events/sched.h | 339 ++++++++++++++++++++++++++++
include/trace/events/skb.h | 40 ++++
include/trace/irq.h | 57 -----
include/trace/kmem.h | 194 ----------------
include/trace/lockdep.h | 60 -----
include/trace/sched.h | 339 ----------------------------
include/trace/skb.h | 40 ----
kernel/exit.c | 2 +-
kernel/fork.c | 3 +-
kernel/irq/handle.c | 2 +-
kernel/kthread.c | 2 +-
kernel/lockdep.c | 2 +-
kernel/sched.c | 2 +-
kernel/signal.c | 2 +-
kernel/softirq.c | 2 +-
kernel/trace/ftrace.c | 2 +-
kernel/trace/trace_events.c | 12 +-
kernel/trace/trace_sched_switch.c | 2 +-
kernel/trace/trace_sched_wakeup.c | 2 +-
mm/util.c | 2 +-
net/core/drop_monitor.c | 2 +-
net/core/net-traces.c | 2 +-
net/core/skbuff.c | 2 +-
samples/Kconfig | 7 +
samples/Makefile | 2 +-
samples/trace_events/Makefile | 8 +
samples/trace_events/trace-events-sample.c | 56 +++++
samples/trace_events/trace-events-sample.h | 124 ++++++++++
33 files changed, 914 insertions(+), 710 deletions(-)
--
^ permalink raw reply [flat|nested] 17+ messages in thread
* [PATCH 1/4] tracing/events: fix compile for modules disabled
2009-04-15 3:15 [PATCH 0/4] [GIT PULL] more updates for TRACE_EVENTS for modules Steven Rostedt
@ 2009-04-15 3:15 ` Steven Rostedt
2009-04-15 16:07 ` Frederic Weisbecker
2009-04-15 3:15 ` [PATCH 2/4] tracing/events: fix lockdep system name Steven Rostedt
` (3 subsequent siblings)
4 siblings, 1 reply; 17+ messages in thread
From: Steven Rostedt @ 2009-04-15 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Frederic Weisbecker, Theodore Tso, Arjan van de Ven,
Christoph Hellwig, Mathieu Desnoyers, Jeremy Fitzhardinge,
Lai Jiangshan, Zhaolei, Li Zefan, KOSAKI Motohiro,
Masami Hiramatsu, Frank Ch. Eigler, Tom Zanussi, Jiaying Zhang,
Michael Rubin, Martin Bligh
[-- Attachment #1: 0001-tracing-events-fix-compile-for-modules-disabled.patch --]
[-- Type: text/plain, Size: 1503 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
Impact: compile fix
The addition of TRACE_EVENT for modules breaks the build for when
modules are disabled. This code fixes that.
Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
kernel/trace/trace_events.c | 12 ++++++++++--
1 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index a4b1777..6591d83 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -797,6 +797,7 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events)
(unsigned long)event < (unsigned long)end; \
event++)
+#ifdef CONFIG_MODULES
static void trace_module_add_events(struct module *mod)
{
struct ftrace_event_call *call, *start, *end;
@@ -840,8 +841,8 @@ static void trace_module_remove_events(struct module *mod)
}
}
-int trace_module_notify(struct notifier_block *self,
- unsigned long val, void *data)
+static int trace_module_notify(struct notifier_block *self,
+ unsigned long val, void *data)
{
struct module *mod = data;
@@ -858,6 +859,13 @@ int trace_module_notify(struct notifier_block *self,
return 0;
}
+#else
+static int trace_module_notify(struct notifier_block *self,
+ unsigned long val, void *data)
+{
+ return 0;
+}
+#endif /* CONFIG_MODULES */
struct notifier_block trace_module_nb = {
.notifier_call = trace_module_notify,
--
1.6.2.1
--
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 2/4] tracing/events: fix lockdep system name
2009-04-15 3:15 [PATCH 0/4] [GIT PULL] more updates for TRACE_EVENTS for modules Steven Rostedt
2009-04-15 3:15 ` [PATCH 1/4] tracing/events: fix compile for modules disabled Steven Rostedt
@ 2009-04-15 3:15 ` Steven Rostedt
2009-04-15 6:34 ` Ingo Molnar
2009-04-15 9:32 ` Peter Zijlstra
2009-04-15 3:15 ` [PATCH 3/4] tracing/events: move trace point headers into include/trace/events Steven Rostedt
` (2 subsequent siblings)
4 siblings, 2 replies; 17+ messages in thread
From: Steven Rostedt @ 2009-04-15 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Frederic Weisbecker, Theodore Tso, Arjan van de Ven,
Christoph Hellwig, Mathieu Desnoyers, Jeremy Fitzhardinge,
Lai Jiangshan, Zhaolei, Li Zefan, KOSAKI Motohiro,
Masami Hiramatsu, Frank Ch. Eigler, Tom Zanussi, Jiaying Zhang,
Michael Rubin, Martin Bligh
[-- Attachment #1: 0002-tracing-events-fix-lockdep-system-name.patch --]
[-- Type: text/plain, Size: 757 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
Impact: fix compile error of lockdep event tracer
Ingo Molnar pointed out that the system name for the lockdep tracer was "lock"
which is used to include the event trace file name. It should be "lockdep"
Reported-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
include/trace/lockdep.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/trace/lockdep.h b/include/trace/lockdep.h
index 4d301e7..45e326b 100644
--- a/include/trace/lockdep.h
+++ b/include/trace/lockdep.h
@@ -5,7 +5,7 @@
#include <linux/tracepoint.h>
#undef TRACE_SYSTEM
-#define TRACE_SYSTEM lock
+#define TRACE_SYSTEM lockdep
#ifdef CONFIG_LOCKDEP
--
1.6.2.1
--
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 3/4] tracing/events: move trace point headers into include/trace/events
2009-04-15 3:15 [PATCH 0/4] [GIT PULL] more updates for TRACE_EVENTS for modules Steven Rostedt
2009-04-15 3:15 ` [PATCH 1/4] tracing/events: fix compile for modules disabled Steven Rostedt
2009-04-15 3:15 ` [PATCH 2/4] tracing/events: fix lockdep system name Steven Rostedt
@ 2009-04-15 3:15 ` Steven Rostedt
2009-04-15 3:15 ` [PATCH 4/4] tracing/events: add trace-events-sample Steven Rostedt
2009-04-15 7:27 ` [PATCH 0/4] [GIT PULL] more updates for TRACE_EVENTS for modules Ingo Molnar
4 siblings, 0 replies; 17+ messages in thread
From: Steven Rostedt @ 2009-04-15 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Frederic Weisbecker, Theodore Tso, Arjan van de Ven,
Christoph Hellwig, Mathieu Desnoyers, Jeremy Fitzhardinge,
Lai Jiangshan, Zhaolei, Li Zefan, KOSAKI Motohiro,
Masami Hiramatsu, Frank Ch. Eigler, Tom Zanussi, Jiaying Zhang,
Michael Rubin, Martin Bligh, Peter Zijlstra, Neil Horman,
Eduard - Gabriel Munteanu, Pekka Enberg
[-- Attachment #1: 0003-tracing-events-move-trace-point-headers-into-includ.patch --]
[-- Type: text/plain, Size: 41278 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
Impact: clean up
Create a sub directory in include/trace called events to keep the
trace point headers in their own separate directory. Only headers that
declare trace points should be defined in this directory.
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Neil Horman <nhorman@tuxdriver.com>
Cc: Zhao Lei <zhaolei@cn.fujitsu.com>
Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
Cc: Pekka Enberg <penberg@cs.helsinki.fi>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
include/linux/kmemtrace.h | 2 +-
include/trace/define_trace.h | 2 +-
include/trace/events/irq.h | 57 ++++++
include/trace/events/kmem.h | 194 +++++++++++++++++++++
include/trace/events/lockdep.h | 60 +++++++
include/trace/events/sched.h | 339 +++++++++++++++++++++++++++++++++++++
include/trace/events/skb.h | 40 +++++
include/trace/irq.h | 57 ------
include/trace/kmem.h | 194 ---------------------
include/trace/lockdep.h | 60 -------
include/trace/sched.h | 339 -------------------------------------
include/trace/skb.h | 40 -----
kernel/exit.c | 2 +-
kernel/fork.c | 3 +-
kernel/irq/handle.c | 2 +-
kernel/kthread.c | 2 +-
kernel/lockdep.c | 2 +-
kernel/sched.c | 2 +-
kernel/signal.c | 2 +-
kernel/softirq.c | 2 +-
kernel/trace/ftrace.c | 2 +-
kernel/trace/trace_sched_switch.c | 2 +-
kernel/trace/trace_sched_wakeup.c | 2 +-
mm/util.c | 2 +-
net/core/drop_monitor.c | 2 +-
net/core/net-traces.c | 2 +-
net/core/skbuff.c | 2 +-
27 files changed, 708 insertions(+), 707 deletions(-)
create mode 100644 include/trace/events/irq.h
create mode 100644 include/trace/events/kmem.h
create mode 100644 include/trace/events/lockdep.h
create mode 100644 include/trace/events/sched.h
create mode 100644 include/trace/events/skb.h
delete mode 100644 include/trace/irq.h
delete mode 100644 include/trace/kmem.h
delete mode 100644 include/trace/lockdep.h
delete mode 100644 include/trace/sched.h
delete mode 100644 include/trace/skb.h
diff --git a/include/linux/kmemtrace.h b/include/linux/kmemtrace.h
index 15c45a2..b616d39 100644
--- a/include/linux/kmemtrace.h
+++ b/include/linux/kmemtrace.h
@@ -9,7 +9,7 @@
#ifdef __KERNEL__
-#include <trace/kmem.h>
+#include <trace/events/kmem.h>
#ifdef CONFIG_KMEMTRACE
extern void kmemtrace_init(void);
diff --git a/include/trace/define_trace.h b/include/trace/define_trace.h
index 980eb66..1886941 100644
--- a/include/trace/define_trace.h
+++ b/include/trace/define_trace.h
@@ -43,7 +43,7 @@
#endif
#ifndef TRACE_INCLUDE_PATH
-# define __TRACE_INCLUDE(system) <trace/system.h>
+# define __TRACE_INCLUDE(system) <trace/events/system.h>
# define UNDEF_TRACE_INCLUDE_FILE
#else
# define __TRACE_INCLUDE(system) __stringify(TRACE_INCLUDE_PATH/system.h)
diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
new file mode 100644
index 0000000..75e3468
--- /dev/null
+++ b/include/trace/events/irq.h
@@ -0,0 +1,57 @@
+#if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_IRQ_H
+
+#include <linux/tracepoint.h>
+#include <linux/interrupt.h>
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM irq
+
+/*
+ * Tracepoint for entry of interrupt handler:
+ */
+TRACE_FORMAT(irq_handler_entry,
+ TP_PROTO(int irq, struct irqaction *action),
+ TP_ARGS(irq, action),
+ TP_FMT("irq=%d handler=%s", irq, action->name)
+ );
+
+/*
+ * Tracepoint for return of an interrupt handler:
+ */
+TRACE_EVENT(irq_handler_exit,
+
+ TP_PROTO(int irq, struct irqaction *action, int ret),
+
+ TP_ARGS(irq, action, ret),
+
+ TP_STRUCT__entry(
+ __field( int, irq )
+ __field( int, ret )
+ ),
+
+ TP_fast_assign(
+ __entry->irq = irq;
+ __entry->ret = ret;
+ ),
+
+ TP_printk("irq=%d return=%s",
+ __entry->irq, __entry->ret ? "handled" : "unhandled")
+);
+
+TRACE_FORMAT(softirq_entry,
+ TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
+ TP_ARGS(h, vec),
+ TP_FMT("softirq=%d action=%s", (int)(h - vec), softirq_to_name[h-vec])
+ );
+
+TRACE_FORMAT(softirq_exit,
+ TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
+ TP_ARGS(h, vec),
+ TP_FMT("softirq=%d action=%s", (int)(h - vec), softirq_to_name[h-vec])
+ );
+
+#endif /* _TRACE_IRQ_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
diff --git a/include/trace/events/kmem.h b/include/trace/events/kmem.h
new file mode 100644
index 0000000..c22c42f
--- /dev/null
+++ b/include/trace/events/kmem.h
@@ -0,0 +1,194 @@
+#if !defined(_TRACE_KMEM_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_KMEM_H
+
+#include <linux/types.h>
+#include <linux/tracepoint.h>
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM kmem
+
+TRACE_EVENT(kmalloc,
+
+ TP_PROTO(unsigned long call_site,
+ const void *ptr,
+ size_t bytes_req,
+ size_t bytes_alloc,
+ gfp_t gfp_flags),
+
+ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags),
+
+ TP_STRUCT__entry(
+ __field( unsigned long, call_site )
+ __field( const void *, ptr )
+ __field( size_t, bytes_req )
+ __field( size_t, bytes_alloc )
+ __field( gfp_t, gfp_flags )
+ ),
+
+ TP_fast_assign(
+ __entry->call_site = call_site;
+ __entry->ptr = ptr;
+ __entry->bytes_req = bytes_req;
+ __entry->bytes_alloc = bytes_alloc;
+ __entry->gfp_flags = gfp_flags;
+ ),
+
+ TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%08x",
+ __entry->call_site,
+ __entry->ptr,
+ __entry->bytes_req,
+ __entry->bytes_alloc,
+ __entry->gfp_flags)
+);
+
+TRACE_EVENT(kmem_cache_alloc,
+
+ TP_PROTO(unsigned long call_site,
+ const void *ptr,
+ size_t bytes_req,
+ size_t bytes_alloc,
+ gfp_t gfp_flags),
+
+ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags),
+
+ TP_STRUCT__entry(
+ __field( unsigned long, call_site )
+ __field( const void *, ptr )
+ __field( size_t, bytes_req )
+ __field( size_t, bytes_alloc )
+ __field( gfp_t, gfp_flags )
+ ),
+
+ TP_fast_assign(
+ __entry->call_site = call_site;
+ __entry->ptr = ptr;
+ __entry->bytes_req = bytes_req;
+ __entry->bytes_alloc = bytes_alloc;
+ __entry->gfp_flags = gfp_flags;
+ ),
+
+ TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%08x",
+ __entry->call_site,
+ __entry->ptr,
+ __entry->bytes_req,
+ __entry->bytes_alloc,
+ __entry->gfp_flags)
+);
+
+TRACE_EVENT(kmalloc_node,
+
+ TP_PROTO(unsigned long call_site,
+ const void *ptr,
+ size_t bytes_req,
+ size_t bytes_alloc,
+ gfp_t gfp_flags,
+ int node),
+
+ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node),
+
+ TP_STRUCT__entry(
+ __field( unsigned long, call_site )
+ __field( const void *, ptr )
+ __field( size_t, bytes_req )
+ __field( size_t, bytes_alloc )
+ __field( gfp_t, gfp_flags )
+ __field( int, node )
+ ),
+
+ TP_fast_assign(
+ __entry->call_site = call_site;
+ __entry->ptr = ptr;
+ __entry->bytes_req = bytes_req;
+ __entry->bytes_alloc = bytes_alloc;
+ __entry->gfp_flags = gfp_flags;
+ __entry->node = node;
+ ),
+
+ TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%08x node=%d",
+ __entry->call_site,
+ __entry->ptr,
+ __entry->bytes_req,
+ __entry->bytes_alloc,
+ __entry->gfp_flags,
+ __entry->node)
+);
+
+TRACE_EVENT(kmem_cache_alloc_node,
+
+ TP_PROTO(unsigned long call_site,
+ const void *ptr,
+ size_t bytes_req,
+ size_t bytes_alloc,
+ gfp_t gfp_flags,
+ int node),
+
+ TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node),
+
+ TP_STRUCT__entry(
+ __field( unsigned long, call_site )
+ __field( const void *, ptr )
+ __field( size_t, bytes_req )
+ __field( size_t, bytes_alloc )
+ __field( gfp_t, gfp_flags )
+ __field( int, node )
+ ),
+
+ TP_fast_assign(
+ __entry->call_site = call_site;
+ __entry->ptr = ptr;
+ __entry->bytes_req = bytes_req;
+ __entry->bytes_alloc = bytes_alloc;
+ __entry->gfp_flags = gfp_flags;
+ __entry->node = node;
+ ),
+
+ TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%08x node=%d",
+ __entry->call_site,
+ __entry->ptr,
+ __entry->bytes_req,
+ __entry->bytes_alloc,
+ __entry->gfp_flags,
+ __entry->node)
+);
+
+TRACE_EVENT(kfree,
+
+ TP_PROTO(unsigned long call_site, const void *ptr),
+
+ TP_ARGS(call_site, ptr),
+
+ TP_STRUCT__entry(
+ __field( unsigned long, call_site )
+ __field( const void *, ptr )
+ ),
+
+ TP_fast_assign(
+ __entry->call_site = call_site;
+ __entry->ptr = ptr;
+ ),
+
+ TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr)
+);
+
+TRACE_EVENT(kmem_cache_free,
+
+ TP_PROTO(unsigned long call_site, const void *ptr),
+
+ TP_ARGS(call_site, ptr),
+
+ TP_STRUCT__entry(
+ __field( unsigned long, call_site )
+ __field( const void *, ptr )
+ ),
+
+ TP_fast_assign(
+ __entry->call_site = call_site;
+ __entry->ptr = ptr;
+ ),
+
+ TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr)
+);
+#endif /* _TRACE_KMEM_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
diff --git a/include/trace/events/lockdep.h b/include/trace/events/lockdep.h
new file mode 100644
index 0000000..45e326b
--- /dev/null
+++ b/include/trace/events/lockdep.h
@@ -0,0 +1,60 @@
+#if !defined(_TRACE_LOCKDEP_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_LOCKDEP_H
+
+#include <linux/lockdep.h>
+#include <linux/tracepoint.h>
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM lockdep
+
+#ifdef CONFIG_LOCKDEP
+
+TRACE_FORMAT(lock_acquire,
+ TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
+ int trylock, int read, int check,
+ struct lockdep_map *next_lock, unsigned long ip),
+ TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip),
+ TP_FMT("%s%s%s", trylock ? "try " : "",
+ read ? "read " : "", lock->name)
+ );
+
+TRACE_FORMAT(lock_release,
+ TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip),
+ TP_ARGS(lock, nested, ip),
+ TP_FMT("%s", lock->name)
+ );
+
+#ifdef CONFIG_LOCK_STAT
+
+TRACE_FORMAT(lock_contended,
+ TP_PROTO(struct lockdep_map *lock, unsigned long ip),
+ TP_ARGS(lock, ip),
+ TP_FMT("%s", lock->name)
+ );
+
+TRACE_EVENT(lock_acquired,
+ TP_PROTO(struct lockdep_map *lock, unsigned long ip, s64 waittime),
+
+ TP_ARGS(lock, ip, waittime),
+
+ TP_STRUCT__entry(
+ __field(const char *, name)
+ __field(unsigned long, wait_usec)
+ __field(unsigned long, wait_nsec_rem)
+ ),
+ TP_fast_assign(
+ __entry->name = lock->name;
+ __entry->wait_nsec_rem = do_div(waittime, NSEC_PER_USEC);
+ __entry->wait_usec = (unsigned long) waittime;
+ ),
+ TP_printk("%s (%lu.%03lu us)", __entry->name, __entry->wait_usec,
+ __entry->wait_nsec_rem)
+);
+
+#endif
+#endif
+
+#endif /* _TRACE_LOCKDEP_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
new file mode 100644
index 0000000..ffa1cab
--- /dev/null
+++ b/include/trace/events/sched.h
@@ -0,0 +1,339 @@
+#if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_SCHED_H
+
+#include <linux/sched.h>
+#include <linux/tracepoint.h>
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM sched
+
+/*
+ * Tracepoint for calling kthread_stop, performed to end a kthread:
+ */
+TRACE_EVENT(sched_kthread_stop,
+
+ TP_PROTO(struct task_struct *t),
+
+ TP_ARGS(t),
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->comm, t->comm, TASK_COMM_LEN);
+ __entry->pid = t->pid;
+ ),
+
+ TP_printk("task %s:%d", __entry->comm, __entry->pid)
+);
+
+/*
+ * Tracepoint for the return value of the kthread stopping:
+ */
+TRACE_EVENT(sched_kthread_stop_ret,
+
+ TP_PROTO(int ret),
+
+ TP_ARGS(ret),
+
+ TP_STRUCT__entry(
+ __field( int, ret )
+ ),
+
+ TP_fast_assign(
+ __entry->ret = ret;
+ ),
+
+ TP_printk("ret %d", __entry->ret)
+);
+
+/*
+ * Tracepoint for waiting on task to unschedule:
+ *
+ * (NOTE: the 'rq' argument is not used by generic trace events,
+ * but used by the latency tracer plugin. )
+ */
+TRACE_EVENT(sched_wait_task,
+
+ TP_PROTO(struct rq *rq, struct task_struct *p),
+
+ TP_ARGS(rq, p),
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ __field( int, prio )
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
+ __entry->pid = p->pid;
+ __entry->prio = p->prio;
+ ),
+
+ TP_printk("task %s:%d [%d]",
+ __entry->comm, __entry->pid, __entry->prio)
+);
+
+/*
+ * Tracepoint for waking up a task:
+ *
+ * (NOTE: the 'rq' argument is not used by generic trace events,
+ * but used by the latency tracer plugin. )
+ */
+TRACE_EVENT(sched_wakeup,
+
+ TP_PROTO(struct rq *rq, struct task_struct *p, int success),
+
+ TP_ARGS(rq, p, success),
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ __field( int, prio )
+ __field( int, success )
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
+ __entry->pid = p->pid;
+ __entry->prio = p->prio;
+ __entry->success = success;
+ ),
+
+ TP_printk("task %s:%d [%d] success=%d",
+ __entry->comm, __entry->pid, __entry->prio,
+ __entry->success)
+);
+
+/*
+ * Tracepoint for waking up a new task:
+ *
+ * (NOTE: the 'rq' argument is not used by generic trace events,
+ * but used by the latency tracer plugin. )
+ */
+TRACE_EVENT(sched_wakeup_new,
+
+ TP_PROTO(struct rq *rq, struct task_struct *p, int success),
+
+ TP_ARGS(rq, p, success),
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ __field( int, prio )
+ __field( int, success )
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
+ __entry->pid = p->pid;
+ __entry->prio = p->prio;
+ __entry->success = success;
+ ),
+
+ TP_printk("task %s:%d [%d] success=%d",
+ __entry->comm, __entry->pid, __entry->prio,
+ __entry->success)
+);
+
+/*
+ * Tracepoint for task switches, performed by the scheduler:
+ *
+ * (NOTE: the 'rq' argument is not used by generic trace events,
+ * but used by the latency tracer plugin. )
+ */
+TRACE_EVENT(sched_switch,
+
+ TP_PROTO(struct rq *rq, struct task_struct *prev,
+ struct task_struct *next),
+
+ TP_ARGS(rq, prev, next),
+
+ TP_STRUCT__entry(
+ __array( char, prev_comm, TASK_COMM_LEN )
+ __field( pid_t, prev_pid )
+ __field( int, prev_prio )
+ __array( char, next_comm, TASK_COMM_LEN )
+ __field( pid_t, next_pid )
+ __field( int, next_prio )
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
+ __entry->prev_pid = prev->pid;
+ __entry->prev_prio = prev->prio;
+ memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
+ __entry->next_pid = next->pid;
+ __entry->next_prio = next->prio;
+ ),
+
+ TP_printk("task %s:%d [%d] ==> %s:%d [%d]",
+ __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
+ __entry->next_comm, __entry->next_pid, __entry->next_prio)
+);
+
+/*
+ * Tracepoint for a task being migrated:
+ */
+TRACE_EVENT(sched_migrate_task,
+
+ TP_PROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
+
+ TP_ARGS(p, orig_cpu, dest_cpu),
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ __field( int, prio )
+ __field( int, orig_cpu )
+ __field( int, dest_cpu )
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
+ __entry->pid = p->pid;
+ __entry->prio = p->prio;
+ __entry->orig_cpu = orig_cpu;
+ __entry->dest_cpu = dest_cpu;
+ ),
+
+ TP_printk("task %s:%d [%d] from: %d to: %d",
+ __entry->comm, __entry->pid, __entry->prio,
+ __entry->orig_cpu, __entry->dest_cpu)
+);
+
+/*
+ * Tracepoint for freeing a task:
+ */
+TRACE_EVENT(sched_process_free,
+
+ TP_PROTO(struct task_struct *p),
+
+ TP_ARGS(p),
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ __field( int, prio )
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
+ __entry->pid = p->pid;
+ __entry->prio = p->prio;
+ ),
+
+ TP_printk("task %s:%d [%d]",
+ __entry->comm, __entry->pid, __entry->prio)
+);
+
+/*
+ * Tracepoint for a task exiting:
+ */
+TRACE_EVENT(sched_process_exit,
+
+ TP_PROTO(struct task_struct *p),
+
+ TP_ARGS(p),
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ __field( int, prio )
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
+ __entry->pid = p->pid;
+ __entry->prio = p->prio;
+ ),
+
+ TP_printk("task %s:%d [%d]",
+ __entry->comm, __entry->pid, __entry->prio)
+);
+
+/*
+ * Tracepoint for a waiting task:
+ */
+TRACE_EVENT(sched_process_wait,
+
+ TP_PROTO(struct pid *pid),
+
+ TP_ARGS(pid),
+
+ TP_STRUCT__entry(
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ __field( int, prio )
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
+ __entry->pid = pid_nr(pid);
+ __entry->prio = current->prio;
+ ),
+
+ TP_printk("task %s:%d [%d]",
+ __entry->comm, __entry->pid, __entry->prio)
+);
+
+/*
+ * Tracepoint for do_fork:
+ */
+TRACE_EVENT(sched_process_fork,
+
+ TP_PROTO(struct task_struct *parent, struct task_struct *child),
+
+ TP_ARGS(parent, child),
+
+ TP_STRUCT__entry(
+ __array( char, parent_comm, TASK_COMM_LEN )
+ __field( pid_t, parent_pid )
+ __array( char, child_comm, TASK_COMM_LEN )
+ __field( pid_t, child_pid )
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN);
+ __entry->parent_pid = parent->pid;
+ memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN);
+ __entry->child_pid = child->pid;
+ ),
+
+ TP_printk("parent %s:%d child %s:%d",
+ __entry->parent_comm, __entry->parent_pid,
+ __entry->child_comm, __entry->child_pid)
+);
+
+/*
+ * Tracepoint for sending a signal:
+ */
+TRACE_EVENT(sched_signal_send,
+
+ TP_PROTO(int sig, struct task_struct *p),
+
+ TP_ARGS(sig, p),
+
+ TP_STRUCT__entry(
+ __field( int, sig )
+ __array( char, comm, TASK_COMM_LEN )
+ __field( pid_t, pid )
+ ),
+
+ TP_fast_assign(
+ memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
+ __entry->pid = p->pid;
+ __entry->sig = sig;
+ ),
+
+ TP_printk("sig: %d task %s:%d",
+ __entry->sig, __entry->comm, __entry->pid)
+);
+
+#endif /* _TRACE_SCHED_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
new file mode 100644
index 0000000..1e8fabb
--- /dev/null
+++ b/include/trace/events/skb.h
@@ -0,0 +1,40 @@
+#if !defined(_TRACE_SKB_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_SKB_H
+
+#include <linux/skbuff.h>
+#include <linux/tracepoint.h>
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM skb
+
+/*
+ * Tracepoint for free an sk_buff:
+ */
+TRACE_EVENT(kfree_skb,
+
+ TP_PROTO(struct sk_buff *skb, void *location),
+
+ TP_ARGS(skb, location),
+
+ TP_STRUCT__entry(
+ __field( void *, skbaddr )
+ __field( unsigned short, protocol )
+ __field( void *, location )
+ ),
+
+ TP_fast_assign(
+ __entry->skbaddr = skb;
+ if (skb) {
+ __entry->protocol = ntohs(skb->protocol);
+ }
+ __entry->location = location;
+ ),
+
+ TP_printk("skbaddr=%p protocol=%u location=%p",
+ __entry->skbaddr, __entry->protocol, __entry->location)
+);
+
+#endif /* _TRACE_SKB_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
diff --git a/include/trace/irq.h b/include/trace/irq.h
deleted file mode 100644
index 75e3468..0000000
--- a/include/trace/irq.h
+++ /dev/null
@@ -1,57 +0,0 @@
-#if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_IRQ_H
-
-#include <linux/tracepoint.h>
-#include <linux/interrupt.h>
-
-#undef TRACE_SYSTEM
-#define TRACE_SYSTEM irq
-
-/*
- * Tracepoint for entry of interrupt handler:
- */
-TRACE_FORMAT(irq_handler_entry,
- TP_PROTO(int irq, struct irqaction *action),
- TP_ARGS(irq, action),
- TP_FMT("irq=%d handler=%s", irq, action->name)
- );
-
-/*
- * Tracepoint for return of an interrupt handler:
- */
-TRACE_EVENT(irq_handler_exit,
-
- TP_PROTO(int irq, struct irqaction *action, int ret),
-
- TP_ARGS(irq, action, ret),
-
- TP_STRUCT__entry(
- __field( int, irq )
- __field( int, ret )
- ),
-
- TP_fast_assign(
- __entry->irq = irq;
- __entry->ret = ret;
- ),
-
- TP_printk("irq=%d return=%s",
- __entry->irq, __entry->ret ? "handled" : "unhandled")
-);
-
-TRACE_FORMAT(softirq_entry,
- TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
- TP_ARGS(h, vec),
- TP_FMT("softirq=%d action=%s", (int)(h - vec), softirq_to_name[h-vec])
- );
-
-TRACE_FORMAT(softirq_exit,
- TP_PROTO(struct softirq_action *h, struct softirq_action *vec),
- TP_ARGS(h, vec),
- TP_FMT("softirq=%d action=%s", (int)(h - vec), softirq_to_name[h-vec])
- );
-
-#endif /* _TRACE_IRQ_H */
-
-/* This part must be outside protection */
-#include <trace/define_trace.h>
diff --git a/include/trace/kmem.h b/include/trace/kmem.h
deleted file mode 100644
index c22c42f..0000000
--- a/include/trace/kmem.h
+++ /dev/null
@@ -1,194 +0,0 @@
-#if !defined(_TRACE_KMEM_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_KMEM_H
-
-#include <linux/types.h>
-#include <linux/tracepoint.h>
-
-#undef TRACE_SYSTEM
-#define TRACE_SYSTEM kmem
-
-TRACE_EVENT(kmalloc,
-
- TP_PROTO(unsigned long call_site,
- const void *ptr,
- size_t bytes_req,
- size_t bytes_alloc,
- gfp_t gfp_flags),
-
- TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags),
-
- TP_STRUCT__entry(
- __field( unsigned long, call_site )
- __field( const void *, ptr )
- __field( size_t, bytes_req )
- __field( size_t, bytes_alloc )
- __field( gfp_t, gfp_flags )
- ),
-
- TP_fast_assign(
- __entry->call_site = call_site;
- __entry->ptr = ptr;
- __entry->bytes_req = bytes_req;
- __entry->bytes_alloc = bytes_alloc;
- __entry->gfp_flags = gfp_flags;
- ),
-
- TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%08x",
- __entry->call_site,
- __entry->ptr,
- __entry->bytes_req,
- __entry->bytes_alloc,
- __entry->gfp_flags)
-);
-
-TRACE_EVENT(kmem_cache_alloc,
-
- TP_PROTO(unsigned long call_site,
- const void *ptr,
- size_t bytes_req,
- size_t bytes_alloc,
- gfp_t gfp_flags),
-
- TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags),
-
- TP_STRUCT__entry(
- __field( unsigned long, call_site )
- __field( const void *, ptr )
- __field( size_t, bytes_req )
- __field( size_t, bytes_alloc )
- __field( gfp_t, gfp_flags )
- ),
-
- TP_fast_assign(
- __entry->call_site = call_site;
- __entry->ptr = ptr;
- __entry->bytes_req = bytes_req;
- __entry->bytes_alloc = bytes_alloc;
- __entry->gfp_flags = gfp_flags;
- ),
-
- TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%08x",
- __entry->call_site,
- __entry->ptr,
- __entry->bytes_req,
- __entry->bytes_alloc,
- __entry->gfp_flags)
-);
-
-TRACE_EVENT(kmalloc_node,
-
- TP_PROTO(unsigned long call_site,
- const void *ptr,
- size_t bytes_req,
- size_t bytes_alloc,
- gfp_t gfp_flags,
- int node),
-
- TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node),
-
- TP_STRUCT__entry(
- __field( unsigned long, call_site )
- __field( const void *, ptr )
- __field( size_t, bytes_req )
- __field( size_t, bytes_alloc )
- __field( gfp_t, gfp_flags )
- __field( int, node )
- ),
-
- TP_fast_assign(
- __entry->call_site = call_site;
- __entry->ptr = ptr;
- __entry->bytes_req = bytes_req;
- __entry->bytes_alloc = bytes_alloc;
- __entry->gfp_flags = gfp_flags;
- __entry->node = node;
- ),
-
- TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%08x node=%d",
- __entry->call_site,
- __entry->ptr,
- __entry->bytes_req,
- __entry->bytes_alloc,
- __entry->gfp_flags,
- __entry->node)
-);
-
-TRACE_EVENT(kmem_cache_alloc_node,
-
- TP_PROTO(unsigned long call_site,
- const void *ptr,
- size_t bytes_req,
- size_t bytes_alloc,
- gfp_t gfp_flags,
- int node),
-
- TP_ARGS(call_site, ptr, bytes_req, bytes_alloc, gfp_flags, node),
-
- TP_STRUCT__entry(
- __field( unsigned long, call_site )
- __field( const void *, ptr )
- __field( size_t, bytes_req )
- __field( size_t, bytes_alloc )
- __field( gfp_t, gfp_flags )
- __field( int, node )
- ),
-
- TP_fast_assign(
- __entry->call_site = call_site;
- __entry->ptr = ptr;
- __entry->bytes_req = bytes_req;
- __entry->bytes_alloc = bytes_alloc;
- __entry->gfp_flags = gfp_flags;
- __entry->node = node;
- ),
-
- TP_printk("call_site=%lx ptr=%p bytes_req=%zu bytes_alloc=%zu gfp_flags=%08x node=%d",
- __entry->call_site,
- __entry->ptr,
- __entry->bytes_req,
- __entry->bytes_alloc,
- __entry->gfp_flags,
- __entry->node)
-);
-
-TRACE_EVENT(kfree,
-
- TP_PROTO(unsigned long call_site, const void *ptr),
-
- TP_ARGS(call_site, ptr),
-
- TP_STRUCT__entry(
- __field( unsigned long, call_site )
- __field( const void *, ptr )
- ),
-
- TP_fast_assign(
- __entry->call_site = call_site;
- __entry->ptr = ptr;
- ),
-
- TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr)
-);
-
-TRACE_EVENT(kmem_cache_free,
-
- TP_PROTO(unsigned long call_site, const void *ptr),
-
- TP_ARGS(call_site, ptr),
-
- TP_STRUCT__entry(
- __field( unsigned long, call_site )
- __field( const void *, ptr )
- ),
-
- TP_fast_assign(
- __entry->call_site = call_site;
- __entry->ptr = ptr;
- ),
-
- TP_printk("call_site=%lx ptr=%p", __entry->call_site, __entry->ptr)
-);
-#endif /* _TRACE_KMEM_H */
-
-/* This part must be outside protection */
-#include <trace/define_trace.h>
diff --git a/include/trace/lockdep.h b/include/trace/lockdep.h
deleted file mode 100644
index 45e326b..0000000
--- a/include/trace/lockdep.h
+++ /dev/null
@@ -1,60 +0,0 @@
-#if !defined(_TRACE_LOCKDEP_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_LOCKDEP_H
-
-#include <linux/lockdep.h>
-#include <linux/tracepoint.h>
-
-#undef TRACE_SYSTEM
-#define TRACE_SYSTEM lockdep
-
-#ifdef CONFIG_LOCKDEP
-
-TRACE_FORMAT(lock_acquire,
- TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
- int trylock, int read, int check,
- struct lockdep_map *next_lock, unsigned long ip),
- TP_ARGS(lock, subclass, trylock, read, check, next_lock, ip),
- TP_FMT("%s%s%s", trylock ? "try " : "",
- read ? "read " : "", lock->name)
- );
-
-TRACE_FORMAT(lock_release,
- TP_PROTO(struct lockdep_map *lock, int nested, unsigned long ip),
- TP_ARGS(lock, nested, ip),
- TP_FMT("%s", lock->name)
- );
-
-#ifdef CONFIG_LOCK_STAT
-
-TRACE_FORMAT(lock_contended,
- TP_PROTO(struct lockdep_map *lock, unsigned long ip),
- TP_ARGS(lock, ip),
- TP_FMT("%s", lock->name)
- );
-
-TRACE_EVENT(lock_acquired,
- TP_PROTO(struct lockdep_map *lock, unsigned long ip, s64 waittime),
-
- TP_ARGS(lock, ip, waittime),
-
- TP_STRUCT__entry(
- __field(const char *, name)
- __field(unsigned long, wait_usec)
- __field(unsigned long, wait_nsec_rem)
- ),
- TP_fast_assign(
- __entry->name = lock->name;
- __entry->wait_nsec_rem = do_div(waittime, NSEC_PER_USEC);
- __entry->wait_usec = (unsigned long) waittime;
- ),
- TP_printk("%s (%lu.%03lu us)", __entry->name, __entry->wait_usec,
- __entry->wait_nsec_rem)
-);
-
-#endif
-#endif
-
-#endif /* _TRACE_LOCKDEP_H */
-
-/* This part must be outside protection */
-#include <trace/define_trace.h>
diff --git a/include/trace/sched.h b/include/trace/sched.h
deleted file mode 100644
index ffa1cab..0000000
--- a/include/trace/sched.h
+++ /dev/null
@@ -1,339 +0,0 @@
-#if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_SCHED_H
-
-#include <linux/sched.h>
-#include <linux/tracepoint.h>
-
-#undef TRACE_SYSTEM
-#define TRACE_SYSTEM sched
-
-/*
- * Tracepoint for calling kthread_stop, performed to end a kthread:
- */
-TRACE_EVENT(sched_kthread_stop,
-
- TP_PROTO(struct task_struct *t),
-
- TP_ARGS(t),
-
- TP_STRUCT__entry(
- __array( char, comm, TASK_COMM_LEN )
- __field( pid_t, pid )
- ),
-
- TP_fast_assign(
- memcpy(__entry->comm, t->comm, TASK_COMM_LEN);
- __entry->pid = t->pid;
- ),
-
- TP_printk("task %s:%d", __entry->comm, __entry->pid)
-);
-
-/*
- * Tracepoint for the return value of the kthread stopping:
- */
-TRACE_EVENT(sched_kthread_stop_ret,
-
- TP_PROTO(int ret),
-
- TP_ARGS(ret),
-
- TP_STRUCT__entry(
- __field( int, ret )
- ),
-
- TP_fast_assign(
- __entry->ret = ret;
- ),
-
- TP_printk("ret %d", __entry->ret)
-);
-
-/*
- * Tracepoint for waiting on task to unschedule:
- *
- * (NOTE: the 'rq' argument is not used by generic trace events,
- * but used by the latency tracer plugin. )
- */
-TRACE_EVENT(sched_wait_task,
-
- TP_PROTO(struct rq *rq, struct task_struct *p),
-
- TP_ARGS(rq, p),
-
- TP_STRUCT__entry(
- __array( char, comm, TASK_COMM_LEN )
- __field( pid_t, pid )
- __field( int, prio )
- ),
-
- TP_fast_assign(
- memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
- __entry->pid = p->pid;
- __entry->prio = p->prio;
- ),
-
- TP_printk("task %s:%d [%d]",
- __entry->comm, __entry->pid, __entry->prio)
-);
-
-/*
- * Tracepoint for waking up a task:
- *
- * (NOTE: the 'rq' argument is not used by generic trace events,
- * but used by the latency tracer plugin. )
- */
-TRACE_EVENT(sched_wakeup,
-
- TP_PROTO(struct rq *rq, struct task_struct *p, int success),
-
- TP_ARGS(rq, p, success),
-
- TP_STRUCT__entry(
- __array( char, comm, TASK_COMM_LEN )
- __field( pid_t, pid )
- __field( int, prio )
- __field( int, success )
- ),
-
- TP_fast_assign(
- memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
- __entry->pid = p->pid;
- __entry->prio = p->prio;
- __entry->success = success;
- ),
-
- TP_printk("task %s:%d [%d] success=%d",
- __entry->comm, __entry->pid, __entry->prio,
- __entry->success)
-);
-
-/*
- * Tracepoint for waking up a new task:
- *
- * (NOTE: the 'rq' argument is not used by generic trace events,
- * but used by the latency tracer plugin. )
- */
-TRACE_EVENT(sched_wakeup_new,
-
- TP_PROTO(struct rq *rq, struct task_struct *p, int success),
-
- TP_ARGS(rq, p, success),
-
- TP_STRUCT__entry(
- __array( char, comm, TASK_COMM_LEN )
- __field( pid_t, pid )
- __field( int, prio )
- __field( int, success )
- ),
-
- TP_fast_assign(
- memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
- __entry->pid = p->pid;
- __entry->prio = p->prio;
- __entry->success = success;
- ),
-
- TP_printk("task %s:%d [%d] success=%d",
- __entry->comm, __entry->pid, __entry->prio,
- __entry->success)
-);
-
-/*
- * Tracepoint for task switches, performed by the scheduler:
- *
- * (NOTE: the 'rq' argument is not used by generic trace events,
- * but used by the latency tracer plugin. )
- */
-TRACE_EVENT(sched_switch,
-
- TP_PROTO(struct rq *rq, struct task_struct *prev,
- struct task_struct *next),
-
- TP_ARGS(rq, prev, next),
-
- TP_STRUCT__entry(
- __array( char, prev_comm, TASK_COMM_LEN )
- __field( pid_t, prev_pid )
- __field( int, prev_prio )
- __array( char, next_comm, TASK_COMM_LEN )
- __field( pid_t, next_pid )
- __field( int, next_prio )
- ),
-
- TP_fast_assign(
- memcpy(__entry->next_comm, next->comm, TASK_COMM_LEN);
- __entry->prev_pid = prev->pid;
- __entry->prev_prio = prev->prio;
- memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
- __entry->next_pid = next->pid;
- __entry->next_prio = next->prio;
- ),
-
- TP_printk("task %s:%d [%d] ==> %s:%d [%d]",
- __entry->prev_comm, __entry->prev_pid, __entry->prev_prio,
- __entry->next_comm, __entry->next_pid, __entry->next_prio)
-);
-
-/*
- * Tracepoint for a task being migrated:
- */
-TRACE_EVENT(sched_migrate_task,
-
- TP_PROTO(struct task_struct *p, int orig_cpu, int dest_cpu),
-
- TP_ARGS(p, orig_cpu, dest_cpu),
-
- TP_STRUCT__entry(
- __array( char, comm, TASK_COMM_LEN )
- __field( pid_t, pid )
- __field( int, prio )
- __field( int, orig_cpu )
- __field( int, dest_cpu )
- ),
-
- TP_fast_assign(
- memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
- __entry->pid = p->pid;
- __entry->prio = p->prio;
- __entry->orig_cpu = orig_cpu;
- __entry->dest_cpu = dest_cpu;
- ),
-
- TP_printk("task %s:%d [%d] from: %d to: %d",
- __entry->comm, __entry->pid, __entry->prio,
- __entry->orig_cpu, __entry->dest_cpu)
-);
-
-/*
- * Tracepoint for freeing a task:
- */
-TRACE_EVENT(sched_process_free,
-
- TP_PROTO(struct task_struct *p),
-
- TP_ARGS(p),
-
- TP_STRUCT__entry(
- __array( char, comm, TASK_COMM_LEN )
- __field( pid_t, pid )
- __field( int, prio )
- ),
-
- TP_fast_assign(
- memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
- __entry->pid = p->pid;
- __entry->prio = p->prio;
- ),
-
- TP_printk("task %s:%d [%d]",
- __entry->comm, __entry->pid, __entry->prio)
-);
-
-/*
- * Tracepoint for a task exiting:
- */
-TRACE_EVENT(sched_process_exit,
-
- TP_PROTO(struct task_struct *p),
-
- TP_ARGS(p),
-
- TP_STRUCT__entry(
- __array( char, comm, TASK_COMM_LEN )
- __field( pid_t, pid )
- __field( int, prio )
- ),
-
- TP_fast_assign(
- memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
- __entry->pid = p->pid;
- __entry->prio = p->prio;
- ),
-
- TP_printk("task %s:%d [%d]",
- __entry->comm, __entry->pid, __entry->prio)
-);
-
-/*
- * Tracepoint for a waiting task:
- */
-TRACE_EVENT(sched_process_wait,
-
- TP_PROTO(struct pid *pid),
-
- TP_ARGS(pid),
-
- TP_STRUCT__entry(
- __array( char, comm, TASK_COMM_LEN )
- __field( pid_t, pid )
- __field( int, prio )
- ),
-
- TP_fast_assign(
- memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
- __entry->pid = pid_nr(pid);
- __entry->prio = current->prio;
- ),
-
- TP_printk("task %s:%d [%d]",
- __entry->comm, __entry->pid, __entry->prio)
-);
-
-/*
- * Tracepoint for do_fork:
- */
-TRACE_EVENT(sched_process_fork,
-
- TP_PROTO(struct task_struct *parent, struct task_struct *child),
-
- TP_ARGS(parent, child),
-
- TP_STRUCT__entry(
- __array( char, parent_comm, TASK_COMM_LEN )
- __field( pid_t, parent_pid )
- __array( char, child_comm, TASK_COMM_LEN )
- __field( pid_t, child_pid )
- ),
-
- TP_fast_assign(
- memcpy(__entry->parent_comm, parent->comm, TASK_COMM_LEN);
- __entry->parent_pid = parent->pid;
- memcpy(__entry->child_comm, child->comm, TASK_COMM_LEN);
- __entry->child_pid = child->pid;
- ),
-
- TP_printk("parent %s:%d child %s:%d",
- __entry->parent_comm, __entry->parent_pid,
- __entry->child_comm, __entry->child_pid)
-);
-
-/*
- * Tracepoint for sending a signal:
- */
-TRACE_EVENT(sched_signal_send,
-
- TP_PROTO(int sig, struct task_struct *p),
-
- TP_ARGS(sig, p),
-
- TP_STRUCT__entry(
- __field( int, sig )
- __array( char, comm, TASK_COMM_LEN )
- __field( pid_t, pid )
- ),
-
- TP_fast_assign(
- memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
- __entry->pid = p->pid;
- __entry->sig = sig;
- ),
-
- TP_printk("sig: %d task %s:%d",
- __entry->sig, __entry->comm, __entry->pid)
-);
-
-#endif /* _TRACE_SCHED_H */
-
-/* This part must be outside protection */
-#include <trace/define_trace.h>
diff --git a/include/trace/skb.h b/include/trace/skb.h
deleted file mode 100644
index 1e8fabb..0000000
--- a/include/trace/skb.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#if !defined(_TRACE_SKB_H) || defined(TRACE_HEADER_MULTI_READ)
-#define _TRACE_SKB_H
-
-#include <linux/skbuff.h>
-#include <linux/tracepoint.h>
-
-#undef TRACE_SYSTEM
-#define TRACE_SYSTEM skb
-
-/*
- * Tracepoint for free an sk_buff:
- */
-TRACE_EVENT(kfree_skb,
-
- TP_PROTO(struct sk_buff *skb, void *location),
-
- TP_ARGS(skb, location),
-
- TP_STRUCT__entry(
- __field( void *, skbaddr )
- __field( unsigned short, protocol )
- __field( void *, location )
- ),
-
- TP_fast_assign(
- __entry->skbaddr = skb;
- if (skb) {
- __entry->protocol = ntohs(skb->protocol);
- }
- __entry->location = location;
- ),
-
- TP_printk("skbaddr=%p protocol=%u location=%p",
- __entry->skbaddr, __entry->protocol, __entry->location)
-);
-
-#endif /* _TRACE_SKB_H */
-
-/* This part must be outside protection */
-#include <trace/define_trace.h>
diff --git a/kernel/exit.c b/kernel/exit.c
index 2fe9d2c..cab535c 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -48,7 +48,7 @@
#include <linux/tracehook.h>
#include <linux/fs_struct.h>
#include <linux/init_task.h>
-#include <trace/sched.h>
+#include <trace/events/sched.h>
#include <asm/uaccess.h>
#include <asm/unistd.h>
diff --git a/kernel/fork.c b/kernel/fork.c
index 4bebf26..085f73e 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -61,7 +61,6 @@
#include <linux/proc_fs.h>
#include <linux/blkdev.h>
#include <linux/fs_struct.h>
-#include <trace/sched.h>
#include <linux/magic.h>
#include <asm/pgtable.h>
@@ -71,6 +70,8 @@
#include <asm/cacheflush.h>
#include <asm/tlbflush.h>
+#include <trace/events/sched.h>
+
/*
* Protected counters by write_lock_irq(&tasklist_lock)
*/
diff --git a/kernel/irq/handle.c b/kernel/irq/handle.c
index 983d8be..37c6363 100644
--- a/kernel/irq/handle.c
+++ b/kernel/irq/handle.c
@@ -20,7 +20,7 @@
#include <linux/bootmem.h>
#define CREATE_TRACE_POINTS
-#include <trace/irq.h>
+#include <trace/events/irq.h>
#include "internals.h"
diff --git a/kernel/kthread.c b/kernel/kthread.c
index e1c7692..41c88fe 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -13,7 +13,7 @@
#include <linux/file.h>
#include <linux/module.h>
#include <linux/mutex.h>
-#include <trace/sched.h>
+#include <trace/events/sched.h>
#define KTHREAD_NICE_LEVEL (-5)
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 257f21a..47b201e 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -48,7 +48,7 @@
#include "lockdep_internals.h"
#define CREATE_TRACE_POINTS
-#include <trace/lockdep.h>
+#include <trace/events/lockdep.h>
#ifdef CONFIG_PROVE_LOCKING
int prove_locking = 1;
diff --git a/kernel/sched.c b/kernel/sched.c
index e6d4518..9f7ffd0 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -79,7 +79,7 @@
#include "sched_cpupri.h"
#define CREATE_TRACE_POINTS
-#include <trace/sched.h>
+#include <trace/events/sched.h>
/*
* Convert user-nice values [ -20 ... 0 ... 19 ]
diff --git a/kernel/signal.c b/kernel/signal.c
index 1d5703f..94ec0a4 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -27,7 +27,7 @@
#include <linux/freezer.h>
#include <linux/pid_namespace.h>
#include <linux/nsproxy.h>
-#include <trace/sched.h>
+#include <trace/events/sched.h>
#include <asm/param.h>
#include <asm/uaccess.h>
diff --git a/kernel/softirq.c b/kernel/softirq.c
index a2d9b45..7ab9dfd 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -24,7 +24,7 @@
#include <linux/ftrace.h>
#include <linux/smp.h>
#include <linux/tick.h>
-#include <trace/irq.h>
+#include <trace/events/irq.h>
#include <asm/irq.h>
/*
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 8e6a0b5..a234889 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -29,7 +29,7 @@
#include <linux/list.h>
#include <linux/hash.h>
-#include <trace/sched.h>
+#include <trace/events/sched.h>
#include <asm/ftrace.h>
diff --git a/kernel/trace/trace_sched_switch.c b/kernel/trace/trace_sched_switch.c
index 9d8cccd..a98106d 100644
--- a/kernel/trace/trace_sched_switch.c
+++ b/kernel/trace/trace_sched_switch.c
@@ -10,7 +10,7 @@
#include <linux/kallsyms.h>
#include <linux/uaccess.h>
#include <linux/ftrace.h>
-#include <trace/sched.h>
+#include <trace/events/sched.h>
#include "trace.h"
diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c
index 5bc00e8..b8b13c5 100644
--- a/kernel/trace/trace_sched_wakeup.c
+++ b/kernel/trace/trace_sched_wakeup.c
@@ -15,7 +15,7 @@
#include <linux/kallsyms.h>
#include <linux/uaccess.h>
#include <linux/ftrace.h>
-#include <trace/sched.h>
+#include <trace/events/sched.h>
#include "trace.h"
diff --git a/mm/util.c b/mm/util.c
index 0e74a22..6794a33 100644
--- a/mm/util.c
+++ b/mm/util.c
@@ -7,7 +7,7 @@
#include <asm/uaccess.h>
#define CREATE_TRACE_POINTS
-#include <trace/kmem.h>
+#include <trace/events/kmem.h>
/**
* kstrdup - allocate space for and copy an existing string
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c
index 9fd0dc3..b75b6ce 100644
--- a/net/core/drop_monitor.c
+++ b/net/core/drop_monitor.c
@@ -23,7 +23,7 @@
#include <linux/bitops.h>
#include <net/genetlink.h>
-#include <trace/skb.h>
+#include <trace/events/skb.h>
#include <asm/unaligned.h>
diff --git a/net/core/net-traces.c b/net/core/net-traces.c
index 8017720..499a67e 100644
--- a/net/core/net-traces.c
+++ b/net/core/net-traces.c
@@ -24,6 +24,6 @@
#include <asm/bitops.h>
#define CREATE_TRACE_POINTS
-#include <trace/skb.h>
+#include <trace/events/skb.h>
EXPORT_TRACEPOINT_SYMBOL_GPL(kfree_skb);
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index ce6356c..12806b8 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -65,7 +65,7 @@
#include <asm/uaccess.h>
#include <asm/system.h>
-#include <trace/skb.h>
+#include <trace/events/skb.h>
#include "kmap_skb.h"
--
1.6.2.1
--
^ permalink raw reply related [flat|nested] 17+ messages in thread
* [PATCH 4/4] tracing/events: add trace-events-sample
2009-04-15 3:15 [PATCH 0/4] [GIT PULL] more updates for TRACE_EVENTS for modules Steven Rostedt
` (2 preceding siblings ...)
2009-04-15 3:15 ` [PATCH 3/4] tracing/events: move trace point headers into include/trace/events Steven Rostedt
@ 2009-04-15 3:15 ` Steven Rostedt
2009-04-15 16:15 ` Frederic Weisbecker
2009-04-16 16:58 ` Christoph Hellwig
2009-04-15 7:27 ` [PATCH 0/4] [GIT PULL] more updates for TRACE_EVENTS for modules Ingo Molnar
4 siblings, 2 replies; 17+ messages in thread
From: Steven Rostedt @ 2009-04-15 3:15 UTC (permalink / raw)
To: linux-kernel
Cc: Ingo Molnar, Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Frederic Weisbecker, Theodore Tso, Arjan van de Ven,
Christoph Hellwig, Mathieu Desnoyers, Jeremy Fitzhardinge,
Lai Jiangshan, Zhaolei, Li Zefan, KOSAKI Motohiro,
Masami Hiramatsu, Frank Ch. Eigler, Tom Zanussi, Jiaying Zhang,
Michael Rubin, Martin Bligh
[-- Attachment #1: 0004-tracing-events-add-trace-events-sample.patch --]
[-- Type: text/plain, Size: 7528 bytes --]
From: Steven Rostedt <srostedt@redhat.com>
This patch adds a sample to the samples directory on how to create
and use TRACE_EVENT trace points.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
samples/Kconfig | 7 ++
samples/Makefile | 2 +-
samples/trace_events/Makefile | 8 ++
samples/trace_events/trace-events-sample.c | 56 +++++++++++++
samples/trace_events/trace-events-sample.h | 124 ++++++++++++++++++++++++++++
5 files changed, 196 insertions(+), 1 deletions(-)
create mode 100644 samples/trace_events/Makefile
create mode 100644 samples/trace_events/trace-events-sample.c
create mode 100644 samples/trace_events/trace-events-sample.h
diff --git a/samples/Kconfig b/samples/Kconfig
index 4b02f5a..93f41c0 100644
--- a/samples/Kconfig
+++ b/samples/Kconfig
@@ -19,6 +19,13 @@ config SAMPLE_TRACEPOINTS
help
This build tracepoints example modules.
+config SAMPLE_TRACE_EVENTS
+ tristate "Build trace_events examples"
+ depends on EVENT_TRACING
+ default m
+ help
+ This build trace event example modules.
+
config SAMPLE_KOBJECT
tristate "Build kobject examples"
help
diff --git a/samples/Makefile b/samples/Makefile
index 10eaca8..13e4b47 100644
--- a/samples/Makefile
+++ b/samples/Makefile
@@ -1,3 +1,3 @@
# Makefile for Linux samples code
-obj-$(CONFIG_SAMPLES) += markers/ kobject/ kprobes/ tracepoints/
+obj-$(CONFIG_SAMPLES) += markers/ kobject/ kprobes/ tracepoints/ trace_events/
diff --git a/samples/trace_events/Makefile b/samples/trace_events/Makefile
new file mode 100644
index 0000000..06c6dea
--- /dev/null
+++ b/samples/trace_events/Makefile
@@ -0,0 +1,8 @@
+# builds the trace events example kernel modules;
+# then to use one (as root): insmod <module_name.ko>
+
+PWD := $(shell pwd)
+
+CFLAGS_trace-events-sample.o := -I$(PWD)/samples/trace_events/
+
+obj-$(CONFIG_SAMPLE_TRACE_EVENTS) += trace-events-sample.o
diff --git a/samples/trace_events/trace-events-sample.c b/samples/trace_events/trace-events-sample.c
new file mode 100644
index 0000000..f33b3ba
--- /dev/null
+++ b/samples/trace_events/trace-events-sample.c
@@ -0,0 +1,56 @@
+#include <linux/module.h>
+#include <linux/kthread.h>
+
+/*
+ * Any file that uses trace points, must include the header.
+ * But only one file, must include the header by defining
+ * CREATE_TRACE_POINTS first. This will make the C code that
+ * creates the handles for the trace points.
+ */
+#define CREATE_TRACE_POINTS
+#include "trace-events-sample.h"
+
+
+static void simple_thread_func(int cnt)
+{
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(HZ);
+ trace_foo_bar("hello", cnt);
+
+ if (!(cnt % 10))
+ /* It is really important that I say "hi!" */
+ printk(KERN_EMERG "hi!\n");
+}
+
+static int simple_thread(void *arg)
+{
+ int cnt = 0;
+
+ while (!kthread_should_stop())
+ simple_thread_func(cnt++);
+
+ return 0;
+}
+
+static struct task_struct *simple_tsk;
+
+static int __init trace_event_init(void)
+{
+ simple_tsk = kthread_run(simple_thread, NULL, "event-sample");
+ if (IS_ERR(simple_tsk))
+ return -1;
+
+ return 0;
+}
+
+static void __exit trace_event_exit(void)
+{
+ kthread_stop(simple_tsk);
+}
+
+module_init(trace_event_init);
+module_exit(trace_event_exit);
+
+MODULE_AUTHOR("Steven Rostedt");
+MODULE_DESCRIPTION("trace-events-sample");
+MODULE_LICENSE("GPL");
diff --git a/samples/trace_events/trace-events-sample.h b/samples/trace_events/trace-events-sample.h
new file mode 100644
index 0000000..eab4644
--- /dev/null
+++ b/samples/trace_events/trace-events-sample.h
@@ -0,0 +1,124 @@
+/*
+ * Notice that this file is not protected like a normal header.
+ * We also must allow for rereading of this file. The
+ *
+ * || defined(TRACE_HEADER_MULTI_READ)
+ *
+ * serves this purpose.
+ */
+#if !defined(_TRACE_EVENT_SAMPLE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_EVENT_SAMPLE_H
+
+/*
+ * All trace headers should include tracepoint.h, until we finally
+ * make it into a standard header.
+ */
+#include <linux/tracepoint.h>
+
+/*
+ * If TRACE_SYSTEM is defined, that will be the directory created
+ * in the ftrace directory under /debugfs/tracing/events/<system>
+ *
+ * The define_trace.h belowe will also look for a file name of
+ * TRACE_SYSTEM.h where TRACE_SYSTEM is what is defined here.
+ *
+ * If you want a different system than file name, you can override
+ * the header name by defining TRACE_INCLUDE_FILE
+ *
+ * If this file was called, goofy.h, then we would define:
+ *
+ * #define TRACE_INCLUDE_FILE goofy
+ *
+ */
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM trace-events-sample
+
+/*
+ * The TRACE_EVENT macro is broken up into 5 parts.
+ *
+ * name: name of the trace point. This is also how to enable the tracepoint.
+ * A function called trace_foo_bar() will be created.
+ *
+ * proto: the prototype of the function trace_foo_bar()
+ * Here it is trace_foo_bar(char *foo, int bar).
+ *
+ * args: must match the arguments in the prototype.
+ * Here it is simply "foo, bar".
+ *
+ * struct: This defines the way the data will be stored in the ring buffer.
+ * There are currently two types of elements. __field and __array.
+ * a __field is broken up into (type, name). Where type can be any
+ * type but an array.
+ * For an array. there are three fields. (type, name, size). The
+ * type of elements in the array, the name of the field and the size
+ * of the array.
+ *
+ * __array( char, foo, 10) is the same as saying char foo[10].
+ *
+ * fast_assign: This is a C like function that is used to store the items
+ * into the ring buffer.
+ *
+ * printk: This is a way to print out the data in pretty print. This is
+ * useful if the system crashes and you are logging via a serial line,
+ * the data can be printed to the console using this "printk" method.
+ *
+ * Note, that for both the assign and the printk, __entry is the handler
+ * to the data structure in the ring buffer, and is defined by the
+ * TP_STRUCT__entry.
+ */
+TRACE_EVENT(foo_bar,
+
+ TP_PROTO(char *foo, int bar),
+
+ TP_ARGS(foo, bar),
+
+ TP_STRUCT__entry(
+ __array( char, foo, 10 )
+ __field( int, bar )
+ ),
+
+ TP_fast_assign(
+ strncpy(__entry->foo, foo, 10);
+ __entry->bar = bar;
+ ),
+
+ TP_printk("foo %s %d", __entry->foo, __entry->bar)
+);
+#endif
+
+/***** NOTICE! The #if protection ends here. *****/
+
+
+/*
+ * There are several ways I could have done this. If I left out the
+ * TRACE_INCLUDE_PATH, then it would default to the kernel source
+ * include/trace/events directory.
+ *
+ * I could specify a path from the define_trace.h file back to this
+ * file.
+ *
+ * #define TRACE_INCLUDE_PATH ../../samples/trace_events
+ *
+ * But I chose to simply make it use the current directory and then in
+ * the Makefile I added:
+ *
+ * CFLAGS_trace-events-sample.o := -I$(PWD)/samples/trace_events/
+ *
+ * This will make sure the current path is part of the include
+ * structure for our file so that we can find it.
+ *
+ * I could have made only the top level directory the include:
+ *
+ * CFLAGS_trace-events-sample.o := -I$(PWD)
+ *
+ * And then let the path to this directory be the TRACE_INCLUDE_PATH:
+ *
+ * #define TRACE_INCLUDE_PATH samples/trace_events
+ *
+ * But then if something defines "samples" or "trace_events" then we
+ * could risk that being converted too, and give us an unexpected
+ * result.
+ */
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#include <trace/define_trace.h>
--
1.6.2.1
--
^ permalink raw reply related [flat|nested] 17+ messages in thread
* Re: [PATCH 2/4] tracing/events: fix lockdep system name
2009-04-15 3:15 ` [PATCH 2/4] tracing/events: fix lockdep system name Steven Rostedt
@ 2009-04-15 6:34 ` Ingo Molnar
2009-04-15 9:32 ` Peter Zijlstra
1 sibling, 0 replies; 17+ messages in thread
From: Ingo Molnar @ 2009-04-15 6:34 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-kernel, Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Frederic Weisbecker, Theodore Tso, Arjan van de Ven,
Christoph Hellwig, Mathieu Desnoyers, Jeremy Fitzhardinge,
Lai Jiangshan, Zhaolei, Li Zefan, KOSAKI Motohiro,
Masami Hiramatsu, Frank Ch. Eigler, Tom Zanussi, Jiaying Zhang,
Michael Rubin, Martin Bligh
* Steven Rostedt <rostedt@goodmis.org> wrote:
> From: Steven Rostedt <srostedt@redhat.com>
>
> Impact: fix compile error of lockdep event tracer
>
> Ingo Molnar pointed out that the system name for the lockdep
> tracer was "lock" which is used to include the event trace file
> name. It should be "lockdep"
btw, i think it would be better to name it 'lock', all around -
i.e. lock.h, lock subsystem, etc.
lockdep is the 'lock dependency tracking engine'.
The locking related tracepoints here are implemented via lockdep
right now, but that might be done differently in the future - and
we dont want to do a rename (or live with a misnomer) then.
Ingo
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/4] [GIT PULL] more updates for TRACE_EVENTS for modules
2009-04-15 3:15 [PATCH 0/4] [GIT PULL] more updates for TRACE_EVENTS for modules Steven Rostedt
` (3 preceding siblings ...)
2009-04-15 3:15 ` [PATCH 4/4] tracing/events: add trace-events-sample Steven Rostedt
@ 2009-04-15 7:27 ` Ingo Molnar
2009-04-15 10:09 ` Ingo Molnar
4 siblings, 1 reply; 17+ messages in thread
From: Ingo Molnar @ 2009-04-15 7:27 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-kernel, Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Frederic Weisbecker, Theodore Tso, Arjan van de Ven,
Christoph Hellwig, Mathieu Desnoyers, Jeremy Fitzhardinge,
Lai Jiangshan, Zhaolei, Li Zefan, KOSAKI Motohiro,
Masami Hiramatsu, Frank Ch. Eigler, Tom Zanussi, Jiaying Zhang,
Michael Rubin, Martin Bligh
* Steven Rostedt <rostedt@goodmis.org> wrote:
> Ingo,
>
> Please pull the latest tip/tracing/core tree, which can be found at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
> tip/tracing/core
>
>
> Steven Rostedt (4):
> tracing/events: fix compile for modules disabled
> tracing/events: fix lockdep system name
> tracing/events: move trace point headers into include/trace/events
> tracing/events: add trace-events-sample
Pulled, thanks - i'm doing some more tests on it now.
The include/trace/ structure now looks extremely tidy, kudos!
Ingo
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 2/4] tracing/events: fix lockdep system name
2009-04-15 3:15 ` [PATCH 2/4] tracing/events: fix lockdep system name Steven Rostedt
2009-04-15 6:34 ` Ingo Molnar
@ 2009-04-15 9:32 ` Peter Zijlstra
1 sibling, 0 replies; 17+ messages in thread
From: Peter Zijlstra @ 2009-04-15 9:32 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-kernel, Ingo Molnar, Andrew Morton, Thomas Gleixner,
Frederic Weisbecker, Theodore Tso, Arjan van de Ven,
Christoph Hellwig, Mathieu Desnoyers, Jeremy Fitzhardinge,
Lai Jiangshan, Zhaolei, Li Zefan, KOSAKI Motohiro,
Masami Hiramatsu, Frank Ch. Eigler, Tom Zanussi, Jiaying Zhang,
Michael Rubin, Martin Bligh
On Tue, 2009-04-14 at 23:15 -0400, Steven Rostedt wrote:
> plain text document attachment
> (0002-tracing-events-fix-lockdep-system-name.patch)
> From: Steven Rostedt <srostedt@redhat.com>
>
> Impact: fix compile error of lockdep event tracer
>
> Ingo Molnar pointed out that the system name for the lockdep tracer was "lock"
> which is used to include the event trace file name. It should be "lockdep"
Ah, I did that on purpose. Whilst it all stems from the lockdep code,
these tracepoints have nothing much to do with dependency tracking,
hence I decided to drop that bit of the name.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 0/4] [GIT PULL] more updates for TRACE_EVENTS for modules
2009-04-15 7:27 ` [PATCH 0/4] [GIT PULL] more updates for TRACE_EVENTS for modules Ingo Molnar
@ 2009-04-15 10:09 ` Ingo Molnar
0 siblings, 0 replies; 17+ messages in thread
From: Ingo Molnar @ 2009-04-15 10:09 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-kernel, Andrew Morton, Thomas Gleixner, Peter Zijlstra,
Frederic Weisbecker, Theodore Tso, Arjan van de Ven,
Christoph Hellwig, Mathieu Desnoyers, Jeremy Fitzhardinge,
Lai Jiangshan, Zhaolei, Li Zefan, KOSAKI Motohiro,
Masami Hiramatsu, Frank Ch. Eigler, Tom Zanussi, Jiaying Zhang,
Michael Rubin, Martin Bligh
* Ingo Molnar <mingo@elte.hu> wrote:
>
> * Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > Ingo,
> >
> > Please pull the latest tip/tracing/core tree, which can be found at:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git
> > tip/tracing/core
> >
> >
> > Steven Rostedt (4):
> > tracing/events: fix compile for modules disabled
> > tracing/events: fix lockdep system name
> > tracing/events: move trace point headers into include/trace/events
> > tracing/events: add trace-events-sample
>
> Pulled, thanks - i'm doing some more tests on it now.
>
> The include/trace/ structure now looks extremely tidy, kudos!
Ok, preliminary tests passed, so i pushed it out into -tip:master as
well.
Btw., i have yet to trigger the lock tracing related lockup you saw
- shouldnt the self-tests have triggered any such lockup?
Ingo
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/4] tracing/events: fix compile for modules disabled
2009-04-15 3:15 ` [PATCH 1/4] tracing/events: fix compile for modules disabled Steven Rostedt
@ 2009-04-15 16:07 ` Frederic Weisbecker
2009-04-15 16:27 ` Steven Rostedt
0 siblings, 1 reply; 17+ messages in thread
From: Frederic Weisbecker @ 2009-04-15 16:07 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-kernel, Ingo Molnar, Andrew Morton, Thomas Gleixner,
Peter Zijlstra, Theodore Tso, Arjan van de Ven, Christoph Hellwig,
Mathieu Desnoyers, Jeremy Fitzhardinge, Lai Jiangshan, Zhaolei,
Li Zefan, KOSAKI Motohiro, Masami Hiramatsu, Frank Ch. Eigler,
Tom Zanussi, Jiaying Zhang, Michael Rubin, Martin Bligh
On Tue, Apr 14, 2009 at 11:15:12PM -0400, Steven Rostedt wrote:
> From: Steven Rostedt <srostedt@redhat.com>
>
> Impact: compile fix
>
> The addition of TRACE_EVENT for modules breaks the build for when
> modules are disabled. This code fixes that.
>
> Reported-by: Ingo Molnar <mingo@elte.hu>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
> kernel/trace/trace_events.c | 12 ++++++++++--
> 1 files changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index a4b1777..6591d83 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -797,6 +797,7 @@ event_create_dir(struct ftrace_event_call *call, struct dentry *d_events)
> (unsigned long)event < (unsigned long)end; \
> event++)
>
> +#ifdef CONFIG_MODULES
> static void trace_module_add_events(struct module *mod)
> {
> struct ftrace_event_call *call, *start, *end;
> @@ -840,8 +841,8 @@ static void trace_module_remove_events(struct module *mod)
> }
> }
>
> -int trace_module_notify(struct notifier_block *self,
> - unsigned long val, void *data)
> +static int trace_module_notify(struct notifier_block *self,
> + unsigned long val, void *data)
> {
> struct module *mod = data;
>
> @@ -858,6 +859,13 @@ int trace_module_notify(struct notifier_block *self,
>
> return 0;
> }
> +#else
> +static int trace_module_notify(struct notifier_block *self,
> + unsigned long val, void *data)
I don't remember when you register the module notifier but
I guess it is on init time, then you can set this func as __init
if !CONFIG_MODULES.
> +{
> + return 0;
> +}
> +#endif /* CONFIG_MODULES */
>
> struct notifier_block trace_module_nb = {
> .notifier_call = trace_module_notify,
And then you can set this struct as __initdata_or_module, so
that you can safely register this module notifier whatever
config you have, and without consuming any space on the off case.
> --
> 1.6.2.1
>
> --
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/4] tracing/events: add trace-events-sample
2009-04-15 3:15 ` [PATCH 4/4] tracing/events: add trace-events-sample Steven Rostedt
@ 2009-04-15 16:15 ` Frederic Weisbecker
2009-04-16 16:58 ` Christoph Hellwig
1 sibling, 0 replies; 17+ messages in thread
From: Frederic Weisbecker @ 2009-04-15 16:15 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-kernel, Ingo Molnar, Andrew Morton, Thomas Gleixner,
Peter Zijlstra, Theodore Tso, Arjan van de Ven, Christoph Hellwig,
Mathieu Desnoyers, Jeremy Fitzhardinge, Lai Jiangshan, Zhaolei,
Li Zefan, KOSAKI Motohiro, Masami Hiramatsu, Frank Ch. Eigler,
Tom Zanussi, Jiaying Zhang, Michael Rubin, Martin Bligh
On Tue, Apr 14, 2009 at 11:15:15PM -0400, Steven Rostedt wrote:
> From: Steven Rostedt <srostedt@redhat.com>
>
> This patch adds a sample to the samples directory on how to create
> and use TRACE_EVENT trace points.
>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
> samples/Kconfig | 7 ++
> samples/Makefile | 2 +-
> samples/trace_events/Makefile | 8 ++
> samples/trace_events/trace-events-sample.c | 56 +++++++++++++
> samples/trace_events/trace-events-sample.h | 124 ++++++++++++++++++++++++++++
> 5 files changed, 196 insertions(+), 1 deletions(-)
> create mode 100644 samples/trace_events/Makefile
> create mode 100644 samples/trace_events/trace-events-sample.c
> create mode 100644 samples/trace_events/trace-events-sample.h
>
> diff --git a/samples/Kconfig b/samples/Kconfig
> index 4b02f5a..93f41c0 100644
> --- a/samples/Kconfig
> +++ b/samples/Kconfig
> @@ -19,6 +19,13 @@ config SAMPLE_TRACEPOINTS
> help
> This build tracepoints example modules.
>
> +config SAMPLE_TRACE_EVENTS
> + tristate "Build trace_events examples"
> + depends on EVENT_TRACING
> + default m
> + help
> + This build trace event example modules.
> +
> config SAMPLE_KOBJECT
> tristate "Build kobject examples"
> help
> diff --git a/samples/Makefile b/samples/Makefile
> index 10eaca8..13e4b47 100644
> --- a/samples/Makefile
> +++ b/samples/Makefile
> @@ -1,3 +1,3 @@
> # Makefile for Linux samples code
>
> -obj-$(CONFIG_SAMPLES) += markers/ kobject/ kprobes/ tracepoints/
> +obj-$(CONFIG_SAMPLES) += markers/ kobject/ kprobes/ tracepoints/ trace_events/
> diff --git a/samples/trace_events/Makefile b/samples/trace_events/Makefile
> new file mode 100644
> index 0000000..06c6dea
> --- /dev/null
> +++ b/samples/trace_events/Makefile
> @@ -0,0 +1,8 @@
> +# builds the trace events example kernel modules;
> +# then to use one (as root): insmod <module_name.ko>
> +
> +PWD := $(shell pwd)
> +
> +CFLAGS_trace-events-sample.o := -I$(PWD)/samples/trace_events/
> +
> +obj-$(CONFIG_SAMPLE_TRACE_EVENTS) += trace-events-sample.o
> diff --git a/samples/trace_events/trace-events-sample.c b/samples/trace_events/trace-events-sample.c
> new file mode 100644
> index 0000000..f33b3ba
> --- /dev/null
> +++ b/samples/trace_events/trace-events-sample.c
> @@ -0,0 +1,56 @@
> +#include <linux/module.h>
> +#include <linux/kthread.h>
> +
> +/*
> + * Any file that uses trace points, must include the header.
> + * But only one file, must include the header by defining
> + * CREATE_TRACE_POINTS first. This will make the C code that
> + * creates the handles for the trace points.
> + */
> +#define CREATE_TRACE_POINTS
> +#include "trace-events-sample.h"
> +
> +
> +static void simple_thread_func(int cnt)
> +{
> + set_current_state(TASK_INTERRUPTIBLE);
> + schedule_timeout(HZ);
> + trace_foo_bar("hello", cnt);
> +
> + if (!(cnt % 10))
> + /* It is really important that I say "hi!" */
Nice design choice! Indeed this is very important! ;-)
Frederic.
> + printk(KERN_EMERG "hi!\n");
> +}
> +
> +static int simple_thread(void *arg)
> +{
> + int cnt = 0;
> +
> + while (!kthread_should_stop())
> + simple_thread_func(cnt++);
> +
> + return 0;
> +}
> +
> +static struct task_struct *simple_tsk;
> +
> +static int __init trace_event_init(void)
> +{
> + simple_tsk = kthread_run(simple_thread, NULL, "event-sample");
> + if (IS_ERR(simple_tsk))
> + return -1;
> +
> + return 0;
> +}
> +
> +static void __exit trace_event_exit(void)
> +{
> + kthread_stop(simple_tsk);
> +}
> +
> +module_init(trace_event_init);
> +module_exit(trace_event_exit);
> +
> +MODULE_AUTHOR("Steven Rostedt");
> +MODULE_DESCRIPTION("trace-events-sample");
> +MODULE_LICENSE("GPL");
> diff --git a/samples/trace_events/trace-events-sample.h b/samples/trace_events/trace-events-sample.h
> new file mode 100644
> index 0000000..eab4644
> --- /dev/null
> +++ b/samples/trace_events/trace-events-sample.h
> @@ -0,0 +1,124 @@
> +/*
> + * Notice that this file is not protected like a normal header.
> + * We also must allow for rereading of this file. The
> + *
> + * || defined(TRACE_HEADER_MULTI_READ)
> + *
> + * serves this purpose.
> + */
> +#if !defined(_TRACE_EVENT_SAMPLE_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_EVENT_SAMPLE_H
> +
> +/*
> + * All trace headers should include tracepoint.h, until we finally
> + * make it into a standard header.
> + */
> +#include <linux/tracepoint.h>
> +
> +/*
> + * If TRACE_SYSTEM is defined, that will be the directory created
> + * in the ftrace directory under /debugfs/tracing/events/<system>
> + *
> + * The define_trace.h belowe will also look for a file name of
> + * TRACE_SYSTEM.h where TRACE_SYSTEM is what is defined here.
> + *
> + * If you want a different system than file name, you can override
> + * the header name by defining TRACE_INCLUDE_FILE
> + *
> + * If this file was called, goofy.h, then we would define:
> + *
> + * #define TRACE_INCLUDE_FILE goofy
> + *
> + */
> +#undef TRACE_SYSTEM
> +#define TRACE_SYSTEM trace-events-sample
> +
> +/*
> + * The TRACE_EVENT macro is broken up into 5 parts.
> + *
> + * name: name of the trace point. This is also how to enable the tracepoint.
> + * A function called trace_foo_bar() will be created.
> + *
> + * proto: the prototype of the function trace_foo_bar()
> + * Here it is trace_foo_bar(char *foo, int bar).
> + *
> + * args: must match the arguments in the prototype.
> + * Here it is simply "foo, bar".
> + *
> + * struct: This defines the way the data will be stored in the ring buffer.
> + * There are currently two types of elements. __field and __array.
> + * a __field is broken up into (type, name). Where type can be any
> + * type but an array.
> + * For an array. there are three fields. (type, name, size). The
> + * type of elements in the array, the name of the field and the size
> + * of the array.
> + *
> + * __array( char, foo, 10) is the same as saying char foo[10].
> + *
> + * fast_assign: This is a C like function that is used to store the items
> + * into the ring buffer.
> + *
> + * printk: This is a way to print out the data in pretty print. This is
> + * useful if the system crashes and you are logging via a serial line,
> + * the data can be printed to the console using this "printk" method.
> + *
> + * Note, that for both the assign and the printk, __entry is the handler
> + * to the data structure in the ring buffer, and is defined by the
> + * TP_STRUCT__entry.
> + */
> +TRACE_EVENT(foo_bar,
> +
> + TP_PROTO(char *foo, int bar),
> +
> + TP_ARGS(foo, bar),
> +
> + TP_STRUCT__entry(
> + __array( char, foo, 10 )
> + __field( int, bar )
> + ),
> +
> + TP_fast_assign(
> + strncpy(__entry->foo, foo, 10);
> + __entry->bar = bar;
> + ),
> +
> + TP_printk("foo %s %d", __entry->foo, __entry->bar)
> +);
> +#endif
> +
> +/***** NOTICE! The #if protection ends here. *****/
> +
> +
> +/*
> + * There are several ways I could have done this. If I left out the
> + * TRACE_INCLUDE_PATH, then it would default to the kernel source
> + * include/trace/events directory.
> + *
> + * I could specify a path from the define_trace.h file back to this
> + * file.
> + *
> + * #define TRACE_INCLUDE_PATH ../../samples/trace_events
> + *
> + * But I chose to simply make it use the current directory and then in
> + * the Makefile I added:
> + *
> + * CFLAGS_trace-events-sample.o := -I$(PWD)/samples/trace_events/
> + *
> + * This will make sure the current path is part of the include
> + * structure for our file so that we can find it.
> + *
> + * I could have made only the top level directory the include:
> + *
> + * CFLAGS_trace-events-sample.o := -I$(PWD)
> + *
> + * And then let the path to this directory be the TRACE_INCLUDE_PATH:
> + *
> + * #define TRACE_INCLUDE_PATH samples/trace_events
> + *
> + * But then if something defines "samples" or "trace_events" then we
> + * could risk that being converted too, and give us an unexpected
> + * result.
> + */
> +#undef TRACE_INCLUDE_PATH
> +#define TRACE_INCLUDE_PATH .
> +#include <trace/define_trace.h>
> --
> 1.6.2.1
>
> --
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 1/4] tracing/events: fix compile for modules disabled
2009-04-15 16:07 ` Frederic Weisbecker
@ 2009-04-15 16:27 ` Steven Rostedt
0 siblings, 0 replies; 17+ messages in thread
From: Steven Rostedt @ 2009-04-15 16:27 UTC (permalink / raw)
To: Frederic Weisbecker
Cc: linux-kernel, Ingo Molnar, Andrew Morton, Thomas Gleixner,
Peter Zijlstra, Theodore Tso, Arjan van de Ven, Christoph Hellwig,
Mathieu Desnoyers, Jeremy Fitzhardinge, Lai Jiangshan, Zhaolei,
Li Zefan, KOSAKI Motohiro, Masami Hiramatsu, Frank Ch. Eigler,
Tom Zanussi, Jiaying Zhang, Michael Rubin, Martin Bligh
On Wed, 15 Apr 2009, Frederic Weisbecker wrote:
> > +#else
> > +static int trace_module_notify(struct notifier_block *self,
> > + unsigned long val, void *data)
>
>
>
> I don't remember when you register the module notifier but
> I guess it is on init time, then you can set this func as __init
> if !CONFIG_MODULES.
>
>
> > +{
> > + return 0;
> > +}
> > +#endif /* CONFIG_MODULES */
> >
> > struct notifier_block trace_module_nb = {
> > .notifier_call = trace_module_notify,
>
>
> And then you can set this struct as __initdata_or_module, so
> that you can safely register this module notifier whatever
> config you have, and without consuming any space on the off case.
Good point. I'll update that.
-- Steve
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/4] tracing/events: add trace-events-sample
2009-04-15 3:15 ` [PATCH 4/4] tracing/events: add trace-events-sample Steven Rostedt
2009-04-15 16:15 ` Frederic Weisbecker
@ 2009-04-16 16:58 ` Christoph Hellwig
2009-04-16 17:34 ` Steven Rostedt
1 sibling, 1 reply; 17+ messages in thread
From: Christoph Hellwig @ 2009-04-16 16:58 UTC (permalink / raw)
To: Steven Rostedt
Cc: linux-kernel, Ingo Molnar, Andrew Morton, Thomas Gleixner,
Peter Zijlstra, Frederic Weisbecker, Theodore Tso,
Arjan van de Ven, Christoph Hellwig, Mathieu Desnoyers,
Jeremy Fitzhardinge, Lai Jiangshan, Zhaolei, Li Zefan,
KOSAKI Motohiro, Masami Hiramatsu, Frank Ch. Eigler, Tom Zanussi,
Jiaying Zhang, Michael Rubin, Martin Bligh
On Tue, Apr 14, 2009 at 11:15:15PM -0400, Steven Rostedt wrote:
> +++ b/samples/trace_events/Makefile
> @@ -0,0 +1,8 @@
> +# builds the trace events example kernel modules;
> +# then to use one (as root): insmod <module_name.ko>
> +
> +PWD := $(shell pwd)
> +
> +CFLAGS_trace-events-sample.o := -I$(PWD)/samples/trace_events/
CFLAGS_trace-events-sample.o += -I$(src)
That should better be written as. But you'd easily get rid of that
by just including the file using #include "foo.h" instead of <foo.h>,
no?
> --- /dev/null
> +++ b/samples/trace_events/trace-events-sample.h
> @@ -0,0 +1,124 @@
> +/*
> + * Notice that this file is not protected like a normal header.
> + * We also must allow for rereading of this file. The
> + *
> + * || defined(TRACE_HEADER_MULTI_READ)
> + *
> + * serves this purpose.
> + */
> +#if !defined(_TRACE_EVENT_SAMPLE_H) || defined(TRACE_HEADER_MULTI_READ)
> +#define _TRACE_EVENT_SAMPLE_H
Why do we need this protection at all? It only be included by the users
of the tracepoints, and it seems just fair to take some more than normal
precaution for more than unusual magic headers.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/4] tracing/events: add trace-events-sample
2009-04-16 16:58 ` Christoph Hellwig
@ 2009-04-16 17:34 ` Steven Rostedt
2009-04-16 17:36 ` Christoph Hellwig
2009-04-16 18:25 ` Sam Ravnborg
0 siblings, 2 replies; 17+ messages in thread
From: Steven Rostedt @ 2009-04-16 17:34 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-kernel, Ingo Molnar, Andrew Morton, Thomas Gleixner,
Peter Zijlstra, Frederic Weisbecker, Theodore Tso,
Arjan van de Ven, Mathieu Desnoyers, Jeremy Fitzhardinge,
Lai Jiangshan, Zhaolei, Li Zefan, KOSAKI Motohiro,
Masami Hiramatsu, Frank Ch. Eigler, Tom Zanussi, Jiaying Zhang,
Michael Rubin, Martin Bligh
On Thu, 16 Apr 2009, Christoph Hellwig wrote:
> On Tue, Apr 14, 2009 at 11:15:15PM -0400, Steven Rostedt wrote:
> > +++ b/samples/trace_events/Makefile
> > @@ -0,0 +1,8 @@
> > +# builds the trace events example kernel modules;
> > +# then to use one (as root): insmod <module_name.ko>
> > +
> > +PWD := $(shell pwd)
> > +
> > +CFLAGS_trace-events-sample.o := -I$(PWD)/samples/trace_events/
>
> CFLAGS_trace-events-sample.o += -I$(src)
Is $(src) defined to be where the object is compiled?
>
> That should better be written as. But you'd easily get rid of that
> by just including the file using #include "foo.h" instead of <foo.h>,
> no?
That is for the define_trace.h to find the file. The define_trace.h will
look from where it is located. ie. include/trace
>
> > --- /dev/null
> > +++ b/samples/trace_events/trace-events-sample.h
> > @@ -0,0 +1,124 @@
> > +/*
> > + * Notice that this file is not protected like a normal header.
> > + * We also must allow for rereading of this file. The
> > + *
> > + * || defined(TRACE_HEADER_MULTI_READ)
> > + *
> > + * serves this purpose.
> > + */
> > +#if !defined(_TRACE_EVENT_SAMPLE_H) || defined(TRACE_HEADER_MULTI_READ)
> > +#define _TRACE_EVENT_SAMPLE_H
>
> Why do we need this protection at all? It only be included by the users
> of the tracepoints, and it seems just fair to take some more than normal
> precaution for more than unusual magic headers.
This was needed for kmem.h because it was causing header recursive hell.
But instead of doing this for just a few headers, having it in all was a
way to be:
1) safe
2) descriptive
#2 is because people are use to the #ifndef _MY_HEADER_H and seeing that
there is also a TRACE_HEADER_MULTI_READ it makes it obvious that this
header may be included more than once, purposefully.
-- Steve
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/4] tracing/events: add trace-events-sample
2009-04-16 17:34 ` Steven Rostedt
@ 2009-04-16 17:36 ` Christoph Hellwig
2009-04-16 17:46 ` Steven Rostedt
2009-04-16 18:25 ` Sam Ravnborg
1 sibling, 1 reply; 17+ messages in thread
From: Christoph Hellwig @ 2009-04-16 17:36 UTC (permalink / raw)
To: Steven Rostedt
Cc: Christoph Hellwig, linux-kernel, Ingo Molnar, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Frederic Weisbecker,
Theodore Tso, Arjan van de Ven, Mathieu Desnoyers,
Jeremy Fitzhardinge, Lai Jiangshan, Zhaolei, Li Zefan,
KOSAKI Motohiro, Masami Hiramatsu, Frank Ch. Eigler, Tom Zanussi,
Jiaying Zhang, Michael Rubin, Martin Bligh
On Thu, Apr 16, 2009 at 01:34:46PM -0400, Steven Rostedt wrote:
> > On Tue, Apr 14, 2009 at 11:15:15PM -0400, Steven Rostedt wrote:
> > > +++ b/samples/trace_events/Makefile
> > > @@ -0,0 +1,8 @@
> > > +# builds the trace events example kernel modules;
> > > +# then to use one (as root): insmod <module_name.ko>
> > > +
> > > +PWD := $(shell pwd)
> > > +
> > > +CFLAGS_trace-events-sample.o := -I$(PWD)/samples/trace_events/
> >
> > CFLAGS_trace-events-sample.o += -I$(src)
>
> Is $(src) defined to be where the object is compiled?
$(src) is the source directory, $(obj) is the directory where the
compiled object ends up.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/4] tracing/events: add trace-events-sample
2009-04-16 17:36 ` Christoph Hellwig
@ 2009-04-16 17:46 ` Steven Rostedt
0 siblings, 0 replies; 17+ messages in thread
From: Steven Rostedt @ 2009-04-16 17:46 UTC (permalink / raw)
To: Christoph Hellwig
Cc: linux-kernel, Ingo Molnar, Andrew Morton, Thomas Gleixner,
Peter Zijlstra, Frederic Weisbecker, Theodore Tso,
Arjan van de Ven, Mathieu Desnoyers, Jeremy Fitzhardinge,
Lai Jiangshan, Zhaolei, Li Zefan, KOSAKI Motohiro,
Masami Hiramatsu, Frank Ch. Eigler, Tom Zanussi, Jiaying Zhang,
Michael Rubin, Martin Bligh
On Thu, 16 Apr 2009, Christoph Hellwig wrote:
> On Thu, Apr 16, 2009 at 01:34:46PM -0400, Steven Rostedt wrote:
> > > On Tue, Apr 14, 2009 at 11:15:15PM -0400, Steven Rostedt wrote:
> > > > +++ b/samples/trace_events/Makefile
> > > > @@ -0,0 +1,8 @@
> > > > +# builds the trace events example kernel modules;
> > > > +# then to use one (as root): insmod <module_name.ko>
> > > > +
> > > > +PWD := $(shell pwd)
> > > > +
> > > > +CFLAGS_trace-events-sample.o := -I$(PWD)/samples/trace_events/
> > >
> > > CFLAGS_trace-events-sample.o += -I$(src)
> >
> > Is $(src) defined to be where the object is compiled?
>
> $(src) is the source directory, $(obj) is the directory where the
> compiled object ends up.
Oh, cool. I did not know that.
I'll update the sample code accordingly.
Thanks!
-- Steve
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: [PATCH 4/4] tracing/events: add trace-events-sample
2009-04-16 17:34 ` Steven Rostedt
2009-04-16 17:36 ` Christoph Hellwig
@ 2009-04-16 18:25 ` Sam Ravnborg
1 sibling, 0 replies; 17+ messages in thread
From: Sam Ravnborg @ 2009-04-16 18:25 UTC (permalink / raw)
To: Steven Rostedt
Cc: Christoph Hellwig, linux-kernel, Ingo Molnar, Andrew Morton,
Thomas Gleixner, Peter Zijlstra, Frederic Weisbecker,
Theodore Tso, Arjan van de Ven, Mathieu Desnoyers,
Jeremy Fitzhardinge, Lai Jiangshan, Zhaolei, Li Zefan,
KOSAKI Motohiro, Masami Hiramatsu, Frank Ch. Eigler, Tom Zanussi,
Jiaying Zhang, Michael Rubin, Martin Bligh
On Thu, Apr 16, 2009 at 01:34:46PM -0400, Steven Rostedt wrote:
>
> On Thu, 16 Apr 2009, Christoph Hellwig wrote:
>
> > On Tue, Apr 14, 2009 at 11:15:15PM -0400, Steven Rostedt wrote:
> > > +++ b/samples/trace_events/Makefile
> > > @@ -0,0 +1,8 @@
> > > +# builds the trace events example kernel modules;
> > > +# then to use one (as root): insmod <module_name.ko>
> > > +
> > > +PWD := $(shell pwd)
> > > +
> > > +CFLAGS_trace-events-sample.o := -I$(PWD)/samples/trace_events/
> >
> > CFLAGS_trace-events-sample.o += -I$(src)
>
> Is $(src) defined to be where the object is compiled?
$(src) is the path to the directory where the source files are
located. $(obj) is the path to the directory where the output
is located.
They are both relative to the root of the kernel tree and thus
they are equal. We have $(src) and $(obj) only for documentation
purposes today.
In this case $(src) is correct as we want to point at where the
source files are located.
Sam
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2009-04-16 18:23 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-15 3:15 [PATCH 0/4] [GIT PULL] more updates for TRACE_EVENTS for modules Steven Rostedt
2009-04-15 3:15 ` [PATCH 1/4] tracing/events: fix compile for modules disabled Steven Rostedt
2009-04-15 16:07 ` Frederic Weisbecker
2009-04-15 16:27 ` Steven Rostedt
2009-04-15 3:15 ` [PATCH 2/4] tracing/events: fix lockdep system name Steven Rostedt
2009-04-15 6:34 ` Ingo Molnar
2009-04-15 9:32 ` Peter Zijlstra
2009-04-15 3:15 ` [PATCH 3/4] tracing/events: move trace point headers into include/trace/events Steven Rostedt
2009-04-15 3:15 ` [PATCH 4/4] tracing/events: add trace-events-sample Steven Rostedt
2009-04-15 16:15 ` Frederic Weisbecker
2009-04-16 16:58 ` Christoph Hellwig
2009-04-16 17:34 ` Steven Rostedt
2009-04-16 17:36 ` Christoph Hellwig
2009-04-16 17:46 ` Steven Rostedt
2009-04-16 18:25 ` Sam Ravnborg
2009-04-15 7:27 ` [PATCH 0/4] [GIT PULL] more updates for TRACE_EVENTS for modules Ingo Molnar
2009-04-15 10:09 ` Ingo Molnar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox