]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
tracing: Remove redundant config HAVE_FTRACE_MCOUNT_RECORD
authorSteven Rostedt <rostedt@goodmis.org>
Fri, 4 Jul 2025 14:48:38 +0000 (10:48 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 23 Jul 2025 00:15:56 +0000 (20:15 -0400)
Ftrace is tightly coupled with architecture specific code because it
requires the use of trampolines written in assembly. This means that when
a new feature or optimization is made, it must be done for all
architectures. To simplify the approach, CONFIG_HAVE_FTRACE_* configs are
added to denote which architecture has the new enhancement so that other
architectures can still function until they too have been updated.

The CONFIG_HAVE_FTRACE_MCOUNT was added to help simplify the
DYNAMIC_FTRACE work, but now every architecture that implements
DYNAMIC_FTRACE also has HAVE_FTRACE_MCOUNT set too, making it redundant
with the HAVE_DYNAMIC_FTRACE.

Remove the HAVE_FTRACE_MCOUNT config and use DYNAMIC_FTRACE directly where
applicable.

Link: https://lore.kernel.org/all/20250703154916.48e3ada7@gandalf.local.home/
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/20250704104838.27a18690@gandalf.local.home
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
22 files changed:
Documentation/trace/ftrace-design.rst
arch/arm/Kconfig
arch/arm64/Kconfig
arch/csky/Kconfig
arch/loongarch/Kconfig
arch/microblaze/Kconfig
arch/mips/Kconfig
arch/parisc/Kconfig
arch/powerpc/Kconfig
arch/riscv/Kconfig
arch/s390/Kconfig
arch/sh/Kconfig
arch/sparc/Kconfig
arch/x86/Kconfig
include/asm-generic/vmlinux.lds.h
include/linux/ftrace.h
include/linux/kernel.h
include/linux/module.h
kernel/module/main.c
kernel/trace/Kconfig
kernel/trace/ftrace.c
scripts/recordmcount.pl

index dc82d64b3a44bdd23677fb55780d5bd4b7a4646c..8f4fab3f932490317972db1a5c45ebd68bee7df3 100644 (file)
@@ -238,19 +238,15 @@ You need very few things to get the syscalls tracing in an arch.
   - Tag this arch as HAVE_SYSCALL_TRACEPOINTS.
 
 
-HAVE_FTRACE_MCOUNT_RECORD
--------------------------
+HAVE_DYNAMIC_FTRACE
+-------------------
 
 See scripts/recordmcount.pl for more info.  Just fill in the arch-specific
 details for how to locate the addresses of mcount call sites via objdump.
 This option doesn't make much sense without also implementing dynamic ftrace.
 
-
-HAVE_DYNAMIC_FTRACE
--------------------
-
-You will first need HAVE_FTRACE_MCOUNT_RECORD and HAVE_FUNCTION_TRACER, so
-scroll your reader back up if you got over eager.
+You will first need HAVE_FUNCTION_TRACER, so scroll your reader back up if you
+got over eager.
 
 Once those are out of the way, you will need to implement:
        - asm/ftrace.h:
index 3072731fe09c5911996d2e5fcc384c424f72f638..33cc9dbb7f68d20d82e850461227257b6829dd55 100644 (file)
@@ -107,7 +107,6 @@ config ARM
        select HAVE_EFFICIENT_UNALIGNED_ACCESS if (CPU_V6 || CPU_V6K || CPU_V7) && MMU
        select HAVE_EXIT_THREAD
        select HAVE_GUP_FAST if ARM_LPAE
-       select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
        select HAVE_FUNCTION_ERROR_INJECTION
        select HAVE_FUNCTION_GRAPH_TRACER
        select HAVE_FUNCTION_TRACER if !XIP_KERNEL
index 55fc331af3371660ede7f83d43e1c4425dcf6b10..f943a07db139d7418ee2a503e24f0d1d51ae5d9b 100644 (file)
@@ -223,7 +223,6 @@ config ARM64
        select HAVE_EFFICIENT_UNALIGNED_ACCESS
        select HAVE_GUP_FAST
        select HAVE_FTRACE_GRAPH_FUNC
-       select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_FUNCTION_TRACER
        select HAVE_FUNCTION_ERROR_INJECTION
        select HAVE_FUNCTION_GRAPH_FREGS
index acc431c331b08eca0c853e96ead44478d99257dd..4331313a42ff307568f07ef195e51112f6d280bd 100644 (file)
@@ -80,7 +80,6 @@ config CSKY
        select HAVE_FUNCTION_TRACER
        select HAVE_FUNCTION_GRAPH_TRACER
        select HAVE_FUNCTION_ERROR_INJECTION
-       select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_KERNEL_GZIP
        select HAVE_KERNEL_LZO
        select HAVE_KERNEL_LZMA
index 4b19f93379a15336e0d13626accf57a5884306a3..bead8266dc5ccd60a343671d659be35cfbaa0f6b 100644 (file)
@@ -144,7 +144,6 @@ config LOONGARCH
        select HAVE_EXIT_THREAD
        select HAVE_GUP_FAST
        select HAVE_FTRACE_GRAPH_FUNC
-       select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_FUNCTION_ARG_ACCESS_API
        select HAVE_FUNCTION_ERROR_INJECTION
        select HAVE_FUNCTION_GRAPH_FREGS
index f18ec02ddeb2335150ee5b0ae9adb4342806aa3b..484ebb3baedf158fad6c25956b355593b71ddb90 100644 (file)
@@ -28,7 +28,6 @@ config MICROBLAZE
        select HAVE_DEBUG_KMEMLEAK
        select HAVE_DMA_CONTIGUOUS
        select HAVE_DYNAMIC_FTRACE
-       select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_FUNCTION_GRAPH_TRACER
        select HAVE_FUNCTION_TRACER
        select HAVE_PAGE_SIZE_4KB
index 1e48184ecf1ec8e29c0a25de6452ece5da835e30..268730824f75a3bf7f74f8fab601ca875dcfc49a 100644 (file)
@@ -73,7 +73,6 @@ config MIPS
        select HAVE_EBPF_JIT if !CPU_MICROMIPS
        select HAVE_EXIT_THREAD
        select HAVE_GUP_FAST
-       select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_FUNCTION_GRAPH_TRACER
        select HAVE_FUNCTION_TRACER
        select HAVE_GCC_PLUGINS
index fcc5973f75195ae12e37826a05afa8d9a56867b8..2efa4b08b7b841aa75cbfb1045d3bc47778a4cd4 100644 (file)
@@ -81,7 +81,6 @@ config PARISC
        select HAVE_KPROBES
        select HAVE_KRETPROBES
        select HAVE_DYNAMIC_FTRACE if $(cc-option,-fpatchable-function-entry=1,1)
-       select HAVE_FTRACE_MCOUNT_RECORD if HAVE_DYNAMIC_FTRACE
        select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY if DYNAMIC_FTRACE
        select HAVE_KPROBES_ON_FTRACE
        select HAVE_DYNAMIC_FTRACE_WITH_REGS
index c3e0cc83f1205e2bc72ff3dbc6a89cc0a47af960..cb4fb8d733004a79f326c53978c8f3097428621a 100644 (file)
@@ -246,7 +246,6 @@ config PPC
        select HAVE_EFFICIENT_UNALIGNED_ACCESS
        select HAVE_GUP_FAST
        select HAVE_FTRACE_GRAPH_FUNC
-       select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_FUNCTION_ARG_ACCESS_API
        select HAVE_FUNCTION_DESCRIPTORS        if PPC64_ELF_ABI_V1
        select HAVE_FUNCTION_ERROR_INJECTION
index d71ea0f4466fc3eefd1bd89f37637193d9a464da..62ec265e2962876d1ee9a35bbd4d8e30f1855dcc 100644 (file)
@@ -159,7 +159,6 @@ config RISCV
        select HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS if (DYNAMIC_FTRACE_WITH_ARGS && !CFI_CLANG)
        select HAVE_DYNAMIC_FTRACE_WITH_ARGS if HAVE_DYNAMIC_FTRACE
        select HAVE_FTRACE_GRAPH_FUNC
-       select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
        select HAVE_FUNCTION_GRAPH_TRACER if HAVE_DYNAMIC_FTRACE_WITH_ARGS
        select HAVE_FUNCTION_GRAPH_FREGS
        select HAVE_FUNCTION_TRACER if !XIP_KERNEL
index 0c16dc443e2f65fc6bd71352e1cc8d7aa60a7c6a..d956e85f04655d4bb3355ba90a6ec683bde143b5 100644 (file)
@@ -199,7 +199,6 @@ config S390
        select HAVE_GUP_FAST
        select HAVE_FENTRY
        select HAVE_FTRACE_GRAPH_FUNC
-       select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_FUNCTION_ARG_ACCESS_API
        select HAVE_FUNCTION_ERROR_INJECTION
        select HAVE_FUNCTION_GRAPH_FREGS
index 89185af7bcc98ca6558879766f20d89f0d7a403c..d5795067befaa434f908abb4c1103e0ba0f8bba3 100644 (file)
@@ -40,7 +40,6 @@ config SUPERH
        select HAVE_GUP_FAST if MMU
        select HAVE_FUNCTION_GRAPH_TRACER
        select HAVE_FUNCTION_TRACER
-       select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_HW_BREAKPOINT
        select HAVE_IOREMAP_PROT if MMU && !X2TLB
        select HAVE_KERNEL_BZIP2
index 0f88123925a4f9f95b1b8336ff80798dacd243f5..f307e730446cc0a504d3299c167e526695072f10 100644 (file)
@@ -78,7 +78,6 @@ config SPARC64
        select MMU_GATHER_NO_FLUSH_CACHE
        select HAVE_ARCH_TRANSPARENT_HUGEPAGE
        select HAVE_DYNAMIC_FTRACE
-       select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_PAGE_SIZE_8KB
        select HAVE_SYSCALL_TRACEPOINTS
        select HAVE_CONTEXT_TRACKING_USER
index 71019b3b54ea71e08d25349ec0612ae329ce0345..eb07f236ce533014ceebb91d82fd5930b9d47f5b 100644 (file)
@@ -244,7 +244,6 @@ config X86
        select HAVE_GUP_FAST
        select HAVE_FENTRY                      if X86_64 || DYNAMIC_FTRACE
        select HAVE_FTRACE_GRAPH_FUNC           if HAVE_FUNCTION_GRAPH_TRACER
-       select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_FUNCTION_GRAPH_FREGS        if HAVE_FUNCTION_GRAPH_TRACER
        select HAVE_FUNCTION_GRAPH_TRACER       if X86_32 || (X86_64 && DYNAMIC_FTRACE)
        select HAVE_FUNCTION_TRACER
index fa5f19b8d53a04970f2ad5803a6e8894a455a113..ae2d2359b79e9e929e6507b107fe7099762f9a02 100644 (file)
@@ -167,7 +167,7 @@ defined(CONFIG_AUTOFDO_CLANG) || defined(CONFIG_PROPELLER_CLANG)
 #define FTRACE_STUB_HACK
 #endif
 
-#ifdef CONFIG_FTRACE_MCOUNT_RECORD
+#ifdef CONFIG_DYNAMIC_FTRACE
 /*
  * 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
index b672ca15f265538442bf61c266d580feef571917..7ded7df6e9b504f1162f8c85a851c894420a17f5 100644 (file)
@@ -1108,7 +1108,7 @@ static __always_inline unsigned long get_lock_parent_ip(void)
 # define trace_preempt_off(a0, a1) do { } while (0)
 #endif
 
-#ifdef CONFIG_FTRACE_MCOUNT_RECORD
+#ifdef CONFIG_DYNAMIC_FTRACE
 extern void ftrace_init(void);
 #ifdef CC_USING_PATCHABLE_FUNCTION_ENTRY
 #define FTRACE_CALLSITE_SECTION        "__patchable_function_entries"
index 1cce1f6410a9dee1397d56c37bda78994c1f30e5..989315dabb869ce7b6e222d667704aa7c7e5a92c 100644 (file)
@@ -373,9 +373,9 @@ ftrace_vprintk(const char *fmt, va_list ap)
 static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { }
 #endif /* CONFIG_TRACING */
 
-/* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */
-#ifdef CONFIG_FTRACE_MCOUNT_RECORD
-# define REBUILD_DUE_TO_FTRACE_MCOUNT_RECORD
+/* Rebuild everything on CONFIG_DYNAMIC_FTRACE */
+#ifdef CONFIG_DYNAMIC_FTRACE
+# define REBUILD_DUE_TO_DYNAMIC_FTRACE
 #endif
 
 /* Permissions on a sysfs file: you didn't miss the 0 prefix did you? */
index 5faa1fb1f4b4d5cfe350b346cb1d8204885eea91..800e6fde9bf74428dcbb7ceef4978bfee03f0dfb 100644 (file)
@@ -539,7 +539,7 @@ struct module {
        struct trace_eval_map **trace_evals;
        unsigned int num_trace_evals;
 #endif
-#ifdef CONFIG_FTRACE_MCOUNT_RECORD
+#ifdef CONFIG_DYNAMIC_FTRACE
        unsigned int num_ftrace_callsites;
        unsigned long *ftrace_callsites;
 #endif
index 413ac6ea37021bc8ae260f624ca2745ed85333fc..58d36f8cef0d95b20375955dfade64f32940dae7 100644 (file)
@@ -2639,7 +2639,7 @@ static int find_module_sections(struct module *mod, struct load_info *info)
                                         sizeof(*mod->trace_bprintk_fmt_start),
                                         &mod->num_trace_bprintk_fmt);
 #endif
-#ifdef CONFIG_FTRACE_MCOUNT_RECORD
+#ifdef CONFIG_DYNAMIC_FTRACE
        /* sechdrs[0].sh_size is always zero */
        mod->ftrace_callsites = section_objs(info, FTRACE_CALLSITE_SECTION,
                                             sizeof(*mod->ftrace_callsites),
index 28afc6941e7a5bc7bf76c6b85d4a13ed6a2b19bb..9f2b1661a8ac6bc5e8a145ca7f8d93b641c4ba74 100644 (file)
@@ -74,11 +74,6 @@ config HAVE_DYNAMIC_FTRACE_NO_PATCHABLE
          If the architecture generates __patchable_function_entries sections
          but does not want them included in the ftrace locations.
 
-config HAVE_FTRACE_MCOUNT_RECORD
-       bool
-       help
-         See Documentation/trace/ftrace-design.rst
-
 config HAVE_SYSCALL_TRACEPOINTS
        bool
        help
@@ -803,27 +798,22 @@ config BPF_KPROBE_OVERRIDE
         Allows BPF to override the execution of a probed function and
         set a different return value.  This is used for error injection.
 
-config FTRACE_MCOUNT_RECORD
-       def_bool y
-       depends on DYNAMIC_FTRACE
-       depends on HAVE_FTRACE_MCOUNT_RECORD
-
 config FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY
        bool
-       depends on FTRACE_MCOUNT_RECORD
+       depends on DYNAMIC_FTRACE
 
 config FTRACE_MCOUNT_USE_CC
        def_bool y
        depends on $(cc-option,-mrecord-mcount)
        depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY
-       depends on FTRACE_MCOUNT_RECORD
+       depends on DYNAMIC_FTRACE
 
 config FTRACE_MCOUNT_USE_OBJTOOL
        def_bool y
        depends on HAVE_OBJTOOL_MCOUNT
        depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY
        depends on !FTRACE_MCOUNT_USE_CC
-       depends on FTRACE_MCOUNT_RECORD
+       depends on DYNAMIC_FTRACE
        select OBJTOOL
 
 config FTRACE_MCOUNT_USE_RECORDMCOUNT
@@ -831,7 +821,7 @@ config FTRACE_MCOUNT_USE_RECORDMCOUNT
        depends on !FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY
        depends on !FTRACE_MCOUNT_USE_CC
        depends on !FTRACE_MCOUNT_USE_OBJTOOL
-       depends on FTRACE_MCOUNT_RECORD
+       depends on DYNAMIC_FTRACE
 
 config TRACING_MAP
        bool
index 4203fad56b6c585d3ddaed32bf0f3ab8b5b730dd..00b76d450a89795aa01fd9d75ce3778ecd8b29a2 100644 (file)
@@ -1042,10 +1042,6 @@ static struct ftrace_ops *removed_ops;
  */
 static bool update_all_ops;
 
-#ifndef CONFIG_FTRACE_MCOUNT_RECORD
-# error Dynamic ftrace depends on MCOUNT_RECORD
-#endif
-
 struct ftrace_func_probe {
        struct ftrace_probe_ops *probe_ops;
        struct ftrace_ops       ops;
index 0871b2e92584b2a73f4cb89ae34ebc9c2b15ff17..861b56dda64e1d663cfeeba80446d2a0b0fa3650 100755 (executable)
@@ -359,7 +359,7 @@ if ($arch eq "x86_64") {
     $mcount_regex = "^\\s*([0-9a-fA-F]+):\\s*R_CKCORE_PCREL_JSR_IMM26BY2\\s+_mcount\$";
     $alignment = 2;
 } else {
-    die "Arch $arch is not supported with CONFIG_FTRACE_MCOUNT_RECORD";
+    die "Arch $arch is not supported with CONFIG_DYNAMIC_FTRACE";
 }
 
 my $text_found = 0;