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

From: Mark Rutland
Date: Mon Nov 04 2019 - 09:00:28 EST


On Mon, Nov 04, 2019 at 08:28:10AM -0500, Steven Rostedt wrote:
> On Thu, 31 Oct 2019 13:00:22 +0000
> Mark Rutland <mark.rutland@xxxxxxx> wrote:
>
> > 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
>
> Just to keep this change in lore, can you at a minimum reply to this
> patch's thread with the new update?

The new change is below (with all else unchanged). I can send a v3 of
the series if you want the whole patch?

Thanks,
Mark.

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index dae64600ccbf..a9c4e4721434 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -110,17 +110,17 @@
#endif

#ifdef CONFIG_FTRACE_MCOUNT_RECORD
-#ifdef CC_USING_PATCHABLE_FUNCTION_ENTRY
-#define MCOUNT_REC() . = ALIGN(8); \
- __start_mcount_loc = .; \
- KEEP(*(__patchable_function_entries)) \
- __stop_mcount_loc = .;
-#else
+/*
+ * 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 for FTRACE_CALLSITE_SECTION's definition.
+ */
#define MCOUNT_REC() . = ALIGN(8); \
__start_mcount_loc = .; \
KEEP(*(__mcount_loc)) \
+ KEEP(*(__patchable_function_entries)) \
__stop_mcount_loc = .;
-#endif
#else
#define MCOUNT_REC()
#endif