Re: [RFC][PATCH] ftrace/x86: Remove mcount support

From: Josh Poimboeuf
Date: Thu May 09 2019 - 16:15:52 EST


On Thu, May 09, 2019 at 03:49:02PM -0400, Steven Rostedt wrote:
>
> From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx>
>
> There's two methods of enabling function tracing in Linux on x86. One is
> with just "gcc -pg" and the other is "gcc -pg -mfentry". The former will use
> calls to a special function "mcount" after the frame is set up in all C
> functions. The latter will add calls to a special function called "fentry"
> as the very first instruction of all C functions.
>
> At compile time, there is a check to see if gcc supports, -mfentry, and if
> it does, it will use that, because it is more versatile and less error prone
> for function tracing.
>
> Starting with v4.19, the minimum gcc supported to build the Linux kernel,
> was raised to version 4.6. That also happens to be the first gcc version to
> support -mfentry. Since on x86, using gcc versions from 4.6 and beyond will
> unconditionally enable the -mfentry, it will no longer use mcount as the
> method for inserting calls into the C functions of the kernel. This means
> that there is no point in continuing to maintain mcount in x86.
>
> Remove support for using mcount. This makes the code less complex, and will
> also allow it to be simplified in the future.
>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
> ---
> arch/x86/include/asm/ftrace.h | 8 +++----
> arch/x86/include/asm/livepatch.h | 3 ---
> arch/x86/kernel/ftrace_32.S | 36 +++++---------------------------
> arch/x86/kernel/ftrace_64.S | 28 +------------------------
> 4 files changed, 9 insertions(+), 66 deletions(-)

I was wondering why you didn't do s/mcount/fentry/ everywhere, but I
guess it's because mcount is still used by other arches, so it still has
a generic meaning tree-wide, right?

Anyway it's nice to finally see this cruft disappear.

Acked-by: Josh Poimboeuf <jpoimboe@xxxxxxxxxx>

--
Josh