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

Commit da184a80 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'tracing-fixes-for-linus' of...

Merge branch 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'tracing-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  tracing: Fix return of trace_dump_stack()
  ksym_tracer: Fix bad cast
  tracing/power: Remove two exports
  tracing: Change event->profile_count to be int type
  tracing: Simplify trace_option_write()
  tracing: Remove useless trace option
  tracing: Use seq file for trace_clock
  tracing: Use seq file for trace_options
  function-graph: Allow writing the same val to set_graph_function
  ftrace: Call trace_parser_clear() properly
  ftrace: Return EINVAL when writing invalid val to set_ftrace_filter
  tracing: Move a printk out of ftrace_raw_reg_event_foo()
  tracing: Pull up calls to trace_define_common_fields()
  tracing: Extract duplicate ftrace_raw_init_event_foo()
  ftrace.h: Use common pr_info fmt string
  tracing: Add stack trace to irqsoff tracer
  tracing: Add trace_dump_stack()
  ring-buffer: Move resize integrity check under reader lock
  ring-buffer: Use sync sched protection on ring buffer resizing
  tracing: Fix wrong usage of strstrip in trace_ksyms
parents 525995d7 e36c5458
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -131,7 +131,7 @@ struct ftrace_event_call {
	void			*mod;
	void			*data;

	atomic_t		profile_count;
	int			profile_count;
	int			(*profile_enable)(struct ftrace_event_call *);
	void			(*profile_disable)(struct ftrace_event_call *);
};
@@ -158,7 +158,7 @@ enum {
	FILTER_PTR_STRING,
};

extern int trace_define_common_fields(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,
			      const char *name, int offset, int size,
			      int is_signed, int filter_type);
+3 −0
Original line number Diff line number Diff line
@@ -535,6 +535,8 @@ extern int
__trace_printk(unsigned long ip, const char *fmt, ...)
	__attribute__ ((format (printf, 2, 3)));

extern void trace_dump_stack(void);

/*
 * The double __builtin_constant_p is because gcc will give us an error
 * if we try to allocate the static variable to fmt if it is not a
@@ -568,6 +570,7 @@ trace_printk(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
static inline void tracing_start(void) { }
static inline void tracing_stop(void) { }
static inline void ftrace_off_permanent(void) { }
static inline void trace_dump_stack(void) { }
static inline int
trace_printk(const char *fmt, ...)
{
+2 −4
Original line number Diff line number Diff line
@@ -102,12 +102,10 @@ struct perf_event_attr;
#ifdef CONFIG_EVENT_PROFILE

#define TRACE_SYS_ENTER_PROFILE_INIT(sname)				       \
	.profile_count = ATOMIC_INIT(-1),				       \
	.profile_enable = prof_sysenter_enable,				       \
	.profile_disable = prof_sysenter_disable,

#define TRACE_SYS_EXIT_PROFILE_INIT(sname)				       \
	.profile_count = ATOMIC_INIT(-1),				       \
	.profile_enable = prof_sysexit_enable,				       \
	.profile_disable = prof_sysexit_disable,
#else
@@ -145,7 +143,7 @@ struct perf_event_attr;
		.name                   = "sys_enter"#sname,		\
		.system                 = "syscalls",			\
		.event                  = &enter_syscall_print_##sname,	\
		.raw_init		= init_syscall_trace,		\
		.raw_init		= trace_event_raw_init,		\
		.show_format		= syscall_enter_format,		\
		.define_fields		= syscall_enter_define_fields,	\
		.regfunc		= reg_event_syscall_enter,	\
@@ -167,7 +165,7 @@ struct perf_event_attr;
		.name                   = "sys_exit"#sname,		\
		.system                 = "syscalls",			\
		.event                  = &exit_syscall_print_##sname,	\
		.raw_init		= init_syscall_trace,		\
		.raw_init		= trace_event_raw_init,		\
		.show_format		= syscall_exit_format,		\
		.define_fields		= syscall_exit_define_fields,	\
		.regfunc		= reg_event_syscall_exit,	\
+6 −50
Original line number Diff line number Diff line
@@ -436,10 +436,6 @@ ftrace_define_fields_##call(struct ftrace_event_call *event_call) \
	struct ftrace_raw_##call field;					\
	int ret;							\
									\
	ret = trace_define_common_fields(event_call);			\
	if (ret)							\
		return ret;						\
									\
	tstruct;							\
									\
	return ret;							\
@@ -559,13 +555,7 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
 *
 * static int ftrace_reg_event_<call>(struct ftrace_event_call *unused)
 * {
 *	int ret;
 *
 *	ret = register_trace_<call>(ftrace_event_<call>);
 *	if (!ret)
 *		pr_info("event trace: Could not activate trace point "
 *			"probe to  <call>");
 *	return ret;
 *	return register_trace_<call>(ftrace_event_<call>);
 * }
 *
 * static void ftrace_unreg_event_<call>(struct ftrace_event_call *unused)
@@ -623,23 +613,12 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
 *	.trace			= ftrace_raw_output_<call>, <-- stage 2
 * };
 *
 * static int ftrace_raw_init_event_<call>(struct ftrace_event_call *unused)
 * {
 *	int id;
 *
 *	id = register_ftrace_event(&ftrace_event_type_<call>);
 *	if (!id)
 *		return -ENODEV;
 *	event_<call>.id = id;
 *	return 0;
 * }
 *
 * static struct ftrace_event_call __used
 * __attribute__((__aligned__(4)))
 * __attribute__((section("_ftrace_events"))) event_<call> = {
 *	.name			= "<call>",
 *	.system			= "<system>",
 *	.raw_init		= ftrace_raw_init_event_<call>,
 *	.raw_init		= trace_event_raw_init,
 *	.regfunc		= ftrace_reg_event_<call>,
 *	.unregfunc		= ftrace_unreg_event_<call>,
 *	.show_format		= ftrace_format_<call>,
@@ -647,13 +626,9 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
 *
 */

#undef TP_FMT
#define TP_FMT(fmt, args...)	fmt "\n", ##args

#ifdef CONFIG_EVENT_PROFILE

#define _TRACE_PROFILE_INIT(call)					\
	.profile_count = ATOMIC_INIT(-1),				\
	.profile_enable = ftrace_profile_enable_##call,			\
	.profile_disable = ftrace_profile_disable_##call,

@@ -728,13 +703,7 @@ static void ftrace_raw_event_##call(proto) \
									\
static int ftrace_raw_reg_event_##call(struct ftrace_event_call *unused)\
{									\
	int ret;							\
									\
	ret = register_trace_##call(ftrace_raw_event_##call);		\
	if (ret)							\
		pr_info("event trace: Could not activate trace point "	\
			"probe to " #call "\n");			\
	return ret;							\
	return register_trace_##call(ftrace_raw_event_##call);		\
}									\
									\
static void ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused)\
@@ -744,19 +713,7 @@ static void ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused)\
									\
static struct trace_event ftrace_event_type_##call = {			\
	.trace			= ftrace_raw_output_##call,		\
};									\
									\
static int ftrace_raw_init_event_##call(struct ftrace_event_call *unused)\
{									\
	int id;								\
									\
	id = register_ftrace_event(&ftrace_event_type_##call);		\
	if (!id)							\
		return -ENODEV;						\
	event_##call.id = id;						\
	INIT_LIST_HEAD(&event_##call.fields);				\
	return 0;							\
}
};

#undef DEFINE_EVENT_PRINT
#define DEFINE_EVENT_PRINT(template, name, proto, args, print)	\
@@ -776,7 +733,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
	.name			= #call,				\
	.system			= __stringify(TRACE_SYSTEM),		\
	.event			= &ftrace_event_type_##call,		\
	.raw_init		= ftrace_raw_init_event_##call,		\
	.raw_init		= trace_event_raw_init,			\
	.regfunc		= ftrace_raw_reg_event_##call,		\
	.unregfunc		= ftrace_raw_unreg_event_##call,	\
	.show_format		= ftrace_format_##template,		\
@@ -793,7 +750,7 @@ __attribute__((section("_ftrace_events"))) event_##call = { \
	.name			= #call,				\
	.system			= __stringify(TRACE_SYSTEM),		\
	.event			= &ftrace_event_type_##call,		\
	.raw_init		= ftrace_raw_init_event_##call,		\
	.raw_init		= trace_event_raw_init,			\
	.regfunc		= ftrace_raw_reg_event_##call,		\
	.unregfunc		= ftrace_raw_unreg_event_##call,	\
	.show_format		= ftrace_format_##call,			\
@@ -953,7 +910,6 @@ end: \
	perf_swevent_put_recursion_context(rctx);			\
end_recursion:								\
	local_irq_restore(irq_flags);					\
									\
}

#undef DEFINE_EVENT
+19 −11
Original line number Diff line number Diff line
@@ -1724,7 +1724,7 @@ ftrace_match_record(struct dyn_ftrace *rec, char *regex, int len, int type)
	return ftrace_match(str, regex, len, type);
}

static void ftrace_match_records(char *buff, int len, int enable)
static int ftrace_match_records(char *buff, int len, int enable)
{
	unsigned int search_len;
	struct ftrace_page *pg;
@@ -1733,6 +1733,7 @@ static void ftrace_match_records(char *buff, int len, int enable)
	char *search;
	int type;
	int not;
	int found = 0;

	flag = enable ? FTRACE_FL_FILTER : FTRACE_FL_NOTRACE;
	type = filter_parse_regex(buff, len, &search, &not);
@@ -1750,6 +1751,7 @@ static void ftrace_match_records(char *buff, int len, int enable)
				rec->flags &= ~flag;
			else
				rec->flags |= flag;
			found = 1;
		}
		/*
		 * Only enable filtering if we have a function that
@@ -1759,6 +1761,8 @@ static void ftrace_match_records(char *buff, int len, int enable)
			ftrace_filtered = 1;
	} while_for_each_ftrace_rec();
	mutex_unlock(&ftrace_lock);

	return found;
}

static int
@@ -1780,7 +1784,7 @@ ftrace_match_module_record(struct dyn_ftrace *rec, char *mod,
		return 1;
}

static void ftrace_match_module_records(char *buff, char *mod, int enable)
static int ftrace_match_module_records(char *buff, char *mod, int enable)
{
	unsigned search_len = 0;
	struct ftrace_page *pg;
@@ -1789,6 +1793,7 @@ static void ftrace_match_module_records(char *buff, char *mod, int enable)
	char *search = buff;
	unsigned long flag;
	int not = 0;
	int found = 0;

	flag = enable ? FTRACE_FL_FILTER : FTRACE_FL_NOTRACE;

@@ -1819,12 +1824,15 @@ static void ftrace_match_module_records(char *buff, char *mod, int enable)
				rec->flags &= ~flag;
			else
				rec->flags |= flag;
			found = 1;
		}
		if (enable && (rec->flags & FTRACE_FL_FILTER))
			ftrace_filtered = 1;

	} while_for_each_ftrace_rec();
	mutex_unlock(&ftrace_lock);

	return found;
}

/*
@@ -1853,8 +1861,9 @@ ftrace_mod_callback(char *func, char *cmd, char *param, int enable)
	if (!strlen(mod))
		return -EINVAL;

	ftrace_match_module_records(func, mod, enable);
	if (ftrace_match_module_records(func, mod, enable))
		return 0;
	return -EINVAL;
}

static struct ftrace_func_command ftrace_mod_cmd = {
@@ -2151,8 +2160,9 @@ static int ftrace_process_regex(char *buff, int len, int enable)
	func = strsep(&next, ":");

	if (!next) {
		ftrace_match_records(func, len, enable);
		if (ftrace_match_records(func, len, enable))
			return 0;
		return ret;
	}

	/* command found */
@@ -2198,10 +2208,9 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,
	    !trace_parser_cont(parser)) {
		ret = ftrace_process_regex(parser->buffer,
					   parser->idx, enable);
		trace_parser_clear(parser);
		if (ret)
			goto out_unlock;

		trace_parser_clear(parser);
	}

	ret = read;
@@ -2543,11 +2552,10 @@ ftrace_set_func(unsigned long *array, int *idx, char *buffer)
					exists = true;
					break;
				}
			if (!exists) {
			if (!exists)
				array[(*idx)++] = rec->ip;
			found = 1;
		}
		}
	} while_for_each_ftrace_rec();

	mutex_unlock(&ftrace_lock);
Loading