All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tracing/events: make struct trace_entry->type to be int type
@ 2009-04-22  8:53 Li Zefan
  2009-04-22  9:10 ` Frederic Weisbecker
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Li Zefan @ 2009-04-22  8:53 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: Steven Rostedt, Frederic Weisbecker, Tom Zanussi, LKML

struct trace_entry->type is unsigned char, while trace event's id is
int type, thus for a event with id >= 256, it's entry->type is cast
to (id % 256), and then we can't see the trace output of this event.

 # insmod trace-events-sample.ko
 # echo foo_bar > /mnt/tracing/set_event
 # cat /debug/tracing/events/trace-events-sample/foo_bar/id
 256
 # cat /mnt/tracing/trace_pipe
           <...>-3548  [001]   215.091142: Unknown type 0
           <...>-3548  [001]   216.089207: Unknown type 0
           <...>-3548  [001]   217.087271: Unknown type 0
           <...>-3548  [001]   218.085332: Unknown type 0

[ Impact: fix output for trace events with id >= 256 ]

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
---
 include/linux/ftrace_event.h |    4 ++--
 include/trace/ftrace.h       |    2 +-
 kernel/trace/trace.c         |    4 ++--
 kernel/trace/trace.h         |    2 +-
 kernel/trace/trace_events.c  |    2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 75f3ac0..2a4a407 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -16,7 +16,7 @@ struct dentry;
  *     bash-15816 [01]   235.197585: idle_cpu <- irq_enter
  */
 struct trace_entry {
-	unsigned char		type;
+	int			type;
 	unsigned char		flags;
 	unsigned char		preempt_count;
 	int			pid;
@@ -73,7 +73,7 @@ enum print_line_t {
 
 
 struct ring_buffer_event *
-trace_current_buffer_lock_reserve(unsigned char type, unsigned long len,
+trace_current_buffer_lock_reserve(int type, unsigned long len,
 				  unsigned long flags, int pc);
 void trace_current_buffer_unlock_commit(struct ring_buffer_event *event,
 					unsigned long flags, int pc);
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 39a3351..15ef08d 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -198,7 +198,7 @@ ftrace_define_fields_##call(void)					\
 	struct ftrace_event_call *event_call = &event_##call;		\
 	int ret;							\
 									\
-	__common_field(unsigned char, type);				\
+	__common_field(int, type);					\
 	__common_field(unsigned char, flags);				\
 	__common_field(unsigned char, preempt_count);			\
 	__common_field(int, pid);					\
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index b9a3adc..b6183bc 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -838,7 +838,7 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags,
 }
 
 struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr,
-						    unsigned char type,
+						    int type,
 						    unsigned long len,
 						    unsigned long flags, int pc)
 {
@@ -881,7 +881,7 @@ void trace_buffer_unlock_commit(struct trace_array *tr,
 }
 
 struct ring_buffer_event *
-trace_current_buffer_lock_reserve(unsigned char type, unsigned long len,
+trace_current_buffer_lock_reserve(int type, unsigned long len,
 				  unsigned long flags, int pc)
 {
 	return trace_buffer_lock_reserve(&global_trace,
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 8750e83..3e5c664 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -422,7 +422,7 @@ void init_tracer_sysprof_debugfs(struct dentry *d_tracer);
 struct ring_buffer_event;
 
 struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr,
-						    unsigned char type,
+						    int type,
 						    unsigned long len,
 						    unsigned long flags,
 						    int pc);
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 9631caf..86fa720 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -398,7 +398,7 @@ static int trace_write_header(struct trace_seq *s)
 				"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
 				"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
 				"\n",
-				FIELD(unsigned char, type),
+				FIELD(int, type),
 				FIELD(unsigned char, flags),
 				FIELD(unsigned char, preempt_count),
 				FIELD(int, pid),
-- 
1.5.4.rc3


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] tracing/events: make struct trace_entry->type to be int type
  2009-04-22  8:53 [PATCH] tracing/events: make struct trace_entry->type to be int type Li Zefan
@ 2009-04-22  9:10 ` Frederic Weisbecker
  2009-04-22  9:19   ` Li Zefan
  2009-04-22 10:06 ` [tip:tracing/core] " tip-bot for Li Zefan
  2009-04-22 13:15 ` [PATCH] " Steven Rostedt
  2 siblings, 1 reply; 10+ messages in thread
From: Frederic Weisbecker @ 2009-04-22  9:10 UTC (permalink / raw)
  To: Li Zefan; +Cc: Ingo Molnar, Steven Rostedt, Tom Zanussi, LKML

On Wed, Apr 22, 2009 at 04:53:34PM +0800, Li Zefan wrote:
> struct trace_entry->type is unsigned char, while trace event's id is
> int type, thus for a event with id >= 256, it's entry->type is cast
> to (id % 256), and then we can't see the trace output of this event.
> 
>  # insmod trace-events-sample.ko
>  # echo foo_bar > /mnt/tracing/set_event
>  # cat /debug/tracing/events/trace-events-sample/foo_bar/id
>  256
>  # cat /mnt/tracing/trace_pipe
>            <...>-3548  [001]   215.091142: Unknown type 0
>            <...>-3548  [001]   216.089207: Unknown type 0
>            <...>-3548  [001]   217.087271: Unknown type 0
>            <...>-3548  [001]   218.085332: Unknown type 0
> 
> [ Impact: fix output for trace events with id >= 256 ]
> 
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>


Indeed, now with the trace_events, we are approaching this possible
overflow and the type is indeed an int:

struct trace_event *ftrace_find_event(int type)

Curious: does it only happen with the trace-event-sample?
I doubt we already reached this threshold of event number.
But anyway, it's a good thing.

Acked-by: Frederic Weisbecker <fweisbec@gmail.com>


> ---
>  include/linux/ftrace_event.h |    4 ++--
>  include/trace/ftrace.h       |    2 +-
>  kernel/trace/trace.c         |    4 ++--
>  kernel/trace/trace.h         |    2 +-
>  kernel/trace/trace_events.c  |    2 +-
>  5 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
> index 75f3ac0..2a4a407 100644
> --- a/include/linux/ftrace_event.h
> +++ b/include/linux/ftrace_event.h
> @@ -16,7 +16,7 @@ struct dentry;
>   *     bash-15816 [01]   235.197585: idle_cpu <- irq_enter
>   */
>  struct trace_entry {
> -	unsigned char		type;
> +	int			type;
>  	unsigned char		flags;
>  	unsigned char		preempt_count;
>  	int			pid;
> @@ -73,7 +73,7 @@ enum print_line_t {
>  
>  
>  struct ring_buffer_event *
> -trace_current_buffer_lock_reserve(unsigned char type, unsigned long len,
> +trace_current_buffer_lock_reserve(int type, unsigned long len,
>  				  unsigned long flags, int pc);
>  void trace_current_buffer_unlock_commit(struct ring_buffer_event *event,
>  					unsigned long flags, int pc);
> diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
> index 39a3351..15ef08d 100644
> --- a/include/trace/ftrace.h
> +++ b/include/trace/ftrace.h
> @@ -198,7 +198,7 @@ ftrace_define_fields_##call(void)					\
>  	struct ftrace_event_call *event_call = &event_##call;		\
>  	int ret;							\
>  									\
> -	__common_field(unsigned char, type);				\
> +	__common_field(int, type);					\
>  	__common_field(unsigned char, flags);				\
>  	__common_field(unsigned char, preempt_count);			\
>  	__common_field(int, pid);					\
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index b9a3adc..b6183bc 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -838,7 +838,7 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags,
>  }
>  
>  struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr,
> -						    unsigned char type,
> +						    int type,
>  						    unsigned long len,
>  						    unsigned long flags, int pc)
>  {
> @@ -881,7 +881,7 @@ void trace_buffer_unlock_commit(struct trace_array *tr,
>  }
>  
>  struct ring_buffer_event *
> -trace_current_buffer_lock_reserve(unsigned char type, unsigned long len,
> +trace_current_buffer_lock_reserve(int type, unsigned long len,
>  				  unsigned long flags, int pc)
>  {
>  	return trace_buffer_lock_reserve(&global_trace,
> diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
> index 8750e83..3e5c664 100644
> --- a/kernel/trace/trace.h
> +++ b/kernel/trace/trace.h
> @@ -422,7 +422,7 @@ void init_tracer_sysprof_debugfs(struct dentry *d_tracer);
>  struct ring_buffer_event;
>  
>  struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr,
> -						    unsigned char type,
> +						    int type,
>  						    unsigned long len,
>  						    unsigned long flags,
>  						    int pc);
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 9631caf..86fa720 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -398,7 +398,7 @@ static int trace_write_header(struct trace_seq *s)
>  				"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
>  				"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
>  				"\n",
> -				FIELD(unsigned char, type),
> +				FIELD(int, type),
>  				FIELD(unsigned char, flags),
>  				FIELD(unsigned char, preempt_count),
>  				FIELD(int, pid),
> -- 
> 1.5.4.rc3
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] tracing/events: make struct trace_entry->type to be int type
  2009-04-22  9:10 ` Frederic Weisbecker
@ 2009-04-22  9:19   ` Li Zefan
  2009-04-22  9:40     ` Ingo Molnar
  0 siblings, 1 reply; 10+ messages in thread
From: Li Zefan @ 2009-04-22  9:19 UTC (permalink / raw)
  To: Frederic Weisbecker; +Cc: Ingo Molnar, Steven Rostedt, Tom Zanussi, LKML

Frederic Weisbecker wrote:
> On Wed, Apr 22, 2009 at 04:53:34PM +0800, Li Zefan wrote:
>> struct trace_entry->type is unsigned char, while trace event's id is
>> int type, thus for a event with id >= 256, it's entry->type is cast
>> to (id % 256), and then we can't see the trace output of this event.
>>
>>  # insmod trace-events-sample.ko
>>  # echo foo_bar > /mnt/tracing/set_event
>>  # cat /debug/tracing/events/trace-events-sample/foo_bar/id
>>  256
>>  # cat /mnt/tracing/trace_pipe
>>            <...>-3548  [001]   215.091142: Unknown type 0
>>            <...>-3548  [001]   216.089207: Unknown type 0
>>            <...>-3548  [001]   217.087271: Unknown type 0
>>            <...>-3548  [001]   218.085332: Unknown type 0
>>
>> [ Impact: fix output for trace events with id >= 256 ]
>>
>> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> 
> 
> Indeed, now with the trace_events, we are approaching this possible
> overflow and the type is indeed an int:
> 
> struct trace_event *ftrace_find_event(int type)
> 
> Curious: does it only happen with the trace-event-sample?
> I doubt we already reached this threshold of event number.
> But anyway, it's a good thing.
> 

I guess we haven't reached this limit, at least for mainline. :)

And the biggest id is 48 in my config.

> Acked-by: Frederic Weisbecker <fweisbec@gmail.com>


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] tracing/events: make struct trace_entry->type to be int type
  2009-04-22  9:19   ` Li Zefan
@ 2009-04-22  9:40     ` Ingo Molnar
  0 siblings, 0 replies; 10+ messages in thread
From: Ingo Molnar @ 2009-04-22  9:40 UTC (permalink / raw)
  To: Li Zefan; +Cc: Frederic Weisbecker, Steven Rostedt, Tom Zanussi, LKML


* Li Zefan <lizf@cn.fujitsu.com> wrote:

> Frederic Weisbecker wrote:
> > On Wed, Apr 22, 2009 at 04:53:34PM +0800, Li Zefan wrote:
> >> struct trace_entry->type is unsigned char, while trace event's id is
> >> int type, thus for a event with id >= 256, it's entry->type is cast
> >> to (id % 256), and then we can't see the trace output of this event.
> >>
> >>  # insmod trace-events-sample.ko
> >>  # echo foo_bar > /mnt/tracing/set_event
> >>  # cat /debug/tracing/events/trace-events-sample/foo_bar/id
> >>  256
> >>  # cat /mnt/tracing/trace_pipe
> >>            <...>-3548  [001]   215.091142: Unknown type 0
> >>            <...>-3548  [001]   216.089207: Unknown type 0
> >>            <...>-3548  [001]   217.087271: Unknown type 0
> >>            <...>-3548  [001]   218.085332: Unknown type 0
> >>
> >> [ Impact: fix output for trace events with id >= 256 ]
> >>
> >> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> > 
> > 
> > Indeed, now with the trace_events, we are approaching this possible
> > overflow and the type is indeed an int:
> > 
> > struct trace_event *ftrace_find_event(int type)
> > 
> > Curious: does it only happen with the trace-event-sample?
> > I doubt we already reached this threshold of event number.
> > But anyway, it's a good thing.
> > 
> 
> I guess we haven't reached this limit, at least for mainline. :)
> 
> And the biggest id is 48 in my config.

I think we'll hit 256 pretty soon :) Applied, thanks guys!

Btw., has anyone thought about a .config option that turns every 
dprintk into a tracepoint, enumerated in /debug/tracing/events/ 
nicely (grouped by subsystems) and toggle-able?

( They cannot have 'format' and 'filter' files [at least yet] - but 
  integrating them into the existing tracing facilities makes sense 
  nevertheless - they are often used as subsystem tracepoints. 
  Allowing them to be captured via the tracing facilities would make 
  their usage a lot more flexible. )

	Ingo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [tip:tracing/core] tracing/events: make struct trace_entry->type to be int type
  2009-04-22  8:53 [PATCH] tracing/events: make struct trace_entry->type to be int type Li Zefan
  2009-04-22  9:10 ` Frederic Weisbecker
@ 2009-04-22 10:06 ` tip-bot for Li Zefan
  2009-04-22 13:40   ` Steven Rostedt
  2009-04-22 13:15 ` [PATCH] " Steven Rostedt
  2 siblings, 1 reply; 10+ messages in thread
From: tip-bot for Li Zefan @ 2009-04-22 10:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, tzanussi, lizf, fweisbec, rostedt, tglx, mingo

Commit-ID:  7a4f453b6d7379a7c380825949977c5a838aa012
Gitweb:     http://git.kernel.org/tip/7a4f453b6d7379a7c380825949977c5a838aa012
Author:     Li Zefan <lizf@cn.fujitsu.com>
AuthorDate: Wed, 22 Apr 2009 16:53:34 +0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Wed, 22 Apr 2009 11:36:38 +0200

tracing/events: make struct trace_entry->type to be int type

struct trace_entry->type is unsigned char, while trace event's id is
int type, thus for a event with id >= 256, it's entry->type is cast
to (id % 256), and then we can't see the trace output of this event.

 # insmod trace-events-sample.ko
 # echo foo_bar > /mnt/tracing/set_event
 # cat /debug/tracing/events/trace-events-sample/foo_bar/id
 256
 # cat /mnt/tracing/trace_pipe
           <...>-3548  [001]   215.091142: Unknown type 0
           <...>-3548  [001]   216.089207: Unknown type 0
           <...>-3548  [001]   217.087271: Unknown type 0
           <...>-3548  [001]   218.085332: Unknown type 0

[ Impact: fix output for trace events with id >= 256 ]

Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <49EEDB0E.5070207@cn.fujitsu.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>


---
 include/linux/ftrace_event.h |    4 ++--
 include/trace/ftrace.h       |    2 +-
 kernel/trace/trace.c         |    4 ++--
 kernel/trace/trace.h         |    2 +-
 kernel/trace/trace_events.c  |    2 +-
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 75f3ac0..2a4a407 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -16,7 +16,7 @@ struct dentry;
  *     bash-15816 [01]   235.197585: idle_cpu <- irq_enter
  */
 struct trace_entry {
-	unsigned char		type;
+	int			type;
 	unsigned char		flags;
 	unsigned char		preempt_count;
 	int			pid;
@@ -73,7 +73,7 @@ enum print_line_t {
 
 
 struct ring_buffer_event *
-trace_current_buffer_lock_reserve(unsigned char type, unsigned long len,
+trace_current_buffer_lock_reserve(int type, unsigned long len,
 				  unsigned long flags, int pc);
 void trace_current_buffer_unlock_commit(struct ring_buffer_event *event,
 					unsigned long flags, int pc);
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 39a3351..15ef08d 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -198,7 +198,7 @@ ftrace_define_fields_##call(void)					\
 	struct ftrace_event_call *event_call = &event_##call;		\
 	int ret;							\
 									\
-	__common_field(unsigned char, type);				\
+	__common_field(int, type);					\
 	__common_field(unsigned char, flags);				\
 	__common_field(unsigned char, preempt_count);			\
 	__common_field(int, pid);					\
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index b9a3adc..b6183bc 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -838,7 +838,7 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags,
 }
 
 struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr,
-						    unsigned char type,
+						    int type,
 						    unsigned long len,
 						    unsigned long flags, int pc)
 {
@@ -881,7 +881,7 @@ void trace_buffer_unlock_commit(struct trace_array *tr,
 }
 
 struct ring_buffer_event *
-trace_current_buffer_lock_reserve(unsigned char type, unsigned long len,
+trace_current_buffer_lock_reserve(int type, unsigned long len,
 				  unsigned long flags, int pc)
 {
 	return trace_buffer_lock_reserve(&global_trace,
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 247948e..7d55bcf 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -422,7 +422,7 @@ void init_tracer_sysprof_debugfs(struct dentry *d_tracer);
 struct ring_buffer_event;
 
 struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr,
-						    unsigned char type,
+						    int type,
 						    unsigned long len,
 						    unsigned long flags,
 						    int pc);
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index 9ea55a7..5d6e879 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -398,7 +398,7 @@ static int trace_write_header(struct trace_seq *s)
 				"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
 				"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
 				"\n",
-				FIELD(unsigned char, type),
+				FIELD(int, type),
 				FIELD(unsigned char, flags),
 				FIELD(unsigned char, preempt_count),
 				FIELD(int, pid),

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] tracing/events: make struct trace_entry->type to be int type
  2009-04-22  8:53 [PATCH] tracing/events: make struct trace_entry->type to be int type Li Zefan
  2009-04-22  9:10 ` Frederic Weisbecker
  2009-04-22 10:06 ` [tip:tracing/core] " tip-bot for Li Zefan
@ 2009-04-22 13:15 ` Steven Rostedt
  2 siblings, 0 replies; 10+ messages in thread
From: Steven Rostedt @ 2009-04-22 13:15 UTC (permalink / raw)
  To: Li Zefan; +Cc: Ingo Molnar, Frederic Weisbecker, Tom Zanussi, LKML


On Wed, 22 Apr 2009, Li Zefan wrote:

> struct trace_entry->type is unsigned char, while trace event's id is
> int type, thus for a event with id >= 256, it's entry->type is cast
> to (id % 256), and then we can't see the trace output of this event.
> 
>  # insmod trace-events-sample.ko
>  # echo foo_bar > /mnt/tracing/set_event
>  # cat /debug/tracing/events/trace-events-sample/foo_bar/id
>  256
>  # cat /mnt/tracing/trace_pipe
>            <...>-3548  [001]   215.091142: Unknown type 0
>            <...>-3548  [001]   216.089207: Unknown type 0
>            <...>-3548  [001]   217.087271: Unknown type 0
>            <...>-3548  [001]   218.085332: Unknown type 0
> 
> [ Impact: fix output for trace events with id >= 256 ]
> 
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> ---
>  include/linux/ftrace_event.h |    4 ++--
>  include/trace/ftrace.h       |    2 +-
>  kernel/trace/trace.c         |    4 ++--
>  kernel/trace/trace.h         |    2 +-
>  kernel/trace/trace_events.c  |    2 +-
>  5 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
> index 75f3ac0..2a4a407 100644
> --- a/include/linux/ftrace_event.h
> +++ b/include/linux/ftrace_event.h
> @@ -16,7 +16,7 @@ struct dentry;
>   *     bash-15816 [01]   235.197585: idle_cpu <- irq_enter
>   */
>  struct trace_entry {
> -	unsigned char		type;
> +	int			type;

I sent out a patch before making this a short. I don't know why it got 
lost. A short is 65536, which should be more than enough to hold all the 
necessary events. It also makes the first few items fit nicely into 4 
bytes.

I'll go dig that patch out again and resend it.

-- Steve



>  	unsigned char		flags;
>  	unsigned char		preempt_count;
>  	int			pid;
> @@ -73,7 +73,7 @@ enum print_line_t {
>  
>  
>  struct ring_buffer_event *
> -trace_current_buffer_lock_reserve(unsigned char type, unsigned long len,
> +trace_current_buffer_lock_reserve(int type, unsigned long len,
>  				  unsigned long flags, int pc);
>  void trace_current_buffer_unlock_commit(struct ring_buffer_event *event,
>  					unsigned long flags, int pc);
> diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
> index 39a3351..15ef08d 100644
> --- a/include/trace/ftrace.h
> +++ b/include/trace/ftrace.h
> @@ -198,7 +198,7 @@ ftrace_define_fields_##call(void)					\
>  	struct ftrace_event_call *event_call = &event_##call;		\
>  	int ret;							\
>  									\
> -	__common_field(unsigned char, type);				\
> +	__common_field(int, type);					\
>  	__common_field(unsigned char, flags);				\
>  	__common_field(unsigned char, preempt_count);			\
>  	__common_field(int, pid);					\
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index b9a3adc..b6183bc 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -838,7 +838,7 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags,
>  }
>  
>  struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr,
> -						    unsigned char type,
> +						    int type,
>  						    unsigned long len,
>  						    unsigned long flags, int pc)
>  {
> @@ -881,7 +881,7 @@ void trace_buffer_unlock_commit(struct trace_array *tr,
>  }
>  
>  struct ring_buffer_event *
> -trace_current_buffer_lock_reserve(unsigned char type, unsigned long len,
> +trace_current_buffer_lock_reserve(int type, unsigned long len,
>  				  unsigned long flags, int pc)
>  {
>  	return trace_buffer_lock_reserve(&global_trace,
> diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
> index 8750e83..3e5c664 100644
> --- a/kernel/trace/trace.h
> +++ b/kernel/trace/trace.h
> @@ -422,7 +422,7 @@ void init_tracer_sysprof_debugfs(struct dentry *d_tracer);
>  struct ring_buffer_event;
>  
>  struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr,
> -						    unsigned char type,
> +						    int type,
>  						    unsigned long len,
>  						    unsigned long flags,
>  						    int pc);
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 9631caf..86fa720 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -398,7 +398,7 @@ static int trace_write_header(struct trace_seq *s)
>  				"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
>  				"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
>  				"\n",
> -				FIELD(unsigned char, type),
> +				FIELD(int, type),
>  				FIELD(unsigned char, flags),
>  				FIELD(unsigned char, preempt_count),
>  				FIELD(int, pid),
> -- 
> 1.5.4.rc3
> 
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tip:tracing/core] tracing/events: make struct trace_entry->type to be int type
  2009-04-22 10:06 ` [tip:tracing/core] " tip-bot for Li Zefan
@ 2009-04-22 13:40   ` Steven Rostedt
  2009-04-22 13:52     ` Ingo Molnar
  0 siblings, 1 reply; 10+ messages in thread
From: Steven Rostedt @ 2009-04-22 13:40 UTC (permalink / raw)
  To: mingo, hpa, linux-kernel, fweisbec, tzanussi, lizf, tglx, mingo
  Cc: linux-tip-commits


Ingo,

We need to make type 2 bytes not 4.

I sent out a patch to do this change last month

 http://patchwork.kernel.org/patch/14573/

-- Steve


On Wed, 22 Apr 2009, tip-bot for Li Zefan wrote:

> Commit-ID:  7a4f453b6d7379a7c380825949977c5a838aa012
> Gitweb:     http://git.kernel.org/tip/7a4f453b6d7379a7c380825949977c5a838aa012
> Author:     Li Zefan <lizf@cn.fujitsu.com>
> AuthorDate: Wed, 22 Apr 2009 16:53:34 +0800
> Committer:  Ingo Molnar <mingo@elte.hu>
> CommitDate: Wed, 22 Apr 2009 11:36:38 +0200
> 
> tracing/events: make struct trace_entry->type to be int type
> 
> struct trace_entry->type is unsigned char, while trace event's id is
> int type, thus for a event with id >= 256, it's entry->type is cast
> to (id % 256), and then we can't see the trace output of this event.
> 
>  # insmod trace-events-sample.ko
>  # echo foo_bar > /mnt/tracing/set_event
>  # cat /debug/tracing/events/trace-events-sample/foo_bar/id
>  256
>  # cat /mnt/tracing/trace_pipe
>            <...>-3548  [001]   215.091142: Unknown type 0
>            <...>-3548  [001]   216.089207: Unknown type 0
>            <...>-3548  [001]   217.087271: Unknown type 0
>            <...>-3548  [001]   218.085332: Unknown type 0
> 
> [ Impact: fix output for trace events with id >= 256 ]
> 
> Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
> Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
> Cc: Steven Rostedt <rostedt@goodmis.org>
> Cc: Tom Zanussi <tzanussi@gmail.com>
> LKML-Reference: <49EEDB0E.5070207@cn.fujitsu.com>
> Signed-off-by: Ingo Molnar <mingo@elte.hu>
> 
> 
> ---
>  include/linux/ftrace_event.h |    4 ++--
>  include/trace/ftrace.h       |    2 +-
>  kernel/trace/trace.c         |    4 ++--
>  kernel/trace/trace.h         |    2 +-
>  kernel/trace/trace_events.c  |    2 +-
>  5 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
> index 75f3ac0..2a4a407 100644
> --- a/include/linux/ftrace_event.h
> +++ b/include/linux/ftrace_event.h
> @@ -16,7 +16,7 @@ struct dentry;
>   *     bash-15816 [01]   235.197585: idle_cpu <- irq_enter
>   */
>  struct trace_entry {
> -	unsigned char		type;
> +	int			type;
>  	unsigned char		flags;
>  	unsigned char		preempt_count;
>  	int			pid;
> @@ -73,7 +73,7 @@ enum print_line_t {
>  
>  
>  struct ring_buffer_event *
> -trace_current_buffer_lock_reserve(unsigned char type, unsigned long len,
> +trace_current_buffer_lock_reserve(int type, unsigned long len,
>  				  unsigned long flags, int pc);
>  void trace_current_buffer_unlock_commit(struct ring_buffer_event *event,
>  					unsigned long flags, int pc);
> diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
> index 39a3351..15ef08d 100644
> --- a/include/trace/ftrace.h
> +++ b/include/trace/ftrace.h
> @@ -198,7 +198,7 @@ ftrace_define_fields_##call(void)					\
>  	struct ftrace_event_call *event_call = &event_##call;		\
>  	int ret;							\
>  									\
> -	__common_field(unsigned char, type);				\
> +	__common_field(int, type);					\
>  	__common_field(unsigned char, flags);				\
>  	__common_field(unsigned char, preempt_count);			\
>  	__common_field(int, pid);					\
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index b9a3adc..b6183bc 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -838,7 +838,7 @@ tracing_generic_entry_update(struct trace_entry *entry, unsigned long flags,
>  }
>  
>  struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr,
> -						    unsigned char type,
> +						    int type,
>  						    unsigned long len,
>  						    unsigned long flags, int pc)
>  {
> @@ -881,7 +881,7 @@ void trace_buffer_unlock_commit(struct trace_array *tr,
>  }
>  
>  struct ring_buffer_event *
> -trace_current_buffer_lock_reserve(unsigned char type, unsigned long len,
> +trace_current_buffer_lock_reserve(int type, unsigned long len,
>  				  unsigned long flags, int pc)
>  {
>  	return trace_buffer_lock_reserve(&global_trace,
> diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
> index 247948e..7d55bcf 100644
> --- a/kernel/trace/trace.h
> +++ b/kernel/trace/trace.h
> @@ -422,7 +422,7 @@ void init_tracer_sysprof_debugfs(struct dentry *d_tracer);
>  struct ring_buffer_event;
>  
>  struct ring_buffer_event *trace_buffer_lock_reserve(struct trace_array *tr,
> -						    unsigned char type,
> +						    int type,
>  						    unsigned long len,
>  						    unsigned long flags,
>  						    int pc);
> diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
> index 9ea55a7..5d6e879 100644
> --- a/kernel/trace/trace_events.c
> +++ b/kernel/trace/trace_events.c
> @@ -398,7 +398,7 @@ static int trace_write_header(struct trace_seq *s)
>  				"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
>  				"\tfield:%s %s;\toffset:%zu;\tsize:%zu;\n"
>  				"\n",
> -				FIELD(unsigned char, type),
> +				FIELD(int, type),
>  				FIELD(unsigned char, flags),
>  				FIELD(unsigned char, preempt_count),
>  				FIELD(int, pid),
> 

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tip:tracing/core] tracing/events: make struct trace_entry->type to be int type
  2009-04-22 13:40   ` Steven Rostedt
@ 2009-04-22 13:52     ` Ingo Molnar
  2009-04-22 14:07       ` Steven Rostedt
  0 siblings, 1 reply; 10+ messages in thread
From: Ingo Molnar @ 2009-04-22 13:52 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: mingo, hpa, linux-kernel, fweisbec, tzanussi, lizf, tglx,
	linux-tip-commits


* Steven Rostedt <rostedt@goodmis.org> wrote:

> Ingo,
> 
> We need to make type 2 bytes not 4.

yeah, saw that - it's OK with 2 bytes too.

> I sent out a patch to do this change last month
> 
>  http://patchwork.kernel.org/patch/14573/

Mind resending it in your next batch of patches?

	Ingo

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tip:tracing/core] tracing/events: make struct trace_entry->type to be int type
  2009-04-22 13:52     ` Ingo Molnar
@ 2009-04-22 14:07       ` Steven Rostedt
  2009-04-23  0:57         ` Li Zefan
  0 siblings, 1 reply; 10+ messages in thread
From: Steven Rostedt @ 2009-04-22 14:07 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: mingo, hpa, linux-kernel, fweisbec, tzanussi, lizf, tglx,
	linux-tip-commits


On Wed, 22 Apr 2009, Ingo Molnar wrote:

> 
> * Steven Rostedt <rostedt@goodmis.org> wrote:
> 
> > Ingo,
> > 
> > We need to make type 2 bytes not 4.
> 
> yeah, saw that - it's OK with 2 bytes too.
> 
> > I sent out a patch to do this change last month
> > 
> >  http://patchwork.kernel.org/patch/14573/
> 
> Mind resending it in your next batch of patches?

OK,

Will do ;-)

-- Steve


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [tip:tracing/core] tracing/events: make struct trace_entry->type to be int type
  2009-04-22 14:07       ` Steven Rostedt
@ 2009-04-23  0:57         ` Li Zefan
  0 siblings, 0 replies; 10+ messages in thread
From: Li Zefan @ 2009-04-23  0:57 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Ingo Molnar, mingo, hpa, linux-kernel, fweisbec, tzanussi, tglx,
	linux-tip-commits

Steven Rostedt wrote:
> On Wed, 22 Apr 2009, Ingo Molnar wrote:
> 
>> * Steven Rostedt <rostedt@goodmis.org> wrote:
>>
>>> Ingo,
>>>
>>> We need to make type 2 bytes not 4.
>> yeah, saw that - it's OK with 2 bytes too.
>>
>>> I sent out a patch to do this change last month
>>>
>>>  http://patchwork.kernel.org/patch/14573/
>> Mind resending it in your next batch of patches?
> 
> OK,
> 
> Will do ;-)
> 

Ah, I didn't notice that patch, and I thought ushort may be too
small for modular TRACE_EVENT.


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-04-23  0:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-22  8:53 [PATCH] tracing/events: make struct trace_entry->type to be int type Li Zefan
2009-04-22  9:10 ` Frederic Weisbecker
2009-04-22  9:19   ` Li Zefan
2009-04-22  9:40     ` Ingo Molnar
2009-04-22 10:06 ` [tip:tracing/core] " tip-bot for Li Zefan
2009-04-22 13:40   ` Steven Rostedt
2009-04-22 13:52     ` Ingo Molnar
2009-04-22 14:07       ` Steven Rostedt
2009-04-23  0:57         ` Li Zefan
2009-04-22 13:15 ` [PATCH] " Steven Rostedt

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.