Skip to contentSkip to conversation

x86-2.6.27: Port I-pipe tracer over ftrace

PATCH New Jan Kiszka 1 participant 1 message Dec 16, 2008

Subsystems (3)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 x86-2.6.27: Port I-pipe tracer over ftrace

This is a port of the I-pipe trace over 2.6.27's new ftrace infrastructure. It basically off-loads us from maintaining the mcount stubs. But it also adds some small additional overhead when enabled, and you should know that playing with /proc/sys/kernel/ftrace_enabled while using the I-pipe trace may disable the function trace points. Besides that, all seems to be fine again, ready to be used.

The patch also contains a bunch of tracer-related cleanups, so the patch actually shrinks.

---
 Makefile                        |    4 --
 arch/x86/kernel/Makefile        |    1 
 arch/x86/kernel/cpu/common_64.c |    4 +-
 arch/x86/kernel/head64.c        |    2 -
 arch/x86/kernel/ipipe.c         |    5 --
 arch/x86/kernel/mcount_32.S     |   27 ---------------
 arch/x86/kernel/mcount_64.S     |   41 -----------------------
 arch/x86/kernel/smpboot.c       |    2 -
 include/linux/linkage.h         |    4 --
 kernel/ipipe/Kconfig.debug      |    6 ---
 kernel/ipipe/tracer.c           |   69 +++++++++++++++++++++++++++++++++++++---
 kernel/trace/Kconfig            |    1 
 12 files changed, 71 insertions(+), 95 deletions(-)
Makefile +0 -4
Index: b/Makefile
===================================================================
@@ -525,10 +525,6 @@ endif
 # Arch Makefiles may override this setting
 KBUILD_CFLAGS += $(call cc-option, -fno-stack-protector)
 
-ifdef CONFIG_IPIPE_TRACE_MCOUNT
-KBUILD_CFLAGS	+= -pg
-endif
-
 ifdef CONFIG_FRAME_POINTER
 KBUILD_CFLAGS	+= -fno-omit-frame-pointer -fno-optimize-sibling-calls
 else
arch/x86/kernel/Makefile +0 -1
Index: b/arch/x86/kernel/Makefile
===================================================================
@@ -79,7 +79,6 @@ obj-$(CONFIG_KGDB)		+= kgdb.o
 obj-$(CONFIG_VM86)		+= vm86_32.o
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 obj-$(CONFIG_IPIPE)		+= ipipe.o
-obj-$(CONFIG_IPIPE_TRACE_MCOUNT)	+= mcount_$(BITS).o
 
 obj-$(CONFIG_HPET_TIMER) 	+= hpet.o
 
arch/x86/kernel/ipipe.c +0 -5
Index: b/arch/x86/kernel/ipipe.c
===================================================================
@@ -1009,8 +1009,3 @@ EXPORT_PER_CPU_SYMBOL_GPL(cpu_tlbstate);
 #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
 EXPORT_SYMBOL(tasklist_lock);
 #endif /* CONFIG_SMP || CONFIG_DEBUG_SPINLOCK */
-
-#ifdef CONFIG_IPIPE_TRACE_MCOUNT
-void notrace mcount(void);
-EXPORT_SYMBOL(mcount);
-#endif /* CONFIG_IPIPE_TRACE_MCOUNT */
arch/x86/kernel/mcount_32.S deleted +0 -27
Index: b/arch/x86/kernel/mcount_32.S
===================================================================
@@ -1,27 +0,0 @@
-/*
- *  linux/arch/x86/mcount_32.S
- *
- *  Copyright (C) 2005, 2007 Jan Kiszka
- */
-
-.globl mcount
-mcount:
-	cmpl $0,ipipe_trace_enable
-	je out
-
-	pushl %eax
-	pushl %ecx
-	pushl %edx
-
-	pushl $0		# no additional value (v)
-	movl 4(%ebp),%ecx	# __CALLER_ADDR1
-	movl 16(%esp),%edx	# __CALLER_ADDR0
-	movl $0,%eax		# IPIPE_TRACE_FUNC
-	call __ipipe_trace
-	popl %eax
-
-	popl %edx
-	popl %ecx
-	popl %eax
-out:
-	ret
arch/x86/kernel/mcount_64.S deleted +0 -41

41 lines not on this page · raw message

kernel/ipipe/Kconfig.debug +1 -5
Index: b/kernel/ipipe/Kconfig.debug
===================================================================
@@ -39,6 +39,7 @@ config IPIPE_TRACE_ENABLE
 config IPIPE_TRACE_MCOUNT
 	bool "Instrument function entries"
 	default y
+	select FTRACE
 	---help---
 	  When enabled, records every kernel function entry in the tracer
 	  log. While this slows down the system noticeably, it provides
@@ -80,9 +81,4 @@ config IPIPE_TRACE_PANIC
 	  as well as ordinary kernel oopses. You can control the number
 	  of printed back trace points via /proc/ipipe/trace.
 
-config IPIPE_TRACE_ENABLE_VALUE
-	int
-	default 0 if !IPIPE_TRACE_ENABLE
-	default 1 if IPIPE_TRACE_ENABLE
-
 endif
kernel/ipipe/tracer.c +65 -4

105 lines not on this page · raw message

kernel/trace/Kconfig +1 -0
Index: b/kernel/trace/Kconfig
===================================================================
@@ -107,6 +107,7 @@ config DYNAMIC_FTRACE
 	depends on BROKEN
 	depends on FTRACE
 	depends on HAVE_DYNAMIC_FTRACE
+	depends on !IPIPE_TRACE_MCOUNT
 	default y
 	help
          This option will modify all the calls to ftrace dynamically
arch/x86/kernel/cpu/common_64.c +2 -2
Index: b/arch/x86/kernel/cpu/common_64.c
===================================================================
@@ -506,7 +506,7 @@ static int __init nonx32_setup(char *str
 }
 __setup("noexec32=", nonx32_setup);
 
-notrace void pda_init(int cpu)
+void pda_init(int cpu)
 {
 	struct x8664_pda *pda = cpu_pda(cpu);
 
@@ -595,7 +595,7 @@ DEFINE_PER_CPU(struct orig_ist, orig_ist
  * 'CPU state barrier', nothing should get across.
  * A lot of state is already set up in PDA init.
  */
-notrace void __cpuinit cpu_init(void)
+void __cpuinit cpu_init(void)
 {
 	int cpu = stack_smp_processor_id();
 	struct tss_struct *t = &per_cpu(init_tss, cpu);
arch/x86/kernel/head64.c +1 -1
Index: b/arch/x86/kernel/head64.c
===================================================================
@@ -72,7 +72,7 @@ static void __init copy_bootdata(char *r
 	}
 }
 
-void __init notrace x86_64_start_kernel(char * real_mode_data)
+void __init x86_64_start_kernel(char * real_mode_data)
 {
 	int i;
 
arch/x86/kernel/smpboot.c +1 -1
Index: b/arch/x86/kernel/smpboot.c
===================================================================
@@ -282,7 +282,7 @@ static void __cpuinit smp_callin(void)
 /*
  * Activate a secondary processor.
  */
-static void notrace __cpuinit start_secondary(void *unused)
+static void __cpuinit start_secondary(void *unused)
 {
 	/*
 	 * Don't put *anything* before cpu_init(), SMP booting is too
include/linux/linkage.h +0 -4
Index: b/include/linux/linkage.h
===================================================================
@@ -95,8 +95,4 @@
 #define ATTRIB_NORET  __attribute__((noreturn))
 #define NORET_AND     noreturn,
 
-#ifndef notrace
-#define notrace		__attribute__((no_instrument_function))
-#endif
-
 #endif
Signature · 2 lines
Siemens AG, Corporate Technology, CT SE 26
Corporate Competence Center Embedded Linux