diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/trace/trace.h | 1 | ||||
-rw-r--r-- | kernel/trace/trace_event_types.h | 4 | ||||
-rw-r--r-- | kernel/trace/trace_events.c | 3 | ||||
-rw-r--r-- | kernel/trace/trace_export.c | 29 |
4 files changed, 27 insertions, 10 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h index 1fb7d6ccadf4..866d0108fd2f 100644 --- a/kernel/trace/trace.h +++ b/kernel/trace/trace.h | |||
@@ -729,6 +729,7 @@ struct ftrace_event_field { | |||
729 | char *type; | 729 | char *type; |
730 | int offset; | 730 | int offset; |
731 | int size; | 731 | int size; |
732 | int is_signed; | ||
732 | }; | 733 | }; |
733 | 734 | ||
734 | struct event_filter { | 735 | struct event_filter { |
diff --git a/kernel/trace/trace_event_types.h b/kernel/trace/trace_event_types.h index cfcecc4fd86d..5e32e375134d 100644 --- a/kernel/trace/trace_event_types.h +++ b/kernel/trace/trace_event_types.h | |||
@@ -141,8 +141,8 @@ TRACE_EVENT_FORMAT(hw_branch, TRACE_HW_BRANCHES, hw_branch_entry, ignore, | |||
141 | 141 | ||
142 | TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore, | 142 | TRACE_EVENT_FORMAT(power, TRACE_POWER, trace_power, ignore, |
143 | TRACE_STRUCT( | 143 | TRACE_STRUCT( |
144 | TRACE_FIELD(ktime_t, state_data.stamp, stamp) | 144 | TRACE_FIELD_SIGN(ktime_t, state_data.stamp, stamp, 1) |
145 | TRACE_FIELD(ktime_t, state_data.end, end) | 145 | TRACE_FIELD_SIGN(ktime_t, state_data.end, end, 1) |
146 | TRACE_FIELD(int, state_data.type, type) | 146 | TRACE_FIELD(int, state_data.type, type) |
147 | TRACE_FIELD(int, state_data.state, state) | 147 | TRACE_FIELD(int, state_data.state, state) |
148 | ), | 148 | ), |
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 1cd1f37373dd..bbbea7479371 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c | |||
@@ -26,7 +26,7 @@ static DEFINE_MUTEX(event_mutex); | |||
26 | LIST_HEAD(ftrace_events); | 26 | LIST_HEAD(ftrace_events); |
27 | 27 | ||
28 | int trace_define_field(struct ftrace_event_call *call, char *type, | 28 | int trace_define_field(struct ftrace_event_call *call, char *type, |
29 | char *name, int offset, int size) | 29 | char *name, int offset, int size, int is_signed) |
30 | { | 30 | { |
31 | struct ftrace_event_field *field; | 31 | struct ftrace_event_field *field; |
32 | 32 | ||
@@ -44,6 +44,7 @@ int trace_define_field(struct ftrace_event_call *call, char *type, | |||
44 | 44 | ||
45 | field->offset = offset; | 45 | field->offset = offset; |
46 | field->size = size; | 46 | field->size = size; |
47 | field->is_signed = is_signed; | ||
47 | list_add(&field->link, &call->fields); | 48 | list_add(&field->link, &call->fields); |
48 | 49 | ||
49 | return 0; | 50 | return 0; |
diff --git a/kernel/trace/trace_export.c b/kernel/trace/trace_export.c index 0cb1a142c74f..d06cf898dc86 100644 --- a/kernel/trace/trace_export.c +++ b/kernel/trace/trace_export.c | |||
@@ -50,6 +50,9 @@ extern void __bad_type_size(void); | |||
50 | if (!ret) \ | 50 | if (!ret) \ |
51 | return 0; | 51 | return 0; |
52 | 52 | ||
53 | #undef TRACE_FIELD_SIGN | ||
54 | #define TRACE_FIELD_SIGN(type, item, assign, is_signed) \ | ||
55 | TRACE_FIELD(type, item, assign) | ||
53 | 56 | ||
54 | #undef TP_RAW_FMT | 57 | #undef TP_RAW_FMT |
55 | #define TP_RAW_FMT(args...) args | 58 | #define TP_RAW_FMT(args...) args |
@@ -98,6 +101,10 @@ ftrace_format_##call(struct trace_seq *s) \ | |||
98 | #define TRACE_FIELD(type, item, assign)\ | 101 | #define TRACE_FIELD(type, item, assign)\ |
99 | entry->item = assign; | 102 | entry->item = assign; |
100 | 103 | ||
104 | #undef TRACE_FIELD_SIGN | ||
105 | #define TRACE_FIELD_SIGN(type, item, assign, is_signed) \ | ||
106 | TRACE_FIELD(type, item, assign) | ||
107 | |||
101 | #undef TP_CMD | 108 | #undef TP_CMD |
102 | #define TP_CMD(cmd...) cmd | 109 | #define TP_CMD(cmd...) cmd |
103 | 110 | ||
@@ -149,7 +156,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
149 | #define TRACE_FIELD(type, item, assign) \ | 156 | #define TRACE_FIELD(type, item, assign) \ |
150 | ret = trace_define_field(event_call, #type, #item, \ | 157 | ret = trace_define_field(event_call, #type, #item, \ |
151 | offsetof(typeof(field), item), \ | 158 | offsetof(typeof(field), item), \ |
152 | sizeof(field.item)); \ | 159 | sizeof(field.item), is_signed_type(type)); \ |
153 | if (ret) \ | 160 | if (ret) \ |
154 | return ret; | 161 | return ret; |
155 | 162 | ||
@@ -157,7 +164,15 @@ __attribute__((section("_ftrace_events"))) event_##call = { \ | |||
157 | #define TRACE_FIELD_SPECIAL(type, item, len, cmd) \ | 164 | #define TRACE_FIELD_SPECIAL(type, item, len, cmd) \ |
158 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ | 165 | ret = trace_define_field(event_call, #type "[" #len "]", #item, \ |
159 | offsetof(typeof(field), item), \ | 166 | offsetof(typeof(field), item), \ |
160 | sizeof(field.item)); \ | 167 | sizeof(field.item), 0); \ |
168 | if (ret) \ | ||
169 | return ret; | ||
170 | |||
171 | #undef TRACE_FIELD_SIGN | ||
172 | #define TRACE_FIELD_SIGN(type, item, assign, is_signed) \ | ||
173 | ret = trace_define_field(event_call, #type, #item, \ | ||
174 | offsetof(typeof(field), item), \ | ||
175 | sizeof(field.item), is_signed); \ | ||
161 | if (ret) \ | 176 | if (ret) \ |
162 | return ret; | 177 | return ret; |
163 | 178 | ||
@@ -173,11 +188,11 @@ ftrace_define_fields_##call(void) \ | |||
173 | struct args field; \ | 188 | struct args field; \ |
174 | int ret; \ | 189 | int ret; \ |
175 | \ | 190 | \ |
176 | __common_field(unsigned char, type); \ | 191 | __common_field(unsigned char, type, 0); \ |
177 | __common_field(unsigned char, flags); \ | 192 | __common_field(unsigned char, flags, 0); \ |
178 | __common_field(unsigned char, preempt_count); \ | 193 | __common_field(unsigned char, preempt_count, 0); \ |
179 | __common_field(int, pid); \ | 194 | __common_field(int, pid, 1); \ |
180 | __common_field(int, tgid); \ | 195 | __common_field(int, tgid, 1); \ |
181 | \ | 196 | \ |
182 | tstruct; \ | 197 | tstruct; \ |
183 | \ | 198 | \ |