Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'trace-fixes-v3.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace

Pull trace fix from Steven Rostedt:
"Vaibhav Nagarnaik discovered that since 3.10 a clean-up patch made the
array index in the trace event format bogus.

He supplied an elegant solution that uses __stringify() and also
removes the need for the event_storage and event_storage_mutex and
also cuts off a few K of overhead from the trace events"

* tag 'trace-fixes-v3.14-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
tracing: Fix array size mismatch in format string

+4 -20
-4
include/linux/ftrace_event.h
··· 495 495 FILTER_TRACE_FN, 496 496 }; 497 497 498 - #define EVENT_STORAGE_SIZE 128 499 - extern struct mutex event_storage_mutex; 500 - extern char event_storage[EVENT_STORAGE_SIZE]; 501 - 502 498 extern int trace_event_raw_init(struct ftrace_event_call *call); 503 499 extern int trace_define_field(struct ftrace_event_call *call, const char *type, 504 500 const char *name, int offset, int size,
+2 -5
include/trace/ftrace.h
··· 310 310 #undef __array 311 311 #define __array(type, item, len) \ 312 312 do { \ 313 - mutex_lock(&event_storage_mutex); \ 313 + char *type_str = #type"["__stringify(len)"]"; \ 314 314 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ 315 - snprintf(event_storage, sizeof(event_storage), \ 316 - "%s[%d]", #type, len); \ 317 - ret = trace_define_field(event_call, event_storage, #item, \ 315 + ret = trace_define_field(event_call, type_str, #item, \ 318 316 offsetof(typeof(field), item), \ 319 317 sizeof(field.item), \ 320 318 is_signed_type(type), FILTER_OTHER); \ 321 - mutex_unlock(&event_storage_mutex); \ 322 319 if (ret) \ 323 320 return ret; \ 324 321 } while (0);
-6
kernel/trace/trace_events.c
··· 27 27 28 28 DEFINE_MUTEX(event_mutex); 29 29 30 - DEFINE_MUTEX(event_storage_mutex); 31 - EXPORT_SYMBOL_GPL(event_storage_mutex); 32 - 33 - char event_storage[EVENT_STORAGE_SIZE]; 34 - EXPORT_SYMBOL_GPL(event_storage); 35 - 36 30 LIST_HEAD(ftrace_events); 37 31 static LIST_HEAD(ftrace_common_fields); 38 32
+2 -5
kernel/trace/trace_export.c
··· 95 95 #undef __array 96 96 #define __array(type, item, len) \ 97 97 do { \ 98 + char *type_str = #type"["__stringify(len)"]"; \ 98 99 BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ 99 - mutex_lock(&event_storage_mutex); \ 100 - snprintf(event_storage, sizeof(event_storage), \ 101 - "%s[%d]", #type, len); \ 102 - ret = trace_define_field(event_call, event_storage, #item, \ 100 + ret = trace_define_field(event_call, type_str, #item, \ 103 101 offsetof(typeof(field), item), \ 104 102 sizeof(field.item), \ 105 103 is_signed_type(type), filter_type); \ 106 - mutex_unlock(&event_storage_mutex); \ 107 104 if (ret) \ 108 105 return ret; \ 109 106 } while (0);