tracing: Clean up trace.h
PATCH v2 1/1 tracing: Clean up trace.h
- remove some dead code
- remove @stats from struct tracer
- move DEFINE_COMPARISON_PRED() and DEFINE_EQUALITY_PRED() to kernel/trace/trace_events_filter.c
---
I've split hw_breakpoint code out.
--- kernel/trace/trace.h | 86 +++++------------------------------- kernel/trace/trace_events_filter.c | 41 +++++++++++++++++ 2 files changed, 52 insertions(+), 75 deletions(-)
kernel/trace/trace.h +11 -75
@@ -125,14 +125,6 @@ struct print_entry {char buf[]; }; -#define TRACE_OLD_SIZE 88 - -struct trace_field_cont { -unsigned char type; -/* Temporary till we get rid of this completely */ -char buf[TRACE_OLD_SIZE -1 ]; -}; -struct trace_mmiotrace_rw {struct trace_entry ent;struct mmiotrace_rw rw;
@@ -182,20 +174,20 @@ enum kmemtrace_type_id {struct kmemtrace_alloc_entry {struct trace_entry ent; -enum kmemtrace_type_id type_id; -unsigned long call_site; -const void *ptr; -size_t bytes_req; -size_t bytes_alloc; -gfp_t gfp_flags; -int node; +enum kmemtrace_type_id type_id; +unsigned long call_site; +const void *ptr; +size_t bytes_req; +size_t bytes_alloc; +gfp_t gfp_flags; +int node; };struct kmemtrace_free_entry {struct trace_entry ent; -enum kmemtrace_type_id type_id; -unsigned long call_site; -const void *ptr; +enum kmemtrace_type_id type_id; +unsigned long call_site; +const void *ptr; };struct syscall_trace_enter {
@@ -226,7 +218,7 @@ struct ksym_trace_entry {* states when a trace occurs. These are: * IRQS_OFF - interrupts were disabled * IRQS_NOSUPPORT - arch does not support irqs_disabled_flags -* NEED_RESCED - reschedule is requested +* NEED_RESCHED - reschedule is requested * HARDIRQ - inside an interrupt handler * SOFTIRQ - inside a softirq handler */
@@ -406,7 +398,6 @@ struct tracer {struct tracer *next;int print_max;struct tracer_flags *flags; -struct tracer_stat *stats; };
@@ -525,20 +516,6 @@ static inline void __trace_stack(struct trace_array *tr, unsigned long flags,extern cycle_t ftrace_now (int cpu); -#ifdef CONFIG_CONTEXT_SWITCH_TRACER -typedef void -(*tracer_switch_func_t )(void *private, -void *__rq, -struct task_struct *prev, -struct task_struct *next); - -struct tracer_switch_ops { -tracer_switch_func_t func; -void *private; -struct tracer_switch_ops *next; -}; -#endif /* CONFIG_CONTEXT_SWITCH_TRACER */ -extern void trace_find_cmdline (int pid,char comm[]);#ifdef CONFIG_DYNAMIC_FTRACE
@@ -841,47 +818,6 @@ filter_check_discard(struct ftrace_event_call *call, void *rec,return 0 ; } -#define DEFINE_COMPARISON_PRED (type) \ -static int filter_pred_##type(struct filter_pred *pred, void *event, \ - int val1, int val2) \ -{ \ - type *addr = (type *)(event + pred->offset); \ - type val = (type)pred->val; \ - int match = 0; \ - \ - switch (pred->op) { \ - case OP_LT: \ - match = (*addr < val); \ - break; \ - case OP_LE: \ - match = (*addr <= val); \ - break; \ - case OP_GT: \ - match = (*addr > val); \ - break; \ - case OP_GE: \ - match = (*addr >= val); \ - break; \ - default: \ - break; \ - } \ - \ - return match; \ -} - -#define DEFINE_EQUALITY_PRED (size) \ -static int filter_pred_##size(struct filter_pred *pred, void *event, \ - int val1, int val2) \ -{ \ - u##size *addr = (u##size *)(event + pred->offset); \ - u##size val = (u##size)pred->val; \ - int match; \ - \ - match = (val == *addr) ^ pred->not; \ - \ - return match; \ -} -extern struct mutex event_mutex;extern struct list_head ftrace_events;
kernel/trace/trace_events_filter.c +41 -0
47 lines not on this page · raw message
Signature · 1 line
1.6.3
Quoted 7 lines · Li Zefan
- remove some dead code
- remove @stats from struct tracer
- moveDEFINE_COMPARISON_PRED()andDEFINE_EQUALITY_PRED()tokernel/trace/trace_events_filter.cSigned-off-by Li Zefan <[email protected]>---
Nice :-)
Quoted 199 lines
I've split
hw_breakpointcode out.--- kernel/trace/trace.h | 86 +++++------------------------------- kernel/trace/trace_events_filter.c | 41 +++++++++++++++++ 2 files changed, 52 insertions(+), 75 deletions(-)kernel/trace/trace.h +11
-75@@ -125,14 +125,6 @@ struct print_entry {char buf[]; }; -#define TRACE_OLD_SIZE 88 - -struct trace_field_cont { -unsigned char type; -/* Temporary till we get rid of this completely */ -char buf[TRACE_OLD_SIZE -1 ]; -}; -struct trace_mmiotrace_rw {struct trace_entry ent;struct mmiotrace_rw rw;@@ -182,20 +174,20 @@ enum kmemtrace_type_id {struct kmemtrace_alloc_entry {struct trace_entry ent; -enum kmemtrace_type_id type_id; -unsigned long call_site; -const void *ptr; -size_t bytes_req; -size_t bytes_alloc; -gfp_t gfp_flags; -int node; +enum kmemtrace_type_id type_id; +unsigned long call_site; +const void *ptr; +size_t bytes_req; +size_t bytes_alloc; +gfp_t gfp_flags; +int node; };struct kmemtrace_free_entry {struct trace_entry ent; -enum kmemtrace_type_id type_id; -unsigned long call_site; -const void *ptr; +enum kmemtrace_type_id type_id; +unsigned long call_site; +const void *ptr; };struct syscall_trace_enter {@@ -226,7 +218,7 @@ struct ksym_trace_entry {* states when a trace occurs. These are: * IRQS_OFF - interrupts were disabled * IRQS_NOSUPPORT - arch does not support irqs_disabled_flags -* NEED_RESCED - reschedule is requested +* NEED_RESCHED - reschedule is requested * HARDIRQ - inside an interrupt handler * SOFTIRQ - inside a softirq handler */ @@ -406,7 +398,6 @@ struct tracer {struct tracer *next;int print_max;struct tracer_flags *flags; -struct tracer_stat *stats; };@@ -525,20 +516,6 @@ static inline void __trace_stack(struct trace_array *tr, unsigned long flags,extern cycle_t ftrace_now (int cpu); -#ifdef CONFIG_CONTEXT_SWITCH_TRACER -typedef void -(*tracer_switch_func_t )(void *private, -void *__rq, -struct task_struct *prev, -struct task_struct *next); - -struct tracer_switch_ops { -tracer_switch_func_t func; -void *private; -struct tracer_switch_ops *next; -}; -#endif /* CONFIG_CONTEXT_SWITCH_TRACER */ -extern void trace_find_cmdline (int pid,char comm[]);#ifdef CONFIG_DYNAMIC_FTRACE @@ -841,47 +818,6 @@ filter_check_discard(struct ftrace_event_call *call, void *rec,return 0 ; } -#define DEFINE_COMPARISON_PRED (type) \ -static int filter_pred_##type(struct filter_pred *pred, void *event, \ - int val1, int val2) \ -{ \ - type *addr = (type *)(event + pred->offset); \ - type val = (type)pred->val; \ - int match = 0; \ - \ - switch (pred->op) { \ - case OP_LT: \ - match = (*addr < val); \ - break; \ - case OP_LE: \ - match = (*addr <= val); \ - break; \ - case OP_GT: \ - match = (*addr > val); \ - break; \ - case OP_GE: \ - match = (*addr >= val); \ - break; \ - default: \ - break; \ - } \ - \ - return match; \ -} - -#define DEFINE_EQUALITY_PRED (size) \ -static int filter_pred_##size(struct filter_pred *pred, void *event, \ - int val1, int val2) \ -{ \ - u##size *addr = (u##size *)(event + pred->offset); \ - u##size val = (u##size)pred->val; \ - int match; \ - \ - match = (val == *addr) ^ pred->not; \ - \ - return match; \ -} -extern struct mutex event_mutex;extern struct list_head ftrace_events;kernel/trace/trace_events_filter.c +41
-0@@ -121,6 +121,47 @@ struct filter_parse_state { } operand; }; +#define DEFINE_COMPARISON_PRED (type) \ +static int filter_pred_##type(struct filter_pred *pred, void *event, \ + int val1, int val2) \ +{ \ + type *addr = (type *)(event + pred->offset); \ + type val = (type)pred->val; \ + int match = 0; \ + \ + switch (pred->op) { \ + case OP_LT: \ + match = (*addr < val); \ + break; \ + case OP_LE: \ + match = (*addr <= val); \ + break; \ + case OP_GT: \ + match = (*addr > val); \ + break; \ + case OP_GE: \ + match = (*addr >= val); \ + break; \ + default: \ + break; \ + } \ + \ + return match; \ +} + +#define DEFINE_EQUALITY_PRED (size) \ +static int filter_pred_##size(struct filter_pred *pred, void *event, \ + int val1, int val2) \ +{ \ + u##size *addr = (u##size *)(event + pred->offset); \ + u##size val = (u##size)pred->val; \ + int match; \ + \ + match = (val == *addr) ^ pred->not; \ + \ + return match; \ +} +DEFINE_COMPARISON_PRED (s64);DEFINE_COMPARISON_PRED (u64);DEFINE_COMPARISON_PRED (s32);Signature · 1 line
1.6.3
Steven Rostedt
maintainerQuoted 5 lines · Li Zefan
- remove some dead code
- remove @stats from struct tracer
- moveDEFINE_COMPARISON_PRED()andDEFINE_EQUALITY_PRED()tokernel/trace/trace_events_filter.c
Actually, Li if you don't mind, I'm going to break this up into separate patches. Each of the above "topics" really should be a separate patch. It makes bisecting and such nicer if for some strange reason this patch became the cause.
-- Steve
Quoted 198 lines
Signed-off-by Li Zefan <[email protected]>---
I've split
hw_breakpointcode out.--- kernel/trace/trace.h | 86 +++++------------------------------- kernel/trace/trace_events_filter.c | 41 +++++++++++++++++ 2 files changed, 52 insertions(+), 75 deletions(-)kernel/trace/trace.h +11
-75@@ -125,14 +125,6 @@ struct print_entry {char buf[]; }; -#define TRACE_OLD_SIZE 88 - -struct trace_field_cont { -unsigned char type; -/* Temporary till we get rid of this completely */ -char buf[TRACE_OLD_SIZE -1 ]; -}; -struct trace_mmiotrace_rw {struct trace_entry ent;struct mmiotrace_rw rw;@@ -182,20 +174,20 @@ enum kmemtrace_type_id {struct kmemtrace_alloc_entry {struct trace_entry ent; -enum kmemtrace_type_id type_id; -unsigned long call_site; -const void *ptr; -size_t bytes_req; -size_t bytes_alloc; -gfp_t gfp_flags; -int node; +enum kmemtrace_type_id type_id; +unsigned long call_site; +const void *ptr; +size_t bytes_req; +size_t bytes_alloc; +gfp_t gfp_flags; +int node; };struct kmemtrace_free_entry {struct trace_entry ent; -enum kmemtrace_type_id type_id; -unsigned long call_site; -const void *ptr; +enum kmemtrace_type_id type_id; +unsigned long call_site; +const void *ptr; };struct syscall_trace_enter {@@ -226,7 +218,7 @@ struct ksym_trace_entry {* states when a trace occurs. These are: * IRQS_OFF - interrupts were disabled * IRQS_NOSUPPORT - arch does not support irqs_disabled_flags -* NEED_RESCED - reschedule is requested +* NEED_RESCHED - reschedule is requested * HARDIRQ - inside an interrupt handler * SOFTIRQ - inside a softirq handler */ @@ -406,7 +398,6 @@ struct tracer {struct tracer *next;int print_max;struct tracer_flags *flags; -struct tracer_stat *stats; };@@ -525,20 +516,6 @@ static inline void __trace_stack(struct trace_array *tr, unsigned long flags,extern cycle_t ftrace_now (int cpu); -#ifdef CONFIG_CONTEXT_SWITCH_TRACER -typedef void -(*tracer_switch_func_t )(void *private, -void *__rq, -struct task_struct *prev, -struct task_struct *next); - -struct tracer_switch_ops { -tracer_switch_func_t func; -void *private; -struct tracer_switch_ops *next; -}; -#endif /* CONFIG_CONTEXT_SWITCH_TRACER */ -extern void trace_find_cmdline (int pid,char comm[]);#ifdef CONFIG_DYNAMIC_FTRACE @@ -841,47 +818,6 @@ filter_check_discard(struct ftrace_event_call *call, void *rec,return 0 ; } -#define DEFINE_COMPARISON_PRED (type) \ -static int filter_pred_##type(struct filter_pred *pred, void *event, \ - int val1, int val2) \ -{ \ - type *addr = (type *)(event + pred->offset); \ - type val = (type)pred->val; \ - int match = 0; \ - \ - switch (pred->op) { \ - case OP_LT: \ - match = (*addr < val); \ - break; \ - case OP_LE: \ - match = (*addr <= val); \ - break; \ - case OP_GT: \ - match = (*addr > val); \ - break; \ - case OP_GE: \ - match = (*addr >= val); \ - break; \ - default: \ - break; \ - } \ - \ - return match; \ -} - -#define DEFINE_EQUALITY_PRED (size) \ -static int filter_pred_##size(struct filter_pred *pred, void *event, \ - int val1, int val2) \ -{ \ - u##size *addr = (u##size *)(event + pred->offset); \ - u##size val = (u##size)pred->val; \ - int match; \ - \ - match = (val == *addr) ^ pred->not; \ - \ - return match; \ -} -extern struct mutex event_mutex;extern struct list_head ftrace_events;kernel/trace/trace_events_filter.c +41
-0@@ -121,6 +121,47 @@ struct filter_parse_state { } operand; }; +#define DEFINE_COMPARISON_PRED (type) \ +static int filter_pred_##type(struct filter_pred *pred, void *event, \ + int val1, int val2) \ +{ \ + type *addr = (type *)(event + pred->offset); \ + type val = (type)pred->val; \ + int match = 0; \ + \ + switch (pred->op) { \ + case OP_LT: \ + match = (*addr < val); \ + break; \ + case OP_LE: \ + match = (*addr <= val); \ + break; \ + case OP_GT: \ + match = (*addr > val); \ + break; \ + case OP_GE: \ + match = (*addr >= val); \ + break; \ + default: \ + break; \ + } \ + \ + return match; \ +} + +#define DEFINE_EQUALITY_PRED (size) \ +static int filter_pred_##size(struct filter_pred *pred, void *event, \ + int val1, int val2) \ +{ \ + u##size *addr = (u##size *)(event + pred->offset); \ + u##size val = (u##size)pred->val; \ + int match; \ + \ + match = (val == *addr) ^ pred->not; \ + \ + return match; \ +} +DEFINE_COMPARISON_PRED (s64);DEFINE_COMPARISON_PRED (u64);DEFINE_COMPARISON_PRED (s32);
Quoted 7 lines · Steven Rostedt
Quoted 5 lines · Li Zefan
- remove some dead code
- remove @stats from struct tracer
- moveDEFINE_COMPARISON_PRED()andDEFINE_EQUALITY_PRED()tokernel/trace/trace_events_filter.c
Quoted 5 lines
Actually, Li if you don't mind, I'm going to break this up into separate patches. Each of the above "topics" really should be a separate patch. It makes bisecting and such nicer if for some strange reason this patch became the cause.
Actually it does more than I described:
- indent some lines
- fix a typo in comment
- remove trace_field_cont
- remove tracer_switch_ops
- remove @stats from struct tracer
- move 2 macros to trace_events_filter.c
I'm not sure it worths breaking into several patches, since each of them is trivial.
But I won't mind if you break this up, or if you want me to do this.
Steven Rostedt
maintainerQuoted 23 lines · Li Zefan
Quoted 7 lines · Steven Rostedt
Quoted 5 lines · Li Zefan
- remove some dead code
- remove @stats from struct tracer
- moveDEFINE_COMPARISON_PRED()andDEFINE_EQUALITY_PRED()tokernel/trace/trace_events_filter.cQuoted 5 lines
Actually, Li if you don't mind, I'm going to break this up into separate patches. Each of the above "topics" really should be a separate patch. It makes bisecting and such nicer if for some strange reason this patch became the cause.
Actually it does more than I described:
- indent some lines
- fix a typo in comment
- removetrace_field_cont
- removetracer_switch_ops
- remove @stats from struct tracer
- move 2 macros totrace_events_filter.c
Quoted 5 lines
I'm not sure it worths breaking into several patches, since each of them is trivial.
But I won't mind if you break this up, or if you want me to do this.
Yeah I already broke it up and sent it out. Some could go together, but I did not like moving code mixed with other cleanups.
Thanks,
-- Steve
[tip:tracing/core] tracing: remove dead code
In reply to Li ZefanCommit-ID: e0ab5f2daee1c7a6a387591bf37f0bad4e407112 Gitweb: http://git.kernel.org/tip/e0ab5f2daee1c7a6a387591bf37f0bad4e407112 Author: Li Zefan <[email protected]> AuthorDate: Thu, 10 Sep 2009 09:34:19 +0800 Committer: Steven Rostedt <[email protected]> CommitDate: Wed, 9 Sep 2009 23:54:06 -0400
tracing: remove dead code
Removes unreachable code.
LKML-Reference: <[email protected]>
--- kernel/trace/trace.h | 22 ---------------------- 1 files changed, 0 insertions(+), 22 deletions(-)
kernel/trace/trace.h +0 -22
@@ -120,14 +120,6 @@ struct print_entry {char buf[]; }; -#define TRACE_OLD_SIZE 88 - -struct trace_field_cont { -unsigned char type; -/* Temporary till we get rid of this completely */ -char buf[TRACE_OLD_SIZE -1 ]; -}; -struct trace_mmiotrace_rw {struct trace_entry ent;struct mmiotrace_rw rw;
@@ -509,20 +501,6 @@ static inline void __trace_stack(struct trace_array *tr, unsigned long flags,extern cycle_t ftrace_now (int cpu); -#ifdef CONFIG_CONTEXT_SWITCH_TRACER -typedef void -(*tracer_switch_func_t )(void *private, -void *__rq, -struct task_struct *prev, -struct task_struct *next); - -struct tracer_switch_ops { -tracer_switch_func_t func; -void *private; -struct tracer_switch_ops *next; -}; -#endif /* CONFIG_CONTEXT_SWITCH_TRACER */ -extern void trace_find_cmdline (int pid,char comm[]);#ifdef CONFIG_DYNAMIC_FTRACE
[tip:tracing/core] tracing: format clean ups
In reply to Li ZefanCommit-ID: bd9cfca9cb71200dd82b320bba12540dc078f4e0 Gitweb: http://git.kernel.org/tip/bd9cfca9cb71200dd82b320bba12540dc078f4e0 Author: Li Zefan <[email protected]> AuthorDate: Thu, 10 Sep 2009 09:34:19 +0800 Committer: Steven Rostedt <[email protected]> CommitDate: Wed, 9 Sep 2009 23:54:07 -0400
tracing: format clean ups
Fix white-space formatting.
LKML-Reference: <[email protected]>
--- kernel/trace/trace.h | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-)
kernel/trace/trace.h +11 -11
@@ -169,20 +169,20 @@ enum kmemtrace_type_id {struct kmemtrace_alloc_entry {struct trace_entry ent; -enum kmemtrace_type_id type_id; -unsigned long call_site; -const void *ptr; -size_t bytes_req; -size_t bytes_alloc; -gfp_t gfp_flags; -int node; +enum kmemtrace_type_id type_id; +unsigned long call_site; +const void *ptr; +size_t bytes_req; +size_t bytes_alloc; +gfp_t gfp_flags; +int node; };struct kmemtrace_free_entry {struct trace_entry ent; -enum kmemtrace_type_id type_id; -unsigned long call_site; -const void *ptr; +enum kmemtrace_type_id type_id; +unsigned long call_site; +const void *ptr; };struct syscall_trace_enter {
@@ -203,7 +203,7 @@ struct syscall_trace_exit {* states when a trace occurs. These are: * IRQS_OFF - interrupts were disabled * IRQS_NOSUPPORT - arch does not support irqs_disabled_flags -* NEED_RESCED - reschedule is requested +* NEED_RESCHED - reschedule is requested * HARDIRQ - inside an interrupt handler * SOFTIRQ - inside a softirq handler */
[tip:tracing/core] tracing: remove stats from struct tracer
In reply to Li ZefanCommit-ID: a5921c6c37d51ee2079ca3c69ea6f7b7384f5d87 Gitweb: http://git.kernel.org/tip/a5921c6c37d51ee2079ca3c69ea6f7b7384f5d87 Author: Li Zefan <[email protected]> AuthorDate: Thu, 10 Sep 2009 09:34:19 +0800 Committer: Steven Rostedt <[email protected]> CommitDate: Wed, 9 Sep 2009 23:54:09 -0400
tracing: remove stats from struct tracer
Remove unused field @stats from struct tracer.
LKML-Reference: <[email protected]>
--- kernel/trace/trace.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
kernel/trace/trace.h +0 -1
@@ -382,7 +382,6 @@ struct tracer {struct tracer *next;int print_max;struct tracer_flags *flags; -struct tracer_stat *stats; };
[tip:tracing/core] tracing: move PRED macros to trace_events_filter.c
In reply to Li ZefanCommit-ID: 197e2eabc90c203d1086916b7f66694ba5fbb937 Gitweb: http://git.kernel.org/tip/197e2eabc90c203d1086916b7f66694ba5fbb937 Author: Li Zefan <[email protected]> AuthorDate: Thu, 10 Sep 2009 09:34:19 +0800 Committer: Steven Rostedt <[email protected]> CommitDate: Wed, 9 Sep 2009 23:54:11 -0400
tracing: move PRED macros to trace_events_filter.c
Move DEFINE_COMPARISON_PRED() and DEFINE_EQUALITY_PRED()
to kernel/trace/trace_events_filter.c
LKML-Reference: <[email protected]>
--- kernel/trace/trace.h | 41 ------------------------------------ kernel/trace/trace_events_filter.c | 41 ++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 41 deletions(-)
kernel/trace/trace.h +0 -41
@@ -800,47 +800,6 @@ filter_check_discard(struct ftrace_event_call *call, void *rec,return 0 ; } -#define DEFINE_COMPARISON_PRED (type) \ -static int filter_pred_##type(struct filter_pred *pred, void *event, \ - int val1, int val2) \ -{ \ - type *addr = (type *)(event + pred->offset); \ - type val = (type)pred->val; \ - int match = 0; \ - \ - switch (pred->op) { \ - case OP_LT: \ - match = (*addr < val); \ - break; \ - case OP_LE: \ - match = (*addr <= val); \ - break; \ - case OP_GT: \ - match = (*addr > val); \ - break; \ - case OP_GE: \ - match = (*addr >= val); \ - break; \ - default: \ - break; \ - } \ - \ - return match; \ -} - -#define DEFINE_EQUALITY_PRED (size) \ -static int filter_pred_##size(struct filter_pred *pred, void *event, \ - int val1, int val2) \ -{ \ - u##size *addr = (u##size *)(event + pred->offset); \ - u##size val = (u##size)pred->val; \ - int match; \ - \ - match = (val == *addr) ^ pred->not; \ - \ - return match; \ -} -extern struct mutex event_mutex;extern struct list_head ftrace_events;
kernel/trace/trace_events_filter.c +41 -0
47 lines not on this page · raw message