]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
kernel: ftrace: export ftrace_sync_ipi
authorAndy Chiu <andybnac@gmail.com>
Mon, 7 Apr 2025 18:08:28 +0000 (02:08 +0800)
committerPalmer Dabbelt <palmer@dabbelt.com>
Thu, 5 Jun 2025 18:09:24 +0000 (11:09 -0700)
The following ftrace patch for riscv uses a data store to update ftrace
function. Therefore, a romote fence is required to order it against
function_trace_op updates. The mechanism is similar to the fence between
function_trace_op and update_ftrace_func in the generic ftrace, so we
leverage the same ftrace_sync_ipi function.

[ alex: Fix build warning when !CONFIG_DYNAMIC_FTRACE ]

Signed-off-by: Andy Chiu <andybnac@gmail.com>
Link: https://lore.kernel.org/r/20250407180838.42877-4-andybnac@gmail.com
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Signed-off-by: Palmer Dabbelt <palmer@dabbelt.com>
include/linux/ftrace.h
kernel/trace/ftrace.c

index fbabc3d848b375a114936b635bc695d59ab018a6..30374478cb07744eb831e0f23670f24c3bc6ed91 100644 (file)
@@ -635,6 +635,8 @@ enum {
 #define ftrace_get_symaddr(fentry_ip) (0)
 #endif
 
+void ftrace_sync_ipi(void *data);
+
 #ifdef CONFIG_DYNAMIC_FTRACE
 
 void ftrace_arch_code_modify_prepare(void);
index 61130bb34d6c34a4225513a383396371067247b3..31e9fe3bf96400629bd1c8dbedd51924f8844ab3 100644 (file)
@@ -188,7 +188,7 @@ static void ftrace_pid_func(unsigned long ip, unsigned long parent_ip,
        op->saved_func(ip, parent_ip, op, fregs);
 }
 
-static void ftrace_sync_ipi(void *data)
+void ftrace_sync_ipi(void *data)
 {
        /* Probably not needed, but do it anyway */
        smp_rmb();