Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/virtio: use canonical ftrace path

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@google.com>
Message-Id: <20230215223350.2658616-6-zwisler@google.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com>

authored by

Ross Zwisler and committed by
Michael S. Tsirkin
07496eea beee7fdb

+9 -5
+1 -1
tools/virtio/virtio-trace/README
··· 95 95 96 96 1) Enable ftrace in the guest 97 97 <Example> 98 - # echo 1 > /sys/kernel/debug/tracing/events/sched/enable 98 + # echo 1 > /sys/kernel/tracing/events/sched/enable 99 99 100 100 2) Run trace agent in the guest 101 101 This agent must be operated as root.
+8 -4
tools/virtio/virtio-trace/trace-agent.c
··· 18 18 #define PIPE_DEF_BUFS 16 19 19 #define PIPE_MIN_SIZE (PAGE_SIZE*PIPE_DEF_BUFS) 20 20 #define PIPE_MAX_SIZE (1024*1024) 21 - #define READ_PATH_FMT \ 22 - "/sys/kernel/debug/tracing/per_cpu/cpu%d/trace_pipe_raw" 21 + #define TRACEFS "/sys/kernel/tracing" 22 + #define DEBUGFS "/sys/kernel/debug/tracing" 23 + #define READ_PATH_FMT "%s/per_cpu/cpu%d/trace_pipe_raw" 23 24 #define WRITE_PATH_FMT "/dev/virtio-ports/trace-path-cpu%d" 24 25 #define CTL_PATH "/dev/virtio-ports/agent-ctl-path" 25 26 ··· 121 120 if (this_is_write_path) 122 121 /* write(output) path */ 123 122 ret = snprintf(buf, PATH_MAX, WRITE_PATH_FMT, cpu_num); 124 - else 123 + else { 125 124 /* read(input) path */ 126 - ret = snprintf(buf, PATH_MAX, READ_PATH_FMT, cpu_num); 125 + ret = snprintf(buf, PATH_MAX, READ_PATH_FMT, TRACEFS, cpu_num); 126 + if (ret > 0 && access(buf, F_OK) != 0) 127 + ret = snprintf(buf, PATH_MAX, READ_PATH_FMT, DEBUGFS, cpu_num); 128 + } 127 129 128 130 if (ret <= 0) { 129 131 pr_err("Failed to generate %s path(CPU#%d):%d\n",