Re: [PATCH 7/9] tools/virtio: use canonical ftrace path

From: Michael S. Tsirkin
Date: Mon Jan 30 2023 - 14:27:46 EST


On Mon, Jan 30, 2023 at 11:19:13AM -0700, Ross Zwisler wrote:
> The canonical location for the tracefs filesystem is at /sys/kernel/tracing.
>
> But, from Documentation/trace/ftrace.rst:
>
> Before 4.1, all ftrace tracing control files were within the debugfs
> file system, which is typically located at /sys/kernel/debug/tracing.
> For backward compatibility, when mounting the debugfs file system,
> the tracefs file system will be automatically mounted at:
>
> /sys/kernel/debug/tracing
>
> A few spots in tools/virtio still refer to this older debugfs
> path, so let's update them to avoid confusion.
>
> Signed-off-by: Ross Zwisler <zwisler@xxxxxxxxxx>
> ---
> tools/virtio/virtio-trace/README | 2 +-
> tools/virtio/virtio-trace/trace-agent.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/virtio/virtio-trace/README b/tools/virtio/virtio-trace/README
> index b64845b823ab..cea29a2a4c0a 100644
> --- a/tools/virtio/virtio-trace/README
> +++ b/tools/virtio/virtio-trace/README
> @@ -95,7 +95,7 @@ Run
>
> 1) Enable ftrace in the guest
> <Example>
> - # echo 1 > /sys/kernel/debug/tracing/events/sched/enable
> + # echo 1 > /sys/kernel/tracing/events/sched/enable
>
> 2) Run trace agent in the guest
> This agent must be operated as root.
> diff --git a/tools/virtio/virtio-trace/trace-agent.c b/tools/virtio/virtio-trace/trace-agent.c
> index cdfe77c2b4c8..805942d02e9f 100644
> --- a/tools/virtio/virtio-trace/trace-agent.c
> +++ b/tools/virtio/virtio-trace/trace-agent.c
> @@ -19,7 +19,7 @@
> #define PIPE_MIN_SIZE (PAGE_SIZE*PIPE_DEF_BUFS)
> #define PIPE_MAX_SIZE (1024*1024)
> #define READ_PATH_FMT \
> - "/sys/kernel/debug/tracing/per_cpu/cpu%d/trace_pipe_raw"
> + "/sys/kernel/tracing/per_cpu/cpu%d/trace_pipe_raw"

Should we try both old and new path then?

> #define WRITE_PATH_FMT "/dev/virtio-ports/trace-path-cpu%d"
> #define CTL_PATH "/dev/virtio-ports/agent-ctl-path"
>
> --
> 2.39.1.456.gfc5497dd1b-goog