Re: [PATCH v4 06/15] ftrace: Use an opaque type for functions not callable from C

From: Sami Tolvanen
Date: Wed Oct 06 2021 - 19:14:36 EST


On Wed, Oct 6, 2021 at 2:24 PM Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
>
> On Wed, Oct 06, 2021 at 05:10:16PM -0400, Steven Rostedt wrote:
> > On Wed, 6 Oct 2021 13:43:35 -0700
> > Josh Poimboeuf <jpoimboe@xxxxxxxxxx> wrote:
> >
> > > On Wed, Oct 06, 2021 at 10:45:41AM -0700, Sami Tolvanen wrote:
> > > > On Wed, Oct 6, 2021 at 9:58 AM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> > > > >
> > > > > On Wed, 6 Oct 2021 09:31:04 -0700
> > > > > Sami Tolvanen <samitolvanen@xxxxxxxxxx> wrote:
> > > > >
> > > > > > > > On Thu, Sep 30, 2021 at 11:05:22AM -0700, Sami Tolvanen wrote:
> > > > > > > > > With CONFIG_CFI_CLANG, the compiler changes function references to point
> > > > > > > > > to the CFI jump table. As ftrace_call, ftrace_regs_call, and mcount_call
> > > > > > > > > are not called from C, use DECLARE_ASM_FUNC_SYMBOL to declare them.
> > > > > > >
> > > > > > > "not called from C" is a bit confusing.
> > > > > >
> > > > > > Any thoughts on how to make this less confusing?
> > > > >
> > > > > "Not called by C code, but injected by the compiler."
> > > > >
> > > > > ?
> > > >
> > > > Sure, sounds good to me. I'll update this in v5.
> > >
> > > "injected by the compiler" sounds even more confusing. It almost sounds
> > > like those functions are generated by GCC, which they are most
> > > definitely not.
> > >
> >
> > Heh, I was thinking of the locations that are injected (mcount / fentry) as
> > these are just replacements for them. Those injections are added by GCC.
> >
> > So, continuing the bikeshedding, what about "not called by C code, but are
> > trampolines injected as calls replacing the nops at the start of
> > functions added by the compiler." ?
>
> I'm not quite sure what that means, but I'll allow it ;-)

Alright, I'll go with the updated version then. I'll also rename
DECLARE_ASM_FUNC_SYMBOL() to DECLARE_NOT_CALLED_FROM_C() unless
someone has strong objections about that.

Sami