From 862559ebd03df5e40ff5513efd0418b689bca081 Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Wed, 26 Aug 2009 22:23:52 -0400 Subject: [PATCH] --- yaml --- r: 158473 b: refs/heads/master c: c0729be99cb2b9d9749256254f1c40a801835896 h: refs/heads/master i: 158471: 3005f117e60b351b0c276b32670a9358f5137e1e v: v3 --- [refs] | 2 +- trunk/arch/s390/kernel/ftrace.c | 36 +++++++------------------- trunk/arch/x86/include/asm/ftrace.h | 7 +++++ trunk/arch/x86/include/asm/unistd_32.h | 2 -- trunk/arch/x86/include/asm/unistd_64.h | 6 ----- trunk/arch/x86/kernel/asm-offsets_64.c | 1 - trunk/arch/x86/kernel/ftrace.c | 8 +++--- trunk/include/trace/ftrace.h | 13 +++++----- trunk/kernel/trace/Kconfig | 1 - trunk/kernel/trace/trace_syscalls.c | 28 +++++++++----------- trunk/kernel/tracepoint.c | 4 +-- 11 files changed, 40 insertions(+), 68 deletions(-) diff --git a/[refs] b/[refs] index 146c5e6ca0b6..b1058852b6be 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 0dd7b74787eaf7858c6c573353a83c3e2766e674 +refs/heads/master: c0729be99cb2b9d9749256254f1c40a801835896 diff --git a/trunk/arch/s390/kernel/ftrace.c b/trunk/arch/s390/kernel/ftrace.c index 57bdcb1e3cdf..3e298e64f0db 100644 --- a/trunk/arch/s390/kernel/ftrace.c +++ b/trunk/arch/s390/kernel/ftrace.c @@ -220,29 +220,6 @@ struct syscall_metadata *syscall_nr_to_meta(int nr) return syscalls_metadata[nr]; } -int syscall_name_to_nr(char *name) -{ - int i; - - if (!syscalls_metadata) - return -1; - for (i = 0; i < NR_syscalls; i++) - if (syscalls_metadata[i]) - if (!strcmp(syscalls_metadata[i]->name, name)) - return i; - return -1; -} - -void set_syscall_enter_id(int num, int id) -{ - syscalls_metadata[num]->enter_id = id; -} - -void set_syscall_exit_id(int num, int id) -{ - syscalls_metadata[num]->exit_id = id; -} - static struct syscall_metadata *find_syscall_meta(unsigned long syscall) { struct syscall_metadata *start; @@ -260,19 +237,24 @@ static struct syscall_metadata *find_syscall_meta(unsigned long syscall) return NULL; } -static int __init arch_init_ftrace_syscalls(void) +void arch_init_ftrace_syscalls(void) { struct syscall_metadata *meta; int i; + static atomic_t refs; + + if (atomic_inc_return(&refs) != 1) + goto out; syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * NR_syscalls, GFP_KERNEL); if (!syscalls_metadata) - return -ENOMEM; + goto out; for (i = 0; i < NR_syscalls; i++) { meta = find_syscall_meta((unsigned long)sys_call_table[i]); syscalls_metadata[i] = meta; } - return 0; + return; +out: + atomic_dec(&refs); } -arch_initcall(arch_init_ftrace_syscalls); #endif diff --git a/trunk/arch/x86/include/asm/ftrace.h b/trunk/arch/x86/include/asm/ftrace.h index db24c2278be0..71136545187a 100644 --- a/trunk/arch/x86/include/asm/ftrace.h +++ b/trunk/arch/x86/include/asm/ftrace.h @@ -28,6 +28,13 @@ #endif +/* FIXME: I don't want to stay hardcoded */ +#ifdef CONFIG_X86_64 +# define FTRACE_SYSCALL_MAX 299 +#else +# define FTRACE_SYSCALL_MAX 337 +#endif + #ifdef CONFIG_FUNCTION_TRACER #define MCOUNT_ADDR ((long)(mcount)) #define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */ diff --git a/trunk/arch/x86/include/asm/unistd_32.h b/trunk/arch/x86/include/asm/unistd_32.h index 8deaada61bc8..732a30706153 100644 --- a/trunk/arch/x86/include/asm/unistd_32.h +++ b/trunk/arch/x86/include/asm/unistd_32.h @@ -345,8 +345,6 @@ #ifdef __KERNEL__ -#define NR_syscalls 337 - #define __ARCH_WANT_IPC_PARSE_VERSION #define __ARCH_WANT_OLD_READDIR #define __ARCH_WANT_OLD_STAT diff --git a/trunk/arch/x86/include/asm/unistd_64.h b/trunk/arch/x86/include/asm/unistd_64.h index b9f3c60de5f7..900e1617e672 100644 --- a/trunk/arch/x86/include/asm/unistd_64.h +++ b/trunk/arch/x86/include/asm/unistd_64.h @@ -688,12 +688,6 @@ __SYSCALL(__NR_perf_counter_open, sys_perf_counter_open) #endif /* __NO_STUBS */ #ifdef __KERNEL__ - -#ifndef COMPILE_OFFSETS -#include -#define NR_syscalls (__NR_syscall_max + 1) -#endif - /* * "Conditional" syscalls * diff --git a/trunk/arch/x86/kernel/asm-offsets_64.c b/trunk/arch/x86/kernel/asm-offsets_64.c index 4a6aeedcd965..898ecc47e129 100644 --- a/trunk/arch/x86/kernel/asm-offsets_64.c +++ b/trunk/arch/x86/kernel/asm-offsets_64.c @@ -3,7 +3,6 @@ * This code generates raw asm output which is post-processed to extract * and format the required data. */ -#define COMPILE_OFFSETS #include #include diff --git a/trunk/arch/x86/kernel/ftrace.c b/trunk/arch/x86/kernel/ftrace.c index 9dbb527e1652..3cff1214e176 100644 --- a/trunk/arch/x86/kernel/ftrace.c +++ b/trunk/arch/x86/kernel/ftrace.c @@ -494,7 +494,7 @@ static struct syscall_metadata *find_syscall_meta(unsigned long *syscall) struct syscall_metadata *syscall_nr_to_meta(int nr) { - if (!syscalls_metadata || nr >= NR_syscalls || nr < 0) + if (!syscalls_metadata || nr >= FTRACE_SYSCALL_MAX || nr < 0) return NULL; return syscalls_metadata[nr]; @@ -507,7 +507,7 @@ int syscall_name_to_nr(char *name) if (!syscalls_metadata) return -1; - for (i = 0; i < NR_syscalls; i++) { + for (i = 0; i < FTRACE_SYSCALL_MAX; i++) { if (syscalls_metadata[i]) { if (!strcmp(syscalls_metadata[i]->name, name)) return i; @@ -533,13 +533,13 @@ static int __init arch_init_ftrace_syscalls(void) unsigned long **psys_syscall_table = &sys_call_table; syscalls_metadata = kzalloc(sizeof(*syscalls_metadata) * - NR_syscalls, GFP_KERNEL); + FTRACE_SYSCALL_MAX, GFP_KERNEL); if (!syscalls_metadata) { WARN_ON(1); return -ENOMEM; } - for (i = 0; i < NR_syscalls; i++) { + for (i = 0; i < FTRACE_SYSCALL_MAX; i++) { meta = find_syscall_meta(psys_syscall_table[i]); syscalls_metadata[i] = meta; } diff --git a/trunk/include/trace/ftrace.h b/trunk/include/trace/ftrace.h index 57c56a998ee6..360a77ad79e1 100644 --- a/trunk/include/trace/ftrace.h +++ b/trunk/include/trace/ftrace.h @@ -45,15 +45,14 @@ }; \ static struct ftrace_event_call event_##name -#undef __cpparg -#define __cpparg(arg...) arg - /* Callbacks are meaningless to ftrace. */ #undef TRACE_EVENT_FN -#define TRACE_EVENT_FN(name, proto, args, tstruct, \ - assign, print, reg, unreg) \ - TRACE_EVENT(name, __cpparg(proto), __cpparg(args), \ - __cpparg(tstruct), __cpparg(assign), __cpparg(print)) \ +#define TRACE_EVENT_FN(name, proto, args, tstruct, \ + assign, print, reg, unreg) \ + TRACE_EVENT(name, TP_PROTO(proto), TP_ARGS(args), \ + TP_STRUCT__entry(tstruct), \ + TP_fast_assign(assign), \ + TP_printk(print)) #include TRACE_INCLUDE(TRACE_INCLUDE_FILE) diff --git a/trunk/kernel/trace/Kconfig b/trunk/kernel/trace/Kconfig index 06be85a7ef8c..163fbfc2f39f 100644 --- a/trunk/kernel/trace/Kconfig +++ b/trunk/kernel/trace/Kconfig @@ -60,7 +60,6 @@ config EVENT_TRACING bool config CONTEXT_SWITCH_TRACER - select MARKERS bool # All tracer options should select GENERIC_TRACER. For those options that are diff --git a/trunk/kernel/trace/trace_syscalls.c b/trunk/kernel/trace/trace_syscalls.c index 4f5fae6fad90..85291c4de406 100644 --- a/trunk/kernel/trace/trace_syscalls.c +++ b/trunk/kernel/trace/trace_syscalls.c @@ -11,8 +11,8 @@ static DEFINE_MUTEX(syscall_trace_lock); static int sys_refcount_enter; static int sys_refcount_exit; -static DECLARE_BITMAP(enabled_enter_syscalls, NR_syscalls); -static DECLARE_BITMAP(enabled_exit_syscalls, NR_syscalls); +static DECLARE_BITMAP(enabled_enter_syscalls, FTRACE_SYSCALL_MAX); +static DECLARE_BITMAP(enabled_exit_syscalls, FTRACE_SYSCALL_MAX); enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags) @@ -227,8 +227,6 @@ void ftrace_syscall_enter(struct pt_regs *regs, long id) int syscall_nr; syscall_nr = syscall_get_nr(current, regs); - if (syscall_nr < 0) - return; if (!test_bit(syscall_nr, enabled_enter_syscalls)) return; @@ -259,8 +257,6 @@ void ftrace_syscall_exit(struct pt_regs *regs, long ret) int syscall_nr; syscall_nr = syscall_get_nr(current, regs); - if (syscall_nr < 0) - return; if (!test_bit(syscall_nr, enabled_exit_syscalls)) return; @@ -289,7 +285,7 @@ int reg_event_syscall_enter(void *ptr) name = (char *)ptr; num = syscall_name_to_nr(name); - if (num < 0 || num >= NR_syscalls) + if (num < 0 || num >= FTRACE_SYSCALL_MAX) return -ENOSYS; mutex_lock(&syscall_trace_lock); if (!sys_refcount_enter) @@ -312,7 +308,7 @@ void unreg_event_syscall_enter(void *ptr) name = (char *)ptr; num = syscall_name_to_nr(name); - if (num < 0 || num >= NR_syscalls) + if (num < 0 || num >= FTRACE_SYSCALL_MAX) return; mutex_lock(&syscall_trace_lock); sys_refcount_enter--; @@ -330,7 +326,7 @@ int reg_event_syscall_exit(void *ptr) name = (char *)ptr; num = syscall_name_to_nr(name); - if (num < 0 || num >= NR_syscalls) + if (num < 0 || num >= FTRACE_SYSCALL_MAX) return -ENOSYS; mutex_lock(&syscall_trace_lock); if (!sys_refcount_exit) @@ -353,7 +349,7 @@ void unreg_event_syscall_exit(void *ptr) name = (char *)ptr; num = syscall_name_to_nr(name); - if (num < 0 || num >= NR_syscalls) + if (num < 0 || num >= FTRACE_SYSCALL_MAX) return; mutex_lock(&syscall_trace_lock); sys_refcount_exit--; @@ -373,8 +369,8 @@ struct trace_event event_syscall_exit = { #ifdef CONFIG_EVENT_PROFILE -static DECLARE_BITMAP(enabled_prof_enter_syscalls, NR_syscalls); -static DECLARE_BITMAP(enabled_prof_exit_syscalls, NR_syscalls); +static DECLARE_BITMAP(enabled_prof_enter_syscalls, FTRACE_SYSCALL_MAX); +static DECLARE_BITMAP(enabled_prof_exit_syscalls, FTRACE_SYSCALL_MAX); static int sys_prof_refcount_enter; static int sys_prof_refcount_exit; @@ -420,7 +416,7 @@ int reg_prof_syscall_enter(char *name) int num; num = syscall_name_to_nr(name); - if (num < 0 || num >= NR_syscalls) + if (num < 0 || num >= FTRACE_SYSCALL_MAX) return -ENOSYS; mutex_lock(&syscall_trace_lock); @@ -442,7 +438,7 @@ void unreg_prof_syscall_enter(char *name) int num; num = syscall_name_to_nr(name); - if (num < 0 || num >= NR_syscalls) + if (num < 0 || num >= FTRACE_SYSCALL_MAX) return; mutex_lock(&syscall_trace_lock); @@ -481,7 +477,7 @@ int reg_prof_syscall_exit(char *name) int num; num = syscall_name_to_nr(name); - if (num < 0 || num >= NR_syscalls) + if (num < 0 || num >= FTRACE_SYSCALL_MAX) return -ENOSYS; mutex_lock(&syscall_trace_lock); @@ -503,7 +499,7 @@ void unreg_prof_syscall_exit(char *name) int num; num = syscall_name_to_nr(name); - if (num < 0 || num >= NR_syscalls) + if (num < 0 || num >= FTRACE_SYSCALL_MAX) return; mutex_lock(&syscall_trace_lock); diff --git a/trunk/kernel/tracepoint.c b/trunk/kernel/tracepoint.c index 9489a0a9b1be..1a6a453b7efb 100644 --- a/trunk/kernel/tracepoint.c +++ b/trunk/kernel/tracepoint.c @@ -597,9 +597,7 @@ void syscall_regfunc(void) if (!sys_tracepoint_refcount) { read_lock_irqsave(&tasklist_lock, flags); do_each_thread(g, t) { - /* Skip kernel threads. */ - if (t->mm) - set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT); + set_tsk_thread_flag(t, TIF_SYSCALL_TRACEPOINT); } while_each_thread(g, t); read_unlock_irqrestore(&tasklist_lock, flags); }