public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <srostedt@redhat.com>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Alexander van Heukelum <heukelum@fastmail.fm>,
	Steven Rostedt <rostedt@goodmis.org>,
	fweisbec <fweisbec@gmail.com>
Subject: Re: [RFC] x86: entry_64 - introduce FTRACE_ frame macro
Date: Fri, 12 Dec 2008 15:19:27 -0500	[thread overview]
Message-ID: <1229113167.32623.12.camel@localhost.localdomain> (raw)
In-Reply-To: <20081212184136.GB14192@localhost>


On Fri, 2008-12-12 at 21:41 +0300, Cyrill Gorcunov wrote:
> Impact: clean up
> 
> Itroduce FTRACE_SAVE/RESTORE_FRAME which allow us to
> save a number of lines on source level.
> 
> Also fix a comment in ftrace.h.
> 
> ---
> Actually I'm not that sure about bringing new macros there
> since we already have a lot so feel free to just drop it.
> 
> Maybe it would be good to comment args passed
> to ftrace_call on ABI level :)

Actually that is pretty much the same as mcount call. But we may change
it in the future. We probably should document (if it is not already) the
ftrace call graph ABI.

> 
> Ah, the patch is on top of -tip e3bdf48

If you have tested this with and without dynamic ftrace, for both the
function tracer and the function graph tracer, then you have my...

Acked-by: Steven Rostedt <srostedt@redhat.com>

-- Steve

> 
>  arch/x86/include/asm/ftrace.h |    2 -
>  arch/x86/kernel/entry_64.S    |   70 +++++++++++++++---------------------------
>  2 files changed, 26 insertions(+), 46 deletions(-)
> 
> Index: linux-2.6.git/arch/x86/include/asm/ftrace.h
> ===================================================================
> --- linux-2.6.git.orig/arch/x86/include/asm/ftrace.h
> +++ linux-2.6.git/arch/x86/include/asm/ftrace.h
> @@ -46,7 +46,7 @@ struct ftrace_ret_stack {
>  /*
>   * Primary handler of a function return.
>   * It relays on ftrace_return_to_handler.
> - * Defined in entry32.S
> + * Defined in entry_32/64.S
>   */
>  extern void return_to_handler(void);
>  
> Index: linux-2.6.git/arch/x86/kernel/entry_64.S
> ===================================================================
> --- linux-2.6.git.orig/arch/x86/kernel/entry_64.S
> +++ linux-2.6.git/arch/x86/kernel/entry_64.S
> @@ -66,10 +66,7 @@ ENTRY(mcount)
>  	retq
>  END(mcount)
>  
> -ENTRY(ftrace_caller)
> -	cmpl $0, function_trace_stop
> -	jne  ftrace_stub
> -
> +	.macro FTRACE_SAVE_FRAME
>  	/* taken from glibc */
>  	subq $0x38, %rsp
>  	movq %rax, (%rsp)
> @@ -79,15 +76,9 @@ ENTRY(ftrace_caller)
>  	movq %rdi, 32(%rsp)
>  	movq %r8, 40(%rsp)
>  	movq %r9, 48(%rsp)
> +	.endm
>  
> -	movq 0x38(%rsp), %rdi
> -	movq 8(%rbp), %rsi
> -	subq $MCOUNT_INSN_SIZE, %rdi
> -
> -.globl ftrace_call
> -ftrace_call:
> -	call ftrace_stub
> -
> +	.macro FTRACE_RESTORE_FRAME
>  	movq 48(%rsp), %r9
>  	movq 40(%rsp), %r8
>  	movq 32(%rsp), %rdi
> @@ -96,6 +87,23 @@ ftrace_call:
>  	movq 8(%rsp), %rcx
>  	movq (%rsp), %rax
>  	addq $0x38, %rsp
> +	.endm
> +
> +ENTRY(ftrace_caller)
> +	cmpl $0, function_trace_stop
> +	jne  ftrace_stub
> +
> +	FTRACE_SAVE_FRAME
> +
> +	movq 0x38(%rsp), %rdi
> +	movq 8(%rbp), %rsi
> +	subq $MCOUNT_INSN_SIZE, %rdi
> +
> +.globl ftrace_call
> +ftrace_call:
> +	call ftrace_stub
> +
> +	FTRACE_RESTORE_FRAME
>  
>  #ifdef CONFIG_FUNCTION_GRAPH_TRACER
>  .globl ftrace_graph_call
> @@ -129,15 +137,7 @@ ftrace_stub:
>  	retq
>  
>  trace:
> -	/* taken from glibc */
> -	subq $0x38, %rsp
> -	movq %rax, (%rsp)
> -	movq %rcx, 8(%rsp)
> -	movq %rdx, 16(%rsp)
> -	movq %rsi, 24(%rsp)
> -	movq %rdi, 32(%rsp)
> -	movq %r8, 40(%rsp)
> -	movq %r9, 48(%rsp)
> +	FTRACE_SAVE_FRAME
>  
>  	movq 0x38(%rsp), %rdi
>  	movq 8(%rbp), %rsi
> @@ -145,14 +145,7 @@ trace:
>  
>  	call   *ftrace_trace_function
>  
> -	movq 48(%rsp), %r9
> -	movq 40(%rsp), %r8
> -	movq 32(%rsp), %rdi
> -	movq 24(%rsp), %rsi
> -	movq 16(%rsp), %rdx
> -	movq 8(%rsp), %rcx
> -	movq (%rsp), %rax
> -	addq $0x38, %rsp
> +	FTRACE_RESTORE_FRAME
>  
>  	jmp ftrace_stub
>  END(mcount)
> @@ -164,14 +157,7 @@ ENTRY(ftrace_graph_caller)
>  	cmpl $0, function_trace_stop
>  	jne ftrace_stub
>  
> -	subq $0x38, %rsp
> -	movq %rax, (%rsp)
> -	movq %rcx, 8(%rsp)
> -	movq %rdx, 16(%rsp)
> -	movq %rsi, 24(%rsp)
> -	movq %rdi, 32(%rsp)
> -	movq %r8, 40(%rsp)
> -	movq %r9, 48(%rsp)
> +	FTRACE_SAVE_FRAME
>  
>  	leaq 8(%rbp), %rdi
>  	movq 0x38(%rsp), %rsi
> @@ -179,14 +165,8 @@ ENTRY(ftrace_graph_caller)
>  
>  	call	prepare_ftrace_return
>  
> -	movq 48(%rsp), %r9
> -	movq 40(%rsp), %r8
> -	movq 32(%rsp), %rdi
> -	movq 24(%rsp), %rsi
> -	movq 16(%rsp), %rdx
> -	movq 8(%rsp), %rcx
> -	movq (%rsp), %rax
> -	addq $0x38, %rsp
> +	FTRACE_RESTORE_FRAME
> +
>  	retq
>  END(ftrace_graph_caller)
>  


  reply	other threads:[~2008-12-12 20:20 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-12 18:41 [RFC] x86: entry_64 - introduce FTRACE_ frame macro Cyrill Gorcunov
2008-12-12 20:19 ` Steven Rostedt [this message]
2008-12-12 20:47   ` Cyrill Gorcunov
2008-12-12 20:52     ` Steven Rostedt
2008-12-12 20:57       ` Cyrill Gorcunov
2008-12-12 20:59         ` Cyrill Gorcunov
2008-12-12 21:22         ` Steven Rostedt
2008-12-12 21:27           ` Cyrill Gorcunov
2008-12-12 21:35           ` Cyrill Gorcunov
2008-12-12 21:41             ` Cyrill Gorcunov
2008-12-12 21:56             ` Steven Rostedt
2008-12-13  8:20               ` Cyrill Gorcunov
2008-12-13 14:46                 ` Frédéric Weisbecker
2008-12-13 14:59                   ` Steven Rostedt
2008-12-13 15:28                     ` Frédéric Weisbecker
2008-12-13 15:16                   ` Cyrill Gorcunov
2008-12-13 15:26                     ` Frédéric Weisbecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1229113167.32623.12.camel@localhost.localdomain \
    --to=srostedt@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=heukelum@fastmail.fm \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox