--- 22cf21e9e792a2c70713427f2a224301e2313c10 +++ 6dc4e5ef7a01aab7e92479455c3672ce6096461c @@ -369,18 +369,11 @@ static int function_stat_show(struct seq { struct ftrace_profile *rec = v; char str[KSYM_SYMBOL_LEN]; - int ret = 0; #ifdef CONFIG_FUNCTION_GRAPH_TRACER + static DEFINE_MUTEX(mutex); static struct trace_seq s; unsigned long long avg; #endif - mutex_lock(&ftrace_profile_lock); - - /* we raced with function_profile_reset() */ - if (unlikely(rec->counter == 0)) { - ret = -EBUSY; - goto out; - } kallsyms_lookup(rec->ip, NULL, NULL, NULL, str); seq_printf(m, " %-30.30s %10lu", str, rec->counter); @@ -390,17 +383,17 @@ static int function_stat_show(struct seq avg = rec->time; do_div(avg, rec->counter); + mutex_lock(&mutex); trace_seq_init(&s); trace_print_graph_duration(rec->time, &s); trace_seq_puts(&s, " "); trace_print_graph_duration(avg, &s); trace_print_seq(m, &s); + mutex_unlock(&mutex); #endif seq_putc(m, '\n'); -out: - mutex_unlock(&ftrace_profile_lock); - return ret; + return 0; } static void ftrace_profile_reset(struct ftrace_profile_stat *stat) @@ -1480,8 +1473,6 @@ static void *t_start(struct seq_file *m, if (*pos > 0) return t_hash_start(m, pos); iter->flags |= FTRACE_ITER_PRINTALL; - /* reset in case of seek/pread */ - iter->flags &= ~FTRACE_ITER_HASH; return iter; } @@ -2402,7 +2393,7 @@ static const struct file_operations ftra .open = ftrace_filter_open, .read = seq_read, .write = ftrace_filter_write, - .llseek = no_llseek, + .llseek = ftrace_regex_lseek, .release = ftrace_filter_release, }; @@ -3267,7 +3258,6 @@ void ftrace_graph_init_task(struct task_ { /* Make sure we do not use the parent ret_stack */ t->ret_stack = NULL; - t->curr_ret_stack = -1; if (ftrace_graph_active) { struct ftrace_ret_stack *ret_stack; @@ -3277,6 +3267,7 @@ void ftrace_graph_init_task(struct task_ GFP_KERNEL); if (!ret_stack) return; + t->curr_ret_stack = -1; atomic_set(&t->tracing_graph_pause, 0); atomic_set(&t->trace_overrun, 0); t->ftrace_timestamp = 0;