linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Ross Zwisler <zwisler@chromium.org>
Cc: linux-kernel@vger.kernel.org, Ross Zwisler <zwisler@google.com>,
	Jason Wang <jasowang@redhat.com>,
	virtualization@lists.linux-foundation.org,
	linux-trace-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH v2 5/6] tools/virtio: use canonical ftrace path
Date: Fri, 2 Jun 2023 07:15:26 -0400	[thread overview]
Message-ID: <20230602071517-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20230215223350.2658616-6-zwisler@google.com>

On Wed, Feb 15, 2023 at 03:33:49PM -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@google.com>

queued this too. thanks!

> ---
>  tools/virtio/virtio-trace/README        |  2 +-
>  tools/virtio/virtio-trace/trace-agent.c | 12 ++++++++----
>  2 files changed, 9 insertions(+), 5 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..7e2d9bbf0b84 100644
> --- a/tools/virtio/virtio-trace/trace-agent.c
> +++ b/tools/virtio/virtio-trace/trace-agent.c
> @@ -18,8 +18,9 @@
>  #define PIPE_DEF_BUFS		16
>  #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"
> +#define TRACEFS 		"/sys/kernel/tracing"
> +#define DEBUGFS 		"/sys/kernel/debug/tracing"
> +#define READ_PATH_FMT		"%s/per_cpu/cpu%d/trace_pipe_raw"
>  #define WRITE_PATH_FMT		"/dev/virtio-ports/trace-path-cpu%d"
>  #define CTL_PATH		"/dev/virtio-ports/agent-ctl-path"
>  
> @@ -120,9 +121,12 @@ static const char *make_path(int cpu_num, bool this_is_write_path)
>  	if (this_is_write_path)
>  		/* write(output) path */
>  		ret = snprintf(buf, PATH_MAX, WRITE_PATH_FMT, cpu_num);
> -	else
> +	else {
>  		/* read(input) path */
> -		ret = snprintf(buf, PATH_MAX, READ_PATH_FMT, cpu_num);
> +		ret = snprintf(buf, PATH_MAX, READ_PATH_FMT, TRACEFS, cpu_num);
> +		if (ret > 0 && access(buf, F_OK) != 0)
> +			ret = snprintf(buf, PATH_MAX, READ_PATH_FMT, DEBUGFS, cpu_num);
> +	}
>  
>  	if (ret <= 0) {
>  		pr_err("Failed to generate %s path(CPU#%d):%d\n",
> -- 
> 2.39.1.637.g21b0678d19-goog


  parent reply	other threads:[~2023-06-02 11:18 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-15 22:33 [PATCH v2 0/6] use canonical ftrace path whenever possible Ross Zwisler
2023-02-15 22:33 ` [PATCH v2 1/6] tracing: always use canonical ftrace path Ross Zwisler
2023-02-16 15:13   ` Masami Hiramatsu
2023-02-17 15:34   ` Mukesh Ojha
2023-02-15 22:33 ` [PATCH v2 2/6] selftests: " Ross Zwisler
2023-02-16 20:58   ` Steven Rostedt
2023-02-17 15:40   ` Mukesh Ojha
2023-02-15 22:33 ` [PATCH v2 3/6] leaking_addresses: also skip " Ross Zwisler
2023-02-15 22:33 ` [PATCH v2 4/6] tools/kvm_stat: use " Ross Zwisler
2023-02-16 21:08   ` Steven Rostedt
2023-02-17 11:32   ` Paolo Bonzini
2023-02-17 15:41   ` Mukesh Ojha
2023-02-15 22:33 ` [PATCH v2 5/6] tools/virtio: " Ross Zwisler
2023-02-17 15:46   ` Mukesh Ojha
2023-06-02 11:15   ` Michael S. Tsirkin [this message]
2023-02-15 22:33 ` [PATCH v2 6/6] tools/virtio: fix typo in README instructions Ross Zwisler
2023-03-10  8:29 ` [PATCH v2 0/6] use canonical ftrace path whenever possible Michael S. Tsirkin
2023-03-10 19:06   ` Ross Zwisler
2023-03-10 19:37     ` Steven Rostedt
2023-03-22  2:32 ` Michael S. Tsirkin
2023-03-22 16:52   ` Ross Zwisler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230602071517-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=zwisler@chromium.org \
    --cc=zwisler@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).