tracing: Call arch_init_ftrace_syscalls at boot
Call arch_init_ftrace_syscalls at boot, so we can determine early the set of syscalls for the syscall trace events. Signed-off-by: Jason Baron <jbaron@redhat.com> Cc: Lai Jiangshan <laijs@cn.fujitsu.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Cc: Jiaying Zhang <jiayingz@google.com> Cc: Martin Bligh <mbligh@google.com> Cc: Li Zefan <lizf@cn.fujitsu.com> Cc: Masami Hiramatsu <mhiramat@redhat.com> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
This commit is contained in:
parent
eeac19a7ef
commit
066e0378c2
|
@ -516,31 +516,24 @@ int syscall_name_to_nr(char *name)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void arch_init_ftrace_syscalls(void)
|
static int __init arch_init_ftrace_syscalls(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct syscall_metadata *meta;
|
struct syscall_metadata *meta;
|
||||||
unsigned long **psys_syscall_table = &sys_call_table;
|
unsigned long **psys_syscall_table = &sys_call_table;
|
||||||
static atomic_t refs;
|
|
||||||
|
|
||||||
if (atomic_inc_return(&refs) != 1)
|
|
||||||
goto end;
|
|
||||||
|
|
||||||
syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) *
|
syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) *
|
||||||
FTRACE_SYSCALL_MAX, GFP_KERNEL);
|
FTRACE_SYSCALL_MAX, GFP_KERNEL);
|
||||||
if (!syscalls_metadata) {
|
if (!syscalls_metadata) {
|
||||||
WARN_ON(1);
|
WARN_ON(1);
|
||||||
return;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < FTRACE_SYSCALL_MAX; i++) {
|
for (i = 0; i < FTRACE_SYSCALL_MAX; i++) {
|
||||||
meta = find_syscall_meta(psys_syscall_table[i]);
|
meta = find_syscall_meta(psys_syscall_table[i]);
|
||||||
syscalls_metadata[i] = meta;
|
syscalls_metadata[i] = meta;
|
||||||
}
|
}
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
/* Paranoid: avoid overflow */
|
|
||||||
end:
|
|
||||||
atomic_dec(&refs);
|
|
||||||
}
|
}
|
||||||
|
arch_initcall(arch_init_ftrace_syscalls);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,7 +19,6 @@ struct syscall_metadata {
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_FTRACE_SYSCALLS
|
#ifdef CONFIG_FTRACE_SYSCALLS
|
||||||
extern void arch_init_ftrace_syscalls(void);
|
|
||||||
extern struct syscall_metadata *syscall_nr_to_meta(int nr);
|
extern struct syscall_metadata *syscall_nr_to_meta(int nr);
|
||||||
extern void start_ftrace_syscalls(void);
|
extern void start_ftrace_syscalls(void);
|
||||||
extern void stop_ftrace_syscalls(void);
|
extern void stop_ftrace_syscalls(void);
|
||||||
|
|
|
@ -106,7 +106,6 @@ void start_ftrace_syscalls(void)
|
||||||
if (++refcount != 1)
|
if (++refcount != 1)
|
||||||
goto unlock;
|
goto unlock;
|
||||||
|
|
||||||
arch_init_ftrace_syscalls();
|
|
||||||
read_lock_irqsave(&tasklist_lock, flags);
|
read_lock_irqsave(&tasklist_lock, flags);
|
||||||
|
|
||||||
do_each_thread(g, t) {
|
do_each_thread(g, t) {
|
||||||
|
|
Loading…
Reference in a new issue