Re: [PATCHv2 2/8] module/ftrace: handle patchable-function-entry

From: Mark Rutland
Date: Thu Oct 31 2019 - 09:00:31 EST


On Thu, Oct 31, 2019 at 12:42:23PM +0100, Torsten Duwe wrote:
> On Thu, Oct 31, 2019 at 09:02:32AM +0000, Mark Rutland wrote:
> > I agree that the CC_USING_PATCHABLE_FUNCTION_ENTRY ifdeffery could be
> > simplified, and that it would be nice to consistently use
> > FTRACE_CALLSITE_SECTION if we can. However, the generic linker script doesn't
> > include anything, and I don't see a good location for that to live.
> >
> > What I could do is add an explicit comment:
> >
> > /*
> > * The ftrace call sites are logged to a section whose name depends on the
> > * compiler option used. A given kernel image will only use one, AKA
> > * FTRACE_CALLSITE_SECTION. We capture all of them here to avoid header
> > * dependencies.
> > */
> > #define MCOUNT_REC() \
> > . = ALIGN(8); \
> > __start_mcount_loc = .; \
> > KEEP(*(__patchable_function_entries)) \
> > KEEP(*(__mcount_loc)) \
> > __stop_mcount_loc = .;
> >
> > ... which should make the dependency clear. Does that sound good to you?
>
> Beautiful. I just didn't want to miss the opportunity to have this cleaned
> up as well, and deemed this patch "closest" because of the definition of
> FTRACE_CALLSITE_SECTION. Put it where you see it fit best.

Sure. I've folded the above into this patch, and pushed out an updated branch:

https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/log/?h=arm64/ftrace-with-regs

Thanks,
Mark.