ftrace: Cleanup ftrace_dyn_arch_init()

Most of ARCHs use empty ftrace_dyn_arch_init(), introduce a weak common
ftrace_dyn_arch_init() to cleanup them.

Link: https://lkml.kernel.org/r/20210909090216.1955240-1-o451686892@gmail.com

Acked-by: Heiko Carstens <hca@linux.ibm.com> (s390)
Acked-by: Helge Deller <deller@gmx.de> (parisc)
Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
Weizhao Ouyang 2021-09-09 17:02:16 +08:00 committed by Steven Rostedt (VMware)
parent 21ccc9cd72
commit 6644c654ea
13 changed files with 5 additions and 61 deletions

View File

@ -193,11 +193,6 @@ int ftrace_make_nop(struct module *mod,
return ret; return ret;
} }
int __init ftrace_dyn_arch_init(void)
{
return 0;
}
#endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* CONFIG_DYNAMIC_FTRACE */
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER

View File

@ -236,11 +236,6 @@ void arch_ftrace_update_code(int command)
command |= FTRACE_MAY_SLEEP; command |= FTRACE_MAY_SLEEP;
ftrace_modify_all_code(command); ftrace_modify_all_code(command);
} }
int __init ftrace_dyn_arch_init(void)
{
return 0;
}
#endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* CONFIG_DYNAMIC_FTRACE */
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER

View File

@ -133,11 +133,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
(unsigned long)func, true, true); (unsigned long)func, true, true);
return ret; return ret;
} }
int __init ftrace_dyn_arch_init(void)
{
return 0;
}
#endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* CONFIG_DYNAMIC_FTRACE */
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS

View File

@ -194,9 +194,3 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
flush_icache_range(addr, addr + 16); flush_icache_range(addr, addr + 16);
return 0; return 0;
} }
/* run from kstop_machine */
int __init ftrace_dyn_arch_init(void)
{
return 0;
}

View File

@ -163,11 +163,6 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
return ret; return ret;
} }
int __init ftrace_dyn_arch_init(void)
{
return 0;
}
int ftrace_update_ftrace_func(ftrace_func_t func) int ftrace_update_ftrace_func(ftrace_func_t func)
{ {
unsigned long ip = (unsigned long)(&ftrace_call); unsigned long ip = (unsigned long)(&ftrace_call);

View File

@ -84,11 +84,6 @@ void _ftrace_caller(unsigned long parent_ip)
/* restore all state needed by the compiler epilogue */ /* restore all state needed by the compiler epilogue */
} }
int __init ftrace_dyn_arch_init(void)
{
return 0;
}
static unsigned long gen_sethi_insn(unsigned long addr) static unsigned long gen_sethi_insn(unsigned long addr)
{ {
unsigned long opcode = 0x46000000; unsigned long opcode = 0x46000000;

View File

@ -94,11 +94,6 @@ int ftrace_disable_ftrace_graph_caller(void)
#endif #endif
#ifdef CONFIG_DYNAMIC_FTRACE #ifdef CONFIG_DYNAMIC_FTRACE
int __init ftrace_dyn_arch_init(void)
{
return 0;
}
int ftrace_update_ftrace_func(ftrace_func_t func) int ftrace_update_ftrace_func(ftrace_func_t func)
{ {
return 0; return 0;

View File

@ -154,11 +154,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
return ret; return ret;
} }
int __init ftrace_dyn_arch_init(void)
{
return 0;
}
#endif #endif
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS

View File

@ -262,11 +262,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
return 0; return 0;
} }
int __init ftrace_dyn_arch_init(void)
{
return 0;
}
void arch_ftrace_update_code(int command) void arch_ftrace_update_code(int command)
{ {
if (ftrace_shared_hotpatch_trampoline(NULL)) if (ftrace_shared_hotpatch_trampoline(NULL))

View File

@ -252,11 +252,6 @@ int ftrace_make_call(struct dyn_ftrace *rec, unsigned long addr)
return ftrace_modify_code(rec->ip, old, new); return ftrace_modify_code(rec->ip, old, new);
} }
int __init ftrace_dyn_arch_init(void)
{
return 0;
}
#endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* CONFIG_DYNAMIC_FTRACE */
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER

View File

@ -82,11 +82,6 @@ int ftrace_update_ftrace_func(ftrace_func_t func)
new = ftrace_call_replace(ip, (unsigned long)func); new = ftrace_call_replace(ip, (unsigned long)func);
return ftrace_modify_code(ip, old, new); return ftrace_modify_code(ip, old, new);
} }
int __init ftrace_dyn_arch_init(void)
{
return 0;
}
#endif #endif
#ifdef CONFIG_FUNCTION_GRAPH_TRACER #ifdef CONFIG_FUNCTION_GRAPH_TRACER

View File

@ -252,11 +252,6 @@ void arch_ftrace_update_code(int command)
ftrace_modify_all_code(command); ftrace_modify_all_code(command);
} }
int __init ftrace_dyn_arch_init(void)
{
return 0;
}
/* Currently only x86_64 supports dynamic trampolines */ /* Currently only x86_64 supports dynamic trampolines */
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64

View File

@ -6847,6 +6847,11 @@ void __init ftrace_free_init_mem(void)
ftrace_free_mem(NULL, start, end); ftrace_free_mem(NULL, start, end);
} }
int __init __weak ftrace_dyn_arch_init(void)
{
return 0;
}
void __init ftrace_init(void) void __init ftrace_init(void)
{ {
extern unsigned long __start_mcount_loc[]; extern unsigned long __start_mcount_loc[];