diff options
author | Lai Jiangshan <laijs@cn.fujitsu.com> | 2009-12-01 03:24:01 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-12-01 11:33:30 -0500 |
commit | 3bbe84e9d385205d638035ee9dcc4db1b486ea08 (patch) | |
tree | e7261e9a3ca13f6e2fd34333e4ccab33b265c32e | |
parent | a1301da0997bf73c44dbe584e9070a13adc89672 (diff) |
trace_syscalls: Simplify syscall profile
use only one prof_sysenter_enable() instead of
prof_sysenter_enable_##sname()
use only one prof_sysenter_disable() instead of
prof_sysenter_disable_##sname()
use only one prof_sysexit_enable() instead of
prof_sysexit_enable_##sname()
use only one prof_sysexit_disable() instead of
prof_sysexit_disable_##sname()
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Jason Baron <jbaron@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <4B14D2A1.8060304@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/linux/syscalls.h | 31 | ||||
-rw-r--r-- | include/trace/syscall.h | 8 | ||||
-rw-r--r-- | kernel/trace/trace_syscalls.c | 24 |
3 files changed, 16 insertions, 47 deletions
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h index cf0d923ea40e..c2df3a593236 100644 --- a/include/linux/syscalls.h +++ b/include/linux/syscalls.h | |||
@@ -99,37 +99,16 @@ struct perf_event_attr; | |||
99 | #define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) | 99 | #define __SC_TEST6(t6, a6, ...) __SC_TEST(t6); __SC_TEST5(__VA_ARGS__) |
100 | 100 | ||
101 | #ifdef CONFIG_EVENT_PROFILE | 101 | #ifdef CONFIG_EVENT_PROFILE |
102 | #define TRACE_SYS_ENTER_PROFILE(sname) \ | ||
103 | static int prof_sysenter_enable_##sname(struct ftrace_event_call *unused) \ | ||
104 | { \ | ||
105 | return reg_prof_syscall_enter("sys"#sname); \ | ||
106 | } \ | ||
107 | \ | ||
108 | static void prof_sysenter_disable_##sname(struct ftrace_event_call *unused) \ | ||
109 | { \ | ||
110 | unreg_prof_syscall_enter("sys"#sname); \ | ||
111 | } | ||
112 | |||
113 | #define TRACE_SYS_EXIT_PROFILE(sname) \ | ||
114 | static int prof_sysexit_enable_##sname(struct ftrace_event_call *unused) \ | ||
115 | { \ | ||
116 | return reg_prof_syscall_exit("sys"#sname); \ | ||
117 | } \ | ||
118 | \ | ||
119 | static void prof_sysexit_disable_##sname(struct ftrace_event_call *unused) \ | ||
120 | { \ | ||
121 | unreg_prof_syscall_exit("sys"#sname); \ | ||
122 | } | ||
123 | 102 | ||
124 | #define TRACE_SYS_ENTER_PROFILE_INIT(sname) \ | 103 | #define TRACE_SYS_ENTER_PROFILE_INIT(sname) \ |
125 | .profile_count = ATOMIC_INIT(-1), \ | 104 | .profile_count = ATOMIC_INIT(-1), \ |
126 | .profile_enable = prof_sysenter_enable_##sname, \ | 105 | .profile_enable = prof_sysenter_enable, \ |
127 | .profile_disable = prof_sysenter_disable_##sname, | 106 | .profile_disable = prof_sysenter_disable, |
128 | 107 | ||
129 | #define TRACE_SYS_EXIT_PROFILE_INIT(sname) \ | 108 | #define TRACE_SYS_EXIT_PROFILE_INIT(sname) \ |
130 | .profile_count = ATOMIC_INIT(-1), \ | 109 | .profile_count = ATOMIC_INIT(-1), \ |
131 | .profile_enable = prof_sysexit_enable_##sname, \ | 110 | .profile_enable = prof_sysexit_enable, \ |
132 | .profile_disable = prof_sysexit_disable_##sname, | 111 | .profile_disable = prof_sysexit_disable, |
133 | #else | 112 | #else |
134 | #define TRACE_SYS_ENTER_PROFILE(sname) | 113 | #define TRACE_SYS_ENTER_PROFILE(sname) |
135 | #define TRACE_SYS_ENTER_PROFILE_INIT(sname) | 114 | #define TRACE_SYS_ENTER_PROFILE_INIT(sname) |
@@ -158,7 +137,6 @@ static void prof_sysexit_disable_##sname(struct ftrace_event_call *unused) \ | |||
158 | struct trace_event enter_syscall_print_##sname = { \ | 137 | struct trace_event enter_syscall_print_##sname = { \ |
159 | .trace = print_syscall_enter, \ | 138 | .trace = print_syscall_enter, \ |
160 | }; \ | 139 | }; \ |
161 | TRACE_SYS_ENTER_PROFILE(sname); \ | ||
162 | static struct ftrace_event_call __used \ | 140 | static struct ftrace_event_call __used \ |
163 | __attribute__((__aligned__(4))) \ | 141 | __attribute__((__aligned__(4))) \ |
164 | __attribute__((section("_ftrace_events"))) \ | 142 | __attribute__((section("_ftrace_events"))) \ |
@@ -181,7 +159,6 @@ static void prof_sysexit_disable_##sname(struct ftrace_event_call *unused) \ | |||
181 | struct trace_event exit_syscall_print_##sname = { \ | 159 | struct trace_event exit_syscall_print_##sname = { \ |
182 | .trace = print_syscall_exit, \ | 160 | .trace = print_syscall_exit, \ |
183 | }; \ | 161 | }; \ |
184 | TRACE_SYS_EXIT_PROFILE(sname); \ | ||
185 | static struct ftrace_event_call __used \ | 162 | static struct ftrace_event_call __used \ |
186 | __attribute__((__aligned__(4))) \ | 163 | __attribute__((__aligned__(4))) \ |
187 | __attribute__((section("_ftrace_events"))) \ | 164 | __attribute__((section("_ftrace_events"))) \ |
diff --git a/include/trace/syscall.h b/include/trace/syscall.h index dff9371e5274..961fda3556bb 100644 --- a/include/trace/syscall.h +++ b/include/trace/syscall.h | |||
@@ -50,10 +50,10 @@ enum print_line_t print_syscall_enter(struct trace_iterator *iter, int flags); | |||
50 | enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags); | 50 | enum print_line_t print_syscall_exit(struct trace_iterator *iter, int flags); |
51 | #endif | 51 | #endif |
52 | #ifdef CONFIG_EVENT_PROFILE | 52 | #ifdef CONFIG_EVENT_PROFILE |
53 | int reg_prof_syscall_enter(char *name); | 53 | int prof_sysenter_enable(struct ftrace_event_call *call); |
54 | void unreg_prof_syscall_enter(char *name); | 54 | void prof_sysenter_disable(struct ftrace_event_call *call); |
55 | int reg_prof_syscall_exit(char *name); | 55 | int prof_sysexit_enable(struct ftrace_event_call *call); |
56 | void unreg_prof_syscall_exit(char *name); | 56 | void prof_sysexit_disable(struct ftrace_event_call *call); |
57 | 57 | ||
58 | #endif | 58 | #endif |
59 | 59 | ||
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c index c6514093c95a..1e85b6cc26aa 100644 --- a/kernel/trace/trace_syscalls.c +++ b/kernel/trace/trace_syscalls.c | |||
@@ -520,14 +520,12 @@ end_recursion: | |||
520 | local_irq_restore(flags); | 520 | local_irq_restore(flags); |
521 | } | 521 | } |
522 | 522 | ||
523 | int reg_prof_syscall_enter(char *name) | 523 | int prof_sysenter_enable(struct ftrace_event_call *call) |
524 | { | 524 | { |
525 | int ret = 0; | 525 | int ret = 0; |
526 | int num; | 526 | int num; |
527 | 527 | ||
528 | num = syscall_name_to_nr(name); | 528 | num = ((struct syscall_metadata *)call->data)->syscall_nr; |
529 | if (num < 0 || num >= NR_syscalls) | ||
530 | return -ENOSYS; | ||
531 | 529 | ||
532 | mutex_lock(&syscall_trace_lock); | 530 | mutex_lock(&syscall_trace_lock); |
533 | if (!sys_prof_refcount_enter) | 531 | if (!sys_prof_refcount_enter) |
@@ -543,13 +541,11 @@ int reg_prof_syscall_enter(char *name) | |||
543 | return ret; | 541 | return ret; |
544 | } | 542 | } |
545 | 543 | ||
546 | void unreg_prof_syscall_enter(char *name) | 544 | void prof_sysenter_disable(struct ftrace_event_call *call) |
547 | { | 545 | { |
548 | int num; | 546 | int num; |
549 | 547 | ||
550 | num = syscall_name_to_nr(name); | 548 | num = ((struct syscall_metadata *)call->data)->syscall_nr; |
551 | if (num < 0 || num >= NR_syscalls) | ||
552 | return; | ||
553 | 549 | ||
554 | mutex_lock(&syscall_trace_lock); | 550 | mutex_lock(&syscall_trace_lock); |
555 | sys_prof_refcount_enter--; | 551 | sys_prof_refcount_enter--; |
@@ -625,14 +621,12 @@ end_recursion: | |||
625 | local_irq_restore(flags); | 621 | local_irq_restore(flags); |
626 | } | 622 | } |
627 | 623 | ||
628 | int reg_prof_syscall_exit(char *name) | 624 | int prof_sysexit_enable(struct ftrace_event_call *call) |
629 | { | 625 | { |
630 | int ret = 0; | 626 | int ret = 0; |
631 | int num; | 627 | int num; |
632 | 628 | ||
633 | num = syscall_name_to_nr(name); | 629 | num = ((struct syscall_metadata *)call->data)->syscall_nr; |
634 | if (num < 0 || num >= NR_syscalls) | ||
635 | return -ENOSYS; | ||
636 | 630 | ||
637 | mutex_lock(&syscall_trace_lock); | 631 | mutex_lock(&syscall_trace_lock); |
638 | if (!sys_prof_refcount_exit) | 632 | if (!sys_prof_refcount_exit) |
@@ -648,13 +642,11 @@ int reg_prof_syscall_exit(char *name) | |||
648 | return ret; | 642 | return ret; |
649 | } | 643 | } |
650 | 644 | ||
651 | void unreg_prof_syscall_exit(char *name) | 645 | void prof_sysexit_disable(struct ftrace_event_call *call) |
652 | { | 646 | { |
653 | int num; | 647 | int num; |
654 | 648 | ||
655 | num = syscall_name_to_nr(name); | 649 | num = ((struct syscall_metadata *)call->data)->syscall_nr; |
656 | if (num < 0 || num >= NR_syscalls) | ||
657 | return; | ||
658 | 650 | ||
659 | mutex_lock(&syscall_trace_lock); | 651 | mutex_lock(&syscall_trace_lock); |
660 | sys_prof_refcount_exit--; | 652 | sys_prof_refcount_exit--; |