Re: [PATCH] perf tools: Fix tracing_path_mount proper path

From: Arnaldo Carvalho de Melo
Date: Tue Oct 16 2018 - 11:18:19 EST


Em Tue, Oct 16, 2018 at 01:48:18PM +0200, Jiri Olsa escreveu:
> If there's no tracefs (RHEL7) support the tracing_path_mount
> returns debugfs path which results in following fail:
>
> # perf probe sys_write
> kprobe_events file does not exist - please rebuild kernel with CONFIG_KPROBE_EVENTS.
> Error: Failed to add events.
>
> In tracing_path_debugfs_mount function we need to return the
> 'tracing' path instead of just the mount to make it work:
>
> # perf probe sys_write
> Added new event:
> probe:sys_write (on sys_write)
>
> You can now use it in all perf tools, such as:
>
> perf record -e probe:sys_write -aR sleep 1
>
> Adding the 'return tracing_path;' also to tracing_path_tracefs_mount
> function just for consistency with tracing_path_debugfs_mount.
>
> Upstream keeps working, because it has the tracefs support.
>
> Link: http://lkml.kernel.org/n/tip-yiwkzexq9fk1ey1xg3gnjlw4@xxxxxxxxxxxxxx
> Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
> ---
> tools/lib/api/fs/tracing_path.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
> index 120037496f77..5afb11b30fca 100644
> --- a/tools/lib/api/fs/tracing_path.c
> +++ b/tools/lib/api/fs/tracing_path.c
> @@ -36,7 +36,7 @@ static const char *tracing_path_tracefs_mount(void)
>
> __tracing_path_set("", mnt);
>
> - return mnt;
> + return tracing_path;
> }
>
> static const char *tracing_path_debugfs_mount(void)
> @@ -49,7 +49,7 @@ static const char *tracing_path_debugfs_mount(void)
>
> __tracing_path_set("tracing/", mnt);
>
> - return mnt;
> + return tracing_path;

Humm, colour me confused, by the name of the function I expected
tracing_path_debugfs_mount() to return the debugfs mount.

tracing_path_tracefs_mount() would return the tracefs mount point, so,
there, returning tracing_path would be ok.

Is there some other way to figure out that tracefs isn't available and
thus we should use debugfs_mount + "/tracing/" for the "tracefs" mount?

This may well be just the naming confusion... lemme read this a bit
more...

- Arnaldo

> }
>
> const char *tracing_path_mount(void)
> --
> 2.17.2