Skip to contentSkip to conversation

powerpc: make mcount a stub for dynamic ftrace

PATCH In review Steven Rostedt 2 participants 3 messages Nov 20, 2008 – Nov 23, 2008 PowerPC

lore
Share & tools
lore
#0 lore raw

cover powerpc: make mcount a stub for dynamic ftrace

Paul,

I have one more patch. I added it to the end of the ppc/ftrace branch. The new way of handling the finding of mcounts means we do not need to do anything in the mcount call itself. It should just be a stub and when ftrace is enabled, it will change the caller sites to call something other than mcount.

The following patches are in:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git

branch: ppc/ftrace

Steven Rostedt (1):
powerpc: ftrace, do nothing in mcount call for dyn ftrace

----

 arch/powerpc/kernel/entry_32.S |   35 +----------------------------------
 arch/powerpc/kernel/entry_64.S |   12 ------------
 2 files changed, 1 insertions(+), 46 deletions(-)
#1 lore raw

PATCH 1/1 powerpc: ftrace, do nothing in mcount call for dyn ftrace

From: Steven Rostedt <[email protected]>

Impact: quicken mcount calls that are not replaced by dyn ftrace

Dynamic ftrace no longer does on the fly recording of mcount locations. The mcount locations are now found at compile time. The mcount function no longer needs to store registers and call a stub function. It can now just simply return.

Since there are some functions that do not get converted to a nop (.init sections and other code that may disappear), this patch should help speed up that code.

---
 arch/powerpc/kernel/entry_32.S |   35 +----------------------------------
 arch/powerpc/kernel/entry_64.S |   12 ------------
 2 files changed, 1 insertions(+), 46 deletions(-)
arch/powerpc/kernel/entry_32.S +1 -34
index 7ecc0d1..d2c4035 100644
@@ -1162,40 +1162,7 @@ machine_check_in_rtas:
 #ifdef CONFIG_DYNAMIC_FTRACE
 _GLOBAL(mcount)
 _GLOBAL(_mcount)
-	stwu	r1,-48(r1)
-	stw	r3, 12(r1)
-	stw	r4, 16(r1)
-	stw	r5, 20(r1)
-	stw	r6, 24(r1)
-	mflr	r3
-	stw	r7, 28(r1)
-	mfcr	r5
-	stw	r8, 32(r1)
-	stw	r9, 36(r1)
-	stw	r10,40(r1)
-	stw	r3, 44(r1)
-	stw	r5, 8(r1)
-	subi	r3, r3, MCOUNT_INSN_SIZE
-	.globl mcount_call
-mcount_call:
-	bl	ftrace_stub
-	nop
-	lwz	r6, 8(r1)
-	lwz	r0, 44(r1)
-	lwz	r3, 12(r1)
-	mtctr	r0
-	lwz	r4, 16(r1)
-	mtcr	r6
-	lwz	r5, 20(r1)
-	lwz	r6, 24(r1)
-	lwz	r0, 52(r1)
-	lwz	r7, 28(r1)
-	lwz	r8, 32(r1)
-	mtlr	r0
-	lwz	r9, 36(r1)
-	lwz	r10,40(r1)
-	addi	r1, r1, 48
-	bctr
+	blr
 
 _GLOBAL(ftrace_caller)
 	/* Based off of objdump optput from glibc */
arch/powerpc/kernel/entry_64.S +0 -12
index e6d5284..b00982e 100644
@@ -888,18 +888,6 @@ _GLOBAL(enter_prom)
 #ifdef CONFIG_DYNAMIC_FTRACE
 _GLOBAL(mcount)
 _GLOBAL(_mcount)
-	/* Taken from output of objdump from lib64/glibc */
-	mflr	r3
-	stdu	r1, -112(r1)
-	std	r3, 128(r1)
-	subi	r3, r3, MCOUNT_INSN_SIZE
-	.globl mcount_call
-mcount_call:
-	bl	ftrace_stub
-	nop
-	ld	r0, 128(r1)
-	mtlr	r0
-	addi	r1, r1, 112
 	blr
 
 _GLOBAL(ftrace_caller)
Signature · 3 lines
1.5.6.5

-- 
#2 lore raw
In reply to Steven Rostedt
Quoted 8 lines · Steven Rostedt

Paul,

I have one more patch. I added it to the end of the ppc/ftrace branch. The new way of handling the finding of mcounts means we do not need to do anything in the mcount call itself. It should just be a stub and when ftrace is enabled, it will change the caller sites to call something other than mcount.

Quoted 5 lines

The following patches are in:

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-trace.git

branch: ppc/ftrace

i've also pulled the ppc/ftrace branch into tip/tracing/powerpc, and added it to ftrace-next's linux-next integration rules.

So if Paul gives the green light that the commits have the right structure, we can freeze down the branch and the SHA1's and integrate it into ftrace-next. (which is integrated in linux-next after the powerpc tree so should be all fine in terms of merge ordering)

Ingo