Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[PATCH 18/18] Create config option for enabling IRQ tracepoints

10 views
Skip to first unread message

Jan Kara

unread,
Mar 22, 2010, 8:40:01 PM3/22/10
to
Signed-off-by: Jan Kara <ja...@suse.cz>
---
include/trace/events/irq.h | 2 ++
kernel/trace/Kconfig | 6 ++++++
2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/irq.h b/include/trace/events/irq.h
index 0e4cfb6..dd9cdb7 100644
--- a/include/trace/events/irq.h
+++ b/include/trace/events/irq.h
@@ -1,5 +1,7 @@
#undef TRACE_SYSTEM
+#undef TRACE_CONFIG
#define TRACE_SYSTEM irq
+#define TRACE_CONFIG CONFIG_IRQ_TRACER

#if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_IRQ_H
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index abcd529..7893ea4 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -152,6 +152,10 @@ config FUNCTION_GRAPH_TRACER
address on the current task structure into a stack of calls.


+# Config option to determine whether IRQ tracepoins should be compiled
+config IRQ_TRACER
+ bool
+
config IRQSOFF_TRACER
bool "Interrupts-off Latency Tracer"
default n
@@ -161,6 +165,7 @@ config IRQSOFF_TRACER
select GENERIC_TRACER
select TRACER_MAX_TRACE
select RING_BUFFER_ALLOW_SWAP
+ select IRQ_TRACER
help
This option measures the time spent in irqs-off critical
sections, with microsecond accuracy.
@@ -183,6 +188,7 @@ config PREEMPT_TRACER
select GENERIC_TRACER
select TRACER_MAX_TRACE
select RING_BUFFER_ALLOW_SWAP
+ select IRQ_TRACER
help
This option measures the time spent in preemption-off critical
sections, with microsecond accuracy.
--
1.6.4.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majo...@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

Jan Kara

unread,
Mar 22, 2010, 8:40:02 PM3/22/10
to
Signed-off-by: Jan Kara <ja...@suse.cz>
---
include/trace/events/workqueue.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h
index d6c9744..d1641ad 100644
--- a/include/trace/events/workqueue.h
+++ b/include/trace/events/workqueue.h


@@ -1,5 +1,7 @@
#undef TRACE_SYSTEM
+#undef TRACE_CONFIG

#define TRACE_SYSTEM workqueue
+#define TRACE_CONFIG CONFIG_WORKQUEUE_TRACER

#if !defined(_TRACE_WORKQUEUE_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_WORKQUEUE_H

Jan Kara

unread,
Mar 22, 2010, 8:40:01 PM3/22/10
to
CC: x...@kernel.org
CC: sparc...@vger.kernel.org
CC: linux...@vger.kernel.org
CC: Alexander Schulz <al...@shark-linux.de>

Signed-off-by: Jan Kara <ja...@suse.cz>
---
include/trace/events/syscalls.h | 2 ++

1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/syscalls.h b/include/trace/events/syscalls.h
index fb726ac..6f0ad30 100644
--- a/include/trace/events/syscalls.h
+++ b/include/trace/events/syscalls.h
@@ -1,6 +1,8 @@
#undef TRACE_SYSTEM
+#undef TRACE_CONFIG
#define TRACE_SYSTEM raw_syscalls
#define TRACE_INCLUDE_FILE syscalls
+#define TRACE_CONFIG CONFIG_FTRACE_SYSCALLS

#if !defined(_TRACE_EVENTS_SYSCALLS_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_EVENTS_SYSCALLS_H

Jan Kara

unread,
Mar 22, 2010, 8:40:01 PM3/22/10
to
CC: linux...@vger.kernel.org

Signed-off-by: Jan Kara <ja...@suse.cz>
---
include/trace/events/ext4.h | 2 ++
include/trace/events/jbd2.h | 2 ++
kernel/trace/Kconfig | 23 +++++++++++++++++++++++
3 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/ext4.h b/include/trace/events/ext4.h
index 2aa6aa3..f1ad2e3 100644
--- a/include/trace/events/ext4.h
+++ b/include/trace/events/ext4.h
@@ -1,5 +1,7 @@
#undef TRACE_SYSTEM
+#undef TRACE_CONFIG
#define TRACE_SYSTEM ext4
+#define TRACE_CONFIG CONFIG_EXT4_TRACER

#if !defined(_TRACE_EXT4_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_EXT4_H
diff --git a/include/trace/events/jbd2.h b/include/trace/events/jbd2.h
index bf16545..37e442b 100644
--- a/include/trace/events/jbd2.h
+++ b/include/trace/events/jbd2.h
@@ -1,5 +1,7 @@
#undef TRACE_SYSTEM
+#undef TRACE_CONFIG
#define TRACE_SYSTEM jbd2
+#define TRACE_CONFIG CONFIG_JBD2_TRACER

#if !defined(_TRACE_JBD2_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_JBD2_H
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 13e13d4..e696314 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -438,6 +438,29 @@ config BLK_DEV_IO_TRACE

If unsure, say N.

+config EXT4_TRACER
+ bool "Support for tracing EXT4 events"
+ depends on EXT4_FS
+ select GENERIC_TRACER
+ select TRACE_ANY_MODULE if EXT4_FS=m
+ help
+ Provide tracing for various functions in ext4 filesystem
+ such as block allocation, delayed allocation, or writeback
+ handling. This trace points can help with debugging allocation
+ algorithms or writeback performance.
+
+ If unsure, say N.
+
+config JBD2_TRACER
+ bool "JBD2 tracing"
+ depends on JBD2
+ select GENERIC_TRACER
+ help
+ Provide tracing for several functions in JBD2 commit and
+ checkpointing code.
+
+ If unsure, say N.
+
config KPROBE_EVENT
depends on KPROBES
depends on HAVE_REGS_AND_STACK_ACCESS_API

Jan Kara

unread,
Mar 22, 2010, 8:40:02 PM3/22/10
to
CC: linux-w...@vger.kernel.org

Signed-off-by: Jan Kara <ja...@suse.cz>
---
net/mac80211/driver-trace.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h
index 41baf73..0e6c059 100644
--- a/net/mac80211/driver-trace.h
+++ b/net/mac80211/driver-trace.h
@@ -1,11 +1,13 @@
#if !defined(__MAC80211_DRIVER_TRACE) || defined(TRACE_HEADER_MULTI_READ)
#define __MAC80211_DRIVER_TRACE

+#undef TRACE_CONFIG
+#define TRACE_CONFIG CONFIG_MAC80211_DRIVER_API_TRACER
#include <linux/tracepoint.h>
#include <net/mac80211.h>
#include "ieee80211_i.h"

-#if !defined(CONFIG_MAC80211_DRIVER_API_TRACER) || defined(__CHECKER__)
+#if defined(__CHECKER__)
#undef TRACE_EVENT
#define TRACE_EVENT(name, proto, ...) \
static inline void trace_ ## name(proto) {}

Jan Kara

unread,
Mar 22, 2010, 8:40:01 PM3/22/10
to
If a particular tracer is disabled, there is no need to generate any tracepoint
code for it. Actually, the inline checks whether tracepoints of the tracer are
active have non-negligible impact on a code size [1] and thus can in theory
lead to slowdown. This is undesirable when e.g. BLK_DEV_IO_TRACE should be
enabled in the production kernel but KMEMTRACE is disabled.

So introduce a macro trickery in <linux/tracepoint.h> so that each tracer can
define TRACE_CONFIG to CONFIG_MY_TRACER before including linux/tracepoint.h in
it's events file and that will result in tracepoints becoming empty if
CONFIG_MY_TRACER is not defined.

[1] As an example: bloat-o-meter mm/slub.o.untraced mm/slub.o.traced
add/remove: 61/1 grow/shrink: 24/10 up/down: 6366/-737 (5629)
function old new delta
deactivate_slab - 592 +592
show_stat - 380 +380
trace_kmalloc_node - 265 +265
trace_kmalloc - 255 +255
kmem_cache_alloc_node 590 825 +235
kmem_cache_alloc 542 768 +226
kfree 566 763 +197
kmem_cache_free 478 671 +193
...

CC: Steven Rostedt <ros...@goodmis.org>
CC: Frederic Weisbecker <fwei...@gmail.com>
CC: Ingo Molnar <mi...@redhat.com>


Signed-off-by: Jan Kara <ja...@suse.cz>
---

include/linux/tracepoint.h | 96 +++++++++++++++++++++++++++++++++++--------
1 files changed, 78 insertions(+), 18 deletions(-)

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index f59604e..1ad17cc 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -37,8 +37,7 @@ struct tracepoint {

#define TP_PROTO(args...) args
#define TP_ARGS(args...) args
-
-#ifdef CONFIG_TRACEPOINTS
+#define PARAMS(args...) args

/*
* it_func[0] is never NULL because there is at least one element in the array
@@ -63,7 +62,7 @@ struct tracepoint {
* not add unwanted padding between the beginning of the section and the
* structure. Force alignment to the same alignment as the section start.
*/
-#define DECLARE_TRACE(name, proto, args) \
+#define DECLARE_TRACE_1(name, proto, args) \
extern struct tracepoint __tracepoint_##name; \
static inline void trace_##name(proto) \
{ \
@@ -81,26 +80,22 @@ struct tracepoint {
}


-#define DEFINE_TRACE_FN(name, reg, unreg) \
+#define DEFINE_TRACE_FN_1(name, reg, unreg) \
static const char __tpstrtab_##name[] \
__attribute__((section("__tracepoints_strings"))) = #name; \
struct tracepoint __tracepoint_##name \
__attribute__((section("__tracepoints"), aligned(32))) = \
{ __tpstrtab_##name, 0, reg, unreg, NULL }

-#define DEFINE_TRACE(name) \
+#define DEFINE_TRACE_1(name) \
DEFINE_TRACE_FN(name, NULL, NULL);

-#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) \
+#define EXPORT_TRACEPOINT_SYMBOL_GPL_1(name) \
EXPORT_SYMBOL_GPL(__tracepoint_##name)
-#define EXPORT_TRACEPOINT_SYMBOL(name) \
+#define EXPORT_TRACEPOINT_SYMBOL_1(name) \
EXPORT_SYMBOL(__tracepoint_##name)

-extern void tracepoint_update_probe_range(struct tracepoint *begin,
- struct tracepoint *end);
-
-#else /* !CONFIG_TRACEPOINTS */
-#define DECLARE_TRACE(name, proto, args) \
+#define DECLARE_TRACE_0(name, proto, args) \
static inline void _do_trace_##name(struct tracepoint *tp, proto) \
{ } \
static inline void trace_##name(proto) \
@@ -114,10 +109,51 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,
return -ENOSYS; \
}

-#define DEFINE_TRACE_FN(name, reg, unreg)
-#define DEFINE_TRACE(name)
-#define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
-#define EXPORT_TRACEPOINT_SYMBOL(name)
+#define DEFINE_TRACE_FN_0(name, reg, unreg)
+#define DEFINE_TRACE_0(name)
+#define EXPORT_TRACEPOINT_SYMBOL_GPL_0(name)
+#define EXPORT_TRACEPOINT_SYMBOL_0(name)
+
+/*
+ * Below two-level macro magic is really needed to propely expand TRACE_CONFIG
+ * macro to 0 or 1 in the end
+ */
+#define __DECLARE_TRACE(config, name, proto, args) \
+ DECLARE_TRACE_##config(name, PARAMS(proto), PARAMS(args))
+#define __DEFINE_TRACE_FN(config, name, reg, unreg) \
+ DEFINE_TRACE_FN_##config(name, reg, unreg)
+#define __DEFINE_TRACE(config, name) DEFINE_TRACE_##config(name)
+#define __EXPORT_TRACEPOINT_SYMBOL_GPL(config, name) \
+ EXPORT_TRACEPOINT_SYMBOL_GPL_##config(name)
+#define __EXPORT_TRACEPOINT_SYMBOL(config, name) \
+ EXPORT_TRACEPOINT_SYMBOL_##config(name)
+
+#define _DECLARE_TRACE(config, name, proto, args) \
+ __DECLARE_TRACE(config, name, PARAMS(proto), PARAMS(args))
+#define _DEFINE_TRACE_FN(config, name, reg, unreg) \
+ __DEFINE_TRACE_FN(config, name, reg, unreg)
+#define _DEFINE_TRACE(config, name) __DEFINE_TRACE(config, name)
+#define _EXPORT_TRACEPOINT_SYMBOL_GPL(config, name) \
+ __EXPORT_TRACEPOINT_SYMBOL_GPL(config, name)
+#define _EXPORT_TRACEPOINT_SYMBOL(config, name) \
+ __EXPORT_TRACEPOINT_SYMBOL(config, name)
+
+#define DECLARE_TRACE(name, proto, args) \
+ _DECLARE_TRACE(TRACE_CONFIG, name, PARAMS(proto), PARAMS(args))
+#define DEFINE_TRACE_FN(name, reg, unreg) \
+ _DEFINE_TRACE_FN(TRACE_CONFIG, name, reg, unreg)
+#define DEFINE_TRACE(name) _DEFINE_TRACE(TRACE_CONFIG, name)
+#define EXPORT_TRACEPOINT_SYMBOL_GPL(name) \
+ _EXPORT_TRACEPOINT_SYMBOL_GPL(TRACE_CONFIG, name)
+#define EXPORT_TRACEPOINT_SYMBOL(name) \
+ _EXPORT_TRACEPOINT_SYMBOL(TRACE_CONFIG, name)
+
+#ifdef CONFIG_TRACEPOINTS
+
+extern void tracepoint_update_probe_range(struct tracepoint *begin,
+ struct tracepoint *end);
+
+#else /* ! CONFIG_TRACEPOINTS */

static inline void tracepoint_update_probe_range(struct tracepoint *begin,
struct tracepoint *end)
@@ -163,11 +199,35 @@ static inline void tracepoint_synchronize_unregister(void)
synchronize_sched();
}

-#define PARAMS(args...) args
-
#endif /* _LINUX_TRACEPOINT_H */

/*
+ * The two chunks below are out of include file ifdef protection because
+ * we want to be able to define TRACE_CONFIG even before second or even
+ * later include of linux/tracepoint.h.
+ */
+/*
+ * Make tracepoints which are not converted to a new method of enabling
+ * always compiled in
+ */
+#ifndef TRACE_CONFIG
+#define TRACE_CONFIG 1
+#endif
+
+/*
+ * If TRACE_CONFIG is defined but a config option it is defined to isn't, make
+ * the result 0. It would require much less magic if the kernel was not
+ * compiled with -Wundef.
+ */
+#define CONFIG_TEST_1
+#define _CONFIG_UNDEF(x) !defined(CONFIG_TEST_##x)
+#define CONFIG_UNDEF(x) _CONFIG_UNDEF(x)
+#if CONFIG_UNDEF(TRACE_CONFIG)
+#undef TRACE_CONFIG
+#define TRACE_CONFIG 0
+#endif
+
+/*
* Note: we keep the TRACE_EVENT outside the include file ifdef protection.
* This is due to the way trace events work. If a file includes two
* trace event headers under one "CREATE_TRACE_POINTS" the first include

Jan Kara

unread,
Mar 22, 2010, 8:40:02 PM3/22/10
to
Signed-off-by: Jan Kara <ja...@suse.cz>
---
include/trace/events/module.h | 2 ++
kernel/trace/Kconfig | 10 ++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/module.h b/include/trace/events/module.h
index 4b0f48b..edaa505 100644
--- a/include/trace/events/module.h
+++ b/include/trace/events/module.h


@@ -1,5 +1,7 @@
#undef TRACE_SYSTEM
+#undef TRACE_CONFIG

#define TRACE_SYSTEM module
+#define TRACE_CONFIG CONFIG_MODULE_TRACER

#if !defined(_TRACE_MODULE_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_MODULE_H
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index ac63423..a9d7e33 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -411,6 +411,16 @@ config LOCK_TRACER

If unsure, say N

+config MODULE_TRACER
+ bool "Trace module loading and unloading"
+ depends on MODULES


+ select GENERIC_TRACER
+ help

+ Provide trace point for module loading, unloading, freeing,
+ etc.


+
+ If unsure, say N

+
config WORKQUEUE_TRACER
bool "Trace workqueues"
select GENERIC_TRACER

Jan Kara

unread,
Mar 22, 2010, 8:40:03 PM3/22/10
to
CC: Ingo Molnar <mi...@elte.hu>
CC: Peter Zijlstra <pet...@infradead.org>

Signed-off-by: Jan Kara <ja...@suse.cz>
---
include/trace/events/sched.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/sched.h b/include/trace/events/sched.h
index cfceb0b..0a08ab1 100644
--- a/include/trace/events/sched.h
+++ b/include/trace/events/sched.h


@@ -1,5 +1,7 @@
#undef TRACE_SYSTEM
+#undef TRACE_CONFIG

#define TRACE_SYSTEM sched
+#define TRACE_CONFIG CONFIG_CONTEXT_SWITCH_TRACER

#if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_SCHED_H

Jan Kara

unread,
Mar 22, 2010, 8:40:02 PM3/22/10
to
CC: dri-...@lists.sourceforge.net

Signed-off-by: Jan Kara <ja...@suse.cz>
---
drivers/gpu/drm/Kconfig | 9 +++++++++
drivers/gpu/drm/i915/i915_trace.h | 2 ++
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 305c590..bce8013 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -124,6 +124,15 @@ config DRM_I915_KMS
the driver to bind to PCI devices, which precludes loading things
like intelfb.

+config DRM_I915_TRACER
+ bool "Enable tracing of i915 driver"
+ depends on DRM_I915 && EVENT_TRACING
+ help
+ Say Y here to make i915 driver provide trace points in functions
+ handling irqs, dmas, and gem.
+
+ If unsure, say N.
+
endchoice

config DRM_MGA
diff --git a/drivers/gpu/drm/i915/i915_trace.h b/drivers/gpu/drm/i915/i915_trace.h
index 01840d9..fdb59c2 100644
--- a/drivers/gpu/drm/i915/i915_trace.h
+++ b/drivers/gpu/drm/i915/i915_trace.h
@@ -3,6 +3,8 @@

#include <linux/stringify.h>
#include <linux/types.h>
+#undef TRACE_CONFIG
+#define TRACE_CONFIG CONFIG_DRM_I915_TRACER
#include <linux/tracepoint.h>

#include <drm/drmP.h>

Jan Kara

unread,
Mar 22, 2010, 8:40:02 PM3/22/10
to
CC: cluste...@redhat.com

Signed-off-by: Jan Kara <ja...@suse.cz>
---
fs/gfs2/Kconfig | 8 ++++++++
fs/gfs2/trace_gfs2.h | 2 ++
2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/fs/gfs2/Kconfig b/fs/gfs2/Kconfig
index 4dcddf8..872ced2 100644
--- a/fs/gfs2/Kconfig
+++ b/fs/gfs2/Kconfig
@@ -38,3 +38,11 @@ config GFS2_FS_LOCKING_DLM
Most users of GFS2 will require this. It provides the locking
interface between GFS2 and the DLM, which is required to use GFS2
in a cluster environment.
+
+config GFS2_TRACER
+ bool "GFS2 tracing"
+ depends on GFS2_FS && EVENT_TRACING
+ help
+ Provide trace points in block allocation functions, locking, and
+ journaling code.
+
diff --git a/fs/gfs2/trace_gfs2.h b/fs/gfs2/trace_gfs2.h
index 148d55c..5f4faf3 100644
--- a/fs/gfs2/trace_gfs2.h
+++ b/fs/gfs2/trace_gfs2.h


@@ -1,5 +1,7 @@
#undef TRACE_SYSTEM
+#undef TRACE_CONFIG

#define TRACE_SYSTEM gfs2
+#define TRACE_CONFIG CONFIG_GFS2_TRACER

#if !defined(_TRACE_GFS2_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_GFS2_H

Jan Kara

unread,
Mar 22, 2010, 8:40:03 PM3/22/10
to
CC: Peter Zijlstra <pet...@infradead.org>
CC: Ingo Molnar <mi...@redhat.com>

Signed-off-by: Jan Kara <ja...@suse.cz>
---
include/trace/events/lock.h | 2 ++
kernel/trace/Kconfig | 9 +++++++++
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/lock.h b/include/trace/events/lock.h
index 5c1dcfc..a1836e5 100644
--- a/include/trace/events/lock.h
+++ b/include/trace/events/lock.h


@@ -1,5 +1,7 @@
#undef TRACE_SYSTEM
+#undef TRACE_CONFIG

#define TRACE_SYSTEM lock
+#define TRACE_CONFIG CONFIG_LOCK_TRACER

#if !defined(_TRACE_LOCK_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_LOCK_H
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index e696314..ac63423 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -402,6 +402,15 @@ config KMEMTRACE

If unsure, say N.

+config LOCK_TRACER
+ bool "Trace lock operations"
+ depends on LOCKDEP
+ select GENERIC_TRACER
+ help
+ Provide trace points for acquisition and release of locks.
+


+ If unsure, say N
+
config WORKQUEUE_TRACER
bool "Trace workqueues"
select GENERIC_TRACER

Jan Kara

unread,
Mar 22, 2010, 8:40:03 PM3/22/10
to
CC: "David S. Miller" <da...@davemloft.net>
CC: net...@vger.kernel.org

Signed-off-by: Jan Kara <ja...@suse.cz>
---
include/trace/events/skb.h | 2 ++
kernel/trace/Kconfig | 10 ++++++++++
2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/skb.h b/include/trace/events/skb.h
index 4b2be6d..cd340df 100644
--- a/include/trace/events/skb.h
+++ b/include/trace/events/skb.h


@@ -1,5 +1,7 @@
#undef TRACE_SYSTEM
+#undef TRACE_CONFIG

#define TRACE_SYSTEM skb
+#define TRACE_CONFIG CONFIG_SKB_TRACER

#if !defined(_TRACE_SKB_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_SKB_H
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index a48ff49..a02d577 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -498,6 +498,16 @@ config JBD2_TRACER

If unsure, say N.

+config SKB_TRACER
+ bool "SKB tracing"
+ depends on NET


+ select GENERIC_TRACER
+ help

+ Provide tracing for copying datagrams into iovecs and freeing
+ skbs.
+


+ If unsure, say N.
+
config KPROBE_EVENT
depends on KPROBES
depends on HAVE_REGS_AND_STACK_ACCESS_API

Jan Kara

unread,
Mar 22, 2010, 8:40:02 PM3/22/10
to
CC: linux...@vger.kernel.org

Signed-off-by: Jan Kara <ja...@suse.cz>
---
include/trace/events/power.h | 2 ++
kernel/trace/Kconfig | 9 +++++++++
2 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/power.h b/include/trace/events/power.h
index c4efe9b..6d84fc1 100644
--- a/include/trace/events/power.h
+++ b/include/trace/events/power.h


@@ -1,5 +1,7 @@
#undef TRACE_SYSTEM
+#undef TRACE_CONFIG

#define TRACE_SYSTEM power
+#define TRACE_CONFIG CONFIG_POWER_TRACER

#if !defined(_TRACE_POWER_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_POWER_H
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index 787f52e..a48ff49 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -430,6 +430,15 @@ config TIMER_TRACER

If unsure, say N

+config POWER_TRACER
+ bool "Trace power events"


+ select GENERIC_TRACER
+ help

+ Provide trace points for events like changing CPU frequency,
+ turning CPUs on / off.
+


+ If unsure, say N
+
config WORKQUEUE_TRACER
bool "Trace workqueues"
select GENERIC_TRACER

Frederic Weisbecker

unread,
Mar 22, 2010, 9:10:02 PM3/22/10
to
On Tue, Mar 23, 2010 at 01:32:08AM +0100, Jan Kara wrote:
> CC: Ingo Molnar <mi...@elte.hu>
> CC: Peter Zijlstra <pet...@infradead.org>
> Signed-off-by: Jan Kara <ja...@suse.cz>
> ---


Note this one is an exception.
Once tracing is enabled, we need the context switch
tracer anyway to keep track of the pid:cmdline mappings.

Steven Rostedt

unread,
Mar 22, 2010, 9:10:01 PM3/22/10
to
And I thought I was nasty with the CPP macros ;-)

Added Mathieu to the Cc since he's the one that wrote the original
tracepoint code.

This is a really lame comment. There should be almost as much comments
as code when doing CPP trickery like this.

Hmm, We can have tracepoints in a header. Would this still work if a
header with a tracepoint was not converted but it was included in a file
that was. Of course I haven't seen the other patches yet so I don't yet
know what a conversion looks like.

-- Steve

<
> +
> +/*
> + * If TRACE_CONFIG is defined but a config option it is defined to isn't, make
> + * the result 0. It would require much less magic if the kernel was not
> + * compiled with -Wundef.
> + */
> +#define CONFIG_TEST_1
> +#define _CONFIG_UNDEF(x) !defined(CONFIG_TEST_##x)
> +#define CONFIG_UNDEF(x) _CONFIG_UNDEF(x)
> +#if CONFIG_UNDEF(TRACE_CONFIG)
> +#undef TRACE_CONFIG
> +#define TRACE_CONFIG 0
> +#endif
> +
> +/*
> * Note: we keep the TRACE_EVENT outside the include file ifdef protection.
> * This is due to the way trace events work. If a file includes two
> * trace event headers under one "CREATE_TRACE_POINTS" the first include


--

Johannes Berg

unread,
Mar 22, 2010, 9:20:02 PM3/22/10
to
On Tue, 2010-03-23 at 01:32 +0100, Jan Kara wrote:
> CC: linux-w...@vger.kernel.org
> Signed-off-by: Jan Kara <ja...@suse.cz>

You kinda missed something there, this patch doesn't explain to me why
and it's all I ever got to see :)

johannes

Chris Wilson

unread,
Mar 23, 2010, 4:50:02 AM3/23/10
to
Out of curiosity what motivated this patch? When adding the tracepoints,
I found the overhead of compiling in but not enabling them to be
insignificant, i.e. nearly unmeasurable in throughput benchmarks, so
didn't believe it warranted a config option. Especially one that advises
people to turn off what may be a useful aid in desktop systems.

Also is TRACER the right name, that would seem to confuse the option with
a standalone tracer as opposed to simply enabling tracepoints.
-ickle

--
Chris Wilson, Intel Open Source Technology Centre

Steven Whitehouse

unread,
Mar 23, 2010, 8:00:01 AM3/23/10
to
Hi,

Now in the GFS2 -nmw git tree. Thanks,

Steve.

On Tue, 2010-03-23 at 01:32 +0100, Jan Kara wrote:


--

Steven Rostedt

unread,
Mar 23, 2010, 8:00:02 PM3/23/10
to
On Mon, 2010-03-22 at 18:11 -0700, Johannes Berg wrote:
> On Tue, 2010-03-23 at 01:32 +0100, Jan Kara wrote:
> > CC: linux-w...@vger.kernel.org
> > Signed-off-by: Jan Kara <ja...@suse.cz>
>
> You kinda missed something there, this patch doesn't explain to me why
> and it's all I ever got to see :)

This patch set is about fine grained tuning of what tracepoints get
enabled and which don't. I honestly think that this should only be
permitted if CONFIG_EMBEDDED is set (if it should be permitted at all).

I would much rather find a way to lower the tracepoint footprint than to
pick and choose what tracepoints get enabled.

-- Steve

Steven Rostedt

unread,
Mar 23, 2010, 8:00:03 PM3/23/10
to
On Tue, 2010-03-23 at 02:07 +0100, Frederic Weisbecker wrote:
> On Tue, Mar 23, 2010 at 01:32:08AM +0100, Jan Kara wrote:
> > CC: Ingo Molnar <mi...@elte.hu>
> > CC: Peter Zijlstra <pet...@infradead.org>
> > Signed-off-by: Jan Kara <ja...@suse.cz>
> > ---
>
>
> Note this one is an exception.
> Once tracing is enabled, we need the context switch
> tracer anyway to keep track of the pid:cmdline mappings.
>
>

Yes, the scheduling tracepoints are needed by several tracers. This must
be enabled by all.

But then again, I'm thinking it would be nicer to find a way to lower
the impact than just turning them off.

Perhaps only allow the individual disabling if CONFIG_EMBEDDED is set.

-- Steve

Steven Rostedt

unread,
Mar 23, 2010, 8:00:03 PM3/23/10
to
On Tue, 2010-03-23 at 12:01 +0000, Steven Whitehouse wrote:
> Hi,
>
> Now in the GFS2 -nmw git tree. Thanks,
>

Note, this depends on patch 1 which we have not yet determined if it
should be applied or not.

-- Steve

Frederic Weisbecker

unread,
Mar 23, 2010, 8:40:02 PM3/23/10
to
On Tue, Mar 23, 2010 at 07:52:01PM -0400, Steven Rostedt wrote:
> On Tue, 2010-03-23 at 02:07 +0100, Frederic Weisbecker wrote:
> > On Tue, Mar 23, 2010 at 01:32:08AM +0100, Jan Kara wrote:
> > > CC: Ingo Molnar <mi...@elte.hu>
> > > CC: Peter Zijlstra <pet...@infradead.org>
> > > Signed-off-by: Jan Kara <ja...@suse.cz>
> > > ---
> >
> >
> > Note this one is an exception.
> > Once tracing is enabled, we need the context switch
> > tracer anyway to keep track of the pid:cmdline mappings.
> >
> >
>
> Yes, the scheduling tracepoints are needed by several tracers. This must
> be enabled by all.
>
> But then again, I'm thinking it would be nicer to find a way to lower
> the impact than just turning them off.
>
> Perhaps only allow the individual disabling if CONFIG_EMBEDDED is set.


Yeah agreed!

Steven Whitehouse

unread,
Mar 24, 2010, 7:20:02 AM3/24/10
to
Hi,

On Tue, 2010-03-23 at 19:56 -0400, Steven Rostedt wrote:
> On Tue, 2010-03-23 at 12:01 +0000, Steven Whitehouse wrote:
> > Hi,
> >
> > Now in the GFS2 -nmw git tree. Thanks,
> >
>
> Note, this depends on patch 1 which we have not yet determined if it
> should be applied or not.
>
> -- Steve
>

Sorry, I think I misread the initial message. I can roll it out again if
required. I did a compile test in both states though and it seemed to
work for me,

Steve.

Steven Rostedt

unread,
Mar 24, 2010, 10:30:02 AM3/24/10
to
On Wed, 2010-03-24 at 11:20 +0000, Steven Whitehouse wrote:
> Hi,
>
> On Tue, 2010-03-23 at 19:56 -0400, Steven Rostedt wrote:
> > On Tue, 2010-03-23 at 12:01 +0000, Steven Whitehouse wrote:
> > > Hi,
> > >
> > > Now in the GFS2 -nmw git tree. Thanks,
> > >
> >
> > Note, this depends on patch 1 which we have not yet determined if it
> > should be applied or not.
> >
> > -- Steve
> >
> Sorry, I think I misread the initial message. I can roll it out again if
> required. I did a compile test in both states though and it seemed to
> work for me,
>

No problem, I'm just saying I believe without the first patch, this is a
nop. That is, both states have the same result. The trace events stay
in.

-- Steve

Jan Kara

unread,
Mar 25, 2010, 9:40:01 PM3/25/10
to
On Mon 22-03-10 21:06:49, Steven Rostedt wrote:
> And I thought I was nasty with the CPP macros ;-)
Yeah, this is the darkest magic I've ever conceived with CPP ;)

...


> > -#define DEFINE_TRACE_FN(name, reg, unreg)
> > -#define DEFINE_TRACE(name)
> > -#define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
> > -#define EXPORT_TRACEPOINT_SYMBOL(name)
> > +#define DEFINE_TRACE_FN_0(name, reg, unreg)
> > +#define DEFINE_TRACE_0(name)
> > +#define EXPORT_TRACEPOINT_SYMBOL_GPL_0(name)
> > +#define EXPORT_TRACEPOINT_SYMBOL_0(name)
> > +
> > +/*
> > + * Below two-level macro magic is really needed to propely expand TRACE_CONFIG
> > + * macro to 0 or 1 in the end
>
> This is a really lame comment. There should be almost as much comments
> as code when doing CPP trickery like this.

OK, I'll expand it with a bit of CPP theory about argument expansion.

...


> > /*
> > + * The two chunks below are out of include file ifdef protection because
> > + * we want to be able to define TRACE_CONFIG even before second or even
> > + * later include of linux/tracepoint.h.
> > + */
> > +/*
> > + * Make tracepoints which are not converted to a new method of enabling
> > + * always compiled in
> > + */
> > +#ifndef TRACE_CONFIG
> > +#define TRACE_CONFIG 1
> > +#endif
>
> Hmm, We can have tracepoints in a header. Would this still work if a
> header with a tracepoint was not converted but it was included in a file
> that was. Of course I haven't seen the other patches yet so I don't yet
> know what a conversion looks like.

Well, if TRACE_CONFIG is not defined while the header is included,
everything is fine. If TRACE_CONFIG would be defined, then it means that
TRACE_SYSTEM is defined as well (I tried to define them at the same place)
and thus either tracepoints belong to the same system - again fine - or
they belong to a different system. But then the header would redefine
TRACE_SYSTEM which would subsequently break the file which included the
header. So what I do should work, unless TRACE_SYSTEM is already broken...
Maybe I can expand the reasoning in the comment.

Honza
--
Jan Kara <ja...@suse.cz>
SUSE Labs, CR

0 new messages