tracing/events: make struct trace_entry->type to be int type
authorLi Zefan <lizf@cn.fujitsu.com>
Wed, 22 Apr 2009 08:53:34 +0000 (16:53 +0800)
committerIngo Molnar <mingo@elte.hu>
Wed, 22 Apr 2009 09:36:38 +0000 (11:36 +0200)
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
include/trace/ftrace.h
kernel/trace/trace.c
kernel/trace/trace.h
kernel/trace/trace_events.c

index 75f3ac01a87c6e3341bf82e35771528dfb0b32fb..2a4a40749911a3f8bdeb6f886db0a6f8aff20486 100644 (file)
@@ -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);
index 39a3351f2e7ffee0157d7f2e4cf78466c56bcb35..15ef08d9add1c1a6aa5d438d4d496c8793b89ece 100644 (file)
@@ -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);                                       \
index b9a3adce9221ad21c4f47cc0ac609048cc728a91..b6183bc9ecae5ca3c3a91d2313d119170207d040 100644 (file)
@@ -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,
index 247948e81b08db0c806dffee273d66a55d74526e..7d55bcf50e49970a7ef6377c5f8e6726e307a1cf 100644 (file)
@@ -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);
index 9ea55a7dfdec360c589b457a9390c097a907754c..5d6e879cf8757590d7e0379eab2fb4f081b7b0c9 100644 (file)
@@ -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),