Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+0 −4
Original line number Original line Diff line number Diff line
@@ -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,
+2 −5
Original line number Original line Diff line number Diff line
@@ -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);
+0 −6
Original line number Original line Diff line number Diff line
@@ -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);


+2 −5
Original line number Original line Diff line number Diff line
@@ -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);