Em Mon, Feb 19, 2018 at 10:33:29AM +0800, changbin...@intel.com escreveu: > From: Changbin Du <changbin...@intel.com> > > Before this change, the '--graph-funcs', '--nograph-funcs' and > '--trace-funcs' options didn't work as expected when the <func> doesn't > exist. Because the kernel side hid possible errors. > > $ sudo ./perf ftrace -a --graph-depth 1 --graph-funcs abcdefg > 0) 0.140 us | rcu_all_qs(); > 3) 0.304 us | mutex_unlock(); > 0) 0.153 us | find_vma(); > 3) 0.088 us | __fsnotify_parent(); > 0) 6.145 us | handle_mm_fault(); > 3) 0.089 us | fsnotify(); > 3) 0.161 us | __sb_end_write(); > 3) 0.710 us | SyS_close(); > 3) 7.848 us | exit_to_usermode_loop(); > > On above example, I specified function filter 'abcdefg' but all functions > are enabled. The expected error is hidden. > > The original fix is to make the kernel support '\0' as end of string: > https://lkml.org/lkml/2018/1/16/116 > > But above fix cannot be compatible with old kernels. Then Namhyung Kim > suggest adding a space after function name. > > This patch will append an '\n' when write tracing file. After this fix, > the perf will report correct error state. Also let it print an error if > reset_tracing_files() fails.
Ok, now it prints: [root@jouet ~]# perf ftrace -a --graph-depth 1 --graph-funcs abcdefg failed to set tracing filters [root@jouet ~]# which is too vague, i.e. the user is left without knowing what was it that didn't work in setting the filter. It would be better to have: [root@jouet ~]# perf ftrace -a --graph-depth 1 --graph-funcs abcdefg failed to set tracing filters: function 'abcdefg' not found. [root@jouet ~]# Anyway, this improves the current situation, so I'm applying it. - Arnaldo