Merge branch 'tracing/urgent' into tracing/core
Merge reason: Pick up latest fixes and update to latest upstream. Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
@@ -225,7 +225,11 @@ static void ftrace_update_pid_func(void)
|
||||
if (ftrace_trace_function == ftrace_stub)
|
||||
return;
|
||||
|
||||
#ifdef CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST
|
||||
func = ftrace_trace_function;
|
||||
#else
|
||||
func = __ftrace_trace_function;
|
||||
#endif
|
||||
|
||||
if (ftrace_pid_trace) {
|
||||
set_ftrace_pid_function(func);
|
||||
@@ -1520,7 +1524,7 @@ static int t_show(struct seq_file *m, void *v)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct seq_operations show_ftrace_seq_ops = {
|
||||
static const struct seq_operations show_ftrace_seq_ops = {
|
||||
.start = t_start,
|
||||
.next = t_next,
|
||||
.stop = t_stop,
|
||||
@@ -1621,8 +1625,10 @@ ftrace_regex_open(struct inode *inode, struct file *file, int enable)
|
||||
if (!ret) {
|
||||
struct seq_file *m = file->private_data;
|
||||
m->private = iter;
|
||||
} else
|
||||
} else {
|
||||
trace_parser_put(&iter->parser);
|
||||
kfree(iter);
|
||||
}
|
||||
} else
|
||||
file->private_data = iter;
|
||||
mutex_unlock(&ftrace_regex_lock);
|
||||
@@ -2148,7 +2154,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,
|
||||
struct trace_parser *parser;
|
||||
ssize_t ret, read;
|
||||
|
||||
if (!cnt || cnt < 0)
|
||||
if (!cnt)
|
||||
return 0;
|
||||
|
||||
mutex_lock(&ftrace_regex_lock);
|
||||
@@ -2162,7 +2168,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf,
|
||||
parser = &iter->parser;
|
||||
read = trace_get_user(parser, ubuf, cnt, ppos);
|
||||
|
||||
if (trace_parser_loaded(parser) &&
|
||||
if (read >= 0 && trace_parser_loaded(parser) &&
|
||||
!trace_parser_cont(parser)) {
|
||||
ret = ftrace_process_regex(parser->buffer,
|
||||
parser->idx, enable);
|
||||
@@ -2360,11 +2366,9 @@ unsigned long ftrace_graph_funcs[FTRACE_GRAPH_MAX_FUNCS] __read_mostly;
|
||||
static void *
|
||||
__g_next(struct seq_file *m, loff_t *pos)
|
||||
{
|
||||
unsigned long *array = m->private;
|
||||
|
||||
if (*pos >= ftrace_graph_count)
|
||||
return NULL;
|
||||
return &array[*pos];
|
||||
return &ftrace_graph_funcs[*pos];
|
||||
}
|
||||
|
||||
static void *
|
||||
@@ -2407,7 +2411,7 @@ static int g_show(struct seq_file *m, void *v)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct seq_operations ftrace_graph_seq_ops = {
|
||||
static const struct seq_operations ftrace_graph_seq_ops = {
|
||||
.start = g_start,
|
||||
.next = g_next,
|
||||
.stop = g_stop,
|
||||
@@ -2428,17 +2432,11 @@ ftrace_graph_open(struct inode *inode, struct file *file)
|
||||
ftrace_graph_count = 0;
|
||||
memset(ftrace_graph_funcs, 0, sizeof(ftrace_graph_funcs));
|
||||
}
|
||||
|
||||
if (file->f_mode & FMODE_READ) {
|
||||
ret = seq_open(file, &ftrace_graph_seq_ops);
|
||||
if (!ret) {
|
||||
struct seq_file *m = file->private_data;
|
||||
m->private = ftrace_graph_funcs;
|
||||
}
|
||||
} else
|
||||
file->private_data = ftrace_graph_funcs;
|
||||
mutex_unlock(&graph_lock);
|
||||
|
||||
if (file->f_mode & FMODE_READ)
|
||||
ret = seq_open(file, &ftrace_graph_seq_ops);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2506,9 +2504,7 @@ ftrace_graph_write(struct file *file, const char __user *ubuf,
|
||||
size_t cnt, loff_t *ppos)
|
||||
{
|
||||
struct trace_parser parser;
|
||||
unsigned long *array;
|
||||
size_t read = 0;
|
||||
ssize_t ret;
|
||||
ssize_t read, ret;
|
||||
|
||||
if (!cnt || cnt < 0)
|
||||
return 0;
|
||||
@@ -2517,35 +2513,31 @@ ftrace_graph_write(struct file *file, const char __user *ubuf,
|
||||
|
||||
if (ftrace_graph_count >= FTRACE_GRAPH_MAX_FUNCS) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
if (file->f_mode & FMODE_READ) {
|
||||
struct seq_file *m = file->private_data;
|
||||
array = m->private;
|
||||
} else
|
||||
array = file->private_data;
|
||||
|
||||
if (trace_parser_get_init(&parser, FTRACE_BUFF_MAX)) {
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
read = trace_get_user(&parser, ubuf, cnt, ppos);
|
||||
|
||||
if (trace_parser_loaded((&parser))) {
|
||||
if (read >= 0 && trace_parser_loaded((&parser))) {
|
||||
parser.buffer[parser.idx] = 0;
|
||||
|
||||
/* we allow only one expression at a time */
|
||||
ret = ftrace_set_func(array, &ftrace_graph_count,
|
||||
ret = ftrace_set_func(ftrace_graph_funcs, &ftrace_graph_count,
|
||||
parser.buffer);
|
||||
if (ret)
|
||||
goto out;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
ret = read;
|
||||
out:
|
||||
|
||||
out_free:
|
||||
trace_parser_put(&parser);
|
||||
out_unlock:
|
||||
mutex_unlock(&graph_lock);
|
||||
|
||||
return ret;
|
||||
@@ -2976,7 +2968,7 @@ int unregister_ftrace_function(struct ftrace_ops *ops)
|
||||
|
||||
int
|
||||
ftrace_enable_sysctl(struct ctl_table *table, int write,
|
||||
struct file *file, void __user *buffer, size_t *lenp,
|
||||
void __user *buffer, size_t *lenp,
|
||||
loff_t *ppos)
|
||||
{
|
||||
int ret;
|
||||
@@ -2986,7 +2978,7 @@ ftrace_enable_sysctl(struct ctl_table *table, int write,
|
||||
|
||||
mutex_lock(&ftrace_lock);
|
||||
|
||||
ret = proc_dointvec(table, write, file, buffer, lenp, ppos);
|
||||
ret = proc_dointvec(table, write, buffer, lenp, ppos);
|
||||
|
||||
if (ret || !write || (last_ftrace_enabled == !!ftrace_enabled))
|
||||
goto out;
|
||||
|
Reference in New Issue
Block a user