Skip to contentSkip to conversation

trace_syscalls: add missed field

PATCH In review Lai Jiangshan 2 participants 5 messages Nov 26, 2009 – Nov 27, 2009 Tracing

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace_syscalls: add missed field

Field syscall number is missed in syscall_enter_define_fields()/ syscall_exit_define_fields().

syscall number is also needed for event filter or other users.

---

kernel/trace/trace_syscalls.c +8 -0
index 9189cbe..63aa807 100644
@@ -261,6 +261,10 @@ int syscall_enter_define_fields(struct ftrace_event_call *call)
 	if (ret)
 		return ret;
 
+	ret = trace_define_field(call, SYSCALL_FIELD(int, nr), FILTER_OTHER);
+	if (ret)
+		return ret;
+
 	for (i = 0; i < meta->nb_args; i++) {
 		ret = trace_define_field(call, meta->types[i],
 					 meta->args[i], offset,
@@ -281,6 +285,10 @@ int syscall_exit_define_fields(struct ftrace_event_call *call)
 	if (ret)
 		return ret;
 
+	ret = trace_define_field(call, SYSCALL_FIELD(int, nr), FILTER_OTHER);
+	if (ret)
+		return ret;
+
 	ret = trace_define_field(call, SYSCALL_FIELD(long, ret),
 				 FILTER_OTHER);
 
#1 lore raw
Quoted 7 lines · Lai Jiangshan

Field syscall number is missed in syscall_enter_define_fields()/ syscall_exit_define_fields().

syscall number is also needed for event filter or other users.

Well, I don't think it's very useful for in-kernel filtering. Filtering a syscall event by its number would mean filtering all event for this syscall. This is the same as not tracing it.

Or do you have other usecases in mind?

Thanks.

#2 lore raw
Quoted 9 lines · Frederic Weisbecker
Quoted 6 lines · Lai Jiangshan

Field syscall number is missed in syscall_enter_define_fields()/ syscall_exit_define_fields().

syscall number is also needed for event filter or other users.

For all kinds of tracer, all fields are "defined"
by trace_define_field(), except this one.
Maybe because I don't like inconsistent codes.

Quoted 7 lines

Well, I don't think it's very useful for in-kernel filtering. Filtering a syscall event by its number would mean filtering all event for this syscall. This is the same as not tracing it.

Or do you have other usecases in mind?

Current, only filter use struct ftrace_event_call->fields, so there is no other usecases ^_^.
But my next take of "tracing: use defined fields to print formats" will use it.

#3 lore raw
Quoted 7 lines · Lai Jiangshan
Quoted 6 lines · Frederic Weisbecker
Quoted 5 lines · Lai Jiangshan

Field syscall number is missed in syscall_enter_define_fields()/ syscall_exit_define_fields().

syscall number is also needed for event filter or other users.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

For all kinds of tracer, all fields are "defined"
by trace_define_field(), except this one.
Maybe because I don't like inconsistent codes.

:)

Quoted 5 lines
Quoted 5 lines

Well, I don't think it's very useful for in-kernel filtering. Filtering a syscall event by its number would mean filtering all event for this syscall. This is the same as not tracing it.

Quoted 7 lines
Quoted 2 lines

Or do you have other usecases in mind?

Current, only filter use struct ftrace_event_call->fields, so there is no other usecases ^_^.
But my next take of "tracing: use defined fields to print formats" will use it.

Oh really you are planning such patch? That looks hard to do considering the tricky things that happen in fields printing sometimes. Also printing the fields is often a human interpretation on how to handle them, so... Anyway, I'll just wait for your patches and see.

That said I really have no opposition against this patch. For consistency over what is done with every other trace event fields, and to anticipate any further uses of trace event fields definition other than filtering:

(Steve, Ingo, should I queue it or...what do you prefer?)

#4 lore raw

[tip:perf/core] trace_syscalls: Add syscall nr field

In reply to Lai Jiangshan
Commit-ID:  0f1ef51d244809f417bdf45cdb00109fb6005672
Gitweb:     http://git.kernel.org/tip/0f1ef51d244809f417bdf45cdb00109fb6005672
Author:     Lai Jiangshan <[email protected]>
AuthorDate: Thu, 26 Nov 2009 15:49:33 +0800
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 27 Nov 2009 06:24:19 +0100

trace_syscalls: Add syscall nr field

Field syscall number is missed in syscall_enter_define_fields()/ syscall_exit_define_fields().

Syscall number is also needed for event filter or other users.

LKML-Reference: <[email protected]>

---
 kernel/trace/trace_syscalls.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
kernel/trace/trace_syscalls.c +8 -0
index 9189cbe..63aa807 100644
@@ -261,6 +261,10 @@ int syscall_enter_define_fields(struct ftrace_event_call *call)
 	if (ret)
 		return ret;
 
+	ret = trace_define_field(call, SYSCALL_FIELD(int, nr), FILTER_OTHER);
+	if (ret)
+		return ret;
+
 	for (i = 0; i < meta->nb_args; i++) {
 		ret = trace_define_field(call, meta->types[i],
 					 meta->args[i], offset,
@@ -281,6 +285,10 @@ int syscall_exit_define_fields(struct ftrace_event_call *call)
 	if (ret)
 		return ret;
 
+	ret = trace_define_field(call, SYSCALL_FIELD(int, nr), FILTER_OTHER);
+	if (ret)
+		return ret;
+
 	ret = trace_define_field(call, SYSCALL_FIELD(long, ret),
 				 FILTER_OTHER);