aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorVaibhav Nagarnaik <vnagarnaik@google.com>2014-02-13 22:51:48 -0500
committerSteven Rostedt <rostedt@goodmis.org>2014-03-20 13:21:05 -0400
commit87291347c49dc40aa339f587b209618201c2e527 (patch)
tree2681b2e84bb9d67cd20f85b0efa62397027b7994 /include
parentdcb99fd9b08cfe1afe426af4d8d3cbc429190f15 (diff)
tracing: Fix array size mismatch in format string
In event format strings, the array size is reported in two locations. One in array subscript and then via the "size:" attribute. The values reported there have a mismatch. For e.g., in sched:sched_switch the prev_comm and next_comm character arrays have subscript values as [32] where as the actual field size is 16. name: sched_switch ID: 301 format: field:unsigned short common_type; offset:0; size:2; signed:0; field:unsigned char common_flags; offset:2; size:1; signed:0; field:unsigned char common_preempt_count; offset:3; size:1;signed:0; field:int common_pid; offset:4; size:4; signed:1; field:char prev_comm[32]; offset:8; size:16; signed:1; field:pid_t prev_pid; offset:24; size:4; signed:1; field:int prev_prio; offset:28; size:4; signed:1; field:long prev_state; offset:32; size:8; signed:1; field:char next_comm[32]; offset:40; size:16; signed:1; field:pid_t next_pid; offset:56; size:4; signed:1; field:int next_prio; offset:60; size:4; signed:1; After bisection, the following commit was blamed: 92edca0 tracing: Use direct field, type and system names This commit removes the duplication of strings for field->name and field->type assuming that all the strings passed in __trace_define_field() are immutable. This is not true for arrays, where the type string is created in event_storage variable and field->type for all array fields points to event_storage. Use __stringify() to create a string constant for the type string. Also, get rid of event_storage and event_storage_mutex that are not needed anymore. also, an added benefit is that this reduces the overhead of events a bit more: text data bss dec hex filename 8424787 2036472 1302528 11763787 b3804b vmlinux 8420814 2036408 1302528 11759750 b37086 vmlinux.patched Link: http://lkml.kernel.org/r/1392349908-29685-1-git-send-email-vnagarnaik@google.com Cc: Laurent Chavey <chavey@google.com> Cc: stable@vger.kernel.org # 3.10+ Signed-off-by: Vaibhav Nagarnaik <vnagarnaik@google.com> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/ftrace_event.h4
-rw-r--r--include/trace/ftrace.h7
2 files changed, 2 insertions, 9 deletions
diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h
index 4e4cc28623ad..4cdb3a17bcb5 100644
--- a/include/linux/ftrace_event.h
+++ b/include/linux/ftrace_event.h
@@ -495,10 +495,6 @@ enum {
495 FILTER_TRACE_FN, 495 FILTER_TRACE_FN,
496}; 496};
497 497
498#define EVENT_STORAGE_SIZE 128
499extern struct mutex event_storage_mutex;
500extern char event_storage[EVENT_STORAGE_SIZE];
501
502extern int trace_event_raw_init(struct ftrace_event_call *call); 498extern int trace_event_raw_init(struct ftrace_event_call *call);
503extern int trace_define_field(struct ftrace_event_call *call, const char *type, 499extern int trace_define_field(struct ftrace_event_call *call, const char *type,
504 const char *name, int offset, int size, 500 const char *name, int offset, int size,
diff --git a/include/trace/ftrace.h b/include/trace/ftrace.h
index 1a8b28db3775..1ee19a24cc5f 100644
--- a/include/trace/ftrace.h
+++ b/include/trace/ftrace.h
@@ -310,15 +310,12 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \
310#undef __array 310#undef __array
311#define __array(type, item, len) \ 311#define __array(type, item, len) \
312 do { \ 312 do { \
313 mutex_lock(&event_storage_mutex); \ 313 char *type_str = #type"["__stringify(len)"]"; \
314 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ 314 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
315 snprintf(event_storage, sizeof(event_storage), \ 315 ret = trace_define_field(event_call, type_str, #item, \
316 "%s[%d]", #type, len); \
317 ret = trace_define_field(event_call, event_storage, #item, \
318 offsetof(typeof(field), item), \ 316 offsetof(typeof(field), item), \
319 sizeof(field.item), \ 317 sizeof(field.item), \
320 is_signed_type(type), FILTER_OTHER); \ 318 is_signed_type(type), FILTER_OTHER); \
321 mutex_unlock(&event_storage_mutex); \
322 if (ret) \ 319 if (ret) \
323 return ret; \ 320 return ret; \
324 } while (0); 321 } while (0);