Skip to content

Commit 4267fda

Browse files
committed
function_graph: Make fgraph_update_pid_func() a stub for !DYNAMIC_FTRACE
When CONFIG_DYNAMIC_FTRACE is not set, the function fgraph_update_pid_func() doesn't do anything. Currently, most of its logic is within a "#ifdef CONFIG_DYNAMIC_FTRACE" block, but its variables were declared outside that, and when DYNAMIC_FTRACE is not set, it produces unused variable warnings. Instead, just place it (and the helper function fgraph_pid_func()) within the #ifdef block and have the header file use a empty stub function for when DYNAMIC_FTRACE is not defined. Link: https://lore.kernel.org/linux-trace-kernel/[email protected] Cc: Masami Hiramatsu <[email protected]> Cc: Mark Rutland <[email protected]> Cc: Mathieu Desnoyers <[email protected]> Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Signed-off-by: Steven Rostedt (Google) <[email protected]>
1 parent 2f6b884 commit 4267fda

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

kernel/trace/fgraph.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,7 @@ void ftrace_graph_exit_task(struct task_struct *t)
11381138
kfree(ret_stack);
11391139
}
11401140

1141+
#ifdef CONFIG_DYNAMIC_FTRACE
11411142
static int fgraph_pid_func(struct ftrace_graph_ent *trace,
11421143
struct fgraph_ops *gops)
11431144
{
@@ -1164,7 +1165,6 @@ void fgraph_update_pid_func(void)
11641165
if (!(graph_ops.flags & FTRACE_OPS_FL_INITIALIZED))
11651166
return;
11661167

1167-
#ifdef CONFIG_DYNAMIC_FTRACE
11681168
list_for_each_entry(op, &graph_ops.subop_list, list) {
11691169
if (op->flags & FTRACE_OPS_FL_PID) {
11701170
gops = container_of(op, struct fgraph_ops, ops);
@@ -1174,8 +1174,8 @@ void fgraph_update_pid_func(void)
11741174
static_call_update(fgraph_func, gops->entryfunc);
11751175
}
11761176
}
1177-
#endif
11781177
}
1178+
#endif
11791179

11801180
/* Allocate a return stack for each task */
11811181
static int start_graph_tracing(void)

kernel/trace/ftrace_internal.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ static inline int ftrace_shutdown_subops(struct ftrace_ops *ops, struct ftrace_o
5252

5353
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
5454
extern int ftrace_graph_active;
55+
# ifdef CONFIG_DYNAMIC_FTRACE
5556
extern void fgraph_update_pid_func(void);
57+
# else
58+
static inline void fgraph_update_pid_func(void) {}
59+
# endif
5660
#else /* !CONFIG_FUNCTION_GRAPH_TRACER */
5761
# define ftrace_graph_active 0
5862
static inline void fgraph_update_pid_func(void) {}

0 commit comments

Comments
 (0)