linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/6] use canonical ftrace path whenever possible
@ 2023-02-15 22:33 Ross Zwisler
  2023-02-15 22:33 ` [PATCH v2 1/6] tracing: always use canonical ftrace path Ross Zwisler
                   ` (7 more replies)
  0 siblings, 8 replies; 21+ messages in thread
From: Ross Zwisler @ 2023-02-15 22:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ross Zwisler, Michael S. Tsirkin, Tobin C. Harding,
	Andrew Morton, Jason Wang, Masami Hiramatsu, Paolo Bonzini,
	Shuah Khan, Tycho Andersen, kvm, linux-hardening,
	linux-kselftest, linux-mm, virtualization, linux-trace-kernel,
	Steven Rostedt

Changes in v2:
 * Dropped patches which were pulled into maintainer trees.
 * Split BPF patches out into another series targeting bpf-next.
 * trace-agent now falls back to debugfs if tracefs isn't present.
 * Added Acked-by from mst@redhat.com to series.
 * Added a typo fixup for the virtio-trace README.

Steven, assuming there are no objections, would you feel comfortable
taking this series through your tree?

---
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

There are many places where this older debugfs path is still used in
code comments, selftests, examples and tools, so let's update them to
avoid confusion.

I've broken up the series as best I could by maintainer or directory,
and I've only sent people the patches that I think they care about to
avoid spamming everyone.

Ross Zwisler (6):
  tracing: always use canonical ftrace path
  selftests: use canonical ftrace path
  leaking_addresses: also skip canonical ftrace path
  tools/kvm_stat: use canonical ftrace path
  tools/virtio: use canonical ftrace path
  tools/virtio: fix typo in README instructions

 include/linux/kernel.h                        |  2 +-
 include/linux/tracepoint.h                    |  4 ++--
 kernel/trace/Kconfig                          | 20 +++++++++----------
 kernel/trace/kprobe_event_gen_test.c          |  2 +-
 kernel/trace/ring_buffer.c                    |  2 +-
 kernel/trace/synth_event_gen_test.c           |  2 +-
 kernel/trace/trace.c                          |  2 +-
 samples/user_events/example.c                 |  4 ++--
 scripts/leaking_addresses.pl                  |  1 +
 scripts/tracing/draw_functrace.py             |  6 +++---
 tools/kvm/kvm_stat/kvm_stat                   |  2 +-
 tools/lib/api/fs/tracing_path.c               |  4 ++--
 .../testing/selftests/user_events/dyn_test.c  |  2 +-
 .../selftests/user_events/ftrace_test.c       | 10 +++++-----
 .../testing/selftests/user_events/perf_test.c |  8 ++++----
 tools/testing/selftests/vm/protection_keys.c  |  4 ++--
 tools/tracing/latency/latency-collector.c     |  2 +-
 tools/virtio/virtio-trace/README              |  4 ++--
 tools/virtio/virtio-trace/trace-agent.c       | 12 +++++++----
 19 files changed, 49 insertions(+), 44 deletions(-)

-- 
2.39.1.637.g21b0678d19-goog


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 1/6] tracing: always use canonical ftrace path
  2023-02-15 22:33 [PATCH v2 0/6] use canonical ftrace path whenever possible Ross Zwisler
@ 2023-02-15 22:33 ` 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
                   ` (6 subsequent siblings)
  7 siblings, 2 replies; 21+ messages in thread
From: Ross Zwisler @ 2023-02-15 22:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ross Zwisler, Steven Rostedt, Masami Hiramatsu, linux-trace-kernel

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

Many comments and Kconfig help messages in the tracing code still refer
to this older debugfs path, so let's update them to avoid confusion.

Signed-off-by: Ross Zwisler <zwisler@google.com>
---
 include/linux/kernel.h                    |  2 +-
 include/linux/tracepoint.h                |  4 ++--
 kernel/trace/Kconfig                      | 20 ++++++++++----------
 kernel/trace/kprobe_event_gen_test.c      |  2 +-
 kernel/trace/ring_buffer.c                |  2 +-
 kernel/trace/synth_event_gen_test.c       |  2 +-
 kernel/trace/trace.c                      |  2 +-
 samples/user_events/example.c             |  4 ++--
 scripts/tracing/draw_functrace.py         |  6 +++---
 tools/lib/api/fs/tracing_path.c           |  4 ++--
 tools/tracing/latency/latency-collector.c |  2 +-
 11 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index fe6efb24d151..40bce7495af8 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -297,7 +297,7 @@ bool mac_pton(const char *s, u8 *mac);
  *
  * Use tracing_on/tracing_off when you want to quickly turn on or off
  * tracing. It simply enables or disables the recording of the trace events.
- * This also corresponds to the user space /sys/kernel/debug/tracing/tracing_on
+ * This also corresponds to the user space /sys/kernel/tracing/tracing_on
  * file, which gives a means for the kernel and userspace to interact.
  * Place a tracing_off() in the kernel where you want tracing to end.
  * From user space, examine the trace, and then echo 1 > tracing_on
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 4b33b95eb8be..fa1004fcf810 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -471,7 +471,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
  *	* This is how the trace record is structured and will
  *	* be saved into the ring buffer. These are the fields
  *	* that will be exposed to user-space in
- *	* /sys/kernel/debug/tracing/events/<*>/format.
+ *	* /sys/kernel/tracing/events/<*>/format.
  *	*
  *	* The declared 'local variable' is called '__entry'
  *	*
@@ -531,7 +531,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
  * tracepoint callback (this is used by programmatic plugins and
  * can also by used by generic instrumentation like SystemTap), and
  * it is also used to expose a structured trace record in
- * /sys/kernel/debug/tracing/events/.
+ * /sys/kernel/tracing/events/.
  *
  * A set of (un)registration functions can be passed to the variant
  * TRACE_EVENT_FN to perform any (un)registration work.
diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index d7043043f59c..5f5e64f9e715 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -239,7 +239,7 @@ config DYNAMIC_FTRACE
 	  enabled, and the functions not enabled will not affect
 	  performance of the system.
 
-	  See the files in /sys/kernel/debug/tracing:
+	  See the files in /sys/kernel/tracing:
 	    available_filter_functions
 	    set_ftrace_filter
 	    set_ftrace_notrace
@@ -299,7 +299,7 @@ config STACK_TRACER
 	select KALLSYMS
 	help
 	  This special tracer records the maximum stack footprint of the
-	  kernel and displays it in /sys/kernel/debug/tracing/stack_trace.
+	  kernel and displays it in /sys/kernel/tracing/stack_trace.
 
 	  This tracer works by hooking into every function call that the
 	  kernel executes, and keeping a maximum stack depth value and
@@ -339,7 +339,7 @@ config IRQSOFF_TRACER
 	  disabled by default and can be runtime (re-)started
 	  via:
 
-	      echo 0 > /sys/kernel/debug/tracing/tracing_max_latency
+	      echo 0 > /sys/kernel/tracing/tracing_max_latency
 
 	  (Note that kernel size and overhead increase with this option
 	  enabled. This option and the preempt-off timing option can be
@@ -363,7 +363,7 @@ config PREEMPT_TRACER
 	  disabled by default and can be runtime (re-)started
 	  via:
 
-	      echo 0 > /sys/kernel/debug/tracing/tracing_max_latency
+	      echo 0 > /sys/kernel/tracing/tracing_max_latency
 
 	  (Note that kernel size and overhead increase with this option
 	  enabled. This option and the irqs-off timing option can be
@@ -515,7 +515,7 @@ config TRACER_SNAPSHOT
 	  Allow tracing users to take snapshot of the current buffer using the
 	  ftrace interface, e.g.:
 
-	      echo 1 > /sys/kernel/debug/tracing/snapshot
+	      echo 1 > /sys/kernel/tracing/snapshot
 	      cat snapshot
 
 config TRACER_SNAPSHOT_PER_CPU_SWAP
@@ -527,7 +527,7 @@ config TRACER_SNAPSHOT_PER_CPU_SWAP
 	  full swap (all buffers). If this is set, then the following is
 	  allowed:
 
-	      echo 1 > /sys/kernel/debug/tracing/per_cpu/cpu2/snapshot
+	      echo 1 > /sys/kernel/tracing/per_cpu/cpu2/snapshot
 
 	  After which, only the tracing buffer for CPU 2 was swapped with
 	  the main tracing buffer, and the other CPU buffers remain the same.
@@ -574,7 +574,7 @@ config PROFILE_ANNOTATED_BRANCHES
 	  This tracer profiles all likely and unlikely macros
 	  in the kernel. It will display the results in:
 
-	  /sys/kernel/debug/tracing/trace_stat/branch_annotated
+	  /sys/kernel/tracing/trace_stat/branch_annotated
 
 	  Note: this will add a significant overhead; only turn this
 	  on if you need to profile the system's use of these macros.
@@ -587,7 +587,7 @@ config PROFILE_ALL_BRANCHES
 	  taken in the kernel is recorded whether it hit or miss.
 	  The results will be displayed in:
 
-	  /sys/kernel/debug/tracing/trace_stat/branch_all
+	  /sys/kernel/tracing/trace_stat/branch_all
 
 	  This option also enables the likely/unlikely profiler.
 
@@ -638,8 +638,8 @@ config BLK_DEV_IO_TRACE
 	  Tracing also is possible using the ftrace interface, e.g.:
 
 	    echo 1 > /sys/block/sda/sda1/trace/enable
-	    echo blk > /sys/kernel/debug/tracing/current_tracer
-	    cat /sys/kernel/debug/tracing/trace_pipe
+	    echo blk > /sys/kernel/tracing/current_tracer
+	    cat /sys/kernel/tracing/trace_pipe
 
 	  If unsure, say N.
 
diff --git a/kernel/trace/kprobe_event_gen_test.c b/kernel/trace/kprobe_event_gen_test.c
index c736487fc0e4..4850fdfe27f1 100644
--- a/kernel/trace/kprobe_event_gen_test.c
+++ b/kernel/trace/kprobe_event_gen_test.c
@@ -21,7 +21,7 @@
  * Then:
  *
  * # insmod kernel/trace/kprobe_event_gen_test.ko
- * # cat /sys/kernel/debug/tracing/trace
+ * # cat /sys/kernel/tracing/trace
  *
  * You should see many instances of the "gen_kprobe_test" and
  * "gen_kretprobe_test" events in the trace buffer.
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index c366a0a9ddba..4cdb2feccff3 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -2886,7 +2886,7 @@ rb_check_timestamp(struct ring_buffer_per_cpu *cpu_buffer,
 		  sched_clock_stable() ? "" :
 		  "If you just came from a suspend/resume,\n"
 		  "please switch to the trace global clock:\n"
-		  "  echo global > /sys/kernel/debug/tracing/trace_clock\n"
+		  "  echo global > /sys/kernel/tracing/trace_clock\n"
 		  "or add trace_clock=global to the kernel command line\n");
 }
 
diff --git a/kernel/trace/synth_event_gen_test.c b/kernel/trace/synth_event_gen_test.c
index 8d77526892f4..8dfe85499d4a 100644
--- a/kernel/trace/synth_event_gen_test.c
+++ b/kernel/trace/synth_event_gen_test.c
@@ -22,7 +22,7 @@
  * Then:
  *
  * # insmod kernel/trace/synth_event_gen_test.ko
- * # cat /sys/kernel/debug/tracing/trace
+ * # cat /sys/kernel/tracing/trace
  *
  * You should see several events in the trace buffer -
  * "create_synth_test", "empty_synth_test", and several instances of
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index c9e40f692650..1101220052b3 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -1142,7 +1142,7 @@ void tracing_snapshot_instance(struct trace_array *tr)
  *
  * Note, make sure to allocate the snapshot with either
  * a tracing_snapshot_alloc(), or by doing it manually
- * with: echo 1 > /sys/kernel/debug/tracing/snapshot
+ * with: echo 1 > /sys/kernel/tracing/snapshot
  *
  * If the snapshot buffer is not allocated, it will stop tracing.
  * Basically making a permanent snapshot.
diff --git a/samples/user_events/example.c b/samples/user_events/example.c
index d06dc24156ec..18e34c9d708e 100644
--- a/samples/user_events/example.c
+++ b/samples/user_events/example.c
@@ -23,8 +23,8 @@
 #endif
 
 /* Assumes debugfs is mounted */
-const char *data_file = "/sys/kernel/debug/tracing/user_events_data";
-const char *status_file = "/sys/kernel/debug/tracing/user_events_status";
+const char *data_file = "/sys/kernel/tracing/user_events_data";
+const char *status_file = "/sys/kernel/tracing/user_events_status";
 
 static int event_status(long **status)
 {
diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_functrace.py
index 438516bdfb3c..42fa87300941 100755
--- a/scripts/tracing/draw_functrace.py
+++ b/scripts/tracing/draw_functrace.py
@@ -12,9 +12,9 @@ calls. Only the functions's names and the call time are provided.
 
 Usage:
 	Be sure that you have CONFIG_FUNCTION_TRACER
-	# mount -t debugfs nodev /sys/kernel/debug
-	# echo function > /sys/kernel/debug/tracing/current_tracer
-	$ cat /sys/kernel/debug/tracing/trace_pipe > ~/raw_trace_func
+	# mount -t tracefs nodev /sys/kernel/tracing
+	# echo function > /sys/kernel/tracing/current_tracer
+	$ cat /sys/kernel/tracing/trace_pipe > ~/raw_trace_func
 	Wait some times but not too much, the script is a bit slow.
 	Break the pipe (Ctrl + Z)
 	$ scripts/tracing/draw_functrace.py < ~/raw_trace_func > draw_functrace
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index b8e457c841ab..7ba3e81274e8 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -14,8 +14,8 @@
 #include "tracing_path.h"
 
 static char tracing_mnt[PATH_MAX]  = "/sys/kernel/debug";
-static char tracing_path[PATH_MAX]        = "/sys/kernel/debug/tracing";
-static char tracing_events_path[PATH_MAX] = "/sys/kernel/debug/tracing/events";
+static char tracing_path[PATH_MAX]        = "/sys/kernel/tracing";
+static char tracing_events_path[PATH_MAX] = "/sys/kernel/tracing/events";
 
 static void __tracing_path_set(const char *tracing, const char *mountpoint)
 {
diff --git a/tools/tracing/latency/latency-collector.c b/tools/tracing/latency/latency-collector.c
index 59a7f2346eab..0fd9c747d396 100644
--- a/tools/tracing/latency/latency-collector.c
+++ b/tools/tracing/latency/latency-collector.c
@@ -1584,7 +1584,7 @@ static void *do_printloop(void *arg)
 		/*
 		 * Toss a coin to decide if we want to sleep before printing
 		 * out the backtrace. The reason for this is that opening
-		 * /sys/kernel/debug/tracing/trace will cause a blackout of
+		 * /sys/kernel/tracing/trace will cause a blackout of
 		 * hundreds of ms, where no latencies will be noted by the
 		 * latency tracer. Thus by randomly sleeping we try to avoid
 		 * missing traces systematically due to this. With this option
-- 
2.39.1.637.g21b0678d19-goog


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 2/6] selftests: use canonical ftrace path
  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-15 22:33 ` 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
                   ` (5 subsequent siblings)
  7 siblings, 2 replies; 21+ messages in thread
From: Ross Zwisler @ 2023-02-15 22:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ross Zwisler, Shuah Khan, Andrew Morton, linux-kselftest,
	linux-mm, linux-trace-kernel, Steven Rostedt

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/testing/selftests still refer to this older debugfs
path, so let's update them to avoid confusion.

Signed-off-by: Ross Zwisler <zwisler@google.com>
---
 tools/testing/selftests/user_events/dyn_test.c    |  2 +-
 tools/testing/selftests/user_events/ftrace_test.c | 10 +++++-----
 tools/testing/selftests/user_events/perf_test.c   |  8 ++++----
 tools/testing/selftests/vm/protection_keys.c      |  4 ++--
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/tools/testing/selftests/user_events/dyn_test.c b/tools/testing/selftests/user_events/dyn_test.c
index d6265d14cd51..8879a7b04c6a 100644
--- a/tools/testing/selftests/user_events/dyn_test.c
+++ b/tools/testing/selftests/user_events/dyn_test.c
@@ -16,7 +16,7 @@
 
 #include "../kselftest_harness.h"
 
-const char *dyn_file = "/sys/kernel/debug/tracing/dynamic_events";
+const char *dyn_file = "/sys/kernel/tracing/dynamic_events";
 const char *clear = "!u:__test_event";
 
 static int Append(const char *value)
diff --git a/tools/testing/selftests/user_events/ftrace_test.c b/tools/testing/selftests/user_events/ftrace_test.c
index 404a2713dcae..a0b2c96eb252 100644
--- a/tools/testing/selftests/user_events/ftrace_test.c
+++ b/tools/testing/selftests/user_events/ftrace_test.c
@@ -16,11 +16,11 @@
 
 #include "../kselftest_harness.h"
 
-const char *data_file = "/sys/kernel/debug/tracing/user_events_data";
-const char *status_file = "/sys/kernel/debug/tracing/user_events_status";
-const char *enable_file = "/sys/kernel/debug/tracing/events/user_events/__test_event/enable";
-const char *trace_file = "/sys/kernel/debug/tracing/trace";
-const char *fmt_file = "/sys/kernel/debug/tracing/events/user_events/__test_event/format";
+const char *data_file = "/sys/kernel/tracing/user_events_data";
+const char *status_file = "/sys/kernel/tracing/user_events_status";
+const char *enable_file = "/sys/kernel/tracing/events/user_events/__test_event/enable";
+const char *trace_file = "/sys/kernel/tracing/trace";
+const char *fmt_file = "/sys/kernel/tracing/events/user_events/__test_event/format";
 
 static inline int status_check(char *status_page, int status_bit)
 {
diff --git a/tools/testing/selftests/user_events/perf_test.c b/tools/testing/selftests/user_events/perf_test.c
index 8b4c7879d5a7..31505642aa9b 100644
--- a/tools/testing/selftests/user_events/perf_test.c
+++ b/tools/testing/selftests/user_events/perf_test.c
@@ -18,10 +18,10 @@
 
 #include "../kselftest_harness.h"
 
-const char *data_file = "/sys/kernel/debug/tracing/user_events_data";
-const char *status_file = "/sys/kernel/debug/tracing/user_events_status";
-const char *id_file = "/sys/kernel/debug/tracing/events/user_events/__test_event/id";
-const char *fmt_file = "/sys/kernel/debug/tracing/events/user_events/__test_event/format";
+const char *data_file = "/sys/kernel/tracing/user_events_data";
+const char *status_file = "/sys/kernel/tracing/user_events_status";
+const char *id_file = "/sys/kernel/tracing/events/user_events/__test_event/id";
+const char *fmt_file = "/sys/kernel/tracing/events/user_events/__test_event/format";
 
 struct event {
 	__u32 index;
diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c
index 95f403a0c46d..0381c34fdd56 100644
--- a/tools/testing/selftests/vm/protection_keys.c
+++ b/tools/testing/selftests/vm/protection_keys.c
@@ -98,7 +98,7 @@ int tracing_root_ok(void)
 void tracing_on(void)
 {
 #if CONTROL_TRACING > 0
-#define TRACEDIR "/sys/kernel/debug/tracing"
+#define TRACEDIR "/sys/kernel/tracing"
 	char pidstr[32];
 
 	if (!tracing_root_ok())
@@ -124,7 +124,7 @@ void tracing_off(void)
 #if CONTROL_TRACING > 0
 	if (!tracing_root_ok())
 		return;
-	cat_into_file("0", "/sys/kernel/debug/tracing/tracing_on");
+	cat_into_file("0", "/sys/kernel/tracing/tracing_on");
 #endif
 }
 
-- 
2.39.1.637.g21b0678d19-goog


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 3/6] leaking_addresses: also skip canonical ftrace path
  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-15 22:33 ` [PATCH v2 2/6] selftests: " Ross Zwisler
@ 2023-02-15 22:33 ` Ross Zwisler
  2023-02-15 22:33 ` [PATCH v2 4/6] tools/kvm_stat: use " Ross Zwisler
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 21+ messages in thread
From: Ross Zwisler @ 2023-02-15 22:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ross Zwisler, Tobin C. Harding, Tycho Andersen, linux-hardening,
	linux-trace-kernel, Steven Rostedt

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

scripts/leaking_addresses.pl only skipped this older debugfs path, so
let's add the canonical path as well.

Signed-off-by: Ross Zwisler <zwisler@google.com>
Acked-by: Tycho Andersen <tycho@tycho.pizza>
---
 scripts/leaking_addresses.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl
index 8f636a23bc3f..e695634d153d 100755
--- a/scripts/leaking_addresses.pl
+++ b/scripts/leaking_addresses.pl
@@ -61,6 +61,7 @@ my @skip_abs = (
 	'/proc/device-tree',
 	'/proc/1/syscall',
 	'/sys/firmware/devicetree',
+	'/sys/kernel/tracing/trace_pipe',
 	'/sys/kernel/debug/tracing/trace_pipe',
 	'/sys/kernel/security/apparmor/revision');
 
-- 
2.39.1.637.g21b0678d19-goog


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 4/6] tools/kvm_stat: use canonical ftrace path
  2023-02-15 22:33 [PATCH v2 0/6] use canonical ftrace path whenever possible Ross Zwisler
                   ` (2 preceding siblings ...)
  2023-02-15 22:33 ` [PATCH v2 3/6] leaking_addresses: also skip " Ross Zwisler
@ 2023-02-15 22:33 ` Ross Zwisler
  2023-02-16 21:08   ` Steven Rostedt
                     ` (2 more replies)
  2023-02-15 22:33 ` [PATCH v2 5/6] tools/virtio: " Ross Zwisler
                   ` (3 subsequent siblings)
  7 siblings, 3 replies; 21+ messages in thread
From: Ross Zwisler @ 2023-02-15 22:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ross Zwisler, Paolo Bonzini, kvm, linux-trace-kernel, Steven Rostedt

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 comment in kvm_stat still refers to this older debugfs path, so let's
update it to avoid confusion.

Signed-off-by: Ross Zwisler <zwisler@google.com>
---
 tools/kvm/kvm_stat/kvm_stat | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
index 6f28180ffeea..15bf00e79e3f 100755
--- a/tools/kvm/kvm_stat/kvm_stat
+++ b/tools/kvm/kvm_stat/kvm_stat
@@ -627,7 +627,7 @@ class TracepointProvider(Provider):
         name)'.
 
         All available events have directories under
-        /sys/kernel/debug/tracing/events/ which export information
+        /sys/kernel/tracing/events/ which export information
         about the specific event. Therefore, listing the dirs gives us
         a list of all available events.
 
-- 
2.39.1.637.g21b0678d19-goog


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 5/6] tools/virtio: use canonical ftrace path
  2023-02-15 22:33 [PATCH v2 0/6] use canonical ftrace path whenever possible Ross Zwisler
                   ` (3 preceding siblings ...)
  2023-02-15 22:33 ` [PATCH v2 4/6] tools/kvm_stat: use " Ross Zwisler
@ 2023-02-15 22:33 ` Ross Zwisler
  2023-02-17 15:46   ` Mukesh Ojha
  2023-06-02 11:15   ` Michael S. Tsirkin
  2023-02-15 22:33 ` [PATCH v2 6/6] tools/virtio: fix typo in README instructions Ross Zwisler
                   ` (2 subsequent siblings)
  7 siblings, 2 replies; 21+ messages in thread
From: Ross Zwisler @ 2023-02-15 22:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ross Zwisler, Michael S. Tsirkin, Jason Wang, virtualization,
	linux-trace-kernel, Steven Rostedt

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>
---
 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


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH v2 6/6] tools/virtio: fix typo in README instructions
  2023-02-15 22:33 [PATCH v2 0/6] use canonical ftrace path whenever possible Ross Zwisler
                   ` (4 preceding siblings ...)
  2023-02-15 22:33 ` [PATCH v2 5/6] tools/virtio: " Ross Zwisler
@ 2023-02-15 22:33 ` Ross Zwisler
  2023-03-10  8:29 ` [PATCH v2 0/6] use canonical ftrace path whenever possible Michael S. Tsirkin
  2023-03-22  2:32 ` Michael S. Tsirkin
  7 siblings, 0 replies; 21+ messages in thread
From: Ross Zwisler @ 2023-02-15 22:33 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ross Zwisler, Michael S. Tsirkin, Jason Wang, virtualization,
	linux-trace-kernel, Steven Rostedt

We need to have a unique chardev for each data path, else the chardevs
will collide and qemu will die with this message:

  qemu-system-x86_64: -device
  virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel0,
  id=channel1,name=trace-path-cpu0:
  Property 'virtserialport.chardev' can't take value 'charchannel0':
  Device 'charchannel0' is in use

Signed-off-by: Ross Zwisler <zwisler@google.com>
---
 tools/virtio/virtio-trace/README | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/virtio/virtio-trace/README b/tools/virtio/virtio-trace/README
index cea29a2a4c0a..0127ff0c54b0 100644
--- a/tools/virtio/virtio-trace/README
+++ b/tools/virtio/virtio-trace/README
@@ -61,7 +61,7 @@ and
       id=channel0,name=agent-ctl-path\
  ##data path##
      -chardev pipe,id=charchannel1,path=/tmp/virtio-trace/trace-path-cpu0\
-     -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel0,\
+     -device virtserialport,bus=virtio-serial0.0,nr=2,chardev=charchannel1,\
       id=channel1,name=trace-path-cpu0\
       ...
 
-- 
2.39.1.637.g21b0678d19-goog


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/6] tracing: always use canonical ftrace path
  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
  1 sibling, 0 replies; 21+ messages in thread
From: Masami Hiramatsu @ 2023-02-16 15:13 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: linux-kernel, Ross Zwisler, Steven Rostedt, Masami Hiramatsu,
	linux-trace-kernel

On Wed, 15 Feb 2023 15:33:45 -0700
Ross Zwisler <zwisler@chromium.org> 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
> 
> Many comments and Kconfig help messages in the tracing code still refer
> to this older debugfs path, so let's update them to avoid confusion.

Looks good to me.

Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>

Thank you,

> 
> Signed-off-by: Ross Zwisler <zwisler@google.com>
> ---
>  include/linux/kernel.h                    |  2 +-
>  include/linux/tracepoint.h                |  4 ++--
>  kernel/trace/Kconfig                      | 20 ++++++++++----------
>  kernel/trace/kprobe_event_gen_test.c      |  2 +-
>  kernel/trace/ring_buffer.c                |  2 +-
>  kernel/trace/synth_event_gen_test.c       |  2 +-
>  kernel/trace/trace.c                      |  2 +-
>  samples/user_events/example.c             |  4 ++--
>  scripts/tracing/draw_functrace.py         |  6 +++---
>  tools/lib/api/fs/tracing_path.c           |  4 ++--
>  tools/tracing/latency/latency-collector.c |  2 +-
>  11 files changed, 25 insertions(+), 25 deletions(-)
> 
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index fe6efb24d151..40bce7495af8 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -297,7 +297,7 @@ bool mac_pton(const char *s, u8 *mac);
>   *
>   * Use tracing_on/tracing_off when you want to quickly turn on or off
>   * tracing. It simply enables or disables the recording of the trace events.
> - * This also corresponds to the user space /sys/kernel/debug/tracing/tracing_on
> + * This also corresponds to the user space /sys/kernel/tracing/tracing_on
>   * file, which gives a means for the kernel and userspace to interact.
>   * Place a tracing_off() in the kernel where you want tracing to end.
>   * From user space, examine the trace, and then echo 1 > tracing_on
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index 4b33b95eb8be..fa1004fcf810 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -471,7 +471,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
>   *	* This is how the trace record is structured and will
>   *	* be saved into the ring buffer. These are the fields
>   *	* that will be exposed to user-space in
> - *	* /sys/kernel/debug/tracing/events/<*>/format.
> + *	* /sys/kernel/tracing/events/<*>/format.
>   *	*
>   *	* The declared 'local variable' is called '__entry'
>   *	*
> @@ -531,7 +531,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
>   * tracepoint callback (this is used by programmatic plugins and
>   * can also by used by generic instrumentation like SystemTap), and
>   * it is also used to expose a structured trace record in
> - * /sys/kernel/debug/tracing/events/.
> + * /sys/kernel/tracing/events/.
>   *
>   * A set of (un)registration functions can be passed to the variant
>   * TRACE_EVENT_FN to perform any (un)registration work.
> diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
> index d7043043f59c..5f5e64f9e715 100644
> --- a/kernel/trace/Kconfig
> +++ b/kernel/trace/Kconfig
> @@ -239,7 +239,7 @@ config DYNAMIC_FTRACE
>  	  enabled, and the functions not enabled will not affect
>  	  performance of the system.
>  
> -	  See the files in /sys/kernel/debug/tracing:
> +	  See the files in /sys/kernel/tracing:
>  	    available_filter_functions
>  	    set_ftrace_filter
>  	    set_ftrace_notrace
> @@ -299,7 +299,7 @@ config STACK_TRACER
>  	select KALLSYMS
>  	help
>  	  This special tracer records the maximum stack footprint of the
> -	  kernel and displays it in /sys/kernel/debug/tracing/stack_trace.
> +	  kernel and displays it in /sys/kernel/tracing/stack_trace.
>  
>  	  This tracer works by hooking into every function call that the
>  	  kernel executes, and keeping a maximum stack depth value and
> @@ -339,7 +339,7 @@ config IRQSOFF_TRACER
>  	  disabled by default and can be runtime (re-)started
>  	  via:
>  
> -	      echo 0 > /sys/kernel/debug/tracing/tracing_max_latency
> +	      echo 0 > /sys/kernel/tracing/tracing_max_latency
>  
>  	  (Note that kernel size and overhead increase with this option
>  	  enabled. This option and the preempt-off timing option can be
> @@ -363,7 +363,7 @@ config PREEMPT_TRACER
>  	  disabled by default and can be runtime (re-)started
>  	  via:
>  
> -	      echo 0 > /sys/kernel/debug/tracing/tracing_max_latency
> +	      echo 0 > /sys/kernel/tracing/tracing_max_latency
>  
>  	  (Note that kernel size and overhead increase with this option
>  	  enabled. This option and the irqs-off timing option can be
> @@ -515,7 +515,7 @@ config TRACER_SNAPSHOT
>  	  Allow tracing users to take snapshot of the current buffer using the
>  	  ftrace interface, e.g.:
>  
> -	      echo 1 > /sys/kernel/debug/tracing/snapshot
> +	      echo 1 > /sys/kernel/tracing/snapshot
>  	      cat snapshot
>  
>  config TRACER_SNAPSHOT_PER_CPU_SWAP
> @@ -527,7 +527,7 @@ config TRACER_SNAPSHOT_PER_CPU_SWAP
>  	  full swap (all buffers). If this is set, then the following is
>  	  allowed:
>  
> -	      echo 1 > /sys/kernel/debug/tracing/per_cpu/cpu2/snapshot
> +	      echo 1 > /sys/kernel/tracing/per_cpu/cpu2/snapshot
>  
>  	  After which, only the tracing buffer for CPU 2 was swapped with
>  	  the main tracing buffer, and the other CPU buffers remain the same.
> @@ -574,7 +574,7 @@ config PROFILE_ANNOTATED_BRANCHES
>  	  This tracer profiles all likely and unlikely macros
>  	  in the kernel. It will display the results in:
>  
> -	  /sys/kernel/debug/tracing/trace_stat/branch_annotated
> +	  /sys/kernel/tracing/trace_stat/branch_annotated
>  
>  	  Note: this will add a significant overhead; only turn this
>  	  on if you need to profile the system's use of these macros.
> @@ -587,7 +587,7 @@ config PROFILE_ALL_BRANCHES
>  	  taken in the kernel is recorded whether it hit or miss.
>  	  The results will be displayed in:
>  
> -	  /sys/kernel/debug/tracing/trace_stat/branch_all
> +	  /sys/kernel/tracing/trace_stat/branch_all
>  
>  	  This option also enables the likely/unlikely profiler.
>  
> @@ -638,8 +638,8 @@ config BLK_DEV_IO_TRACE
>  	  Tracing also is possible using the ftrace interface, e.g.:
>  
>  	    echo 1 > /sys/block/sda/sda1/trace/enable
> -	    echo blk > /sys/kernel/debug/tracing/current_tracer
> -	    cat /sys/kernel/debug/tracing/trace_pipe
> +	    echo blk > /sys/kernel/tracing/current_tracer
> +	    cat /sys/kernel/tracing/trace_pipe
>  
>  	  If unsure, say N.
>  
> diff --git a/kernel/trace/kprobe_event_gen_test.c b/kernel/trace/kprobe_event_gen_test.c
> index c736487fc0e4..4850fdfe27f1 100644
> --- a/kernel/trace/kprobe_event_gen_test.c
> +++ b/kernel/trace/kprobe_event_gen_test.c
> @@ -21,7 +21,7 @@
>   * Then:
>   *
>   * # insmod kernel/trace/kprobe_event_gen_test.ko
> - * # cat /sys/kernel/debug/tracing/trace
> + * # cat /sys/kernel/tracing/trace
>   *
>   * You should see many instances of the "gen_kprobe_test" and
>   * "gen_kretprobe_test" events in the trace buffer.
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index c366a0a9ddba..4cdb2feccff3 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -2886,7 +2886,7 @@ rb_check_timestamp(struct ring_buffer_per_cpu *cpu_buffer,
>  		  sched_clock_stable() ? "" :
>  		  "If you just came from a suspend/resume,\n"
>  		  "please switch to the trace global clock:\n"
> -		  "  echo global > /sys/kernel/debug/tracing/trace_clock\n"
> +		  "  echo global > /sys/kernel/tracing/trace_clock\n"
>  		  "or add trace_clock=global to the kernel command line\n");
>  }
>  
> diff --git a/kernel/trace/synth_event_gen_test.c b/kernel/trace/synth_event_gen_test.c
> index 8d77526892f4..8dfe85499d4a 100644
> --- a/kernel/trace/synth_event_gen_test.c
> +++ b/kernel/trace/synth_event_gen_test.c
> @@ -22,7 +22,7 @@
>   * Then:
>   *
>   * # insmod kernel/trace/synth_event_gen_test.ko
> - * # cat /sys/kernel/debug/tracing/trace
> + * # cat /sys/kernel/tracing/trace
>   *
>   * You should see several events in the trace buffer -
>   * "create_synth_test", "empty_synth_test", and several instances of
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index c9e40f692650..1101220052b3 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -1142,7 +1142,7 @@ void tracing_snapshot_instance(struct trace_array *tr)
>   *
>   * Note, make sure to allocate the snapshot with either
>   * a tracing_snapshot_alloc(), or by doing it manually
> - * with: echo 1 > /sys/kernel/debug/tracing/snapshot
> + * with: echo 1 > /sys/kernel/tracing/snapshot
>   *
>   * If the snapshot buffer is not allocated, it will stop tracing.
>   * Basically making a permanent snapshot.
> diff --git a/samples/user_events/example.c b/samples/user_events/example.c
> index d06dc24156ec..18e34c9d708e 100644
> --- a/samples/user_events/example.c
> +++ b/samples/user_events/example.c
> @@ -23,8 +23,8 @@
>  #endif
>  
>  /* Assumes debugfs is mounted */
> -const char *data_file = "/sys/kernel/debug/tracing/user_events_data";
> -const char *status_file = "/sys/kernel/debug/tracing/user_events_status";
> +const char *data_file = "/sys/kernel/tracing/user_events_data";
> +const char *status_file = "/sys/kernel/tracing/user_events_status";
>  
>  static int event_status(long **status)
>  {
> diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_functrace.py
> index 438516bdfb3c..42fa87300941 100755
> --- a/scripts/tracing/draw_functrace.py
> +++ b/scripts/tracing/draw_functrace.py
> @@ -12,9 +12,9 @@ calls. Only the functions's names and the call time are provided.
>  
>  Usage:
>  	Be sure that you have CONFIG_FUNCTION_TRACER
> -	# mount -t debugfs nodev /sys/kernel/debug
> -	# echo function > /sys/kernel/debug/tracing/current_tracer
> -	$ cat /sys/kernel/debug/tracing/trace_pipe > ~/raw_trace_func
> +	# mount -t tracefs nodev /sys/kernel/tracing
> +	# echo function > /sys/kernel/tracing/current_tracer
> +	$ cat /sys/kernel/tracing/trace_pipe > ~/raw_trace_func
>  	Wait some times but not too much, the script is a bit slow.
>  	Break the pipe (Ctrl + Z)
>  	$ scripts/tracing/draw_functrace.py < ~/raw_trace_func > draw_functrace
> diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
> index b8e457c841ab..7ba3e81274e8 100644
> --- a/tools/lib/api/fs/tracing_path.c
> +++ b/tools/lib/api/fs/tracing_path.c
> @@ -14,8 +14,8 @@
>  #include "tracing_path.h"
>  
>  static char tracing_mnt[PATH_MAX]  = "/sys/kernel/debug";
> -static char tracing_path[PATH_MAX]        = "/sys/kernel/debug/tracing";
> -static char tracing_events_path[PATH_MAX] = "/sys/kernel/debug/tracing/events";
> +static char tracing_path[PATH_MAX]        = "/sys/kernel/tracing";
> +static char tracing_events_path[PATH_MAX] = "/sys/kernel/tracing/events";
>  
>  static void __tracing_path_set(const char *tracing, const char *mountpoint)
>  {
> diff --git a/tools/tracing/latency/latency-collector.c b/tools/tracing/latency/latency-collector.c
> index 59a7f2346eab..0fd9c747d396 100644
> --- a/tools/tracing/latency/latency-collector.c
> +++ b/tools/tracing/latency/latency-collector.c
> @@ -1584,7 +1584,7 @@ static void *do_printloop(void *arg)
>  		/*
>  		 * Toss a coin to decide if we want to sleep before printing
>  		 * out the backtrace. The reason for this is that opening
> -		 * /sys/kernel/debug/tracing/trace will cause a blackout of
> +		 * /sys/kernel/tracing/trace will cause a blackout of
>  		 * hundreds of ms, where no latencies will be noted by the
>  		 * latency tracer. Thus by randomly sleeping we try to avoid
>  		 * missing traces systematically due to this. With this option
> -- 
> 2.39.1.637.g21b0678d19-goog
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 2/6] selftests: use canonical ftrace path
  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
  1 sibling, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2023-02-16 20:58 UTC (permalink / raw)
  To: Ross Zwisler, Shuah Khan
  Cc: linux-kernel, Ross Zwisler, Shuah Khan, Andrew Morton,
	linux-kselftest, linux-mm, linux-trace-kernel

On Wed, 15 Feb 2023 15:33:46 -0700
Ross Zwisler <zwisler@chromium.org> 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/testing/selftests still refer to this older debugfs
> path, so let's update them to avoid confusion.

Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Shuah,

Care to pull this in through your tree?

-- Steve

> 
> Signed-off-by: Ross Zwisler <zwisler@google.com>
> ---
>  tools/testing/selftests/user_events/dyn_test.c    |  2 +-
>  tools/testing/selftests/user_events/ftrace_test.c | 10 +++++-----
>  tools/testing/selftests/user_events/perf_test.c   |  8 ++++----
>  tools/testing/selftests/vm/protection_keys.c      |  4 ++--
>  4 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/tools/testing/selftests/user_events/dyn_test.c b/tools/testing/selftests/user_events/dyn_test.c
> index d6265d14cd51..8879a7b04c6a 100644
> --- a/tools/testing/selftests/user_events/dyn_test.c
> +++ b/tools/testing/selftests/user_events/dyn_test.c
> @@ -16,7 +16,7 @@
>  
>  #include "../kselftest_harness.h"
>  
> -const char *dyn_file = "/sys/kernel/debug/tracing/dynamic_events";
> +const char *dyn_file = "/sys/kernel/tracing/dynamic_events";
>  const char *clear = "!u:__test_event";
>  
>  static int Append(const char *value)
> diff --git a/tools/testing/selftests/user_events/ftrace_test.c b/tools/testing/selftests/user_events/ftrace_test.c
> index 404a2713dcae..a0b2c96eb252 100644
> --- a/tools/testing/selftests/user_events/ftrace_test.c
> +++ b/tools/testing/selftests/user_events/ftrace_test.c
> @@ -16,11 +16,11 @@
>  
>  #include "../kselftest_harness.h"
>  
> -const char *data_file = "/sys/kernel/debug/tracing/user_events_data";
> -const char *status_file = "/sys/kernel/debug/tracing/user_events_status";
> -const char *enable_file = "/sys/kernel/debug/tracing/events/user_events/__test_event/enable";
> -const char *trace_file = "/sys/kernel/debug/tracing/trace";
> -const char *fmt_file = "/sys/kernel/debug/tracing/events/user_events/__test_event/format";
> +const char *data_file = "/sys/kernel/tracing/user_events_data";
> +const char *status_file = "/sys/kernel/tracing/user_events_status";
> +const char *enable_file = "/sys/kernel/tracing/events/user_events/__test_event/enable";
> +const char *trace_file = "/sys/kernel/tracing/trace";
> +const char *fmt_file = "/sys/kernel/tracing/events/user_events/__test_event/format";
>  
>  static inline int status_check(char *status_page, int status_bit)
>  {
> diff --git a/tools/testing/selftests/user_events/perf_test.c b/tools/testing/selftests/user_events/perf_test.c
> index 8b4c7879d5a7..31505642aa9b 100644
> --- a/tools/testing/selftests/user_events/perf_test.c
> +++ b/tools/testing/selftests/user_events/perf_test.c
> @@ -18,10 +18,10 @@
>  
>  #include "../kselftest_harness.h"
>  
> -const char *data_file = "/sys/kernel/debug/tracing/user_events_data";
> -const char *status_file = "/sys/kernel/debug/tracing/user_events_status";
> -const char *id_file = "/sys/kernel/debug/tracing/events/user_events/__test_event/id";
> -const char *fmt_file = "/sys/kernel/debug/tracing/events/user_events/__test_event/format";
> +const char *data_file = "/sys/kernel/tracing/user_events_data";
> +const char *status_file = "/sys/kernel/tracing/user_events_status";
> +const char *id_file = "/sys/kernel/tracing/events/user_events/__test_event/id";
> +const char *fmt_file = "/sys/kernel/tracing/events/user_events/__test_event/format";
>  
>  struct event {
>  	__u32 index;
> diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c
> index 95f403a0c46d..0381c34fdd56 100644
> --- a/tools/testing/selftests/vm/protection_keys.c
> +++ b/tools/testing/selftests/vm/protection_keys.c
> @@ -98,7 +98,7 @@ int tracing_root_ok(void)
>  void tracing_on(void)
>  {
>  #if CONTROL_TRACING > 0
> -#define TRACEDIR "/sys/kernel/debug/tracing"
> +#define TRACEDIR "/sys/kernel/tracing"
>  	char pidstr[32];
>  
>  	if (!tracing_root_ok())
> @@ -124,7 +124,7 @@ void tracing_off(void)
>  #if CONTROL_TRACING > 0
>  	if (!tracing_root_ok())
>  		return;
> -	cat_into_file("0", "/sys/kernel/debug/tracing/tracing_on");
> +	cat_into_file("0", "/sys/kernel/tracing/tracing_on");
>  #endif
>  }
>  


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 4/6] tools/kvm_stat: use canonical ftrace path
  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
  2 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2023-02-16 21:08 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: linux-kernel, Ross Zwisler, Paolo Bonzini, kvm, linux-trace-kernel

On Wed, 15 Feb 2023 15:33:48 -0700
Ross Zwisler <zwisler@chromium.org> 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 comment in kvm_stat still refers to this older debugfs path, so let's
> update it to avoid confusion.
> 
> Signed-off-by: Ross Zwisler <zwisler@google.com>

Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

-- Steve

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 4/6] tools/kvm_stat: use canonical ftrace path
  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
  2 siblings, 0 replies; 21+ messages in thread
From: Paolo Bonzini @ 2023-02-17 11:32 UTC (permalink / raw)
  To: Ross Zwisler, linux-kernel
  Cc: Ross Zwisler, kvm, linux-trace-kernel, Steven Rostedt

On 2/15/23 23:33, 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 comment in kvm_stat still refers to this older debugfs path, so let's
> update it to avoid confusion.
> 
> Signed-off-by: Ross Zwisler <zwisler@google.com>
> ---
>   tools/kvm/kvm_stat/kvm_stat | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
> index 6f28180ffeea..15bf00e79e3f 100755
> --- a/tools/kvm/kvm_stat/kvm_stat
> +++ b/tools/kvm/kvm_stat/kvm_stat
> @@ -627,7 +627,7 @@ class TracepointProvider(Provider):
>           name)'.
>   
>           All available events have directories under
> -        /sys/kernel/debug/tracing/events/ which export information
> +        /sys/kernel/tracing/events/ which export information
>           about the specific event. Therefore, listing the dirs gives us
>           a list of all available events.
>   

Acked-by: Paolo Bonzini <pbonzini@redhat.com>


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 1/6] tracing: always use canonical ftrace path
  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
  1 sibling, 0 replies; 21+ messages in thread
From: Mukesh Ojha @ 2023-02-17 15:34 UTC (permalink / raw)
  To: Ross Zwisler, linux-kernel
  Cc: Ross Zwisler, Steven Rostedt, Masami Hiramatsu, linux-trace-kernel



On 2/16/2023 4:03 AM, 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
> 
> Many comments and Kconfig help messages in the tracing code still refer
> to this older debugfs path, so let's update them to avoid confusion.
> 
> Signed-off-by: Ross Zwisler <zwisler@google.com>
> ---
>   include/linux/kernel.h                    |  2 +-
>   include/linux/tracepoint.h                |  4 ++--
>   kernel/trace/Kconfig                      | 20 ++++++++++----------
>   kernel/trace/kprobe_event_gen_test.c      |  2 +-
>   kernel/trace/ring_buffer.c                |  2 +-
>   kernel/trace/synth_event_gen_test.c       |  2 +-
>   kernel/trace/trace.c                      |  2 +-
>   samples/user_events/example.c             |  4 ++--
>   scripts/tracing/draw_functrace.py         |  6 +++---
>   tools/lib/api/fs/tracing_path.c           |  4 ++--
>   tools/tracing/latency/latency-collector.c |  2 +-
>   11 files changed, 25 insertions(+), 25 deletions(-)
> 
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index fe6efb24d151..40bce7495af8 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -297,7 +297,7 @@ bool mac_pton(const char *s, u8 *mac);
>    *
>    * Use tracing_on/tracing_off when you want to quickly turn on or off
>    * tracing. It simply enables or disables the recording of the trace events.
> - * This also corresponds to the user space /sys/kernel/debug/tracing/tracing_on
> + * This also corresponds to the user space /sys/kernel/tracing/tracing_on
>    * file, which gives a means for the kernel and userspace to interact.
>    * Place a tracing_off() in the kernel where you want tracing to end.
>    * From user space, examine the trace, and then echo 1 > tracing_on
> diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
> index 4b33b95eb8be..fa1004fcf810 100644
> --- a/include/linux/tracepoint.h
> +++ b/include/linux/tracepoint.h
> @@ -471,7 +471,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
>    *	* This is how the trace record is structured and will
>    *	* be saved into the ring buffer. These are the fields
>    *	* that will be exposed to user-space in
> - *	* /sys/kernel/debug/tracing/events/<*>/format.
> + *	* /sys/kernel/tracing/events/<*>/format.
>    *	*
>    *	* The declared 'local variable' is called '__entry'
>    *	*
> @@ -531,7 +531,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
>    * tracepoint callback (this is used by programmatic plugins and
>    * can also by used by generic instrumentation like SystemTap), and
>    * it is also used to expose a structured trace record in
> - * /sys/kernel/debug/tracing/events/.
> + * /sys/kernel/tracing/events/.
>    *
>    * A set of (un)registration functions can be passed to the variant
>    * TRACE_EVENT_FN to perform any (un)registration work.
> diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
> index d7043043f59c..5f5e64f9e715 100644
> --- a/kernel/trace/Kconfig
> +++ b/kernel/trace/Kconfig
> @@ -239,7 +239,7 @@ config DYNAMIC_FTRACE
>   	  enabled, and the functions not enabled will not affect
>   	  performance of the system.
>   
> -	  See the files in /sys/kernel/debug/tracing:
> +	  See the files in /sys/kernel/tracing:
>   	    available_filter_functions
>   	    set_ftrace_filter
>   	    set_ftrace_notrace
> @@ -299,7 +299,7 @@ config STACK_TRACER
>   	select KALLSYMS
>   	help
>   	  This special tracer records the maximum stack footprint of the
> -	  kernel and displays it in /sys/kernel/debug/tracing/stack_trace.
> +	  kernel and displays it in /sys/kernel/tracing/stack_trace.
>   
>   	  This tracer works by hooking into every function call that the
>   	  kernel executes, and keeping a maximum stack depth value and
> @@ -339,7 +339,7 @@ config IRQSOFF_TRACER
>   	  disabled by default and can be runtime (re-)started
>   	  via:
>   
> -	      echo 0 > /sys/kernel/debug/tracing/tracing_max_latency
> +	      echo 0 > /sys/kernel/tracing/tracing_max_latency
>   
>   	  (Note that kernel size and overhead increase with this option
>   	  enabled. This option and the preempt-off timing option can be
> @@ -363,7 +363,7 @@ config PREEMPT_TRACER
>   	  disabled by default and can be runtime (re-)started
>   	  via:
>   
> -	      echo 0 > /sys/kernel/debug/tracing/tracing_max_latency
> +	      echo 0 > /sys/kernel/tracing/tracing_max_latency
>   
>   	  (Note that kernel size and overhead increase with this option
>   	  enabled. This option and the irqs-off timing option can be
> @@ -515,7 +515,7 @@ config TRACER_SNAPSHOT
>   	  Allow tracing users to take snapshot of the current buffer using the
>   	  ftrace interface, e.g.:
>   
> -	      echo 1 > /sys/kernel/debug/tracing/snapshot
> +	      echo 1 > /sys/kernel/tracing/snapshot
>   	      cat snapshot
>   
>   config TRACER_SNAPSHOT_PER_CPU_SWAP
> @@ -527,7 +527,7 @@ config TRACER_SNAPSHOT_PER_CPU_SWAP
>   	  full swap (all buffers). If this is set, then the following is
>   	  allowed:
>   
> -	      echo 1 > /sys/kernel/debug/tracing/per_cpu/cpu2/snapshot
> +	      echo 1 > /sys/kernel/tracing/per_cpu/cpu2/snapshot
>   
>   	  After which, only the tracing buffer for CPU 2 was swapped with
>   	  the main tracing buffer, and the other CPU buffers remain the same.
> @@ -574,7 +574,7 @@ config PROFILE_ANNOTATED_BRANCHES
>   	  This tracer profiles all likely and unlikely macros
>   	  in the kernel. It will display the results in:
>   
> -	  /sys/kernel/debug/tracing/trace_stat/branch_annotated
> +	  /sys/kernel/tracing/trace_stat/branch_annotated
>   
>   	  Note: this will add a significant overhead; only turn this
>   	  on if you need to profile the system's use of these macros.
> @@ -587,7 +587,7 @@ config PROFILE_ALL_BRANCHES
>   	  taken in the kernel is recorded whether it hit or miss.
>   	  The results will be displayed in:
>   
> -	  /sys/kernel/debug/tracing/trace_stat/branch_all
> +	  /sys/kernel/tracing/trace_stat/branch_all
>   
>   	  This option also enables the likely/unlikely profiler.
>   
> @@ -638,8 +638,8 @@ config BLK_DEV_IO_TRACE
>   	  Tracing also is possible using the ftrace interface, e.g.:
>   
>   	    echo 1 > /sys/block/sda/sda1/trace/enable
> -	    echo blk > /sys/kernel/debug/tracing/current_tracer
> -	    cat /sys/kernel/debug/tracing/trace_pipe
> +	    echo blk > /sys/kernel/tracing/current_tracer
> +	    cat /sys/kernel/tracing/trace_pipe
>   
>   	  If unsure, say N.
>   
> diff --git a/kernel/trace/kprobe_event_gen_test.c b/kernel/trace/kprobe_event_gen_test.c
> index c736487fc0e4..4850fdfe27f1 100644
> --- a/kernel/trace/kprobe_event_gen_test.c
> +++ b/kernel/trace/kprobe_event_gen_test.c
> @@ -21,7 +21,7 @@
>    * Then:
>    *
>    * # insmod kernel/trace/kprobe_event_gen_test.ko
> - * # cat /sys/kernel/debug/tracing/trace
> + * # cat /sys/kernel/tracing/trace
>    *
>    * You should see many instances of the "gen_kprobe_test" and
>    * "gen_kretprobe_test" events in the trace buffer.
> diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
> index c366a0a9ddba..4cdb2feccff3 100644
> --- a/kernel/trace/ring_buffer.c
> +++ b/kernel/trace/ring_buffer.c
> @@ -2886,7 +2886,7 @@ rb_check_timestamp(struct ring_buffer_per_cpu *cpu_buffer,
>   		  sched_clock_stable() ? "" :
>   		  "If you just came from a suspend/resume,\n"
>   		  "please switch to the trace global clock:\n"
> -		  "  echo global > /sys/kernel/debug/tracing/trace_clock\n"
> +		  "  echo global > /sys/kernel/tracing/trace_clock\n"
>   		  "or add trace_clock=global to the kernel command line\n");
>   }
>   
> diff --git a/kernel/trace/synth_event_gen_test.c b/kernel/trace/synth_event_gen_test.c
> index 8d77526892f4..8dfe85499d4a 100644
> --- a/kernel/trace/synth_event_gen_test.c
> +++ b/kernel/trace/synth_event_gen_test.c
> @@ -22,7 +22,7 @@
>    * Then:
>    *
>    * # insmod kernel/trace/synth_event_gen_test.ko
> - * # cat /sys/kernel/debug/tracing/trace
> + * # cat /sys/kernel/tracing/trace
>    *
>    * You should see several events in the trace buffer -
>    * "create_synth_test", "empty_synth_test", and several instances of
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index c9e40f692650..1101220052b3 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -1142,7 +1142,7 @@ void tracing_snapshot_instance(struct trace_array *tr)
>    *
>    * Note, make sure to allocate the snapshot with either
>    * a tracing_snapshot_alloc(), or by doing it manually
> - * with: echo 1 > /sys/kernel/debug/tracing/snapshot
> + * with: echo 1 > /sys/kernel/tracing/snapshot
>    *
>    * If the snapshot buffer is not allocated, it will stop tracing.
>    * Basically making a permanent snapshot.
> diff --git a/samples/user_events/example.c b/samples/user_events/example.c
> index d06dc24156ec..18e34c9d708e 100644
> --- a/samples/user_events/example.c
> +++ b/samples/user_events/example.c
> @@ -23,8 +23,8 @@
>   #endif
>   
>   /* Assumes debugfs is mounted */
> -const char *data_file = "/sys/kernel/debug/tracing/user_events_data";
> -const char *status_file = "/sys/kernel/debug/tracing/user_events_status";
> +const char *data_file = "/sys/kernel/tracing/user_events_data";
> +const char *status_file = "/sys/kernel/tracing/user_events_status";
>   
>   static int event_status(long **status)
>   {
> diff --git a/scripts/tracing/draw_functrace.py b/scripts/tracing/draw_functrace.py
> index 438516bdfb3c..42fa87300941 100755
> --- a/scripts/tracing/draw_functrace.py
> +++ b/scripts/tracing/draw_functrace.py
> @@ -12,9 +12,9 @@ calls. Only the functions's names and the call time are provided.
>   
>   Usage:
>   	Be sure that you have CONFIG_FUNCTION_TRACER
> -	# mount -t debugfs nodev /sys/kernel/debug
> -	# echo function > /sys/kernel/debug/tracing/current_tracer
> -	$ cat /sys/kernel/debug/tracing/trace_pipe > ~/raw_trace_func
> +	# mount -t tracefs nodev /sys/kernel/tracing
> +	# echo function > /sys/kernel/tracing/current_tracer
> +	$ cat /sys/kernel/tracing/trace_pipe > ~/raw_trace_func
>   	Wait some times but not too much, the script is a bit slow.
>   	Break the pipe (Ctrl + Z)
>   	$ scripts/tracing/draw_functrace.py < ~/raw_trace_func > draw_functrace
> diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
> index b8e457c841ab..7ba3e81274e8 100644
> --- a/tools/lib/api/fs/tracing_path.c
> +++ b/tools/lib/api/fs/tracing_path.c
> @@ -14,8 +14,8 @@
>   #include "tracing_path.h"
>   
>   static char tracing_mnt[PATH_MAX]  = "/sys/kernel/debug";
> -static char tracing_path[PATH_MAX]        = "/sys/kernel/debug/tracing";
> -static char tracing_events_path[PATH_MAX] = "/sys/kernel/debug/tracing/events";
> +static char tracing_path[PATH_MAX]        = "/sys/kernel/tracing";
> +static char tracing_events_path[PATH_MAX] = "/sys/kernel/tracing/events";
>   
>   static void __tracing_path_set(const char *tracing, const char *mountpoint)
>   {
> diff --git a/tools/tracing/latency/latency-collector.c b/tools/tracing/latency/latency-collector.c
> index 59a7f2346eab..0fd9c747d396 100644
> --- a/tools/tracing/latency/latency-collector.c
> +++ b/tools/tracing/latency/latency-collector.c
> @@ -1584,7 +1584,7 @@ static void *do_printloop(void *arg)
>   		/*
>   		 * Toss a coin to decide if we want to sleep before printing
>   		 * out the backtrace. The reason for this is that opening
> -		 * /sys/kernel/debug/tracing/trace will cause a blackout of
> +		 * /sys/kernel/tracing/trace will cause a blackout of
>   		 * hundreds of ms, where no latencies will be noted by the
>   		 * latency tracer. Thus by randomly sleeping we try to avoid
>   		 * missing traces systematically due to this. With this option


LGTM.

Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com>

-Mukesh

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 2/6] selftests: use canonical ftrace path
  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
  1 sibling, 0 replies; 21+ messages in thread
From: Mukesh Ojha @ 2023-02-17 15:40 UTC (permalink / raw)
  To: Ross Zwisler, linux-kernel
  Cc: Ross Zwisler, Shuah Khan, Andrew Morton, linux-kselftest,
	linux-mm, linux-trace-kernel, Steven Rostedt



On 2/16/2023 4:03 AM, 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/testing/selftests still refer to this older debugfs
> path, so let's update them to avoid confusion.
> 
> Signed-off-by: Ross Zwisler <zwisler@google.com>
> ---
>   tools/testing/selftests/user_events/dyn_test.c    |  2 +-
>   tools/testing/selftests/user_events/ftrace_test.c | 10 +++++-----
>   tools/testing/selftests/user_events/perf_test.c   |  8 ++++----
>   tools/testing/selftests/vm/protection_keys.c      |  4 ++--
>   4 files changed, 12 insertions(+), 12 deletions(-)
> 
> diff --git a/tools/testing/selftests/user_events/dyn_test.c b/tools/testing/selftests/user_events/dyn_test.c
> index d6265d14cd51..8879a7b04c6a 100644
> --- a/tools/testing/selftests/user_events/dyn_test.c
> +++ b/tools/testing/selftests/user_events/dyn_test.c
> @@ -16,7 +16,7 @@
>   
>   #include "../kselftest_harness.h"
>   
> -const char *dyn_file = "/sys/kernel/debug/tracing/dynamic_events";
> +const char *dyn_file = "/sys/kernel/tracing/dynamic_events";
>   const char *clear = "!u:__test_event";
>   
>   static int Append(const char *value)
> diff --git a/tools/testing/selftests/user_events/ftrace_test.c b/tools/testing/selftests/user_events/ftrace_test.c
> index 404a2713dcae..a0b2c96eb252 100644
> --- a/tools/testing/selftests/user_events/ftrace_test.c
> +++ b/tools/testing/selftests/user_events/ftrace_test.c
> @@ -16,11 +16,11 @@
>   
>   #include "../kselftest_harness.h"
>   
> -const char *data_file = "/sys/kernel/debug/tracing/user_events_data";
> -const char *status_file = "/sys/kernel/debug/tracing/user_events_status";
> -const char *enable_file = "/sys/kernel/debug/tracing/events/user_events/__test_event/enable";
> -const char *trace_file = "/sys/kernel/debug/tracing/trace";
> -const char *fmt_file = "/sys/kernel/debug/tracing/events/user_events/__test_event/format";
> +const char *data_file = "/sys/kernel/tracing/user_events_data";
> +const char *status_file = "/sys/kernel/tracing/user_events_status";
> +const char *enable_file = "/sys/kernel/tracing/events/user_events/__test_event/enable";
> +const char *trace_file = "/sys/kernel/tracing/trace";
> +const char *fmt_file = "/sys/kernel/tracing/events/user_events/__test_event/format";
>   
>   static inline int status_check(char *status_page, int status_bit)
>   {
> diff --git a/tools/testing/selftests/user_events/perf_test.c b/tools/testing/selftests/user_events/perf_test.c
> index 8b4c7879d5a7..31505642aa9b 100644
> --- a/tools/testing/selftests/user_events/perf_test.c
> +++ b/tools/testing/selftests/user_events/perf_test.c
> @@ -18,10 +18,10 @@
>   
>   #include "../kselftest_harness.h"
>   
> -const char *data_file = "/sys/kernel/debug/tracing/user_events_data";
> -const char *status_file = "/sys/kernel/debug/tracing/user_events_status";
> -const char *id_file = "/sys/kernel/debug/tracing/events/user_events/__test_event/id";
> -const char *fmt_file = "/sys/kernel/debug/tracing/events/user_events/__test_event/format";
> +const char *data_file = "/sys/kernel/tracing/user_events_data";
> +const char *status_file = "/sys/kernel/tracing/user_events_status";
> +const char *id_file = "/sys/kernel/tracing/events/user_events/__test_event/id";
> +const char *fmt_file = "/sys/kernel/tracing/events/user_events/__test_event/format";
>   
>   struct event {
>   	__u32 index;
> diff --git a/tools/testing/selftests/vm/protection_keys.c b/tools/testing/selftests/vm/protection_keys.c
> index 95f403a0c46d..0381c34fdd56 100644
> --- a/tools/testing/selftests/vm/protection_keys.c
> +++ b/tools/testing/selftests/vm/protection_keys.c
> @@ -98,7 +98,7 @@ int tracing_root_ok(void)
>   void tracing_on(void)
>   {
>   #if CONTROL_TRACING > 0
> -#define TRACEDIR "/sys/kernel/debug/tracing"
> +#define TRACEDIR "/sys/kernel/tracing"
>   	char pidstr[32];
>   
>   	if (!tracing_root_ok())
> @@ -124,7 +124,7 @@ void tracing_off(void)
>   #if CONTROL_TRACING > 0
>   	if (!tracing_root_ok())
>   		return;
> -	cat_into_file("0", "/sys/kernel/debug/tracing/tracing_on");
> +	cat_into_file("0", "/sys/kernel/tracing/tracing_on");
>   #endif
>   }
>   


Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com>

-Mukesh

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 4/6] tools/kvm_stat: use canonical ftrace path
  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
  2 siblings, 0 replies; 21+ messages in thread
From: Mukesh Ojha @ 2023-02-17 15:41 UTC (permalink / raw)
  To: Ross Zwisler, linux-kernel
  Cc: Ross Zwisler, Paolo Bonzini, kvm, linux-trace-kernel, Steven Rostedt



On 2/16/2023 4:03 AM, 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 comment in kvm_stat still refers to this older debugfs path, so let's
> update it to avoid confusion.
> 
> Signed-off-by: Ross Zwisler <zwisler@google.com>
> ---
>   tools/kvm/kvm_stat/kvm_stat | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/kvm/kvm_stat/kvm_stat b/tools/kvm/kvm_stat/kvm_stat
> index 6f28180ffeea..15bf00e79e3f 100755
> --- a/tools/kvm/kvm_stat/kvm_stat
> +++ b/tools/kvm/kvm_stat/kvm_stat
> @@ -627,7 +627,7 @@ class TracepointProvider(Provider):
>           name)'.
>   
>           All available events have directories under
> -        /sys/kernel/debug/tracing/events/ which export information
> +        /sys/kernel/tracing/events/ which export information
>           about the specific event. Therefore, listing the dirs gives us
>           a list of all available events.
>   

Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com>

-Mukesh

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 5/6] tools/virtio: use canonical ftrace path
  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
  1 sibling, 0 replies; 21+ messages in thread
From: Mukesh Ojha @ 2023-02-17 15:46 UTC (permalink / raw)
  To: Ross Zwisler, linux-kernel
  Cc: Ross Zwisler, Michael S. Tsirkin, Jason Wang, virtualization,
	linux-trace-kernel, Steven Rostedt



On 2/16/2023 4:03 AM, 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>
> ---
>   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);
> +	}
> 


Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com>

-Mukesh


>   	if (ret <= 0) {
>   		pr_err("Failed to generate %s path(CPU#%d):%d\n",

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/6] use canonical ftrace path whenever possible
  2023-02-15 22:33 [PATCH v2 0/6] use canonical ftrace path whenever possible Ross Zwisler
                   ` (5 preceding siblings ...)
  2023-02-15 22:33 ` [PATCH v2 6/6] tools/virtio: fix typo in README instructions Ross Zwisler
@ 2023-03-10  8:29 ` Michael S. Tsirkin
  2023-03-10 19:06   ` Ross Zwisler
  2023-03-22  2:32 ` Michael S. Tsirkin
  7 siblings, 1 reply; 21+ messages in thread
From: Michael S. Tsirkin @ 2023-03-10  8:29 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: linux-kernel, Ross Zwisler, Tobin C. Harding, Andrew Morton,
	Jason Wang, Masami Hiramatsu, Paolo Bonzini, Shuah Khan,
	Tycho Andersen, kvm, linux-hardening, linux-kselftest, linux-mm,
	virtualization, linux-trace-kernel, Steven Rostedt

On Wed, Feb 15, 2023 at 03:33:44PM -0700, Ross Zwisler wrote:
> Changes in v2:
>  * Dropped patches which were pulled into maintainer trees.
>  * Split BPF patches out into another series targeting bpf-next.
>  * trace-agent now falls back to debugfs if tracefs isn't present.
>  * Added Acked-by from mst@redhat.com to series.
>  * Added a typo fixup for the virtio-trace README.
> 
> Steven, assuming there are no objections, would you feel comfortable
> taking this series through your tree?

Acked-by: Michael S. Tsirkin <mst@redhat.com>

if you want the virtio patches through my tree after all, let me know.

> ---
> 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
> 
> There are many places where this older debugfs path is still used in
> code comments, selftests, examples and tools, so let's update them to
> avoid confusion.
> 
> I've broken up the series as best I could by maintainer or directory,
> and I've only sent people the patches that I think they care about to
> avoid spamming everyone.
> 
> Ross Zwisler (6):
>   tracing: always use canonical ftrace path
>   selftests: use canonical ftrace path
>   leaking_addresses: also skip canonical ftrace path
>   tools/kvm_stat: use canonical ftrace path
>   tools/virtio: use canonical ftrace path
>   tools/virtio: fix typo in README instructions
> 
>  include/linux/kernel.h                        |  2 +-
>  include/linux/tracepoint.h                    |  4 ++--
>  kernel/trace/Kconfig                          | 20 +++++++++----------
>  kernel/trace/kprobe_event_gen_test.c          |  2 +-
>  kernel/trace/ring_buffer.c                    |  2 +-
>  kernel/trace/synth_event_gen_test.c           |  2 +-
>  kernel/trace/trace.c                          |  2 +-
>  samples/user_events/example.c                 |  4 ++--
>  scripts/leaking_addresses.pl                  |  1 +
>  scripts/tracing/draw_functrace.py             |  6 +++---
>  tools/kvm/kvm_stat/kvm_stat                   |  2 +-
>  tools/lib/api/fs/tracing_path.c               |  4 ++--
>  .../testing/selftests/user_events/dyn_test.c  |  2 +-
>  .../selftests/user_events/ftrace_test.c       | 10 +++++-----
>  .../testing/selftests/user_events/perf_test.c |  8 ++++----
>  tools/testing/selftests/vm/protection_keys.c  |  4 ++--
>  tools/tracing/latency/latency-collector.c     |  2 +-
>  tools/virtio/virtio-trace/README              |  4 ++--
>  tools/virtio/virtio-trace/trace-agent.c       | 12 +++++++----
>  19 files changed, 49 insertions(+), 44 deletions(-)
> 
> -- 
> 2.39.1.637.g21b0678d19-goog


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/6] use canonical ftrace path whenever possible
  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
  0 siblings, 1 reply; 21+ messages in thread
From: Ross Zwisler @ 2023-03-10 19:06 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Ross Zwisler, linux-kernel, Tobin C. Harding, Andrew Morton,
	Jason Wang, Masami Hiramatsu, Paolo Bonzini, Shuah Khan,
	Tycho Andersen, kvm, linux-hardening, linux-kselftest, linux-mm,
	virtualization, linux-trace-kernel, Steven Rostedt

On Fri, Mar 10, 2023 at 03:29:49AM -0500, Michael S. Tsirkin wrote:
> On Wed, Feb 15, 2023 at 03:33:44PM -0700, Ross Zwisler wrote:
> > Changes in v2:
> >  * Dropped patches which were pulled into maintainer trees.
> >  * Split BPF patches out into another series targeting bpf-next.
> >  * trace-agent now falls back to debugfs if tracefs isn't present.
> >  * Added Acked-by from mst@redhat.com to series.
> >  * Added a typo fixup for the virtio-trace README.
> > 
> > Steven, assuming there are no objections, would you feel comfortable
> > taking this series through your tree?
> 
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> 
> if you want the virtio patches through my tree after all, let me know.

Yes, please, that would be great.  I'll send out v3 with the few patches that
haven't gotten a response, but I'll drop the virtio patches assuming you've
got them.

Thanks!

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/6] use canonical ftrace path whenever possible
  2023-03-10 19:06   ` Ross Zwisler
@ 2023-03-10 19:37     ` Steven Rostedt
  0 siblings, 0 replies; 21+ messages in thread
From: Steven Rostedt @ 2023-03-10 19:37 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: Michael S. Tsirkin, Ross Zwisler, linux-kernel, Tobin C. Harding,
	Andrew Morton, Jason Wang, Masami Hiramatsu, Paolo Bonzini,
	Shuah Khan, Tycho Andersen, kvm, linux-hardening,
	linux-kselftest, linux-mm, virtualization, linux-trace-kernel

On Fri, 10 Mar 2023 12:06:58 -0700
Ross Zwisler <zwisler@google.com> wrote:

> On Fri, Mar 10, 2023 at 03:29:49AM -0500, Michael S. Tsirkin wrote:
> > On Wed, Feb 15, 2023 at 03:33:44PM -0700, Ross Zwisler wrote:  
> > > Changes in v2:
> > >  * Dropped patches which were pulled into maintainer trees.
> > >  * Split BPF patches out into another series targeting bpf-next.
> > >  * trace-agent now falls back to debugfs if tracefs isn't present.
> > >  * Added Acked-by from mst@redhat.com to series.
> > >  * Added a typo fixup for the virtio-trace README.
> > > 
> > > Steven, assuming there are no objections, would you feel comfortable
> > > taking this series through your tree?  
> > 
> > Acked-by: Michael S. Tsirkin <mst@redhat.com>
> > 
> > if you want the virtio patches through my tree after all, let me know.  
> 
> Yes, please, that would be great.  I'll send out v3 with the few patches that
> haven't gotten a response, but I'll drop the virtio patches assuming you've
> got them.
>

Since the last patch 6/6 is not tracing related, I would prefer it to go
through the virtio tree.

For patches 1-5, please add:

Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>

Thanks!

-- Steve

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/6] use canonical ftrace path whenever possible
  2023-02-15 22:33 [PATCH v2 0/6] use canonical ftrace path whenever possible Ross Zwisler
                   ` (6 preceding siblings ...)
  2023-03-10  8:29 ` [PATCH v2 0/6] use canonical ftrace path whenever possible Michael S. Tsirkin
@ 2023-03-22  2:32 ` Michael S. Tsirkin
  2023-03-22 16:52   ` Ross Zwisler
  7 siblings, 1 reply; 21+ messages in thread
From: Michael S. Tsirkin @ 2023-03-22  2:32 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: linux-kernel, Ross Zwisler, Tobin C. Harding, Andrew Morton,
	Jason Wang, Masami Hiramatsu, Paolo Bonzini, Shuah Khan,
	Tycho Andersen, kvm, linux-hardening, linux-kselftest, linux-mm,
	virtualization, linux-trace-kernel, Steven Rostedt

On Wed, Feb 15, 2023 at 03:33:44PM -0700, Ross Zwisler wrote:
> Changes in v2:
>  * Dropped patches which were pulled into maintainer trees.
>  * Split BPF patches out into another series targeting bpf-next.
>  * trace-agent now falls back to debugfs if tracefs isn't present.
>  * Added Acked-by from mst@redhat.com to series.
>  * Added a typo fixup for the virtio-trace README.
> 
> Steven, assuming there are no objections, would you feel comfortable
> taking this series through your tree?

for merging up to patch 5 through another tree:

Acked-by: Michael S. Tsirkin <mst@redhat.com>

I'll merge patch 6, no problem.


> ---
> 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
> 
> There are many places where this older debugfs path is still used in
> code comments, selftests, examples and tools, so let's update them to
> avoid confusion.
> 
> I've broken up the series as best I could by maintainer or directory,
> and I've only sent people the patches that I think they care about to
> avoid spamming everyone.
> 
> Ross Zwisler (6):
>   tracing: always use canonical ftrace path
>   selftests: use canonical ftrace path
>   leaking_addresses: also skip canonical ftrace path
>   tools/kvm_stat: use canonical ftrace path
>   tools/virtio: use canonical ftrace path
>   tools/virtio: fix typo in README instructions
> 
>  include/linux/kernel.h                        |  2 +-
>  include/linux/tracepoint.h                    |  4 ++--
>  kernel/trace/Kconfig                          | 20 +++++++++----------
>  kernel/trace/kprobe_event_gen_test.c          |  2 +-
>  kernel/trace/ring_buffer.c                    |  2 +-
>  kernel/trace/synth_event_gen_test.c           |  2 +-
>  kernel/trace/trace.c                          |  2 +-
>  samples/user_events/example.c                 |  4 ++--
>  scripts/leaking_addresses.pl                  |  1 +
>  scripts/tracing/draw_functrace.py             |  6 +++---
>  tools/kvm/kvm_stat/kvm_stat                   |  2 +-
>  tools/lib/api/fs/tracing_path.c               |  4 ++--
>  .../testing/selftests/user_events/dyn_test.c  |  2 +-
>  .../selftests/user_events/ftrace_test.c       | 10 +++++-----
>  .../testing/selftests/user_events/perf_test.c |  8 ++++----
>  tools/testing/selftests/vm/protection_keys.c  |  4 ++--
>  tools/tracing/latency/latency-collector.c     |  2 +-
>  tools/virtio/virtio-trace/README              |  4 ++--
>  tools/virtio/virtio-trace/trace-agent.c       | 12 +++++++----
>  19 files changed, 49 insertions(+), 44 deletions(-)
> 
> -- 
> 2.39.1.637.g21b0678d19-goog


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 0/6] use canonical ftrace path whenever possible
  2023-03-22  2:32 ` Michael S. Tsirkin
@ 2023-03-22 16:52   ` Ross Zwisler
  0 siblings, 0 replies; 21+ messages in thread
From: Ross Zwisler @ 2023-03-22 16:52 UTC (permalink / raw)
  To: Michael S. Tsirkin
  Cc: Ross Zwisler, linux-kernel, Tobin C. Harding, Andrew Morton,
	Jason Wang, Masami Hiramatsu, Paolo Bonzini, Shuah Khan,
	Tycho Andersen, kvm, linux-hardening, linux-kselftest, linux-mm,
	virtualization, linux-trace-kernel, Steven Rostedt

On Tue, Mar 21, 2023 at 10:32:46PM -0400, Michael S. Tsirkin wrote:
> On Wed, Feb 15, 2023 at 03:33:44PM -0700, Ross Zwisler wrote:
> > Changes in v2:
> >  * Dropped patches which were pulled into maintainer trees.
> >  * Split BPF patches out into another series targeting bpf-next.
> >  * trace-agent now falls back to debugfs if tracefs isn't present.
> >  * Added Acked-by from mst@redhat.com to series.
> >  * Added a typo fixup for the virtio-trace README.
> > 
> > Steven, assuming there are no objections, would you feel comfortable
> > taking this series through your tree?
> 
> for merging up to patch 5 through another tree:
> 
> Acked-by: Michael S. Tsirkin <mst@redhat.com>
> 
> I'll merge patch 6, no problem.

Hey Michael, would you also mind merging patch 5, the other virtio patch?

[PATCH v2 5/6] tools/virtio: use canonical ftrace path

https://lore.kernel.org/all/20230215223350.2658616-6-zwisler@google.com/

I don't think Steven took this one through his tree.  Thanks!

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 5/6] tools/virtio: use canonical ftrace path
  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
  1 sibling, 0 replies; 21+ messages in thread
From: Michael S. Tsirkin @ 2023-06-02 11:15 UTC (permalink / raw)
  To: Ross Zwisler
  Cc: linux-kernel, Ross Zwisler, Jason Wang, virtualization,
	linux-trace-kernel, Steven Rostedt

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


^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2023-06-02 11:18 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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

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).