Re: [RFC] ftrace: Add support to keep some functions out of ftrace

Steven Rostedt
2022-08-12T21:50:53Z

On Fri, 12 Aug 2022 23:18:15 +0200
Jiri Olsa <olsajiri@gmail.com> wrote:

> the patch below moves the bpf function into sepatate object and switches
> off the -mrecord-mcount for it.. so the function gets profile call
> generated but it's not visible to ftrace
>
> this seems to work, but it depends on -mrecord-mcount support in gcc and
> it's x86 specific... other archs seems to use -fpatchable-function-entry,
> which does not seem to have option to omit symbol from being collected
> to the section
>
> disabling specific ftrace symbol with FTRACE_FL_DISABLED flag seems to
> be easir and generic solution.. I'll send RFC for that

No, please don't.

I could help you with recordmcount (which creates the .mcount_loc
locations when -mrecordmcount is not enabled) and remove it for you.

I still want this solution over the easy-way-out that can lead to half
of the kernel being hidden from ftrace.

This is the point that I made about fentry == ftrace. Because we did
the hard part to make fentry work. That included creating sections that
point to them.

All your patch needs is to tell the build not to run recordmcount on
the file. Remember that perl script I wrote? It (and the C version) is
what creates the mcount_loc location that you need to hide these files from.

-- Steve