Skip to content

RFC ftrace/x86: Clean up of mcount.S code

Steven Rostedt lkml 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest9 patches 4 repliesIn review
  2. v1 RFC7 patches 4 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9ftrace/x86: Have static tracing also use ftrace_caller_setuparch/x86/kernel/mcount_64.S+7 -150 replies
2/9ftrace/x86: Move MCOUNT_SAVE_FRAME out of header filearch/x86/include/asm/ftrace.h arch/x86/kernel/mcount_64.S+29 -330 replies
3/9ftrace/x86: Rename MCOUNT_SAVE_FRAME and add more detailed commentsarch/x86/kernel/mcount_64.S+24 -80 replies
4/9ftrace/x86: Have save_mcount_regs store RIP in %rdi for first parameterarch/x86/kernel/mcount_64.S+3 -40 replies
5/9ftrace/x86: Simplify save_mcount_regs on getting RIParch/x86/kernel/mcount_64.S+18 -190 replies
6/9ftrace/x86: Add macro MCOUNT_REG_SIZE for amount of stack used to save mcount regsarch/x86/kernel/mcount_64.S+12 -120 replies
7/9ftrace/x86: Have save_mcount_regs macro also save stack frames if neededarch/x86/kernel/mcount_64.S+67 -510 replies
8/9ftrace/x86: Get rid of ftrace_caller_setuparch/x86/kernel/mcount_64.S+42 -290 replies
9/9ftrace/fgraph/x86: Have prepare_ftrace_return() take ip as first parameterarch/x86/kernel/ftrace.c arch/x86/kernel/mcount_64.S+6 -90 replies

Reviews trailers per patch

None of the 9 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchThomas Gleixner
SeriesR-b
1/9
2/9
3/9
4/9
5/9
6/9
7/9
8/9
9/9

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [RFC][PATCH 0/9 v2] ftrace/x86: Clean up of mcount.S code

Linus,

I ran these through my test suite and they passed. Are these changes fine for you? If so, I'll include them in my 3.19 queue.

I still think the "band-aid patch" should go into 3.18 now, as it does fix a real bug, and is small and less likely to cause any regressions that this patch series might do. Which also makes it a candidate for stable.

The rolled up patch is below as well, and you can get the full code from my git tree.

Thanks,

-- Steve

git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
rfc/mcount-update

Head SHA1: dcdf7dedfa5d4efd22306b0463469ef35fac8d27

Steven Rostedt (Red Hat) (9):
ftrace/x86: Have static tracing also use ftrace_caller_setup ftrace/x86: Move MCOUNT_SAVE_FRAME out of header file
ftrace/x86: Rename MCOUNT_SAVE_FRAME and add more detailed comments ftrace/x86: Have save_mcount_regs store RIP in %rdi for first parameter ftrace/x86: Simplify save_mcount_regs on getting RIP
ftrace/x86: Add macro MCOUNT_REG_SIZE for amount of stack used to save mcount regs ftrace/x86: Have save_mcount_regs macro also save stack frames if needed ftrace/x86: Get rid of ftrace_caller_setup
ftrace/fgraph/x86: Have prepare_ftrace_return() take ip as first parameter

----

 arch/x86/include/asm/ftrace.h |  33 ------
 arch/x86/kernel/ftrace.c      |   4 +-
 arch/x86/kernel/mcount_64.S   | 233 ++++++++++++++++++++++++++----------------
 3 files changed, 149 insertions(+), 121 deletions(-)

---------------------------

arch/x86/include/asm/ftrace.h +0 -33
index e1f7fecaa7d6..f45acad3c4b6 100644
@@ -1,39 +1,6 @@
 #ifndef _ASM_X86_FTRACE_H
 #define _ASM_X86_FTRACE_H
 
-#ifdef __ASSEMBLY__
-
-	/* skip is set if the stack was already partially adjusted */
-	.macro MCOUNT_SAVE_FRAME skip=0
-	 /*
-	  * We add enough stack to save all regs.
-	  */
-	subq $(SS+8-\skip), %rsp
-	movq %rax, RAX(%rsp)
-	movq %rcx, RCX(%rsp)
-	movq %rdx, RDX(%rsp)
-	movq %rsi, RSI(%rsp)
-	movq %rdi, RDI(%rsp)
-	movq %r8, R8(%rsp)
-	movq %r9, R9(%rsp)
-	 /* Move RIP to its proper location */
-	movq SS+8(%rsp), %rdx
-	movq %rdx, RIP(%rsp)
-	.endm
-
-	.macro MCOUNT_RESTORE_FRAME skip=0
-	movq R9(%rsp), %r9
-	movq R8(%rsp), %r8
-	movq RDI(%rsp), %rdi
-	movq RSI(%rsp), %rsi
-	movq RDX(%rsp), %rdx
-	movq RCX(%rsp), %rcx
-	movq RAX(%rsp), %rax
-	addq $(SS+8-\skip), %rsp
-	.endm
-
-#endif
-
 #ifdef CONFIG_FUNCTION_TRACER
 #ifdef CC_USING_FENTRY
 # define MCOUNT_ADDR		((long)(__fentry__))
arch/x86/kernel/ftrace.c +2 -2
index 60881d919432..2142376dc8c6 100644
@@ -871,7 +871,7 @@ static void *addr_from_call(void *ptr)
 	return ptr + MCOUNT_INSN_SIZE + calc.offset;
 }
 
-void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
+void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
 			   unsigned long frame_pointer);
 
 /*
@@ -964,7 +964,7 @@ int ftrace_disable_ftrace_graph_caller(void)
  * Hook the return address and push it in the stack of return addrs
  * in current thread info.
  */
-void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr,
+void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
 			   unsigned long frame_pointer)
 {
 	unsigned long old;
arch/x86/kernel/mcount_64.S +147 -86

333 lines not on this page · raw message