linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ftrace: Be more specific about arch impact when function tracer is enabled
@ 2022-07-06 20:12 Steven Rostedt
  2022-07-11 10:58 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2022-07-06 20:12 UTC (permalink / raw)
  To: LKML; +Cc: Ingo Molnar, Andrew Morton, Sascha Hauer, linux-arm-kernel

From: Steven Rostedt (Google) <rostedt@goodmis.org>

It was brought up that on ARMv7, that because the FUNCTION_TRACER does not
use nops to keep function tracing disabled because of the use of a link
register, it does have some performance impact.

The start of functions when -pg is used to compile the kernel is:

	push    {lr}
	bl      8010e7c0 <__gnu_mcount_nc>

When function tracing is tuned off, it becomes:

	push    {lr}
	add   sp, sp, #4

Which just puts the stack back to its normal location. But these two
instructions at the start of every function does incur some overhead.

Be more honest in the Kconfig FUNCTION_TRACER description and specify that
the overhead being in the noise was x86 specific, but other architectures
may vary.

Link: https://lore.kernel.org/all/20220705105416.GE5208@pengutronix.de/

Reported-by: Sascha Hauer <sha@pengutronix.de>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index debbbb083286..ccd6a5ade3e9 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -194,7 +194,8 @@ config FUNCTION_TRACER
 	  sequence is then dynamically patched into a tracer call when
 	  tracing is enabled by the administrator. If it's runtime disabled
 	  (the bootup default), then the overhead of the instructions is very
-	  small and not measurable even in micro-benchmarks.
+	  small and not measurable even in micro-benchmarks (at least on
+	  x86, but may have impact on other architectures).
 
 config FUNCTION_GRAPH_TRACER
 	bool "Kernel Function Graph Tracer"

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ftrace: Be more specific about arch impact when function tracer is enabled
  2022-07-06 20:12 [PATCH] ftrace: Be more specific about arch impact when function tracer is enabled Steven Rostedt
@ 2022-07-11 10:58 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2022-07-11 10:58 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: LKML, Ingo Molnar, Andrew Morton, linux-arm-kernel

On Wed, Jul 06, 2022 at 04:12:31PM -0400, Steven Rostedt wrote:
> From: Steven Rostedt (Google) <rostedt@goodmis.org>
> 
> It was brought up that on ARMv7, that because the FUNCTION_TRACER does not
> use nops to keep function tracing disabled because of the use of a link
> register, it does have some performance impact.
> 
> The start of functions when -pg is used to compile the kernel is:
> 
> 	push    {lr}
> 	bl      8010e7c0 <__gnu_mcount_nc>
> 
> When function tracing is tuned off, it becomes:
> 
> 	push    {lr}
> 	add   sp, sp, #4
> 
> Which just puts the stack back to its normal location. But these two
> instructions at the start of every function does incur some overhead.
> 
> Be more honest in the Kconfig FUNCTION_TRACER description and specify that
> the overhead being in the noise was x86 specific, but other architectures
> may vary.
> 
> Link: https://lore.kernel.org/all/20220705105416.GE5208@pengutronix.de/
> 
> Reported-by: Sascha Hauer <sha@pengutronix.de>
> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
> ---

Thanks Steven

Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

Sascha

> diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
> index debbbb083286..ccd6a5ade3e9 100644
> --- a/kernel/trace/Kconfig
> +++ b/kernel/trace/Kconfig
> @@ -194,7 +194,8 @@ config FUNCTION_TRACER
>  	  sequence is then dynamically patched into a tracer call when
>  	  tracing is enabled by the administrator. If it's runtime disabled
>  	  (the bootup default), then the overhead of the instructions is very
> -	  small and not measurable even in micro-benchmarks.
> +	  small and not measurable even in micro-benchmarks (at least on
> +	  x86, but may have impact on other architectures).
>  
>  config FUNCTION_GRAPH_TRACER
>  	bool "Kernel Function Graph Tracer"
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-11 10:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-06 20:12 [PATCH] ftrace: Be more specific about arch impact when function tracer is enabled Steven Rostedt
2022-07-11 10:58 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).