function-graph: fix the output of set_graph_function
PATCH 1/2 function-graph: fix the output of set_graph_function
It always shows "ftrace_graph_funcs":
# echo 'sys_open' > set_graph_function # cat set_graph_function ftrace_graph_funcs
--- kernel/trace/ftrace.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
kernel/trace/ftrace.c +1 -1
@@ -2505,7 +2505,7 @@ static int g_show(struct seq_file *m, void *v)return 0 ; } -seq_printf (m,"%pf\n" , v); +seq_printf (m,"%pf\n" , (void *)*ptr);return 0 ; }
Signature · 1 line
1.6.3
PATCH 2/2 function-graph: use ftrace_graph_funcs directly
No need to store ftrace_graph_funcs in file->private.
--- kernel/trace/ftrace.c | 22 ++++------------------ 1 files changed, 4 insertions(+), 18 deletions(-)
kernel/trace/ftrace.c +4 -18
@@ -2463,11 +2463,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 *
@@ -2531,16 +2529,10 @@ ftrace_graph_open(struct inode *inode, struct file *file) ftrace_graph_count =0 ;memset (ftrace_graph_funcs,0 ,sizeof (ftrace_graph_funcs)); } +mutex_unlock (&graph_lock); -if (file->f_mode &FMODE_READ ) { +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);return ret; }
@@ -2601,7 +2593,7 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, size_t cnt, loff_t *ppos) {unsigned char buffer[FTRACE_BUFF_MAX +1 ]; -unsigned long *array; +unsigned long *array = ftrace_graph_funcs;size_t read =0 ;ssize_t ret;int index =0 ;
@@ -2617,12 +2609,6 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, goto out; } -if (file->f_mode &FMODE_READ ) { -struct seq_file *m = file->private_data; - array = m->private; - }else - array = file->private_data; - ret =get_user (ch, ubuf++);if (ret) goto out;
Signature · 1 line
1.6.3
Steven Rostedt
maintainerQuoted 5 lines · Li Zefan
It always shows "
ftrace_graph_funcs":# echo 'sys_open' > set_graph_function # cat set_graph_function ftrace_graph_funcs
Nice fix. Hmm, this probably should go into 31.
-- Steve
Quoted 23 lines
Signed-off-by Li Zefan <[email protected]>--- kernel/trace/ftrace.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)kernel/trace/ftrace.c +1
-1@@ -2505,7 +2505,7 @@ static int g_show(struct seq_file *m, void *v)return 0 ; } -seq_printf (m,"%pf\n" , v); +seq_printf (m,"%pf\n" , (void *)*ptr);return 0 ; }Signature · 1 line
1.6.3
Steven Rostedt
maintainerRe: [PATCH -tip 2/2] function-graph: use ftrace_graph_funcs directly
In reply to Li ZefanQuoted 1 line · Li Zefan
No need to store
ftrace_graph_funcsinfile->private.
Thanks, I'll queue this up for 32.
-- Steve
Quoted 10 lines · Steven Rostedt
Quoted 5 lines · Li Zefan
It always shows "
ftrace_graph_funcs":# echo 'sys_open' > set_graph_function # cat set_graph_function ftrace_graph_funcsNice fix. Hmm, this probably should go into 31.
The bug is introduced by a patch in tracing/core,
so this fix is for -tip only. :)
Steven Rostedt
maintainerQuoted 9 lines · Li Zefan
Quoted 8 lines · Steven Rostedt
Quoted 5 lines · Li Zefan
It always shows "
ftrace_graph_funcs":# echo 'sys_open' > set_graph_function # cat set_graph_function ftrace_graph_funcs
Quoted 5 lines
Quoted 2 lines
Nice fix. Hmm, this probably should go into 31.
The bug is introduced by a patch in tracing/core,
so this fix is for -tip only. :)
OK, thanks for telling me that. It makes it easier for the queue.
-- Steve