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

From: Steven Rostedt
Date: Thu May 09 2019 - 22:38:52 EST


On Thu, 9 May 2019 15:49:02 -0400
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> diff --git a/arch/x86/include/asm/ftrace.h b/arch/x86/include/asm/ftrace.h
> index cf350639e76d..287f1f7b2e52 100644
> --- a/arch/x86/include/asm/ftrace.h
> +++ b/arch/x86/include/asm/ftrace.h
> @@ -3,12 +3,10 @@
> #define _ASM_X86_FTRACE_H
>
> #ifdef CONFIG_FUNCTION_TRACER
> -#ifdef CC_USING_FENTRY
> -# define MCOUNT_ADDR ((unsigned long)(__fentry__))
> -#else
> -# define MCOUNT_ADDR ((unsigned long)(mcount))
> -# define HAVE_FUNCTION_GRAPH_FP_TEST
> +#ifndef CC_USING_FENTRY
> +# error Compiler does not support fentry?
> #endif
> +# define MCOUNT_ADDR ((unsigned long)(__fentry__))
> #define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */
>
> #ifdef CONFIG_DYNAMIC_FTRACE

Failed my tests. :-(

In arch/x86/Kconfig ...

select HAVE_FENTRY if X86_64 || DYNAMIC_FTRACE


Bah! I need to work a little on this patch.

I need to implement fentry in the !DYNAMIC_FTRACE code of x86_32 first.
Shouldn't be too hard, but still.

I could also just force DYNAMIC_FTRACE to be 'y' for x86_32 if
CONFIG_FUNCTION_TRACER is set. The only reason I still support static
FTRACE on x86 is because I use it to test !DYNAMIC_FTRACE generic code,
because there's still some archs that only support the !DYNAMIC_FTRACE
function tracer.

-- Steve