mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andy Lutomirski <luto@amacapital.net>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [RFC][PATCH 5/5] ftrace/x86-32: Add -mfentry support to x86_32 with DYNAMIC_FTRACE set
Date: Thu, 16 Mar 2017 18:24:12 +0900	[thread overview]
Message-ID: <20170316182412.965a091f2721062b21556da7@kernel.org> (raw)
In-Reply-To: <20170315200255.828608428@goodmis.org>

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>

  parent reply	other threads:[~2017-03-16  9:24 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-15 19:55 [RFC][PATCH 0/5] ftrace/x86_32: Ftrace cleanup and add support for -mfentry Steven Rostedt
2017-03-15 19:55 ` [RFC][PATCH 1/5] x86/ftrace: Rename mcount_64.S to ftrace.S Steven Rostedt
2017-03-15 19:55 ` [RFC][PATCH 2/5] ftrace/x86-32: Move the ftrace specific code out of entry_32.S Steven Rostedt
2017-03-15 19:55 ` [RFC][PATCH 3/5] ftrace/x86_32: Add stack frame pointer to ftrace_caller Steven Rostedt
2017-03-15 21:13   ` Josh Poimboeuf
2017-03-15 19:55 ` [RFC][PATCH 4/5] ftrace/x86_32: Clean up ftrace_regs_caller Steven Rostedt
2017-03-15 21:13   ` Josh Poimboeuf
2017-03-15 23:11     ` Steven Rostedt
2017-03-16  8:39       ` Masami Hiramatsu
2017-03-15 19:55 ` [RFC][PATCH 5/5] ftrace/x86-32: Add -mfentry support to x86_32 with DYNAMIC_FTRACE set Steven Rostedt
2017-03-15 21:55   ` Josh Poimboeuf
2017-03-15 23:13     ` Steven Rostedt
2017-03-16  9:24   ` Masami Hiramatsu [this message]
2017-03-16 13:02     ` Steven Rostedt

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=20170316182412.965a091f2721062b21556da7@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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

all inboxes | Powered by JetHome®