linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] ARM: ensure sched_clock() and children are notrace
@ 2010-11-06 18:25 Rabin Vincent
  2010-11-06 18:25 ` [PATCH 2/6] ARM: place C irq handlers in IRQ_ENTRY for ftrace Rabin Vincent
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Rabin Vincent @ 2010-11-06 18:25 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Steven Rostedt, Frederic Weisbecker, Tim Bird, linux-kernel,
	Rabin Vincent

Include sched.h in the files implementing sched_clock() and ensure that
any functions called from sched_clock() have the notrace annotation.

Signed-off-by: Rabin Vincent <rabin@rab.in>
---
 arch/arm/mach-tegra/timer.c           |    3 ++-
 arch/arm/mach-u300/timer.c            |    1 +
 arch/arm/plat-iop/time.c              |    3 ++-
 arch/arm/plat-nomadik/timer.c         |    5 +++--
 arch/arm/plat-omap/counter_32k.c      |   11 ++++++-----
 arch/arm/plat-versatile/sched-clock.c |    1 +
 6 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
index 9057d6f..88ed925 100644
--- a/arch/arm/mach-tegra/timer.c
+++ b/arch/arm/mach-tegra/timer.c
@@ -21,6 +21,7 @@
 #include <linux/time.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
+#include <linux/sched.h>
 #include <linux/clockchips.h>
 #include <linux/clocksource.h>
 #include <linux/clk.h>
@@ -89,7 +90,7 @@ static void tegra_timer_set_mode(enum clock_event_mode mode,
 	}
 }
 
-static cycle_t tegra_clocksource_read(struct clocksource *cs)
+static cycle_t notrace tegra_clocksource_read(struct clocksource *cs)
 {
 	return cnt32_to_63(timer_readl(TIMERUS_CNTR_1US));
 }
diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
index 3fc4472..672b28a 100644
--- a/arch/arm/mach-u300/timer.c
+++ b/arch/arm/mach-u300/timer.c
@@ -11,6 +11,7 @@
 #include <linux/interrupt.h>
 #include <linux/time.h>
 #include <linux/timex.h>
+#include <linux/sched.h>
 #include <linux/clockchips.h>
 #include <linux/clocksource.h>
 #include <linux/types.h>
diff --git a/arch/arm/plat-iop/time.c b/arch/arm/plat-iop/time.c
index 85d3e55..558cdfa 100644
--- a/arch/arm/plat-iop/time.c
+++ b/arch/arm/plat-iop/time.c
@@ -18,6 +18,7 @@
 #include <linux/time.h>
 #include <linux/init.h>
 #include <linux/timex.h>
+#include <linux/sched.h>
 #include <linux/io.h>
 #include <linux/clocksource.h>
 #include <linux/clockchips.h>
@@ -36,7 +37,7 @@
 /*
  * IOP clocksource (free-running timer 1).
  */
-static cycle_t iop_clocksource_read(struct clocksource *unused)
+static cycle_t notrace iop_clocksource_read(struct clocksource *unused)
 {
 	return 0xffffffffu - read_tcr1();
 }
diff --git a/arch/arm/plat-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c
index aedf9c1..70969a7 100644
--- a/arch/arm/plat-nomadik/timer.c
+++ b/arch/arm/plat-nomadik/timer.c
@@ -11,6 +11,7 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
+#include <linux/sched.h>
 #include <linux/io.h>
 #include <linux/clockchips.h>
 #include <linux/clk.h>
@@ -26,13 +27,13 @@ void __iomem *mtu_base; /* ssigned by machine code */
  * Kernel assumes that sched_clock can be called early
  * but the MTU may not yet be initialized.
  */
-static cycle_t nmdk_read_timer_dummy(struct clocksource *cs)
+static cycle_t notrace nmdk_read_timer_dummy(struct clocksource *cs)
 {
 	return 0;
 }
 
 /* clocksource: MTU decrements, so we negate the value being read. */
-static cycle_t nmdk_read_timer(struct clocksource *cs)
+static cycle_t notrace nmdk_read_timer(struct clocksource *cs)
 {
 	return -readl(mtu_base + MTU_VAL(0));
 }
diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
index 155fe43..bc9bc6c 100644
--- a/arch/arm/plat-omap/counter_32k.c
+++ b/arch/arm/plat-omap/counter_32k.c
@@ -13,6 +13,7 @@
  * NOTE: This timer is not the same timer as the old OMAP1 MPU timer.
  */
 #include <linux/kernel.h>
+#include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/clk.h>
 #include <linux/io.h>
@@ -44,7 +45,7 @@
 static u32 offset_32k __read_mostly;
 
 #ifdef CONFIG_ARCH_OMAP16XX
-static cycle_t omap16xx_32k_read(struct clocksource *cs)
+static cycle_t notrace omap16xx_32k_read(struct clocksource *cs)
 {
 	return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
 }
@@ -53,7 +54,7 @@ static cycle_t omap16xx_32k_read(struct clocksource *cs)
 #endif
 
 #ifdef CONFIG_ARCH_OMAP2420
-static cycle_t omap2420_32k_read(struct clocksource *cs)
+static cycle_t notrace omap2420_32k_read(struct clocksource *cs)
 {
 	return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
 }
@@ -62,7 +63,7 @@ static cycle_t omap2420_32k_read(struct clocksource *cs)
 #endif
 
 #ifdef CONFIG_ARCH_OMAP2430
-static cycle_t omap2430_32k_read(struct clocksource *cs)
+static cycle_t notrace omap2430_32k_read(struct clocksource *cs)
 {
 	return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
 }
@@ -71,7 +72,7 @@ static cycle_t omap2430_32k_read(struct clocksource *cs)
 #endif
 
 #ifdef CONFIG_ARCH_OMAP3
-static cycle_t omap34xx_32k_read(struct clocksource *cs)
+static cycle_t notrace omap34xx_32k_read(struct clocksource *cs)
 {
 	return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
 }
@@ -80,7 +81,7 @@ static cycle_t omap34xx_32k_read(struct clocksource *cs)
 #endif
 
 #ifdef CONFIG_ARCH_OMAP4
-static cycle_t omap44xx_32k_read(struct clocksource *cs)
+static cycle_t notrace omap44xx_32k_read(struct clocksource *cs)
 {
 	return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
 }
diff --git a/arch/arm/plat-versatile/sched-clock.c b/arch/arm/plat-versatile/sched-clock.c
index 9768cf7..9696ddc 100644
--- a/arch/arm/plat-versatile/sched-clock.c
+++ b/arch/arm/plat-versatile/sched-clock.c
@@ -20,6 +20,7 @@
  */
 #include <linux/cnt32_to_63.h>
 #include <linux/io.h>
+#include <linux/sched.h>
 #include <asm/div64.h>
 
 #include <mach/hardware.h>
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/6] ARM: place C irq handlers in IRQ_ENTRY for ftrace
  2010-11-06 18:25 [PATCH 1/6] ARM: ensure sched_clock() and children are notrace Rabin Vincent
@ 2010-11-06 18:25 ` Rabin Vincent
  2010-11-06 18:25 ` [PATCH 3/6] ARM: ftrace: use gas macros to avoid code duplication Rabin Vincent
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Rabin Vincent @ 2010-11-06 18:25 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Steven Rostedt, Frederic Weisbecker, Tim Bird, linux-kernel,
	Rabin Vincent

When FUNCTION_GRAPH_TRACER is enabled, place do_IRQ() and friends in the
IRQ_ENTRY section so that the irq-related features of the function graph
tracer work.

Signed-off-by: Rabin Vincent <rabin@rab.in>
---
 arch/arm/include/asm/system.h |    5 +++++
 arch/arm/include/asm/traps.h  |   23 +++++++++++++++++++++--
 arch/arm/kernel/irq.c         |    4 +++-
 arch/arm/kernel/smp.c         |    5 +++--
 arch/arm/kernel/vmlinux.lds.S |    1 +
 5 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 1120f18..ec4327a 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -63,6 +63,11 @@
 #include <asm/outercache.h>
 
 #define __exception	__attribute__((section(".exception.text")))
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+#define __exception_irq_entry	__irq_entry
+#else
+#define __exception_irq_entry	__exception
+#endif
 
 struct thread_info;
 struct task_struct;
diff --git a/arch/arm/include/asm/traps.h b/arch/arm/include/asm/traps.h
index af5d5d1..1b960d5 100644
--- a/arch/arm/include/asm/traps.h
+++ b/arch/arm/include/asm/traps.h
@@ -15,13 +15,32 @@ struct undef_hook {
 void register_undef_hook(struct undef_hook *hook);
 void unregister_undef_hook(struct undef_hook *hook);
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+static inline int __in_irqentry_text(unsigned long ptr)
+{
+	extern char __irqentry_text_start[];
+	extern char __irqentry_text_end[];
+
+	return ptr >= (unsigned long)&__irqentry_text_start &&
+	       ptr < (unsigned long)&__irqentry_text_end;
+}
+#else
+static inline int __in_irqentry_text(unsigned long ptr)
+{
+	return 0;
+}
+#endif
+
 static inline int in_exception_text(unsigned long ptr)
 {
 	extern char __exception_text_start[];
 	extern char __exception_text_end[];
+	int in;
+
+	in = ptr >= (unsigned long)&__exception_text_start &&
+	     ptr < (unsigned long)&__exception_text_end;
 
-	return ptr >= (unsigned long)&__exception_text_start &&
-	       ptr < (unsigned long)&__exception_text_end;
+	return in ? : __in_irqentry_text(ptr);
 }
 
 extern void __init early_trap_init(void);
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 36ad3be..6d61633 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -35,6 +35,7 @@
 #include <linux/list.h>
 #include <linux/kallsyms.h>
 #include <linux/proc_fs.h>
+#include <linux/ftrace.h>
 
 #include <asm/system.h>
 #include <asm/mach/irq.h>
@@ -105,7 +106,8 @@ unlock:
  * come via this function.  Instead, they should provide their
  * own 'handler'
  */
-asmlinkage void __exception asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
+asmlinkage void __exception_irq_entry
+asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
 {
 	struct pt_regs *old_regs = set_irq_regs(regs);
 
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 8c19595..bbca898 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -16,6 +16,7 @@
 #include <linux/cache.h>
 #include <linux/profile.h>
 #include <linux/errno.h>
+#include <linux/ftrace.h>
 #include <linux/mm.h>
 #include <linux/err.h>
 #include <linux/cpu.h>
@@ -457,7 +458,7 @@ static void ipi_timer(void)
 }
 
 #ifdef CONFIG_LOCAL_TIMERS
-asmlinkage void __exception do_local_timer(struct pt_regs *regs)
+asmlinkage void __exception_irq_entry do_local_timer(struct pt_regs *regs)
 {
 	struct pt_regs *old_regs = set_irq_regs(regs);
 	int cpu = smp_processor_id();
@@ -544,7 +545,7 @@ static void ipi_cpu_stop(unsigned int cpu)
  *
  *  Bit 0 - Inter-processor function call
  */
-asmlinkage void __exception do_IPI(struct pt_regs *regs)
+asmlinkage void __exception_irq_entry do_IPI(struct pt_regs *regs)
 {
 	unsigned int cpu = smp_processor_id();
 	struct ipi_data *ipi = &per_cpu(ipi_data, cpu);
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index cead889..897c1a8 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -101,6 +101,7 @@ SECTIONS
 			__exception_text_start = .;
 			*(.exception.text)
 			__exception_text_end = .;
+			IRQENTRY_TEXT
 			TEXT_TEXT
 			SCHED_TEXT
 			LOCK_TEXT
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/6] ARM: ftrace: use gas macros to avoid code duplication
  2010-11-06 18:25 [PATCH 1/6] ARM: ensure sched_clock() and children are notrace Rabin Vincent
  2010-11-06 18:25 ` [PATCH 2/6] ARM: place C irq handlers in IRQ_ENTRY for ftrace Rabin Vincent
@ 2010-11-06 18:25 ` Rabin Vincent
  2010-11-06 18:25 ` [PATCH 4/6] ARM: ftrace: function graph tracer support Rabin Vincent
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Rabin Vincent @ 2010-11-06 18:25 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Steven Rostedt, Frederic Weisbecker, Tim Bird, linux-kernel,
	Rabin Vincent

Use assembler macros to avoid copy/pasting code between the
implementations of the two variants of the mcount call.

Signed-off-by: Rabin Vincent <rabin@rab.in>
---
 arch/arm/kernel/entry-common.S |  146 ++++++++++++++++++++++------------------
 1 files changed, 80 insertions(+), 66 deletions(-)

diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 8bfa987..fe1d586 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -141,98 +141,112 @@ ENDPROC(ret_from_fork)
 #endif
 #endif
 
-#ifdef CONFIG_DYNAMIC_FTRACE
-ENTRY(__gnu_mcount_nc)
-	mov	ip, lr
-	ldmia	sp!, {lr}
-	mov	pc, ip
-ENDPROC(__gnu_mcount_nc)
+.macro __mcount suffix
+	mcount_enter
+	ldr	r0, =ftrace_trace_function
+	ldr	r2, [r0]
+	adr	r0, .Lftrace_stub
+	cmp	r0, r2
+	bne	1f
+	mcount_exit
 
-ENTRY(ftrace_caller)
-	stmdb	sp!, {r0-r3, lr}
-	mov	r0, lr
+1: 	mcount_get_lr	r1			@ lr of instrumented func
+	mov	r0, lr				@ instrumented function
+	sub	r0, r0, #MCOUNT_INSN_SIZE
+	adr	lr, BSYM(2f)
+	mov	pc, r2
+2:	mcount_exit
+.endm
+
+.macro __ftrace_caller suffix
+	mcount_enter
+
+	mcount_get_lr	r1			@ lr of instrumented func
+	mov	r0, lr				@ instrumented function
 	sub	r0, r0, #MCOUNT_INSN_SIZE
-	ldr	r1, [sp, #20]
 
-	.global	ftrace_call
-ftrace_call:
+	.globl ftrace_call\suffix
+ftrace_call\suffix:
 	bl	ftrace_stub
-	ldmia	sp!, {r0-r3, ip, lr}
-	mov	pc, ip
-ENDPROC(ftrace_caller)
+
+	mcount_exit
+.endm
 
 #ifdef CONFIG_OLD_MCOUNT
+/*
+ * mcount
+ */
+
+.macro mcount_enter
+	stmdb	sp!, {r0-r3, lr}
+.endm
+
+.macro mcount_get_lr reg
+	ldr	\reg, [fp, #-4]
+.endm
+
+.macro mcount_exit
+	ldr	lr, [fp, #-4]
+	ldmia	sp!, {r0-r3, pc}
+.endm
+
 ENTRY(mcount)
+#ifdef CONFIG_DYNAMIC_FTRACE
 	stmdb	sp!, {lr}
 	ldr	lr, [fp, #-4]
 	ldmia	sp!, {pc}
+#else
+	__mcount _old
+#endif
 ENDPROC(mcount)
 
+#ifdef CONFIG_DYNAMIC_FTRACE
 ENTRY(ftrace_caller_old)
-	stmdb	sp!, {r0-r3, lr}
-	ldr	r1, [fp, #-4]
-	mov	r0, lr
-	sub	r0, r0, #MCOUNT_INSN_SIZE
-
-	.globl ftrace_call_old
-ftrace_call_old:
-	bl	ftrace_stub
-	ldr	lr, [fp, #-4]			@ restore lr
-	ldmia	sp!, {r0-r3, pc}
+	__ftrace_caller _old
 ENDPROC(ftrace_caller_old)
 #endif
 
-#else
+.purgem mcount_enter
+.purgem mcount_get_lr
+.purgem mcount_exit
+#endif
 
-ENTRY(__gnu_mcount_nc)
+/*
+ * __gnu_mcount_nc
+ */
+
+.macro mcount_enter
 	stmdb	sp!, {r0-r3, lr}
-	ldr	r0, =ftrace_trace_function
-	ldr	r2, [r0]
-	adr	r0, .Lftrace_stub
-	cmp	r0, r2
-	bne	gnu_trace
+.endm
+
+.macro mcount_get_lr reg
+	ldr	\reg, [sp, #20]
+.endm
+
+.macro mcount_exit
 	ldmia	sp!, {r0-r3, ip, lr}
 	mov	pc, ip
+.endm
 
-gnu_trace:
-	ldr	r1, [sp, #20]			@ lr of instrumented routine
-	mov	r0, lr
-	sub	r0, r0, #MCOUNT_INSN_SIZE
-	adr	lr, BSYM(1f)
-	mov	pc, r2
-1:
-	ldmia	sp!, {r0-r3, ip, lr}
+ENTRY(__gnu_mcount_nc)
+#ifdef CONFIG_DYNAMIC_FTRACE
+	mov	ip, lr
+	ldmia	sp!, {lr}
 	mov	pc, ip
+#else
+	__mcount
+#endif
 ENDPROC(__gnu_mcount_nc)
 
-#ifdef CONFIG_OLD_MCOUNT
-/*
- * This is under an ifdef in order to force link-time errors for people trying
- * to build with !FRAME_POINTER with a GCC which doesn't use the new-style
- * mcount.
- */
-ENTRY(mcount)
-	stmdb	sp!, {r0-r3, lr}
-	ldr	r0, =ftrace_trace_function
-	ldr	r2, [r0]
-	adr	r0, ftrace_stub
-	cmp	r0, r2
-	bne	trace
-	ldr	lr, [fp, #-4]			@ restore lr
-	ldmia	sp!, {r0-r3, pc}
-
-trace:
-	ldr	r1, [fp, #-4]			@ lr of instrumented routine
-	mov	r0, lr
-	sub	r0, r0, #MCOUNT_INSN_SIZE
-	mov	lr, pc
-	mov	pc, r2
-	ldr	lr, [fp, #-4]			@ restore lr
-	ldmia	sp!, {r0-r3, pc}
-ENDPROC(mcount)
+#ifdef CONFIG_DYNAMIC_FTRACE
+ENTRY(ftrace_caller)
+	__ftrace_caller
+ENDPROC(ftrace_caller)
 #endif
 
-#endif /* CONFIG_DYNAMIC_FTRACE */
+.purgem mcount_enter
+.purgem mcount_get_lr
+.purgem mcount_exit
 
 ENTRY(ftrace_stub)
 .Lftrace_stub:
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/6] ARM: ftrace: function graph tracer support
  2010-11-06 18:25 [PATCH 1/6] ARM: ensure sched_clock() and children are notrace Rabin Vincent
  2010-11-06 18:25 ` [PATCH 2/6] ARM: place C irq handlers in IRQ_ENTRY for ftrace Rabin Vincent
  2010-11-06 18:25 ` [PATCH 3/6] ARM: ftrace: use gas macros to avoid code duplication Rabin Vincent
@ 2010-11-06 18:25 ` Rabin Vincent
  2010-11-06 18:25 ` [PATCH 5/6] ARM: ftrace: graph tracer + dynamic ftrace Rabin Vincent
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 13+ messages in thread
From: Rabin Vincent @ 2010-11-06 18:25 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Steven Rostedt, Frederic Weisbecker, Tim Bird, linux-kernel,
	Rabin Vincent

From: Tim Bird <tim.bird@am.sony.com>

Cc: Tim Bird <tim.bird@am.sony.com>
[rabin@rab.in: rebase on top of latest code,
	       keep code in ftrace.c instead of separate file,
	       check for ftrace_graph_entry also]
Signed-off-by: Rabin Vincent <rabin@rab.in>
---
 arch/arm/kernel/Makefile       |    3 +-
 arch/arm/kernel/entry-common.S |   46 ++++++++++++++++++++++++++++++++++++++++
 arch/arm/kernel/ftrace.c       |   34 +++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+), 1 deletions(-)

diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 078dd22..b3225d4 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -5,7 +5,7 @@
 CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET)
 AFLAGS_head.o        := -DTEXT_OFFSET=$(TEXT_OFFSET)
 
-ifdef CONFIG_DYNAMIC_FTRACE
+ifdef CONFIG_FUNCTION_TRACER
 CFLAGS_REMOVE_ftrace.o = -pg
 endif
 
@@ -33,6 +33,7 @@ obj-$(CONFIG_SMP)		+= smp.o
 obj-$(CONFIG_HAVE_ARM_SCU)	+= smp_scu.o
 obj-$(CONFIG_HAVE_ARM_TWD)	+= smp_twd.o
 obj-$(CONFIG_DYNAMIC_FTRACE)	+= ftrace.o
+obj-$(CONFIG_FUNCTION_GRAPH_TRACER)	+= ftrace.o
 obj-$(CONFIG_KEXEC)		+= machine_kexec.o relocate_kernel.o
 obj-$(CONFIG_KPROBES)		+= kprobes.o kprobes-decode.o
 obj-$(CONFIG_ATAGS_PROC)	+= atags.o
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index fe1d586..9f17662 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -148,6 +148,20 @@ ENDPROC(ret_from_fork)
 	adr	r0, .Lftrace_stub
 	cmp	r0, r2
 	bne	1f
+
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+	ldr     r1, =ftrace_graph_return
+	ldr     r2, [r1]
+	cmp     r0, r2
+	bne     ftrace_graph_caller\suffix
+
+	ldr     r1, =ftrace_graph_entry
+	ldr     r2, [r1]
+	ldr     r0, =ftrace_graph_entry_stub
+	cmp     r0, r2
+	bne     ftrace_graph_caller\suffix
+#endif
+
 	mcount_exit
 
 1: 	mcount_get_lr	r1			@ lr of instrumented func
@@ -172,6 +186,15 @@ ftrace_call\suffix:
 	mcount_exit
 .endm
 
+.macro __ftrace_graph_caller
+	sub	r0, fp, #4		@ &lr of instrumented routine (&parent)
+	mov	r1, lr			@ instrumented routine (func)
+	sub	r1, r1, #MCOUNT_INSN_SIZE
+	mov	r2, fp			@ frame pointer
+	bl	prepare_ftrace_return
+	mcount_exit
+.endm
+
 #ifdef CONFIG_OLD_MCOUNT
 /*
  * mcount
@@ -206,6 +229,12 @@ ENTRY(ftrace_caller_old)
 ENDPROC(ftrace_caller_old)
 #endif
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+ENTRY(ftrace_graph_caller_old)
+	__ftrace_graph_caller
+ENDPROC(ftrace_graph_caller_old)
+#endif
+
 .purgem mcount_enter
 .purgem mcount_get_lr
 .purgem mcount_exit
@@ -244,10 +273,27 @@ ENTRY(ftrace_caller)
 ENDPROC(ftrace_caller)
 #endif
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+ENTRY(ftrace_graph_caller)
+	__ftrace_graph_caller
+ENDPROC(ftrace_graph_caller)
+#endif
+
 .purgem mcount_enter
 .purgem mcount_get_lr
 .purgem mcount_exit
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+	.globl return_to_handler
+return_to_handler:
+	stmdb	sp!, {r0-r3}
+	mov	r0, fp			@ frame pointer
+	bl	ftrace_return_to_handler
+	mov	lr, r0			@ r0 has real ret addr
+	ldmia	sp!, {r0-r3}
+	mov	pc, lr
+#endif
+
 ENTRY(ftrace_stub)
 .Lftrace_stub:
 	mov	pc, lr
diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c
index 971ac8c..7a702a5 100644
--- a/arch/arm/kernel/ftrace.c
+++ b/arch/arm/kernel/ftrace.c
@@ -24,6 +24,7 @@
 #define	NOP		0xe8bd4000	/* pop {lr} */
 #endif
 
+#ifdef CONFIG_DYNAMIC_FTRACE
 #ifdef CONFIG_OLD_MCOUNT
 #define OLD_MCOUNT_ADDR	((unsigned long) mcount)
 #define OLD_FTRACE_ADDR ((unsigned long) ftrace_caller_old)
@@ -193,3 +194,36 @@ int __init ftrace_dyn_arch_init(void *data)
 
 	return 0;
 }
+#endif /* CONFIG_DYNAMIC_FTRACE */
+
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
+			   unsigned long frame_pointer)
+{
+	unsigned long return_hooker = (unsigned long) &return_to_handler;
+	struct ftrace_graph_ent trace;
+	unsigned long old;
+	int err;
+
+	if (unlikely(atomic_read(&current->tracing_graph_pause)))
+		return;
+
+	old = *parent;
+	*parent = return_hooker;
+
+	err = ftrace_push_return_trace(old, self_addr, &trace.depth,
+				       frame_pointer);
+	if (err == -EBUSY) {
+		*parent = old;
+		return;
+	}
+
+	trace.func = self_addr;
+
+	/* Only trace if the calling function expects to */
+	if (!ftrace_graph_entry(&trace)) {
+		current->curr_ret_stack--;
+		*parent = old;
+	}
+}
+#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/6] ARM: ftrace: graph tracer + dynamic ftrace
  2010-11-06 18:25 [PATCH 1/6] ARM: ensure sched_clock() and children are notrace Rabin Vincent
                   ` (2 preceding siblings ...)
  2010-11-06 18:25 ` [PATCH 4/6] ARM: ftrace: function graph tracer support Rabin Vincent
@ 2010-11-06 18:25 ` Rabin Vincent
  2010-11-06 18:25 ` [PATCH 6/6] ARM: ftrace: enable function graph tracer Rabin Vincent
  2010-11-12 18:44 ` [PATCH 1/6] ARM: ensure sched_clock() and children are notrace Rabin Vincent
  5 siblings, 0 replies; 13+ messages in thread
From: Rabin Vincent @ 2010-11-06 18:25 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Steven Rostedt, Frederic Weisbecker, Tim Bird, linux-kernel,
	Rabin Vincent

Support the graph tracer + dynamic ftrace combination on ARM.

Signed-off-by: Rabin Vincent <rabin@rab.in>
---
 arch/arm/kernel/entry-common.S |   12 +++++++
 arch/arm/kernel/ftrace.c       |   69 +++++++++++++++++++++++++++++++++++++---
 2 files changed, 76 insertions(+), 5 deletions(-)

diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 9f17662..aae802e 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -183,12 +183,24 @@ ENDPROC(ret_from_fork)
 ftrace_call\suffix:
 	bl	ftrace_stub
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+	.globl ftrace_graph_call\suffix
+ftrace_graph_call\suffix:
+	mov	r0, r0
+#endif
+
 	mcount_exit
 .endm
 
 .macro __ftrace_graph_caller
 	sub	r0, fp, #4		@ &lr of instrumented routine (&parent)
+#ifdef CONFIG_DYNAMIC_FTRACE
+	@ called from __ftrace_caller, saved in mcount_enter
+	ldr	r1, [sp, #16]		@ instrumented routine (func)
+#else
+	@ called from __mcount, untouched in lr
 	mov	r1, lr			@ instrumented routine (func)
+#endif
 	sub	r1, r1, #MCOUNT_INSN_SIZE
 	mov	r2, fp			@ frame pointer
 	bl	prepare_ftrace_return
diff --git a/arch/arm/kernel/ftrace.c b/arch/arm/kernel/ftrace.c
index 7a702a5..c0062ad 100644
--- a/arch/arm/kernel/ftrace.c
+++ b/arch/arm/kernel/ftrace.c
@@ -60,9 +60,9 @@ static unsigned long adjust_address(struct dyn_ftrace *rec, unsigned long addr)
 }
 #endif
 
-/* construct a branch (BL) instruction to addr */
 #ifdef CONFIG_THUMB2_KERNEL
-static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr)
+static unsigned long ftrace_gen_branch(unsigned long pc, unsigned long addr,
+				       bool link)
 {
 	unsigned long s, j1, j2, i1, i2, imm10, imm11;
 	unsigned long first, second;
@@ -84,15 +84,22 @@ static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr)
 	j2 = (!i2) ^ s;
 
 	first = 0xf000 | (s << 10) | imm10;
-	second = 0xd000 | (j1 << 13) | (j2 << 11) | imm11;
+	second = 0x9000 | (j1 << 13) | (j2 << 11) | imm11;
+	if (link)
+		second |= 1 << 14;
 
 	return (second << 16) | first;
 }
 #else
-static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr)
+static unsigned long ftrace_gen_branch(unsigned long pc, unsigned long addr,
+				       bool link)
 {
+	unsigned long opcode = 0xea000000;
 	long offset;
 
+	if (link)
+		opcode |= 1 << 24;
+
 	offset = (long)addr - (long)(pc + 8);
 	if (unlikely(offset < -33554432 || offset > 33554428)) {
 		/* Can't generate branches that far (from ARM ARM). Ftrace
@@ -104,10 +111,15 @@ static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr)
 
 	offset = (offset >> 2) & 0x00ffffff;
 
-	return 0xeb000000 | offset;
+	return opcode | offset;
 }
 #endif
 
+static unsigned long ftrace_call_replace(unsigned long pc, unsigned long addr)
+{
+	return ftrace_gen_branch(pc, addr, true);
+}
+
 static int ftrace_modify_code(unsigned long pc, unsigned long old,
 			      unsigned long new)
 {
@@ -226,4 +238,51 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
 		*parent = old;
 	}
 }
+
+#ifdef CONFIG_DYNAMIC_FTRACE
+extern unsigned long ftrace_graph_call;
+extern unsigned long ftrace_graph_call_old;
+extern void ftrace_graph_caller_old(void);
+
+static int __ftrace_modify_caller(unsigned long *callsite,
+				  void (*func) (void), bool enable)
+{
+	unsigned long caller_fn = (unsigned long) func;
+	unsigned long pc = (unsigned long) callsite;
+	unsigned long branch = ftrace_gen_branch(pc, caller_fn, false);
+	unsigned long nop = 0xe1a00000;	/* mov r0, r0 */
+	unsigned long old = enable ? nop : branch;
+	unsigned long new = enable ? branch : nop;
+
+	return ftrace_modify_code(pc, old, new);
+}
+
+static int ftrace_modify_graph_caller(bool enable)
+{
+	int ret;
+
+	ret = __ftrace_modify_caller(&ftrace_graph_call,
+				     ftrace_graph_caller,
+				     enable);
+
+#ifdef CONFIG_OLD_MCOUNT
+	if (!ret)
+		ret = __ftrace_modify_caller(&ftrace_graph_call_old,
+					     ftrace_graph_caller_old,
+					     enable);
+#endif
+
+	return ret;
+}
+
+int ftrace_enable_ftrace_graph_caller(void)
+{
+	return ftrace_modify_graph_caller(true);
+}
+
+int ftrace_disable_ftrace_graph_caller(void)
+{
+	return ftrace_modify_graph_caller(false);
+}
+#endif /* CONFIG_DYNAMIC_FTRACE */
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/6] ARM: ftrace: enable function graph tracer
  2010-11-06 18:25 [PATCH 1/6] ARM: ensure sched_clock() and children are notrace Rabin Vincent
                   ` (3 preceding siblings ...)
  2010-11-06 18:25 ` [PATCH 5/6] ARM: ftrace: graph tracer + dynamic ftrace Rabin Vincent
@ 2010-11-06 18:25 ` Rabin Vincent
  2010-11-06 19:06   ` Catalin Marinas
  2010-11-12 18:44 ` [PATCH 1/6] ARM: ensure sched_clock() and children are notrace Rabin Vincent
  5 siblings, 1 reply; 13+ messages in thread
From: Rabin Vincent @ 2010-11-06 18:25 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Steven Rostedt, Frederic Weisbecker, Tim Bird, linux-kernel,
	Rabin Vincent

Add the options to enable the function graph tracer on ARM.  Function
graph tracer support requires frame pointers, so exclude Thumb-2 and
also explicitly select FRAME_POINTER in FUNCTION_GRAPH_TRACER since
FUNCTION_TRACER doesn't select FRAME_POINTER when ARM_UNWIND is used
Therefore, with GCC 4.4.0+, you get plain function tracing without frame
pointers, but you'll need them if you want function graph tracing.

Signed-off-by: Rabin Vincent <rabin@rab.in>
---
 arch/arm/Kconfig     |    1 +
 kernel/trace/Kconfig |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a19a526..c5e96ff 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -14,6 +14,7 @@ config ARM
 	select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
 	select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL)
 	select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL)
+	select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL)
 	select HAVE_GENERIC_DMA_COHERENT
 	select HAVE_KERNEL_GZIP
 	select HAVE_KERNEL_LZO
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index e04b8bc..ff23dcf 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -141,6 +141,7 @@ config FUNCTION_TRACER
 
 config FUNCTION_GRAPH_TRACER
 	bool "Kernel Function Graph Tracer"
+	select FRAME_POINTER if ARM_UNWIND
 	depends on HAVE_FUNCTION_GRAPH_TRACER
 	depends on FUNCTION_TRACER
 	depends on !X86_32 || !CC_OPTIMIZE_FOR_SIZE
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/6] ARM: ftrace: enable function graph tracer
  2010-11-06 18:25 ` [PATCH 6/6] ARM: ftrace: enable function graph tracer Rabin Vincent
@ 2010-11-06 19:06   ` Catalin Marinas
  2010-11-08  9:18     ` Uwe Kleine-König
  0 siblings, 1 reply; 13+ messages in thread
From: Catalin Marinas @ 2010-11-06 19:06 UTC (permalink / raw)
  To: Rabin Vincent
  Cc: linux-arm-kernel, Steven Rostedt, Frederic Weisbecker, Tim Bird,
	linux-kernel

On Saturday, November 6, 2010, Rabin Vincent <rabin@rab.in> wrote:
> Add the options to enable the function graph tracer on ARM.  Function
> graph tracer support requires frame pointers, so exclude Thumb-2 and
> also explicitly select FRAME_POINTER in FUNCTION_GRAPH_TRACER since
> FUNCTION_TRACER doesn't select FRAME_POINTER when ARM_UNWIND is used
> Therefore, with GCC 4.4.0+, you get plain function tracing without frame
> pointers, but you'll need them if you want function graph tracing.
.....
> --- a/kernel/trace/Kconfig
> +++ b/kernel/trace/Kconfig
> @@ -141,6 +141,7 @@ config FUNCTION_TRACER
>
>  config FUNCTION_GRAPH_TRACER
>         bool "Kernel Function Graph Tracer"
> +       select FRAME_POINTER if ARM_UNWIND

Would it be better to modify FRAME_POINTER definition in the ARM
Kconfig so that it is enabled automatically when FUNCTION_GRAPH_TRACER
is enabled?

-- 
Catalin

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/6] ARM: ftrace: enable function graph tracer
  2010-11-06 19:06   ` Catalin Marinas
@ 2010-11-08  9:18     ` Uwe Kleine-König
  2010-11-08 10:42       ` Catalin Marinas
  0 siblings, 1 reply; 13+ messages in thread
From: Uwe Kleine-König @ 2010-11-08  9:18 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Rabin Vincent, Frederic Weisbecker, linux-kernel, Steven Rostedt,
	linux-arm-kernel, Tim Bird

On Sat, Nov 06, 2010 at 07:06:28PM +0000, Catalin Marinas wrote:
> On Saturday, November 6, 2010, Rabin Vincent <rabin@rab.in> wrote:
> > Add the options to enable the function graph tracer on ARM.  Function
> > graph tracer support requires frame pointers, so exclude Thumb-2 and
> > also explicitly select FRAME_POINTER in FUNCTION_GRAPH_TRACER since
> > FUNCTION_TRACER doesn't select FRAME_POINTER when ARM_UNWIND is used
> > Therefore, with GCC 4.4.0+, you get plain function tracing without frame
> > pointers, but you'll need them if you want function graph tracing.
> .....
> > --- a/kernel/trace/Kconfig
> > +++ b/kernel/trace/Kconfig
> > @@ -141,6 +141,7 @@ config FUNCTION_TRACER
> >
> >  config FUNCTION_GRAPH_TRACER
> >         bool "Kernel Function Graph Tracer"
> > +       select FRAME_POINTER if ARM_UNWIND
> 
> Would it be better to modify FRAME_POINTER definition in the ARM
> Kconfig so that it is enabled automatically when FUNCTION_GRAPH_TRACER
> is enabled?
I don't like that suggestion much because it hides the dependency.
Moreover a "default y if FUNCTION_GRAPH_TRACER" doesn't work if a
precondition for FRAME_POINTER isn't true.  Rabin's approach at least
generates a warning.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/6] ARM: ftrace: enable function graph tracer
  2010-11-08  9:18     ` Uwe Kleine-König
@ 2010-11-08 10:42       ` Catalin Marinas
  2010-11-09 13:46         ` Rabin Vincent
  0 siblings, 1 reply; 13+ messages in thread
From: Catalin Marinas @ 2010-11-08 10:42 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Rabin Vincent, Frederic Weisbecker, linux-kernel, Steven Rostedt,
	linux-arm-kernel, Tim Bird

2010/11/8 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> On Sat, Nov 06, 2010 at 07:06:28PM +0000, Catalin Marinas wrote:
>> On Saturday, November 6, 2010, Rabin Vincent <rabin@rab.in> wrote:
>> > Add the options to enable the function graph tracer on ARM.  Function
>> > graph tracer support requires frame pointers, so exclude Thumb-2 and
>> > also explicitly select FRAME_POINTER in FUNCTION_GRAPH_TRACER since
>> > FUNCTION_TRACER doesn't select FRAME_POINTER when ARM_UNWIND is used
>> > Therefore, with GCC 4.4.0+, you get plain function tracing without frame
>> > pointers, but you'll need them if you want function graph tracing.
>> .....
>> > --- a/kernel/trace/Kconfig
>> > +++ b/kernel/trace/Kconfig
>> > @@ -141,6 +141,7 @@ config FUNCTION_TRACER
>> >
>> >  config FUNCTION_GRAPH_TRACER
>> >         bool "Kernel Function Graph Tracer"
>> > +       select FRAME_POINTER if ARM_UNWIND
>>
>> Would it be better to modify FRAME_POINTER definition in the ARM
>> Kconfig so that it is enabled automatically when FUNCTION_GRAPH_TRACER
>> is enabled?
> I don't like that suggestion much because it hides the dependency.
> Moreover a "default y if FUNCTION_GRAPH_TRACER" doesn't work if a
> precondition for FRAME_POINTER isn't true.  Rabin's approach at least
> generates a warning.

If a precondition for FRAME_POINTER isn't true, we should not force it
via 'select'. We try to get rid of such warnings in the kernel.

However, on ARM the FRAME_POINTER depends on !THUMB2_KERNEL but for
Thumb-2 kernels HAVE_FUNCTION_GRAPH_TRACER is also disabled, so there
isn't a dependency issue here. It's more like a personal preference to
keep the changes within the arch/arm tree.

-- 
Catalin

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/6] ARM: ftrace: enable function graph tracer
  2010-11-08 10:42       ` Catalin Marinas
@ 2010-11-09 13:46         ` Rabin Vincent
  2010-11-09 14:22           ` Catalin Marinas
  0 siblings, 1 reply; 13+ messages in thread
From: Rabin Vincent @ 2010-11-09 13:46 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Uwe Kleine-König, Frederic Weisbecker, linux-kernel,
	Steven Rostedt, linux-arm-kernel, Tim Bird

On Mon, Nov 08, 2010 at 10:42:57AM +0000, Catalin Marinas wrote:
> 2010/11/8 Uwe Kleine-König <u.kleine-koenig@pengutronix.de>:
> > On Sat, Nov 06, 2010 at 07:06:28PM +0000, Catalin Marinas wrote:
> >> On Saturday, November 6, 2010, Rabin Vincent <rabin@rab.in> wrote:
> >> > --- a/kernel/trace/Kconfig
> >> > +++ b/kernel/trace/Kconfig
> >> > @@ -141,6 +141,7 @@ config FUNCTION_TRACER
> >> >
> >> >  config FUNCTION_GRAPH_TRACER
> >> >         bool "Kernel Function Graph Tracer"
> >> > +       select FRAME_POINTER if ARM_UNWIND
> >>
> >> Would it be better to modify FRAME_POINTER definition in the ARM
> >> Kconfig so that it is enabled automatically when FUNCTION_GRAPH_TRACER
> >> is enabled?
> > I don't like that suggestion much because it hides the dependency.
> > Moreover a "default y if FUNCTION_GRAPH_TRACER" doesn't work if a
> > precondition for FRAME_POINTER isn't true.  Rabin's approach at least
> > generates a warning.
> 
> If a precondition for FRAME_POINTER isn't true, we should not force it
> via 'select'. We try to get rid of such warnings in the kernel.
> 
> However, on ARM the FRAME_POINTER depends on !THUMB2_KERNEL but for
> Thumb-2 kernels HAVE_FUNCTION_GRAPH_TRACER is also disabled, so there
> isn't a dependency issue here. It's more like a personal preference to
> keep the changes within the arch/arm tree.

OK, new patch below.

>From ce3856933234b0976068be8bdc46340dcf31ef6f Mon Sep 17 00:00:00 2001
From: Rabin Vincent <rabin@rab.in>
Date: Sat, 6 Nov 2010 23:03:53 +0530
Subject: [PATCHv2] ARM: ftrace: enable function graph tracer

Add the options to enable the function graph tracer on ARM.  Function
graph tracer support requires frame pointers, so exclude Thumb-2 and
also make sure FRAME_POINTER gets enabled when FUNCTION_GRAPH_TRACER is
used, since FUNCTION_TRACER doesn't "select FRAME_POINTER" when
ARM_UNWIND is used.  Therefore, with GCC 4.4.0+, you get plain function
tracing without frame pointers, but you'll need them if you want
function graph tracing.

Signed-off-by: Rabin Vincent <rabin@rab.in>
---
 arch/arm/Kconfig       |    1 +
 arch/arm/Kconfig.debug |    2 +-
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index a19a526..c5e96ff 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -14,6 +14,7 @@ config ARM
 	select HAVE_FUNCTION_TRACER if (!XIP_KERNEL)
 	select HAVE_FTRACE_MCOUNT_RECORD if (!XIP_KERNEL)
 	select HAVE_DYNAMIC_FTRACE if (!XIP_KERNEL)
+	select HAVE_FUNCTION_GRAPH_TRACER if (!THUMB2_KERNEL)
 	select HAVE_GENERIC_DMA_COHERENT
 	select HAVE_KERNEL_GZIP
 	select HAVE_KERNEL_LZO
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index 2fd0b99..eac62085 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -23,7 +23,7 @@ config STRICT_DEVMEM
 config FRAME_POINTER
 	bool
 	depends on !THUMB2_KERNEL
-	default y if !ARM_UNWIND
+	default y if !ARM_UNWIND || FUNCTION_GRAPH_TRACER
 	help
 	  If you say N here, the resulting kernel will be slightly smaller and
 	  faster. However, if neither FRAME_POINTER nor ARM_UNWIND are enabled,
-- 
1.7.2.3


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 6/6] ARM: ftrace: enable function graph tracer
  2010-11-09 13:46         ` Rabin Vincent
@ 2010-11-09 14:22           ` Catalin Marinas
  0 siblings, 0 replies; 13+ messages in thread
From: Catalin Marinas @ 2010-11-09 14:22 UTC (permalink / raw)
  To: Rabin Vincent
  Cc: Uwe Kleine-König, Frederic Weisbecker, linux-kernel,
	Steven Rostedt, linux-arm-kernel, Tim Bird

On Tue, 2010-11-09 at 13:46 +0000, Rabin Vincent wrote:
> Subject: [PATCHv2] ARM: ftrace: enable function graph tracer
> 
> Add the options to enable the function graph tracer on ARM.  Function
> graph tracer support requires frame pointers, so exclude Thumb-2 and
> also make sure FRAME_POINTER gets enabled when FUNCTION_GRAPH_TRACER is
> used, since FUNCTION_TRACER doesn't "select FRAME_POINTER" when
> ARM_UNWIND is used.  Therefore, with GCC 4.4.0+, you get plain function
> tracing without frame pointers, but you'll need them if you want
> function graph tracing.
> 
> Signed-off-by: Rabin Vincent <rabin@rab.in>

Looks ok to me.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/6] ARM: ensure sched_clock() and children are notrace
  2010-11-06 18:25 [PATCH 1/6] ARM: ensure sched_clock() and children are notrace Rabin Vincent
                   ` (4 preceding siblings ...)
  2010-11-06 18:25 ` [PATCH 6/6] ARM: ftrace: enable function graph tracer Rabin Vincent
@ 2010-11-12 18:44 ` Rabin Vincent
  2010-11-19 16:09   ` Rabin Vincent
  5 siblings, 1 reply; 13+ messages in thread
From: Rabin Vincent @ 2010-11-12 18:44 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Steven Rostedt, Frederic Weisbecker, Tim Bird, linux-kernel,
	Rabin Vincent, Colin Cross, Erik Gilling, Olof Johansson,
	Linus Walleij, Mikael Pettersson, Tony Lindgren

CC'd some mach maintainers.  I can split this up if needed,
since these bits can be applied independently from the rest
of the patches in the series.

On Sat, Nov 6, 2010 at 11:55 PM, Rabin Vincent <rabin@rab.in> wrote:
> Include sched.h in the files implementing sched_clock() and ensure that
> any functions called from sched_clock() have the notrace annotation.
>
> Signed-off-by: Rabin Vincent <rabin@rab.in>
> ---
>  arch/arm/mach-tegra/timer.c           |    3 ++-
>  arch/arm/mach-u300/timer.c            |    1 +
>  arch/arm/plat-iop/time.c              |    3 ++-
>  arch/arm/plat-nomadik/timer.c         |    5 +++--
>  arch/arm/plat-omap/counter_32k.c      |   11 ++++++-----
>  arch/arm/plat-versatile/sched-clock.c |    1 +
>  6 files changed, 15 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm/mach-tegra/timer.c b/arch/arm/mach-tegra/timer.c
> index 9057d6f..88ed925 100644
> --- a/arch/arm/mach-tegra/timer.c
> +++ b/arch/arm/mach-tegra/timer.c
> @@ -21,6 +21,7 @@
>  #include <linux/time.h>
>  #include <linux/interrupt.h>
>  #include <linux/irq.h>
> +#include <linux/sched.h>
>  #include <linux/clockchips.h>
>  #include <linux/clocksource.h>
>  #include <linux/clk.h>
> @@ -89,7 +90,7 @@ static void tegra_timer_set_mode(enum clock_event_mode mode,
>        }
>  }
>
> -static cycle_t tegra_clocksource_read(struct clocksource *cs)
> +static cycle_t notrace tegra_clocksource_read(struct clocksource *cs)
>  {
>        return cnt32_to_63(timer_readl(TIMERUS_CNTR_1US));
>  }
> diff --git a/arch/arm/mach-u300/timer.c b/arch/arm/mach-u300/timer.c
> index 3fc4472..672b28a 100644
> --- a/arch/arm/mach-u300/timer.c
> +++ b/arch/arm/mach-u300/timer.c
> @@ -11,6 +11,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/time.h>
>  #include <linux/timex.h>
> +#include <linux/sched.h>
>  #include <linux/clockchips.h>
>  #include <linux/clocksource.h>
>  #include <linux/types.h>
> diff --git a/arch/arm/plat-iop/time.c b/arch/arm/plat-iop/time.c
> index 85d3e55..558cdfa 100644
> --- a/arch/arm/plat-iop/time.c
> +++ b/arch/arm/plat-iop/time.c
> @@ -18,6 +18,7 @@
>  #include <linux/time.h>
>  #include <linux/init.h>
>  #include <linux/timex.h>
> +#include <linux/sched.h>
>  #include <linux/io.h>
>  #include <linux/clocksource.h>
>  #include <linux/clockchips.h>
> @@ -36,7 +37,7 @@
>  /*
>  * IOP clocksource (free-running timer 1).
>  */
> -static cycle_t iop_clocksource_read(struct clocksource *unused)
> +static cycle_t notrace iop_clocksource_read(struct clocksource *unused)
>  {
>        return 0xffffffffu - read_tcr1();
>  }
> diff --git a/arch/arm/plat-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c
> index aedf9c1..70969a7 100644
> --- a/arch/arm/plat-nomadik/timer.c
> +++ b/arch/arm/plat-nomadik/timer.c
> @@ -11,6 +11,7 @@
>  #include <linux/init.h>
>  #include <linux/interrupt.h>
>  #include <linux/irq.h>
> +#include <linux/sched.h>
>  #include <linux/io.h>
>  #include <linux/clockchips.h>
>  #include <linux/clk.h>
> @@ -26,13 +27,13 @@ void __iomem *mtu_base; /* ssigned by machine code */
>  * Kernel assumes that sched_clock can be called early
>  * but the MTU may not yet be initialized.
>  */
> -static cycle_t nmdk_read_timer_dummy(struct clocksource *cs)
> +static cycle_t notrace nmdk_read_timer_dummy(struct clocksource *cs)
>  {
>        return 0;
>  }
>
>  /* clocksource: MTU decrements, so we negate the value being read. */
> -static cycle_t nmdk_read_timer(struct clocksource *cs)
> +static cycle_t notrace nmdk_read_timer(struct clocksource *cs)
>  {
>        return -readl(mtu_base + MTU_VAL(0));
>  }
> diff --git a/arch/arm/plat-omap/counter_32k.c b/arch/arm/plat-omap/counter_32k.c
> index 155fe43..bc9bc6c 100644
> --- a/arch/arm/plat-omap/counter_32k.c
> +++ b/arch/arm/plat-omap/counter_32k.c
> @@ -13,6 +13,7 @@
>  * NOTE: This timer is not the same timer as the old OMAP1 MPU timer.
>  */
>  #include <linux/kernel.h>
> +#include <linux/sched.h>
>  #include <linux/init.h>
>  #include <linux/clk.h>
>  #include <linux/io.h>
> @@ -44,7 +45,7 @@
>  static u32 offset_32k __read_mostly;
>
>  #ifdef CONFIG_ARCH_OMAP16XX
> -static cycle_t omap16xx_32k_read(struct clocksource *cs)
> +static cycle_t notrace omap16xx_32k_read(struct clocksource *cs)
>  {
>        return omap_readl(OMAP16XX_TIMER_32K_SYNCHRONIZED) - offset_32k;
>  }
> @@ -53,7 +54,7 @@ static cycle_t omap16xx_32k_read(struct clocksource *cs)
>  #endif
>
>  #ifdef CONFIG_ARCH_OMAP2420
> -static cycle_t omap2420_32k_read(struct clocksource *cs)
> +static cycle_t notrace omap2420_32k_read(struct clocksource *cs)
>  {
>        return omap_readl(OMAP2420_32KSYNCT_BASE + 0x10) - offset_32k;
>  }
> @@ -62,7 +63,7 @@ static cycle_t omap2420_32k_read(struct clocksource *cs)
>  #endif
>
>  #ifdef CONFIG_ARCH_OMAP2430
> -static cycle_t omap2430_32k_read(struct clocksource *cs)
> +static cycle_t notrace omap2430_32k_read(struct clocksource *cs)
>  {
>        return omap_readl(OMAP2430_32KSYNCT_BASE + 0x10) - offset_32k;
>  }
> @@ -71,7 +72,7 @@ static cycle_t omap2430_32k_read(struct clocksource *cs)
>  #endif
>
>  #ifdef CONFIG_ARCH_OMAP3
> -static cycle_t omap34xx_32k_read(struct clocksource *cs)
> +static cycle_t notrace omap34xx_32k_read(struct clocksource *cs)
>  {
>        return omap_readl(OMAP3430_32KSYNCT_BASE + 0x10) - offset_32k;
>  }
> @@ -80,7 +81,7 @@ static cycle_t omap34xx_32k_read(struct clocksource *cs)
>  #endif
>
>  #ifdef CONFIG_ARCH_OMAP4
> -static cycle_t omap44xx_32k_read(struct clocksource *cs)
> +static cycle_t notrace omap44xx_32k_read(struct clocksource *cs)
>  {
>        return omap_readl(OMAP4430_32KSYNCT_BASE + 0x10) - offset_32k;
>  }
> diff --git a/arch/arm/plat-versatile/sched-clock.c b/arch/arm/plat-versatile/sched-clock.c
> index 9768cf7..9696ddc 100644
> --- a/arch/arm/plat-versatile/sched-clock.c
> +++ b/arch/arm/plat-versatile/sched-clock.c
> @@ -20,6 +20,7 @@
>  */
>  #include <linux/cnt32_to_63.h>
>  #include <linux/io.h>
> +#include <linux/sched.h>
>  #include <asm/div64.h>
>
>  #include <mach/hardware.h>
> --
> 1.7.2.3
>
>

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/6] ARM: ensure sched_clock() and children are notrace
  2010-11-12 18:44 ` [PATCH 1/6] ARM: ensure sched_clock() and children are notrace Rabin Vincent
@ 2010-11-19 16:09   ` Rabin Vincent
  0 siblings, 0 replies; 13+ messages in thread
From: Rabin Vincent @ 2010-11-19 16:09 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Steven Rostedt, Frederic Weisbecker, Tim Bird, linux-kernel,
	Colin Cross, Erik Gilling, Olof Johansson, Linus Walleij,
	Mikael Pettersson, Tony Lindgren

> On Sat, Nov 6, 2010 at 11:55 PM, Rabin Vincent <rabin@rab.in> wrote:
> > Include sched.h in the files implementing sched_clock() and ensure that
> > any functions called from sched_clock() have the notrace annotation.

On Sat, Nov 13, 2010 at 12:14:51AM +0530, Rabin Vincent wrote:
> CC'd some mach maintainers.  I can split this up if needed,
> since these bits can be applied independently from the rest
> of the patches in the series.

I've split it up anyway, since tegra and nomadik have since fixed it
themselves while reworking their sched_clock() implementations (and
there are probably others who need to do this), and I missed a couple of
functions in omap and u300 in the first patch.

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2010-11-19 16:09 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-11-06 18:25 [PATCH 1/6] ARM: ensure sched_clock() and children are notrace Rabin Vincent
2010-11-06 18:25 ` [PATCH 2/6] ARM: place C irq handlers in IRQ_ENTRY for ftrace Rabin Vincent
2010-11-06 18:25 ` [PATCH 3/6] ARM: ftrace: use gas macros to avoid code duplication Rabin Vincent
2010-11-06 18:25 ` [PATCH 4/6] ARM: ftrace: function graph tracer support Rabin Vincent
2010-11-06 18:25 ` [PATCH 5/6] ARM: ftrace: graph tracer + dynamic ftrace Rabin Vincent
2010-11-06 18:25 ` [PATCH 6/6] ARM: ftrace: enable function graph tracer Rabin Vincent
2010-11-06 19:06   ` Catalin Marinas
2010-11-08  9:18     ` Uwe Kleine-König
2010-11-08 10:42       ` Catalin Marinas
2010-11-09 13:46         ` Rabin Vincent
2010-11-09 14:22           ` Catalin Marinas
2010-11-12 18:44 ` [PATCH 1/6] ARM: ensure sched_clock() and children are notrace Rabin Vincent
2010-11-19 16:09   ` Rabin Vincent

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).