Commit 477cc484 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'trace-fixes-v3.14-rc7' of...

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
parents 7e09e738 87291347
...@@ -495,10 +495,6 @@ enum { ...@@ -495,10 +495,6 @@ enum {
FILTER_TRACE_FN, FILTER_TRACE_FN,
}; };
#define EVENT_STORAGE_SIZE 128
extern struct mutex event_storage_mutex;
extern char event_storage[EVENT_STORAGE_SIZE];
extern int trace_event_raw_init(struct ftrace_event_call *call); extern int trace_event_raw_init(struct ftrace_event_call *call);
extern int trace_define_field(struct ftrace_event_call *call, const char *type, extern int trace_define_field(struct ftrace_event_call *call, const char *type,
const char *name, int offset, int size, const char *name, int offset, int size,
......
...@@ -310,15 +310,12 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \ ...@@ -310,15 +310,12 @@ static struct trace_event_functions ftrace_event_type_funcs_##call = { \
#undef __array #undef __array
#define __array(type, item, len) \ #define __array(type, item, len) \
do { \ do { \
mutex_lock(&event_storage_mutex); \ char *type_str = #type"["__stringify(len)"]"; \
BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
snprintf(event_storage, sizeof(event_storage), \ ret = trace_define_field(event_call, type_str, #item, \
"%s[%d]", #type, len); \
ret = trace_define_field(event_call, event_storage, #item, \
offsetof(typeof(field), item), \ offsetof(typeof(field), item), \
sizeof(field.item), \ sizeof(field.item), \
is_signed_type(type), FILTER_OTHER); \ is_signed_type(type), FILTER_OTHER); \
mutex_unlock(&event_storage_mutex); \
if (ret) \ if (ret) \
return ret; \ return ret; \
} while (0); } while (0);
......
...@@ -27,12 +27,6 @@ ...@@ -27,12 +27,6 @@
DEFINE_MUTEX(event_mutex); DEFINE_MUTEX(event_mutex);
DEFINE_MUTEX(event_storage_mutex);
EXPORT_SYMBOL_GPL(event_storage_mutex);
char event_storage[EVENT_STORAGE_SIZE];
EXPORT_SYMBOL_GPL(event_storage);
LIST_HEAD(ftrace_events); LIST_HEAD(ftrace_events);
static LIST_HEAD(ftrace_common_fields); static LIST_HEAD(ftrace_common_fields);
......
...@@ -95,15 +95,12 @@ static void __always_unused ____ftrace_check_##name(void) \ ...@@ -95,15 +95,12 @@ static void __always_unused ____ftrace_check_##name(void) \
#undef __array #undef __array
#define __array(type, item, len) \ #define __array(type, item, len) \
do { \ do { \
char *type_str = #type"["__stringify(len)"]"; \
BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \ BUILD_BUG_ON(len > MAX_FILTER_STR_VAL); \
mutex_lock(&event_storage_mutex); \ ret = trace_define_field(event_call, type_str, #item, \
snprintf(event_storage, sizeof(event_storage), \
"%s[%d]", #type, len); \
ret = trace_define_field(event_call, event_storage, #item, \
offsetof(typeof(field), item), \ offsetof(typeof(field), item), \
sizeof(field.item), \ sizeof(field.item), \
is_signed_type(type), filter_type); \ is_signed_type(type), filter_type); \
mutex_unlock(&event_storage_mutex); \
if (ret) \ if (ret) \
return ret; \ return ret; \
} while (0); } while (0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment