[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f8dcb3dd-a8a6-5326-ea4a-bea2eb1c4651@suse.cz>
Date: Tue, 22 Oct 2019 13:38:42 +0200
From: Jiri Slaby <jslaby@...e.cz>
To: Borislav Petkov <bp@...en8.de>,
Steven Rostedt <rostedt@...dmis.org>
Cc: tip-bot2 for Jiri Slaby <tip-bot2@...utronix.de>,
linux-kernel@...r.kernel.org, linux-tip-commits@...r.kernel.org,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Josh Poimboeuf <jpoimboe@...hat.com>,
linux-arch@...r.kernel.org, Masami Hiramatsu <mhiramat@...nel.org>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>, x86-ml <x86@...nel.org>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH] x86/ftrace: Get rid of function_hook
On 21. 10. 19, 16:10, Borislav Petkov wrote:
> From: Borislav Petkov <bp@...e.de>
>
> function_hook is used as a better name than the default __fentry__
> which is the profiling counter which gcc adds before every function's
> prologue. Thus, it is not called from C and cannot have the same
> semantics as a pure C function - it saves/restores regs so that a C
> function can be called.
>
> Drop the function_hook symbol and use __fentry__ directly for better
> alignment with gcc's documentation.
>
> Switch the marking to SYM_CODE_START/_END which is reserved for
> non-standard, special functions.
>
> Signed-off-by: Borislav Petkov <bp@...e.de>
> Cc: "H. Peter Anvin" <hpa@...or.com>
> Cc: Ingo Molnar <mingo@...hat.com>
> Cc: Jiri Slaby <jslaby@...e.cz>
On the top of Steven's comment:
Acked-by: Jiri Slaby <jslaby@...e.cz>
Thanks for taking care of this while my tooth was causing me pain.
> Cc: Jonathan Corbet <corbet@....net>
> Cc: Josh Poimboeuf <jpoimboe@...hat.com>
> Cc: linux-doc@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: "Steven Rostedt (VMware)" <rostedt@...dmis.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: x86@...nel.org
> ---
> Documentation/asm-annotations.rst | 4 ++--
> arch/x86/kernel/ftrace_32.S | 8 +++-----
> arch/x86/kernel/ftrace_64.S | 13 ++++++-------
> 3 files changed, 11 insertions(+), 14 deletions(-)
>
> diff --git a/Documentation/asm-annotations.rst b/Documentation/asm-annotations.rst
> index 29ccd6e61fe5..f55c2bb74d00 100644
> --- a/Documentation/asm-annotations.rst
> +++ b/Documentation/asm-annotations.rst
> @@ -117,9 +117,9 @@ This section covers ``SYM_FUNC_*`` and ``SYM_CODE_*`` enumerated above.
> So in most cases, developers should write something like in the following
> example, having some asm instructions in between the macros, of course::
>
> - SYM_FUNC_START(function_hook)
> + SYM_FUNC_START(memset)
> ... asm insns ...
> - SYM_FUNC_END(function_hook)
> + SYM_FUNC_END(memset)
>
> In fact, this kind of annotation corresponds to the now deprecated ``ENTRY``
> and ``ENDPROC`` macros.
> diff --git a/arch/x86/kernel/ftrace_32.S b/arch/x86/kernel/ftrace_32.S
> index 8ed1f5d371f0..77be7e7e5e59 100644
> --- a/arch/x86/kernel/ftrace_32.S
> +++ b/arch/x86/kernel/ftrace_32.S
> @@ -12,18 +12,16 @@
> #include <asm/frame.h>
> #include <asm/asm-offsets.h>
>
> -# define function_hook __fentry__
> -EXPORT_SYMBOL(__fentry__)
> -
> #ifdef CONFIG_FRAME_POINTER
> # define MCOUNT_FRAME 1 /* using frame = true */
> #else
> # define MCOUNT_FRAME 0 /* using frame = false */
> #endif
>
> -SYM_FUNC_START(function_hook)
> +SYM_CODE_START(__fentry__)
> ret
> -SYM_FUNC_END(function_hook)
> +SYM_CODE_END(__fentry__)
> +EXPORT_SYMBOL(__fentry__)
>
> SYM_CODE_START(ftrace_caller)
>
> diff --git a/arch/x86/kernel/ftrace_64.S b/arch/x86/kernel/ftrace_64.S
> index 69c8d1b9119e..3029fe4f8547 100644
> --- a/arch/x86/kernel/ftrace_64.S
> +++ b/arch/x86/kernel/ftrace_64.S
> @@ -14,9 +14,6 @@
> .code64
> .section .entry.text, "ax"
>
> -# define function_hook __fentry__
> -EXPORT_SYMBOL(__fentry__)
> -
> #ifdef CONFIG_FRAME_POINTER
> /* Save parent and function stack frames (rip and rbp) */
> # define MCOUNT_FRAME_SIZE (8+16*2)
> @@ -132,9 +129,10 @@ EXPORT_SYMBOL(__fentry__)
>
> #ifdef CONFIG_DYNAMIC_FTRACE
>
> -SYM_FUNC_START(function_hook)
> +SYM_CODE_START(__fentry__)
> retq
> -SYM_FUNC_END(function_hook)
> +SYM_CODE_END(__fentry__)
> +EXPORT_SYMBOL(__fentry__)
>
> SYM_FUNC_START(ftrace_caller)
> /* save_mcount_regs fills in first two parameters */
> @@ -248,7 +246,7 @@ SYM_FUNC_END(ftrace_regs_caller)
>
> #else /* ! CONFIG_DYNAMIC_FTRACE */
>
> -SYM_FUNC_START(function_hook)
> +SYM_CODE_START(__fentry__)
> cmpq $ftrace_stub, ftrace_trace_function
> jnz trace
>
> @@ -279,7 +277,8 @@ trace:
> restore_mcount_regs
>
> jmp fgraph_trace
> -SYM_FUNC_END(function_hook)
> +SYM_CODE_END(__fentry__)
> +EXPORT_SYMBOL(__fentry__)
> #endif /* CONFIG_DYNAMIC_FTRACE */
>
> #ifdef CONFIG_FUNCTION_GRAPH_TRACER
>
--
js
suse labs
Powered by blists - more mailing lists