All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King - ARM Linux <linux@armlinux.org.uk>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	 Steven Rostedt <rostedt@goodmis.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	 Cristian Marussi <cristian.marussi@arm.com>,
	Nathan Chancellor <nathan@kernel.org>,
	 Nick Desaulniers <ndesaulniers@google.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	 Masami Hiramatsu <mhiramat@kernel.org>
Subject: Re: [PATCH v3 08/13] ARM: ftrace: enable the graph tracer with the EABI unwinder
Date: Thu, 3 Feb 2022 10:41:59 +0100	[thread overview]
Message-ID: <CAMj1kXG6TAigN15gAKx-7eWjFLTX+Tj3Ksum-T9mXTKdMazAGA@mail.gmail.com> (raw)
In-Reply-To: <CAK8P3a0j1Y9pEDVGG0aQx3iKs8zUjpaz2YmbJnfuA5vPOnbaaA@mail.gmail.com>

On Thu, 3 Feb 2022 at 10:17, Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Thu, Feb 3, 2022 at 9:21 AM Ard Biesheuvel <ardb@kernel.org> wrote:
> >
> > Enable the function graph tracer in combination with the EABI unwinder,
> > so that Thumb2 builds or Clang ARM builds can make use of it.
> >
> > This involves using the unwinder to locate the return address of an
> > instrumented function on the stack, so that it can be overridden and
> > made to refer to the ftrace handling routines that need to be called at
> > function return.
> >
> > Given that for these builds, it is not guaranteed that the value of the
> > link register is stored on the stack, fall back to the stack slot that
> > will be used by the ftrace exit code to restore LR in the instrumented
> > function's execution context.
> >
> > Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
> > Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
>
> > diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
> > index 07055a503022..cc7523f44be4 100644
> > --- a/arch/arm/Kconfig.debug
> > +++ b/arch/arm/Kconfig.debug
> > @@ -65,7 +65,7 @@ config UNWINDER_FRAME_POINTER
> >
> >  config UNWINDER_ARM
> >         bool "ARM EABI stack unwinder"
> > -       depends on AEABI && !FUNCTION_GRAPH_TRACER
> > +       depends on AEABI
> >         # https://github.com/ClangBuiltLinux/linux/issues/732
> >         depends on !LD_IS_LLD || LLD_VERSION >= 110000
> >         select ARM_UNWIND
>
> What are the remaining tradeoffs between the two unwinders
> on EABI kernels?

The frame pointer based stack tracer dumps the values of the registers
at each level, by decoding the instructions that push them onto the
stack in the prologue. And the frame pointer unwinder is generally a
bit more robust.

> Since we require llvm-11 as the minimum
> toolchain now, we can probably drop the LLD_VERSION
> check here as well, so UNWINDER_ARM should finally work
> for any EABI kernel.
>

Indeed.

> According to the help text, the main downside is a small size
> increase that I've measured at under 1% in multi_v7_defconfig,
> however that seems to be far outweighed by allowing thumb2
> kernels that reduce the size by 15% in the same config.
>

Yeah the EABI format unwind info is a bit more compact than DWARF, so
the size is manageable. I saw a ~30% reduction in .text size, so 15%
for the core kernel is probably accurate, but it is likely a bit
better for modules (modulo the rounding to page size, of course)

> Are there any other reasons for keeping the frame pointer
> unwinder as a normal option for ARMv7?
>

Just the points mentioned above

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

  reply	other threads:[~2022-02-03  9:43 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-03  8:21 [PATCH v3 00/13] ARM: ftrace fixes and cleanups Ard Biesheuvel
2022-02-03  8:21 ` [PATCH v3 01/13] ARM: ftrace: ensure that ADR takes the Thumb bit into account Ard Biesheuvel
2022-02-03  8:21 ` [PATCH v3 02/13] ARM: ftrace: use ADD not POP to counter PUSH at entry Ard Biesheuvel
2022-02-03  8:21 ` [PATCH v3 03/13] ARM: ftrace: use trampolines to keep .init.text in branching range Ard Biesheuvel
2022-02-03  8:21 ` [PATCH v3 04/13] ARM: ftrace: avoid redundant loads or clobbering IP Ard Biesheuvel
2022-02-03  8:21 ` [PATCH v3 05/13] ARM: ftrace: avoid unnecessary literal loads Ard Biesheuvel
2022-02-03  8:21 ` [PATCH v3 06/13] ARM: ftrace: enable HAVE_FUNCTION_GRAPH_FP_TEST Ard Biesheuvel
2022-02-03  8:21 ` [PATCH v3 07/13] ARM: unwind: track location of LR value in stack frame Ard Biesheuvel
2022-02-07 18:14   ` Nick Desaulniers
2022-02-03  8:21 ` [PATCH v3 08/13] ARM: ftrace: enable the graph tracer with the EABI unwinder Ard Biesheuvel
2022-02-03  9:16   ` Arnd Bergmann
2022-02-03  9:41     ` Ard Biesheuvel [this message]
2022-02-03 16:09     ` Nathan Chancellor
2022-02-03 16:11       ` Ard Biesheuvel
2022-02-03  8:22 ` [PATCH v3 09/13] ARM: kprobes: treat R7 as the frame pointer register in Thumb2 builds Ard Biesheuvel
2022-02-03  8:22 ` [PATCH v3 10/13] drivers/firmware/scmi: disable ftrace for Clang " Ard Biesheuvel
2022-02-07 18:28   ` Sudeep Holla
2022-02-08 21:18     ` Ard Biesheuvel
2022-02-11  9:56   ` Sudeep Holla
2022-02-03  8:22 ` [PATCH v3 11/13] ARM: cacheflush: avoid clobbering the frame pointer Ard Biesheuvel
2022-02-07 19:12   ` Nick Desaulniers
2022-02-08 10:08     ` Ard Biesheuvel
2022-02-08 22:34       ` Nick Desaulniers
2022-02-08 22:39         ` Nick Desaulniers
2022-02-03  8:22 ` [PATCH v3 12/13] ARM: mach-bcm: disable ftrace in SMC invocation routines Ard Biesheuvel
2022-02-03 20:39   ` Nick Desaulniers
2022-02-03  8:22 ` [PATCH v3 13/13] Revert "ARM: 9144/1: forbid ftrace with clang and thumb2_kernel" Ard Biesheuvel

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=CAMj1kXG6TAigN15gAKx-7eWjFLTX+Tj3Ksum-T9mXTKdMazAGA@mail.gmail.com \
    --to=ardb@kernel.org \
    --cc=arnd@arndb.de \
    --cc=cristian.marussi@arm.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@armlinux.org.uk \
    --cc=mhiramat@kernel.org \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=rostedt@goodmis.org \
    --cc=sudeep.holla@arm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.