Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1602127

Re: [RFC][PATCH 5/5] ftrace/x86-32: Add -mfentry support to x86_32 with DYNAMIC_FTRACE set

From Masami Hiramatsu <mhiramat@kernel.org>
Newsgroups linux.kernel
Subject Re: [RFC][PATCH 5/5] ftrace/x86-32: Add -mfentry support to x86_32 with DYNAMIC_FTRACE set
Date 2017-03-16 10:30 +0100
Message-ID <tlzTj-4Bt-13@gated-at.bofh.it> (permalink)
References <tlnyN-4i6-3@gated-at.bofh.it> <tlnyO-4i6-35@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, 15 Mar 2017 15:55:32 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> 
> x86_64 has had fentry support for some time. I did not add support to x86_32
> as I was unsure if it will be used much in the future. It is still very much
> used, and there's issues with function graph tracing with gcc playing around
> with the mcount frames, causing function graph to panic. The fentry code
> does not have this issue, and is able to cope as there is no frame to mess
> up.
> 
> Note, this only add support for fentry when DYNAMIC_FTRACE is set. There's
> really no reason to not have that set, because the performance of the
> machine drops significantly when it's not enabled. I only keep
> !DYNAMIC_FTRACE around to test it off, as there's still some archs that have
> FTRACE but not DYNAMIC_FTRACE.
> 
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
>  arch/x86/Kconfig            |  2 +-
>  arch/x86/kernel/ftrace_32.S | 88 +++++++++++++++++++++++++++++++++++++++------
>  2 files changed, 79 insertions(+), 11 deletions(-)
> 
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index cc98d5a294ee..8c17146427ca 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -127,7 +127,7 @@ config X86
>  	select HAVE_EBPF_JIT			if X86_64
>  	select HAVE_EFFICIENT_UNALIGNED_ACCESS
>  	select HAVE_EXIT_THREAD
> -	select HAVE_FENTRY			if X86_64
> +	select HAVE_FENTRY			if X86_64 || DYNAMIC_FTRACE
>  	select HAVE_FTRACE_MCOUNT_RECORD
>  	select HAVE_FUNCTION_GRAPH_TRACER
>  	select HAVE_FUNCTION_TRACER
> diff --git a/arch/x86/kernel/ftrace_32.S b/arch/x86/kernel/ftrace_32.S
> index 8ca33d9806ac..4bf8223555cd 100644
> --- a/arch/x86/kernel/ftrace_32.S
> +++ b/arch/x86/kernel/ftrace_32.S
> @@ -9,27 +9,75 @@
>  #include <asm/export.h>
>  #include <asm/ftrace.h>
>  
> +
> +#ifdef CC_USING_FENTRY
> +# define function_hook	__fentry__
> +EXPORT_SYMBOL(__fentry__)
> +#else
> +# define function_hook	mcount
> +EXPORT_SYMBOL(mcount)
> +#endif
> +
> +/* mcount uses a frame pointer even if CONFIG_FRAME_POINTER is not set */
> +#if !defined(CC_USING_FENTRY) || defined(CONFIG_FRAME_POINTER)
> +# define USING_FRAME_POINTER
> +#endif
> +
> +#ifdef USING_FRAME_POINTER
> +# ifdef CC_USING_FENTRY
> +#  define MCOUNT_FRAME_SIZE		(4*4)	/* bp,ip and parent's  */
> +# else
> +#  define MCOUNT_FRAME_SIZE		4	/* just the bp         */
> +# endif
> +# define MCOUNT_FRAME			1	/* using frame = true  */
> +#else
> +# define MCOUNT_FRAME_SIZE		0	/* no stack frame      */
> +# define MCOUNT_FRAME			0	/* using frame = false */
> +#endif

It seems that there is no use of MCOUNT_FRAME_SIZE below. Do we really need it?

Thanks,

-- 
Masami Hiramatsu <mhiramat@kernel.org>

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC][PATCH 0/5] ftrace/x86_32: Ftrace cleanup and add support for -mfentry Steven Rostedt <rostedt@goodmis.org> - 2017-03-15 21:20 +0100
  [RFC][PATCH 2/5] ftrace/x86-32: Move the ftrace specific code out of entry_32.S Steven Rostedt <rostedt@goodmis.org> - 2017-03-15 21:20 +0100
  [RFC][PATCH 5/5] ftrace/x86-32: Add -mfentry support to x86_32 with DYNAMIC_FTRACE set Steven Rostedt <rostedt@goodmis.org> - 2017-03-15 21:20 +0100
    Re: [RFC][PATCH 5/5] ftrace/x86-32: Add -mfentry support to x86_32  with DYNAMIC_FTRACE set Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-15 23:00 +0100
      Re: [RFC][PATCH 5/5] ftrace/x86-32: Add -mfentry support to x86_32  with DYNAMIC_FTRACE set Steven Rostedt <rostedt@goodmis.org> - 2017-03-16 00:20 +0100
    Re: [RFC][PATCH 5/5] ftrace/x86-32: Add -mfentry support to x86_32  with DYNAMIC_FTRACE set Masami Hiramatsu <mhiramat@kernel.org> - 2017-03-16 10:30 +0100
      Re: [RFC][PATCH 5/5] ftrace/x86-32: Add -mfentry support to x86_32  with DYNAMIC_FTRACE set Steven Rostedt <rostedt@goodmis.org> - 2017-03-16 14:10 +0100
  [RFC][PATCH 4/5] ftrace/x86_32: Clean up ftrace_regs_caller Steven Rostedt <rostedt@goodmis.org> - 2017-03-15 21:20 +0100
    Re: [RFC][PATCH 4/5] ftrace/x86_32: Clean up ftrace_regs_caller Josh Poimboeuf <jpoimboe@redhat.com> - 2017-03-15 22:20 +0100
      Re: [RFC][PATCH 4/5] ftrace/x86_32: Clean up ftrace_regs_caller Steven Rostedt <rostedt@goodmis.org> - 2017-03-16 00:20 +0100
        Re: [RFC][PATCH 4/5] ftrace/x86_32: Clean up ftrace_regs_caller Masami Hiramatsu <mhiramat@kernel.org> - 2017-03-16 09:40 +0100

csiph-web