linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "zhangwei(Jovi)" <jovi.zhangwei@huawei.com>
To: <rostedt@goodmis.org>, <fweisbec@gmail.com>, <mingo@redhat.com>,
	<linux-kernel@vger.kernel.org>
Cc: "zhangwei(Jovi)" <jovi.zhangwei@huawei.com>
Subject: [PATCH v3 05/12] tracing: switch syscall tracing to use event_trace_ops backend
Date: Wed, 10 Apr 2013 11:26:26 +0800	[thread overview]
Message-ID: <1365564393-10972-6-git-send-email-jovi.zhangwei@huawei.com> (raw)
In-Reply-To: <1365564393-10972-1-git-send-email-jovi.zhangwei@huawei.com>

From: "zhangwei(Jovi)" <jovi.zhangwei@huawei.com>

Other tracepoints already switched to use event_trace_ops as
backend store mechanism, syscall tracing can use same backend.

This change would also expose syscall tracing to external modules
with same interface like other tracepoints.

Signed-off-by: zhangwei(Jovi) <jovi.zhangwei@huawei.com>
---
 kernel/trace/trace_syscalls.c |   49 ++++++++++++++---------------------------
 1 file changed, 16 insertions(+), 33 deletions(-)

diff --git a/kernel/trace/trace_syscalls.c b/kernel/trace/trace_syscalls.c
index 322e164..72675b1 100644
--- a/kernel/trace/trace_syscalls.c
+++ b/kernel/trace/trace_syscalls.c
@@ -302,12 +302,10 @@ static int __init syscall_exit_define_fields(struct ftrace_event_call *call)
 static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id)
 {
 	struct trace_array *tr = data;
+	struct ftrace_event_file event_file;
+	struct trace_descriptor_t desc;
 	struct syscall_trace_enter *entry;
 	struct syscall_metadata *sys_data;
-	struct ring_buffer_event *event;
-	struct ring_buffer *buffer;
-	unsigned long irq_flags;
-	int pc;
 	int syscall_nr;
 	int size;
 
@@ -323,34 +321,26 @@ static void ftrace_syscall_enter(void *data, struct pt_regs *regs, long id)
 
 	size = sizeof(*entry) + sizeof(unsigned long) * sys_data->nb_args;
 
-	local_save_flags(irq_flags);
-	pc = preempt_count();
-
-	buffer = tr->trace_buffer.buffer;
-	event = trace_buffer_lock_reserve(buffer,
-			sys_data->enter_event->event.type, size, irq_flags, pc);
-	if (!event)
+	event_file.tr = tr;
+	event_file.event_call = sys_data->enter_event;
+	event_file.flags = FTRACE_EVENT_FL_ENABLED;
+	entry = tr->ops->pre_trace(&event_file, size, &desc);
+	if (!entry)
 		return;
 
-	entry = ring_buffer_event_data(event);
 	entry->nr = syscall_nr;
 	syscall_get_arguments(current, regs, 0, sys_data->nb_args, entry->args);
 
-	if (!filter_current_check_discard(buffer, sys_data->enter_event,
-					  entry, event))
-		trace_current_buffer_unlock_commit(buffer, event,
-						   irq_flags, pc);
+	tr->ops->do_trace(&event_file, entry, size, &desc);
 }
 
 static void ftrace_syscall_exit(void *data, struct pt_regs *regs, long ret)
 {
 	struct trace_array *tr = data;
+	struct ftrace_event_file event_file;
+	struct trace_descriptor_t desc;
 	struct syscall_trace_exit *entry;
 	struct syscall_metadata *sys_data;
-	struct ring_buffer_event *event;
-	struct ring_buffer *buffer;
-	unsigned long irq_flags;
-	int pc;
 	int syscall_nr;
 
 	syscall_nr = trace_get_syscall_nr(current, regs);
@@ -363,24 +353,17 @@ static void ftrace_syscall_exit(void *data, struct pt_regs *regs, long ret)
 	if (!sys_data)
 		return;
 
-	local_save_flags(irq_flags);
-	pc = preempt_count();
-
-	buffer = tr->trace_buffer.buffer;
-	event = trace_buffer_lock_reserve(buffer,
-			sys_data->exit_event->event.type, sizeof(*entry),
-			irq_flags, pc);
-	if (!event)
+	event_file.tr = tr;
+	event_file.event_call = sys_data->exit_event;
+	event_file.flags = FTRACE_EVENT_FL_ENABLED;
+	entry = tr->ops->pre_trace(&event_file, sizeof(*entry), &desc);
+	if (!entry)
 		return;
 
-	entry = ring_buffer_event_data(event);
 	entry->nr = syscall_nr;
 	entry->ret = syscall_get_return_value(current, regs);
 
-	if (!filter_current_check_discard(buffer, sys_data->exit_event,
-					  entry, event))
-		trace_current_buffer_unlock_commit(buffer, event,
-						   irq_flags, pc);
+	tr->ops->do_trace(&event_file, entry, sizeof(*entry), &desc);
 }
 
 static int reg_event_syscall_enter(struct ftrace_event_file *file,
-- 
1.7.9.7



  parent reply	other threads:[~2013-04-10  3:29 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-10  3:26 [PATCH v3 00/12] event tracing expose change and bugfix/cleanup zhangwei(Jovi)
2013-04-10  3:26 ` [PATCH v3 01/12] tracing: move trace_array definition into include/linux/trace_array.h zhangwei(Jovi)
2013-07-02 23:19   ` Steven Rostedt
2013-07-03  4:02     ` zhangwei(Jovi)
2013-04-10  3:26 ` [PATCH v3 02/12] tracing: fix irqs-off tag display in syscall tracing zhangwei(Jovi)
2013-07-02 23:25   ` Steven Rostedt
2013-04-10  3:26 ` [PATCH v3 03/12] tracing: expose event tracing infrastructure zhangwei(Jovi)
2013-07-02 23:35   ` Steven Rostedt
2013-07-03  3:59     ` zhangwei(Jovi)
2013-04-10  3:26 ` [PATCH v3 04/12] tracing: export ftrace_events zhangwei(Jovi)
2013-04-10  3:26 ` zhangwei(Jovi) [this message]
2013-04-10  3:26 ` [PATCH v3 06/12] tracing: expose structure ftrace_event_field zhangwei(Jovi)
2013-04-10  3:26 ` [PATCH v3 07/12] tracing: remove TRACE_EVENT_TYPE enum definition zhangwei(Jovi)
2013-07-02 23:39   ` Steven Rostedt
2013-04-10  3:26 ` [PATCH v3 08/12] tracing: remove obsolete macro guard _TRACE_PROFILE_INIT zhangwei(Jovi)
2013-04-10  3:26 ` [PATCH v3 09/12] tracing: remove ftrace(...) function zhangwei(Jovi)
2013-07-02 23:45   ` Steven Rostedt
2013-04-10  3:26 ` [PATCH v3 10/12] tracing: use per trace_array clock_id instead of global trace_clock_id zhangwei(Jovi)
2013-04-10  3:26 ` [PATCH v3 11/12] tracing: guard tracing_selftest_disabled by CONFIG_FTRACE_STARTUP_TEST zhangwei(Jovi)
2013-07-02 23:56   ` Steven Rostedt
2013-07-03  4:12     ` zhangwei(Jovi)
2013-07-03 11:39       ` Steven Rostedt
2013-04-10  3:26 ` [PATCH v3 12/12] libtraceevent: add libtraceevent prefix in warning message zhangwei(Jovi)
2013-04-10 15:08 ` [PATCH v3 00/12] event tracing expose change and bugfix/cleanup Steven Rostedt
2013-04-11  3:31   ` zhangwei(Jovi)
2013-07-02 23:16   ` Steven Rostedt

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=1365564393-10972-6-git-send-email-jovi.zhangwei@huawei.com \
    --to=jovi.zhangwei@huawei.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=rostedt@goodmis.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).