[PATCH 02/20 -v5] Add basic support for gcc profiler instrumentation

Previous thread: [PATCH 20/20 -v5] trace preempt off critical timings by Steven Rostedt on Wednesday, January 23, 2008 - 12:02 pm. (1 message)

Next thread: [PATCH 15/20 -v5] Generic command line storage by Steven Rostedt on Wednesday, January 23, 2008 - 12:02 pm. (1 message)
To: LKML <linux-kernel@...>
Cc: Ingo Molnar <mingo@...>, Linus Torvalds <torvalds@...>, Andrew Morton <akpm@...>, Peter Zijlstra <a.p.zijlstra@...>, Christoph Hellwig <hch@...>, Mathieu Desnoyers <mathieu.desnoyers@...>, Gregory Haskins <ghaskins@...>, Arnaldo Carvalho de Melo <acme@...>, Thomas Gleixner <tglx@...>, Tim Bird <tim.bird@...>, Sam Ravnborg <sam@...>, Frank Ch. Eigler <fche@...>, Jan Kiszka <jan.kiszka@...>, John Stultz <johnstul@...>, Arjan van de Ven <arjan@...>, Steven Rostedt <srostedt@...>
Date: Wednesday, January 23, 2008 - 12:02 pm

If CONFIG_MCOUNT is selected and /proc/sys/kernel/mcount_enabled is set to a
non-zero value the mcount routine will be called everytime we enter a kernel
function that is not marked with the "notrace" attribute.

The mcount routine will then call a registered function if a function
happens to be registered.

[This code has been highly hacked by Steven Rostedt, so don't
blame Arnaldo for all of this ;-) ]

Update:
It is now possible to register more than one mcount function.
If only one mcount function is registered, that will be the
function that mcount calls directly. If more than one function
is registered, then mcount will call a function that will loop
through the functions to call.

Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
Makefile | 3
arch/x86/Kconfig | 1
arch/x86/kernel/entry_32.S | 25 +++++++
arch/x86/kernel/entry_64.S | 36 +++++++++++
include/linux/linkage.h | 2
include/linux/mcount.h | 38 ++++++++++++
kernel/sysctl.c | 11 +++
lib/Kconfig.debug | 2
lib/Makefile | 2
lib/tracing/Kconfig | 10 +++
lib/tracing/Makefile | 3
lib/tracing/mcount.c | 141 +++++++++++++++++++++++++++++++++++++++++++++
12 files changed, 274 insertions(+)

Index: linux-mcount.git/Makefile
===================================================================
--- linux-mcount.git.orig/Makefile 2008-01-23 10:26:31.000000000 -0500
+++ linux-mcount.git/Makefile 2008-01-23 10:26:34.000000000 -0500
@@ -509,6 +509,9 @@ endif

include $(srctree)/arch/$(SRCARCH)/Makefile

+ifdef CONFIG_MCOUNT
+KBUILD_CFLAGS += -pg
+endif
ifdef CONFIG_FRAME_POINTER
KBUILD_CFLAGS += -fno-omit-frame-pointer -fno-optimize-sibling-calls
else
Index: linux-mcount.git/arch/x86/Kconfig
===================================================================
--- linux-mcount.git.orig/arc...

Previous thread: [PATCH 20/20 -v5] trace preempt off critical timings by Steven Rostedt on Wednesday, January 23, 2008 - 12:02 pm. (1 message)

Next thread: [PATCH 15/20 -v5] Generic command line storage by Steven Rostedt on Wednesday, January 23, 2008 - 12:02 pm. (1 message)