From: Li Zefan <lizf@cn.fujitsu.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Tom Zanussi <tzanussi@gmail.com>, Jason Baron <jbaron@redhat.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/6] tracing/syscalls: Add profile filter support
Date: Mon, 07 Sep 2009 16:13:18 +0800 [thread overview]
Message-ID: <4AA4C09E.4050704@cn.fujitsu.com> (raw)
In-Reply-To: <4AA4C04D.1050201@cn.fujitsu.com>
This makes syscall profile events filter-able.
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
include/linux/syscalls.h | 14 ++++++++++----
kernel/trace/trace_syscalls.c | 9 +++++++--
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
index a8e3782..510d941 100644
--- a/include/linux/syscalls.h
+++ b/include/linux/syscalls.h
@@ -103,30 +103,36 @@ struct perf_counter_attr;
static int prof_sysenter_enable_##sname(struct ftrace_event_call *event_call) \
{ \
int ret = 0; \
- if (!atomic_inc_return(&event_enter_##sname.profile_count)) \
+ if (!atomic_inc_return(&event_call->profile_count)) \
ret = reg_prof_syscall_enter("sys"#sname); \
return ret; \
} \
\
static void prof_sysenter_disable_##sname(struct ftrace_event_call *event_call)\
{ \
- if (atomic_add_negative(-1, &event_enter_##sname.profile_count)) \
+ if (atomic_add_negative(-1, &event_call->profile_count)) { \
unreg_prof_syscall_enter("sys"#sname); \
+ tracepoint_synchronize_unregister(); \
+ destroy_profile_preds(event_call); \
+ } \
}
#define TRACE_SYS_EXIT_PROFILE(sname) \
static int prof_sysexit_enable_##sname(struct ftrace_event_call *event_call) \
{ \
int ret = 0; \
- if (!atomic_inc_return(&event_exit_##sname.profile_count)) \
+ if (!atomic_inc_return(&event_call->profile_count)) \
ret = reg_prof_syscall_exit("sys"#sname); \
return ret; \
} \
\
static void prof_sysexit_disable_##sname(struct ftrace_event_call *event_call) \
{ \
- if (atomic_add_negative(-1, &event_exit_##sname.profile_count)) \
+ if (atomic_add_negative(-1, &event_call->profile_count)) { \
unreg_prof_syscall_exit("sys"#sname); \
+ tracepoint_synchronize_unregister(); \
+ destroy_profile_preds(event_call); \
+ } \
}
#define TRACE_SYS_ENTER_PROFILE_INIT(sname) \
diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 8712ce3..c2faf98 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -414,7 +414,10 @@ static void prof_syscall_enter(struct pt_regs *regs, long id)
rec->nr = syscall_nr;
syscall_get_arguments(current, regs, 0, sys_data->nb_args,
(unsigned long *)&rec->args);
- perf_tpcounter_event(sys_data->enter_id, 0, 1, rec, size);
+
+ if (profile_filter_check(sys_data->enter_event, &rec))
+ perf_tpcounter_event(sys_data->enter_id, 0, 1,
+ rec, size);
} while(0);
}
@@ -476,7 +479,9 @@ static void prof_syscall_exit(struct pt_regs *regs, long ret)
rec.nr = syscall_nr;
rec.ret = syscall_get_return_value(current, regs);
- perf_tpcounter_event(sys_data->exit_id, 0, 1, &rec, sizeof(rec));
+ if (profile_filter_check(sys_data->exit_event, &rec))
+ perf_tpcounter_event(sys_data->exit_id, 0, 1,
+ &rec, sizeof(rec));
}
int reg_prof_syscall_exit(char *name)
--
1.6.3
next prev parent reply other threads:[~2009-09-07 8:14 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-07 8:11 [PATCH 0/6] perf trace: Add filter support Li Zefan
2009-09-07 8:12 ` [PATCH 1/6] tracing/filters: refactor subsystem filter code Li Zefan
2009-09-07 8:12 ` [PATCH 2/6] tracing/profile: Add filter support Li Zefan
2009-09-08 2:01 ` Frederic Weisbecker
2009-09-08 2:24 ` Frederic Weisbecker
2009-09-08 8:35 ` Peter Zijlstra
2009-09-08 12:33 ` Frederic Weisbecker
2009-09-07 8:13 ` Li Zefan [this message]
2009-09-07 8:13 ` [PATCH 4/6] perf_counter: Add PERF_COUNTER_IOC_SET_FILTER ioctl Li Zefan
2009-09-07 16:44 ` Peter Zijlstra
2009-09-07 16:48 ` Ingo Molnar
2009-09-07 16:55 ` Peter Zijlstra
2009-09-08 0:49 ` Li Zefan
2009-09-08 6:52 ` Ingo Molnar
2009-09-08 8:37 ` Peter Zijlstra
2009-09-08 7:01 ` Tom Zanussi
2009-09-09 2:18 ` Li Zefan
2009-09-10 4:45 ` Tom Zanussi
2009-09-10 23:01 ` Randy Dunlap
2009-09-11 4:08 ` Tom Zanussi
2009-09-07 8:13 ` [PATCH 5/6] perf trace: increase MAX_EVENT_LENGTH Li Zefan
2009-09-07 8:14 ` [PATCH 6/6] perf trace: Add filter support Li Zefan
2009-09-08 0:02 ` [PATCH 0/6] " Frederic Weisbecker
2009-09-08 1:06 ` Li Zefan
2009-09-08 2:12 ` Frederic Weisbecker
2009-09-08 6:53 ` Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4AA4C09E.4050704@cn.fujitsu.com \
--to=lizf@cn.fujitsu.com \
--cc=fweisbec@gmail.com \
--cc=jbaron@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tzanussi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.