tracing/trace_stack: cleanup for trace_lookup_stack()
PATCH 1/2 tracing/trace_stack: cleanup for trace_lookup_stack()
We can use %pF input format instead of sprint_symbol() and %s input format
Thanks for Li Zefan's offline review.
Signed-off-by Xiao Guangrong <[email protected]>
Reviewed-by Li Zefan <[email protected]>
--- kernel/trace/trace_stack.c | 9 +-------- 1 files changed, 1 insertions(+), 8 deletions(-)
kernel/trace/trace_stack.c +1 -8
@@ -234,15 +234,8 @@ static void t_stop(struct seq_file *m, void *p)static int trace_lookup_stack (struct seq_file *m,long i) {unsigned long addr = stack_dump_trace[i]; -#ifdef CONFIG_KALLSYMS -char str[KSYM_SYMBOL_LEN ]; -sprint_symbol (str, addr); - -return seq_printf (m,"%s\n" , str); -#else -return seq_printf (m,"%p\n" , (void *)addr); -#endif +return seq_printf (m,"%pF\n" , (void *)addr); }static void print_disabled (struct seq_file *m)
Signature · 1 line
1.6.1.2
PATCH 2/2 tracing/function: cleanup for function tracer
We can use %pf input format instead of kallsyms_lookup() and %s input format
Thanks for Li Zefan's offline review.
Signed-off-by Xiao Guangrong <[email protected]>
Reviewed-by Li Zefan <[email protected]>
--- kernel/trace/ftrace.c | 17 +++-------------- kernel/trace/trace_functions.c | 4 +--- 2 files changed, 4 insertions(+), 17 deletions(-)
kernel/trace/ftrace.c +3 -14
@@ -1438,18 +1438,13 @@ static int t_hash_show(struct seq_file *m, void *v) {struct ftrace_func_probe *rec;struct hlist_node *hnd = v; -char str[KSYM_SYMBOL_LEN ]; rec = hlist_entry(hnd, struct ftrace_func_probe, node);if (rec->ops->print)return rec->ops->kallsyms_lookup (rec->ip,NULL ,NULL ,NULL , str); -seq_printf (m,"%s:" , str); - -kallsyms_lookup ((unsigned long )rec->ops->func,NULL ,NULL ,NULL , str); -seq_printf (m,"%s" , str); +seq_printf (m,"%pf:%pf" , (void *)rec->ip, (void *)rec->ops->func);if (rec->data)seq_printf (m,":%p" , rec->data);
@@ -1547,7 +1542,6 @@ static int t_show(struct seq_file *m, void *v) {struct ftrace_iterator *iter = m->private;struct dyn_ftrace *rec = v; -char str[KSYM_SYMBOL_LEN ];if (iter->flags &FTRACE_ITER_HASH )return t_hash_show (m, v);
@@ -1560,9 +1554,7 @@ static int t_show(struct seq_file *m, void *v)if (!rec)return 0 ; -kallsyms_lookup (rec->ip,NULL ,NULL ,NULL , str); - -seq_printf (m,"%s\n" , str); +seq_printf (m,"%pf\n" , (void *)rec->ip);return 0 ; }
@@ -2543,7 +2535,6 @@ static void g_stop(struct seq_file *m, void *p)static int g_show (struct seq_file *m,void *v) {unsigned long *ptr = v; -char str[KSYM_SYMBOL_LEN ];if (!ptr)return 0 ;
@@ -2553,9 +2544,7 @@ static int g_show(struct seq_file *m, void *v)return 0 ; } -kallsyms_lookup (*ptr,NULL ,NULL ,NULL , str); - -seq_printf (m,"%s\n" , str); +seq_printf (m,"%pf\n" , v);return 0 ; }
kernel/trace/trace_functions.c +1 -3
@@ -288,11 +288,9 @@ static int ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip, struct ftrace_probe_ops *ops, void *data) { - char str[KSYM_SYMBOL_LEN]; long count = (long)data; -kallsyms_lookup (ip,NULL ,NULL ,NULL , str); -seq_printf (m,"%s:" , str); +seq_printf (m,"%pf:" , (void *)ip);if (ops == &traceon_probe_ops)seq_printf (m,"traceon" );
Signature · 1 line
1.6.1.2
Re: [PATCH 2/2] tracing/function: cleanup for function tracer
Quoted 7 lines · Xiao Guangrong
We can use %pf input format instead of
kallsyms_lookup()and %s input formatThanks for Li Zefan's offline review.
Signed-off-by Xiao Guangrong <[email protected]>Reviewed-by Li Zefan <[email protected]>
Queuing these two patches for .32
Thanks!
Frederic.
Quoted 87 lines
--- kernel/trace/ftrace.c | 17 +++-------------- kernel/trace/trace_functions.c | 4 +--- 2 files changed, 4 insertions(+), 17 deletions(-)kernel/trace/ftrace.c +3
-14@@ -1438,18 +1438,13 @@ static int t_hash_show(struct seq_file *m, void *v) {struct ftrace_func_probe *rec;struct hlist_node *hnd = v; -char str[KSYM_SYMBOL_LEN ]; rec = hlist_entry(hnd, struct ftrace_func_probe, node);if (rec->ops->print)return rec->ops->kallsyms_lookup (rec->ip,NULL ,NULL ,NULL , str); -seq_printf (m,"%s:" , str); - -kallsyms_lookup ((unsigned long )rec->ops->func,NULL ,NULL ,NULL , str); -seq_printf (m,"%s" , str); +seq_printf (m,"%pf:%pf" , (void *)rec->ip, (void *)rec->ops->func);if (rec->data)seq_printf (m,":%p" , rec->data);@@ -1547,7 +1542,6 @@ static int t_show(struct seq_file *m, void *v) {struct ftrace_iterator *iter = m->private;struct dyn_ftrace *rec = v; -char str[KSYM_SYMBOL_LEN ];if (iter->flags &FTRACE_ITER_HASH )return t_hash_show (m, v);@@ -1560,9 +1554,7 @@ static int t_show(struct seq_file *m, void *v)if (!rec)return 0 ; -kallsyms_lookup (rec->ip,NULL ,NULL ,NULL , str); - -seq_printf (m,"%s\n" , str); +seq_printf (m,"%pf\n" , (void *)rec->ip);return 0 ; }@@ -2543,7 +2535,6 @@ static void g_stop(struct seq_file *m, void *p)static int g_show (struct seq_file *m,void *v) {unsigned long *ptr = v; -char str[KSYM_SYMBOL_LEN ];if (!ptr)return 0 ;@@ -2553,9 +2544,7 @@ static int g_show(struct seq_file *m, void *v)return 0 ; } -kallsyms_lookup (*ptr,NULL ,NULL ,NULL , str); - -seq_printf (m,"%s\n" , str); +seq_printf (m,"%pf\n" , v);return 0 ; }kernel/trace/trace_functions.c +1
-3@@ -288,11 +288,9 @@ static int ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip, struct ftrace_probe_ops *ops, void *data) { - char str[KSYM_SYMBOL_LEN]; long count = (long)data; -kallsyms_lookup (ip,NULL ,NULL ,NULL , str); -seq_printf (m,"%s:" , str); +seq_printf (m,"%pf:" , (void *)ip);if (ops == &traceon_probe_ops)seq_printf (m,"traceon" );Signature · 1 line
1.6.1.2