aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/ftrace.c
diff options
context:
space:
mode:
authorJason Baron <jbaron@redhat.com>2009-08-10 16:52:23 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2009-08-11 14:35:26 -0400
commit066e0378c23f0a3db730893f6a041e4a3922a385 (patch)
treebe402805c83dfc6547d4eb1e8b4129dcec1d9831 /arch/x86/kernel/ftrace.c
parenteeac19a7efa150231e4a6bb110d6f27500bcc8ce (diff)
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>
Diffstat (limited to 'arch/x86/kernel/ftrace.c')
-rw-r--r--arch/x86/kernel/ftrace.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index afb31d72618d..0d93d409b8d2 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -516,31 +516,24 @@ int syscall_name_to_nr(char *name)
516 return -1; 516 return -1;
517} 517}
518 518
519void arch_init_ftrace_syscalls(void) 519static int __init arch_init_ftrace_syscalls(void)
520{ 520{
521 int i; 521 int i;
522 struct syscall_metadata *meta; 522 struct syscall_metadata *meta;
523 unsigned long **psys_syscall_table = &sys_call_table; 523 unsigned long **psys_syscall_table = &sys_call_table;
524 static atomic_t refs;
525
526 if (atomic_inc_return(&refs) != 1)
527 goto end;
528 524
529 syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * 525 syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) *
530 FTRACE_SYSCALL_MAX, GFP_KERNEL); 526 FTRACE_SYSCALL_MAX, GFP_KERNEL);
531 if (!syscalls_metadata) { 527 if (!syscalls_metadata) {
532 WARN_ON(1); 528 WARN_ON(1);
533 return; 529 return -ENOMEM;
534 } 530 }
535 531
536 for (i = 0; i < FTRACE_SYSCALL_MAX; i++) { 532 for (i = 0; i < FTRACE_SYSCALL_MAX; i++) {
537 meta = find_syscall_meta(psys_syscall_table[i]); 533 meta = find_syscall_meta(psys_syscall_table[i]);
538 syscalls_metadata[i] = meta; 534 syscalls_metadata[i] = meta;
539 } 535 }
540 return; 536 return 0;
541
542 /* Paranoid: avoid overflow */
543end:
544 atomic_dec(&refs);
545} 537}
538arch_initcall(arch_init_ftrace_syscalls);
546#endif 539#endif