Skip to content

Commit cfce092

Browse files
mrutland-armwilldeacon
authored andcommitted
ftrace: arm64: remove static ftrace
The build test robot pointer out that there's a build failure when: CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS=y CONFIG_DYNAMIC_FTRACE_WITH_ARGS=n ... due to some mismatched ifdeffery, some of which checks CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS, and some of which checks CONFIG_DYNAMIC_FTRACE_WITH_ARGS, leading to some missing definitions expected by the core code when CONFIG_DYNAMIC_FTRACE=n and consequently CONFIG_DYNAMIC_FTRACE_WITH_ARGS=n. There's really not much point in supporting CONFIG_DYNAMIC_FTRACE=n (AKA static ftrace). All supported toolchains allow us to implement DYNAMIC_FTRACE, distributions all prefer DYNAMIC_FTRACE, and both powerpc and s390 removed support for static ftrace in commits: 0c0c523 ("powerpc: Only support DYNAMIC_FTRACE not static") 5d6a016 ("s390/ftrace: enforce DYNAMIC_FTRACE if FUNCTION_TRACER is selected") ... and according to Steven, static ftrace is only supported on x86 to allow testing that the core code still functions in this configuration. Given that, let's simplify matters by removing arm64's support for static ftrace. This avoids the problem originally reported, and leaves us with less code to maintain. Fixes: 26299b3 ("ftrace: arm64: move from REGS to ARGS") Link: https://lore.kernel.org/r/[email protected] Suggested-by: Steven Rostedt <[email protected]> Signed-off-by: Mark Rutland <[email protected]> Cc: Will Deacon <[email protected]> Cc: Catalin Marinas <[email protected]> Acked-by: Steven Rostedt (Google) <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent 26299b3 commit cfce092

File tree

3 files changed

+1
-44
lines changed

3 files changed

+1
-44
lines changed

arch/arm64/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ config ARM64
117117
select CPU_PM if (SUSPEND || CPU_IDLE)
118118
select CRC32
119119
select DCACHE_WORD_ACCESS
120+
select DYNAMIC_FTRACE if FUNCTION_TRACER
120121
select DMA_DIRECT_REMAP
121122
select EDAC_SUPPORT
122123
select FRAME_POINTER

arch/arm64/kernel/entry-ftrace.S

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -170,44 +170,6 @@ SYM_CODE_END(ftrace_caller)
170170
add \reg, \reg, #8
171171
.endm
172172

173-
#ifndef CONFIG_DYNAMIC_FTRACE
174-
/*
175-
* void _mcount(unsigned long return_address)
176-
* @return_address: return address to instrumented function
177-
*
178-
* This function makes calls, if enabled, to:
179-
* - tracer function to probe instrumented function's entry,
180-
* - ftrace_graph_caller to set up an exit hook
181-
*/
182-
SYM_FUNC_START(_mcount)
183-
mcount_enter
184-
185-
ldr_l x2, ftrace_trace_function
186-
adr x0, ftrace_stub
187-
cmp x0, x2 // if (ftrace_trace_function
188-
b.eq skip_ftrace_call // != ftrace_stub) {
189-
190-
mcount_get_pc x0 // function's pc
191-
mcount_get_lr x1 // function's lr (= parent's pc)
192-
blr x2 // (*ftrace_trace_function)(pc, lr);
193-
194-
skip_ftrace_call: // }
195-
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
196-
ldr_l x2, ftrace_graph_return
197-
cmp x0, x2 // if ((ftrace_graph_return
198-
b.ne ftrace_graph_caller // != ftrace_stub)
199-
200-
ldr_l x2, ftrace_graph_entry // || (ftrace_graph_entry
201-
adr_l x0, ftrace_graph_entry_stub // != ftrace_graph_entry_stub))
202-
cmp x0, x2
203-
b.ne ftrace_graph_caller // ftrace_graph_caller();
204-
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
205-
mcount_exit
206-
SYM_FUNC_END(_mcount)
207-
EXPORT_SYMBOL(_mcount)
208-
NOKPROBE(_mcount)
209-
210-
#else /* CONFIG_DYNAMIC_FTRACE */
211173
/*
212174
* _mcount() is used to build the kernel with -pg option, but all the branch
213175
* instructions to _mcount() are replaced to NOP initially at kernel start up,
@@ -247,7 +209,6 @@ SYM_INNER_LABEL(ftrace_graph_call, SYM_L_GLOBAL) // ftrace_graph_caller();
247209

248210
mcount_exit
249211
SYM_FUNC_END(ftrace_caller)
250-
#endif /* CONFIG_DYNAMIC_FTRACE */
251212

252213
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
253214
/*

arch/arm64/kernel/ftrace.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ int ftrace_regs_query_register_offset(const char *name)
6060
}
6161
#endif
6262

63-
#ifdef CONFIG_DYNAMIC_FTRACE
6463
/*
6564
* Replace a single instruction, which may be a branch or NOP.
6665
* If @validate == true, a replaced instruction is checked against 'old'.
@@ -268,7 +267,6 @@ void arch_ftrace_update_code(int command)
268267
command |= FTRACE_MAY_SLEEP;
269268
ftrace_modify_all_code(command);
270269
}
271-
#endif /* CONFIG_DYNAMIC_FTRACE */
272270

273271
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
274272
/*
@@ -299,8 +297,6 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
299297
}
300298
}
301299

302-
#ifdef CONFIG_DYNAMIC_FTRACE
303-
304300
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_ARGS
305301
void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
306302
struct ftrace_ops *op, struct ftrace_regs *fregs)
@@ -338,5 +334,4 @@ int ftrace_disable_ftrace_graph_caller(void)
338334
return ftrace_modify_graph_caller(false);
339335
}
340336
#endif /* CONFIG_DYNAMIC_FTRACE_WITH_ARGS */
341-
#endif /* CONFIG_DYNAMIC_FTRACE */
342337
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */

0 commit comments

Comments
 (0)