Skip to contentSkip to conversation

bpf: use canonical ftrace path

PATCH In review Ross Zwisler 3 participants 4 messages Feb 13, 2023 – Feb 14, 2023

Subsystems (5)
Kselftest BPF InfiniBand Tracing +1 more subsystems
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 bpf: use canonical ftrace path

The canonical location for the tracefs filesystem is at /sys/kernel/tracing.

But, from Documentation/trace/ftrace.rst:

Before 4.1, all ftrace tracing control files were within the debugfs file system, which is typically located at /sys/kernel/debug/tracing. For backward compatibility, when mounting the debugfs file system, the tracefs file system will be automatically mounted at:

/sys/kernel/debug/tracing

Many comments and samples in the bpf code still refer to this older debugfs path, so let's update them to avoid confusion. There are a few spots where the bpf code explicitly checks both tracefs and debugfs (tools/bpf/bpftool/tracelog.c and tools/lib/api/fs/fs.c) and I've left those alone so that the tools can continue to work with both paths.

---

[ Per Alexei's request, resending towards bpf-next ]

 include/uapi/linux/bpf.h            | 8 ++++----
 samples/bpf/cpustat_kern.c          | 4 ++--
 samples/bpf/hbm.c                   | 4 ++--
 samples/bpf/ibumad_kern.c           | 4 ++--
 samples/bpf/lwt_len_hist.sh         | 2 +-
 samples/bpf/offwaketime_kern.c      | 2 +-
 samples/bpf/task_fd_query_user.c    | 4 ++--
 samples/bpf/test_lwt_bpf.sh         | 2 +-
 samples/bpf/test_overhead_tp_kern.c | 4 ++--
 tools/include/uapi/linux/bpf.h      | 8 ++++----
 10 files changed, 21 insertions(+), 21 deletions(-)
include/uapi/linux/bpf.h +4 -4
index 464ca3f01fe7..44387b31cbde 100644
@@ -1642,17 +1642,17 @@ union bpf_attr {
  * 	Description
  * 		This helper is a "printk()-like" facility for debugging. It
  * 		prints a message defined by format *fmt* (of size *fmt_size*)
- * 		to file *\/sys/kernel/debug/tracing/trace* from DebugFS, if
+ * 		to file *\/sys/kernel/tracing/trace* from TraceFS, if
  * 		available. It can take up to three additional **u64**
  * 		arguments (as an eBPF helpers, the total number of arguments is
  * 		limited to five).
  *
  * 		Each time the helper is called, it appends a line to the trace.
- * 		Lines are discarded while *\/sys/kernel/debug/tracing/trace* is
- * 		open, use *\/sys/kernel/debug/tracing/trace_pipe* to avoid this.
+ * 		Lines are discarded while *\/sys/kernel/tracing/trace* is
+ * 		open, use *\/sys/kernel/tracing/trace_pipe* to avoid this.
  * 		The format of the trace is customizable, and the exact output
  * 		one will get depends on the options set in
- * 		*\/sys/kernel/debug/tracing/trace_options* (see also the
+ * 		*\/sys/kernel/tracing/trace_options* (see also the
  * 		*README* file under the same directory). However, it usually
  * 		defaults to something like:
  *
samples/bpf/cpustat_kern.c +2 -2
index 5aefd19cdfa1..944f13fe164a 100644
@@ -76,8 +76,8 @@ struct {
 
 /*
  * The trace events for cpu_idle and cpu_frequency are taken from:
- * /sys/kernel/debug/tracing/events/power/cpu_idle/format
- * /sys/kernel/debug/tracing/events/power/cpu_frequency/format
+ * /sys/kernel/tracing/events/power/cpu_idle/format
+ * /sys/kernel/tracing/events/power/cpu_frequency/format
  *
  * These two events have same format, so define one common structure.
  */
samples/bpf/hbm.c +2 -2
index 516fbac28b71..ff58ec43f56a 100644
@@ -65,7 +65,7 @@ static void Usage(void);
 static void read_trace_pipe2(void);
 static void do_error(char *msg, bool errno_flag);
 
-#define DEBUGFS "/sys/kernel/debug/tracing/"
+#define TRACEFS "/sys/kernel/tracing/"
 
 static struct bpf_program *bpf_prog;
 static struct bpf_object *obj;
@@ -77,7 +77,7 @@ static void read_trace_pipe2(void)
 	FILE *outf;
 	char *outFname = "hbm_out.log";
 
-	trace_fd = open(DEBUGFS "trace_pipe", O_RDONLY, 0);
+	trace_fd = open(TRACEFS "trace_pipe", O_RDONLY, 0);
 	if (trace_fd < 0) {
 		printf("Error opening trace_pipe\n");
 		return;
samples/bpf/ibumad_kern.c +2 -2
index 9b193231024a..f07474c72525 100644
@@ -39,8 +39,8 @@ struct {
 /* Taken from the current format defined in
  * include/trace/events/ib_umad.h
  * and
- * /sys/kernel/debug/tracing/events/ib_umad/ib_umad_read/format
- * /sys/kernel/debug/tracing/events/ib_umad/ib_umad_write/format
+ * /sys/kernel/tracing/events/ib_umad/ib_umad_read/format
+ * /sys/kernel/tracing/events/ib_umad/ib_umad_write/format
  */
 struct ib_umad_rw_args {
 	u64 pad;
samples/bpf/lwt_len_hist.sh +1 -1
index 0eda9754f50b..11fa0a087db6 100755
@@ -5,7 +5,7 @@ NS1=lwt_ns1
 VETH0=tst_lwt1a
 VETH1=tst_lwt1b
 
-TRACE_ROOT=/sys/kernel/debug/tracing
+TRACE_ROOT=/sys/kernel/tracing
 
 function cleanup {
 	# To reset saved histogram, remove pinned map
samples/bpf/offwaketime_kern.c +1 -1
index eb4d94742e6b..23f12b47e9e5 100644
@@ -110,7 +110,7 @@ static inline int update_counts(void *ctx, u32 pid, u64 delta)
 }
 
 #if 1
-/* taken from /sys/kernel/debug/tracing/events/sched/sched_switch/format */
+/* taken from /sys/kernel/tracing/events/sched/sched_switch/format */
 struct sched_switch_args {
 	unsigned long long pad;
 	char prev_comm[TASK_COMM_LEN];
samples/bpf/task_fd_query_user.c +2 -2
index a33d74bd3a4b..1e61f2180470 100644
@@ -235,7 +235,7 @@ static int test_debug_fs_uprobe(char *binary_path, long offset, bool is_return)
 	struct bpf_link *link;
 	ssize_t bytes;
 
-	snprintf(buf, sizeof(buf), "/sys/kernel/debug/tracing/%s_events",
+	snprintf(buf, sizeof(buf), "/sys/kernel/tracing/%s_events",
 		 event_type);
 	kfd = open(buf, O_WRONLY | O_TRUNC, 0);
 	CHECK_PERROR_RET(kfd < 0);
@@ -252,7 +252,7 @@ static int test_debug_fs_uprobe(char *binary_path, long offset, bool is_return)
 	close(kfd);
 	kfd = -1;
 
-	snprintf(buf, sizeof(buf), "/sys/kernel/debug/tracing/events/%ss/%s/id",
+	snprintf(buf, sizeof(buf), "/sys/kernel/tracing/events/%ss/%s/id",
 		 event_type, event_alias);
 	efd = open(buf, O_RDONLY, 0);
 	CHECK_PERROR_RET(efd < 0);
samples/bpf/test_lwt_bpf.sh +1 -1
index 65a976058dd3..db5691e6637f 100755
@@ -19,7 +19,7 @@ IPVETH3="192.168.111.2"
 
 IP_LOCAL="192.168.99.1"
 
-TRACE_ROOT=/sys/kernel/debug/tracing
+TRACE_ROOT=/sys/kernel/tracing
 
 function lookup_mac()
 {
samples/bpf/test_overhead_tp_kern.c +2 -2
index 80edadacb692..a1d53b0d8476 100644
@@ -8,7 +8,7 @@
 #include <uapi/linux/bpf.h>
 #include <bpf/bpf_helpers.h>
 
-/* from /sys/kernel/debug/tracing/events/task/task_rename/format */
+/* from /sys/kernel/tracing/events/task/task_rename/format */
 struct task_rename {
 	__u64 pad;
 	__u32 pid;
@@ -22,7 +22,7 @@ int prog(struct task_rename *ctx)
 	return 0;
 }
 
-/* from /sys/kernel/debug/tracing/events/random/urandom_read/format */
+/* from /sys/kernel/tracing/events/random/urandom_read/format */
 struct urandom_read {
 	__u64 pad;
 	int got_bits;
tools/include/uapi/linux/bpf.h +4 -4
index 464ca3f01fe7..44387b31cbde 100644
@@ -1642,17 +1642,17 @@ union bpf_attr {
  * 	Description
  * 		This helper is a "printk()-like" facility for debugging. It
  * 		prints a message defined by format *fmt* (of size *fmt_size*)
- * 		to file *\/sys/kernel/debug/tracing/trace* from DebugFS, if
+ * 		to file *\/sys/kernel/tracing/trace* from TraceFS, if
  * 		available. It can take up to three additional **u64**
  * 		arguments (as an eBPF helpers, the total number of arguments is
  * 		limited to five).
  *
  * 		Each time the helper is called, it appends a line to the trace.
- * 		Lines are discarded while *\/sys/kernel/debug/tracing/trace* is
- * 		open, use *\/sys/kernel/debug/tracing/trace_pipe* to avoid this.
+ * 		Lines are discarded while *\/sys/kernel/tracing/trace* is
+ * 		open, use *\/sys/kernel/tracing/trace_pipe* to avoid this.
  * 		The format of the trace is customizable, and the exact output
  * 		one will get depends on the options set in
- * 		*\/sys/kernel/debug/tracing/trace_options* (see also the
+ * 		*\/sys/kernel/tracing/trace_options* (see also the
  * 		*README* file under the same directory). However, it usually
  * 		defaults to something like:
  *
Signature · 1 line
2.39.1.581.gbfd45094c4-goog
#1 lore raw

PATCH 2/2 selftests/bpf: use canonical ftrace path

The canonical location for the tracefs filesystem is at /sys/kernel/tracing.

But, from Documentation/trace/ftrace.rst:

Before 4.1, all ftrace tracing control files were within the debugfs file system, which is typically located at /sys/kernel/debug/tracing. For backward compatibility, when mounting the debugfs file system, the tracefs file system will be automatically mounted at:

/sys/kernel/debug/tracing

Many tests in the bpf selftest code still refer to this older debugfs path, so let's update them to avoid confusion.

---

[ Per Alexei's request, resending towards bpf-next ]

 tools/testing/selftests/bpf/get_cgroup_id_user.c          | 2 +-
 .../testing/selftests/bpf/prog_tests/kprobe_multi_test.c  | 2 +-
 tools/testing/selftests/bpf/prog_tests/task_fd_query_tp.c | 2 +-
 tools/testing/selftests/bpf/prog_tests/tp_attach_query.c  | 2 +-
 tools/testing/selftests/bpf/prog_tests/trace_printk.c     | 2 +-
 tools/testing/selftests/bpf/prog_tests/trace_vprintk.c    | 2 +-
 tools/testing/selftests/bpf/progs/test_stacktrace_map.c   | 2 +-
 tools/testing/selftests/bpf/progs/test_tracepoint.c       | 2 +-
 tools/testing/selftests/bpf/test_ftrace.sh                | 2 +-
 tools/testing/selftests/bpf/test_tunnel.sh                | 8 ++++----
 tools/testing/selftests/bpf/trace_helpers.c               | 4 ++--
 11 files changed, 15 insertions(+), 15 deletions(-)
tools/testing/selftests/bpf/get_cgroup_id_user.c +1 -1
index 156743cf5870..478e080128be 100644
@@ -87,7 +87,7 @@ int main(int argc, char **argv)
 	bpf_map_update_elem(pidmap_fd, &key, &pid, 0);
 
 	snprintf(buf, sizeof(buf),
-		 "/sys/kernel/debug/tracing/events/%s/id", probe_name);
+		 "/sys/kernel/tracing/events/%s/id", probe_name);
 	efd = open(buf, O_RDONLY, 0);
 	if (CHECK(efd < 0, "open", "err %d errno %d\n", efd, errno))
 		goto close_prog;
tools/testing/selftests/bpf/prog_tests/kprobe_multi_test.c +1 -1
index c6f37e825f11..6f0f2d8984db 100644
@@ -338,7 +338,7 @@ static int get_syms(char ***symsp, size_t *cntp)
 	 * Filtering out duplicates by using hashmap__add, which won't
 	 * add existing entry.
 	 */
-	f = fopen("/sys/kernel/debug/tracing/available_filter_functions", "r");
+	f = fopen("/sys/kernel/tracing/available_filter_functions", "r");
 	if (!f)
 		return -EINVAL;
 
tools/testing/selftests/bpf/prog_tests/task_fd_query_tp.c +1 -1
index c717741bf8b6..6d70559fc19b 100644
@@ -18,7 +18,7 @@ static void test_task_fd_query_tp_core(const char *probe_name,
 		goto close_prog;
 
 	snprintf(buf, sizeof(buf),
-		 "/sys/kernel/debug/tracing/events/%s/id", probe_name);
+		 "/sys/kernel/tracing/events/%s/id", probe_name);
 	efd = open(buf, O_RDONLY, 0);
 	if (CHECK(efd < 0, "open", "err %d errno %d\n", efd, errno))
 		goto close_prog;
tools/testing/selftests/bpf/prog_tests/tp_attach_query.c +1 -1
index a479080533db..4308e3a828d8 100644
@@ -17,7 +17,7 @@ void serial_test_tp_attach_query(void)
 		obj[i] = NULL;
 
 	snprintf(buf, sizeof(buf),
-		 "/sys/kernel/debug/tracing/events/sched/sched_switch/id");
+		 "/sys/kernel/tracing/events/sched/sched_switch/id");
 	efd = open(buf, O_RDONLY, 0);
 	if (CHECK(efd < 0, "open", "err %d errno %d\n", efd, errno))
 		return;
tools/testing/selftests/bpf/prog_tests/trace_printk.c +1 -1
index cade7f12315f..ff50a928cb98 100644
@@ -5,7 +5,7 @@
 
 #include "trace_printk.lskel.h"
 
-#define TRACEBUF	"/sys/kernel/debug/tracing/trace_pipe"
+#define TRACEBUF	"/sys/kernel/tracing/trace_pipe"
 #define SEARCHMSG	"testing,testing"
 
 void serial_test_trace_printk(void)
tools/testing/selftests/bpf/prog_tests/trace_vprintk.c +1 -1
index 7a4e313e8558..e568d7f247ec 100644
@@ -5,7 +5,7 @@
 
 #include "trace_vprintk.lskel.h"
 
-#define TRACEBUF	"/sys/kernel/debug/tracing/trace_pipe"
+#define TRACEBUF	"/sys/kernel/tracing/trace_pipe"
 #define SEARCHMSG	"1,2,3,4,5,6,7,8,9,10"
 
 void serial_test_trace_vprintk(void)
tools/testing/selftests/bpf/progs/test_stacktrace_map.c +1 -1
index 728dbd39eff0..47568007b668 100644
@@ -38,7 +38,7 @@ struct {
 	__type(value, stack_trace_t);
 } stack_amap SEC(".maps");
 
-/* taken from /sys/kernel/debug/tracing/events/sched/sched_switch/format */
+/* taken from /sys/kernel/tracing/events/sched/sched_switch/format */
 struct sched_switch_args {
 	unsigned long long pad;
 	char prev_comm[TASK_COMM_LEN];
tools/testing/selftests/bpf/progs/test_tracepoint.c +1 -1
index 43bd7a20cc50..4cb8bbb6a320 100644
@@ -4,7 +4,7 @@
 #include <vmlinux.h>
 #include <bpf/bpf_helpers.h>
 
-/* taken from /sys/kernel/debug/tracing/events/sched/sched_switch/format */
+/* taken from /sys/kernel/tracing/events/sched/sched_switch/format */
 struct sched_switch_args {
 	unsigned long long pad;
 	char prev_comm[TASK_COMM_LEN];
tools/testing/selftests/bpf/test_ftrace.sh +1 -1
index 20de7bb873bc..e3e2328a1b65 100755
@@ -1,6 +1,6 @@
 #!/bin/bash
 
-TR=/sys/kernel/debug/tracing/
+TR=/sys/kernel/tracing/
 clear_trace() { # reset trace output
     echo > $TR/trace
 }
tools/testing/selftests/bpf/test_tunnel.sh +4 -4
index 2eaedc1d9ed3..bbbd242f7cef 100755
@@ -543,7 +543,7 @@ setup_xfrm_tunnel()
 test_xfrm_tunnel()
 {
 	config_device
-	> /sys/kernel/debug/tracing/trace
+	> /sys/kernel/tracing/trace
 	setup_xfrm_tunnel
 	mkdir -p ${BPF_PIN_TUNNEL_DIR}
 	bpftool prog loadall ${BPF_FILE} ${BPF_PIN_TUNNEL_DIR}
@@ -552,11 +552,11 @@ test_xfrm_tunnel()
 		${BPF_PIN_TUNNEL_DIR}/xfrm_get_state
 	ip netns exec at_ns0 ping $PING_ARG 10.1.1.200
 	sleep 1
-	grep "reqid 1" /sys/kernel/debug/tracing/trace
+	grep "reqid 1" /sys/kernel/tracing/trace
 	check_err $?
-	grep "spi 0x1" /sys/kernel/debug/tracing/trace
+	grep "spi 0x1" /sys/kernel/tracing/trace
 	check_err $?
-	grep "remote ip 0xac100164" /sys/kernel/debug/tracing/trace
+	grep "remote ip 0xac100164" /sys/kernel/tracing/trace
 	check_err $?
 	cleanup
 
tools/testing/selftests/bpf/trace_helpers.c +2 -2
index 09a16a77bae4..d2816aa35a9b 100644
@@ -12,7 +12,7 @@
 #include <sys/mman.h>
 #include "trace_helpers.h"
 
-#define DEBUGFS "/sys/kernel/debug/tracing/"
+#define TRACEFS "/sys/kernel/tracing/"
 
 #define MAX_SYMS 300000
 static struct ksym syms[MAX_SYMS];
@@ -136,7 +136,7 @@ void read_trace_pipe(void)
 {
 	int trace_fd;
 
-	trace_fd = open(DEBUGFS "trace_pipe", O_RDONLY, 0);
+	trace_fd = open(TRACEFS "trace_pipe", O_RDONLY, 0);
 	if (trace_fd < 0)
 		return;
 
Signature · 1 line
2.39.1.581.gbfd45094c4-goog
#2 lore raw
In reply to Ross Zwisler
Quoted 9 lines · Ross Zwisler

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:

Quoted 7 lines

/sys/kernel/debug/tracing

Many comments and samples in the bpf code still refer to this older debugfs path, so let's update them to avoid confusion. There are a few spots where the bpf code explicitly checks both tracefs and debugfs (tools/bpf/bpftool/tracelog.c and tools/lib/api/fs/fs.c) and I've left those alone so that the tools can continue to work with both paths.

Doesn't seem to apply cleanly to bpf-next?

https://github.com/kernel-patches/bpf/pull/4584

Quoted 211 lines

---

[ Per Alexei's request, resending towards bpf-next ]

  include/uapi/linux/bpf.h            | 8 ++++----
  samples/bpf/cpustat_kern.c          | 4 ++--
  samples/bpf/hbm.c                   | 4 ++--
  samples/bpf/ibumad_kern.c           | 4 ++--
  samples/bpf/lwt_len_hist.sh         | 2 +-
  samples/bpf/offwaketime_kern.c      | 2 +-
  samples/bpf/task_fd_query_user.c    | 4 ++--
  samples/bpf/test_lwt_bpf.sh         | 2 +-
  samples/bpf/test_overhead_tp_kern.c | 4 ++--
  tools/include/uapi/linux/bpf.h      | 8 ++++----
  10 files changed, 21 insertions(+), 21 deletions(-)
include/uapi/linux/bpf.h +4 -4
index 464ca3f01fe7..44387b31cbde 100644
@@ -1642,17 +1642,17 @@ union bpf_attr {
   * 	Description
   * 		This helper is a "printk()-like" facility for debugging. It
   * 		prints a message defined by format *fmt* (of size *fmt_size*)
- * 		to file *\/sys/kernel/debug/tracing/trace* from DebugFS, if
+ * 		to file *\/sys/kernel/tracing/trace* from TraceFS, if
   * 		available. It can take up to three additional **u64**
   * 		arguments (as an eBPF helpers, the total number of arguments is
   * 		limited to five).
   *
   * 		Each time the helper is called, it appends a line to the trace.
- * 		Lines are discarded while *\/sys/kernel/debug/tracing/trace* is
- * 		open, use *\/sys/kernel/debug/tracing/trace_pipe* to avoid this.
+ * 		Lines are discarded while *\/sys/kernel/tracing/trace* is
+ * 		open, use *\/sys/kernel/tracing/trace_pipe* to avoid this.
   * 		The format of the trace is customizable, and the exact output
   * 		one will get depends on the options set in
- * 		*\/sys/kernel/debug/tracing/trace_options* (see also the
+ * 		*\/sys/kernel/tracing/trace_options* (see also the
   * 		*README* file under the same directory). However, it usually
   * 		defaults to something like:
   *
samples/bpf/cpustat_kern.c +2 -2
index 5aefd19cdfa1..944f13fe164a 100644
@@ -76,8 +76,8 @@ struct {
 
  /*
   * The trace events for cpu_idle and cpu_frequency are taken from:
- * /sys/kernel/debug/tracing/events/power/cpu_idle/format
- * /sys/kernel/debug/tracing/events/power/cpu_frequency/format
+ * /sys/kernel/tracing/events/power/cpu_idle/format
+ * /sys/kernel/tracing/events/power/cpu_frequency/format
   *
   * These two events have same format, so define one common structure.
   */
samples/bpf/hbm.c +2 -2
index 516fbac28b71..ff58ec43f56a 100644
@@ -65,7 +65,7 @@ static void Usage(void);
  static void read_trace_pipe2(void);
  static void do_error(char *msg, bool errno_flag);
 
-#define DEBUGFS "/sys/kernel/debug/tracing/"
+#define TRACEFS "/sys/kernel/tracing/"
 
  static struct bpf_program *bpf_prog;
  static struct bpf_object *obj;
@@ -77,7 +77,7 @@ static void read_trace_pipe2(void)
  	FILE *outf;
  	char *outFname = "hbm_out.log";
 
-	trace_fd = open(DEBUGFS "trace_pipe", O_RDONLY, 0);
+	trace_fd = open(TRACEFS "trace_pipe", O_RDONLY, 0);
  	if (trace_fd < 0) {
  		printf("Error opening trace_pipe\n");
  		return;
samples/bpf/ibumad_kern.c +2 -2
index 9b193231024a..f07474c72525 100644
@@ -39,8 +39,8 @@ struct {
  /* Taken from the current format defined in
   * include/trace/events/ib_umad.h
   * and
- * /sys/kernel/debug/tracing/events/ib_umad/ib_umad_read/format
- * /sys/kernel/debug/tracing/events/ib_umad/ib_umad_write/format
+ * /sys/kernel/tracing/events/ib_umad/ib_umad_read/format
+ * /sys/kernel/tracing/events/ib_umad/ib_umad_write/format
   */
  struct ib_umad_rw_args {
  	u64 pad;
samples/bpf/lwt_len_hist.sh +1 -1
index 0eda9754f50b..11fa0a087db6 100755
@@ -5,7 +5,7 @@ NS1=lwt_ns1
  VETH0=tst_lwt1a
  VETH1=tst_lwt1b
 
-TRACE_ROOT=/sys/kernel/debug/tracing
+TRACE_ROOT=/sys/kernel/tracing
 
  function cleanup {
  	# To reset saved histogram, remove pinned map
samples/bpf/offwaketime_kern.c +1 -1
index eb4d94742e6b..23f12b47e9e5 100644
@@ -110,7 +110,7 @@ static inline int update_counts(void *ctx, u32 pid,  
 u64 delta)
  }
 
  #if 1
-/* taken from /sys/kernel/debug/tracing/events/sched/sched_switch/format  
 */
+/* taken from /sys/kernel/tracing/events/sched/sched_switch/format */
  struct sched_switch_args {
  	unsigned long long pad;
  	char prev_comm[TASK_COMM_LEN];
samples/bpf/task_fd_query_user.c +1 -1
index a33d74bd3a4b..1e61f2180470 100644
@@ -235,7 +235,7 @@ static int test_debug_fs_uprobe(char *binary_path,  
 long offset, bool is_return)
  	struct bpf_link *link;
  	ssize_t bytes;
 
-	snprintf(buf, sizeof(buf), "/sys/kernel/debug/tracing/%s_events",
+	snprintf(buf, sizeof(buf), "/sys/kernel/tracing/%s_events",
  		 event_type);
  	kfd = open(buf, O_WRONLY | O_TRUNC, 0);
  	CHECK_PERROR_RET(kfd < 0);
samples/bpf/task_fd_query_user.c +1 -1
@@ -252,7 +252,7 @@ static int test_debug_fs_uprobe(char *binary_path,  
 long offset, bool is_return)
  	close(kfd);
  	kfd = -1;
 
-	snprintf(buf, sizeof(buf), "/sys/kernel/debug/tracing/events/%ss/%s/id",
+	snprintf(buf, sizeof(buf), "/sys/kernel/tracing/events/%ss/%s/id",
  		 event_type, event_alias);
  	efd = open(buf, O_RDONLY, 0);
  	CHECK_PERROR_RET(efd < 0);
samples/bpf/test_lwt_bpf.sh +1 -1
index 65a976058dd3..db5691e6637f 100755
@@ -19,7 +19,7 @@ IPVETH3="192.168.111.2"
 
  IP_LOCAL="192.168.99.1"
 
-TRACE_ROOT=/sys/kernel/debug/tracing
+TRACE_ROOT=/sys/kernel/tracing
 
  function lookup_mac()
  {
samples/bpf/test_overhead_tp_kern.c +2 -2
index 80edadacb692..a1d53b0d8476 100644
@@ -8,7 +8,7 @@
  #include <uapi/linux/bpf.h>
  #include <bpf/bpf_helpers.h>
 
-/* from /sys/kernel/debug/tracing/events/task/task_rename/format */
+/* from /sys/kernel/tracing/events/task/task_rename/format */
  struct task_rename {
  	__u64 pad;
  	__u32 pid;
@@ -22,7 +22,7 @@ int prog(struct task_rename *ctx)
  	return 0;
  }
 
-/* from /sys/kernel/debug/tracing/events/random/urandom_read/format */
+/* from /sys/kernel/tracing/events/random/urandom_read/format */
  struct urandom_read {
  	__u64 pad;
  	int got_bits;
tools/include/uapi/linux/bpf.h +4 -5
index 464ca3f01fe7..44387b31cbde 100644
@@ -1642,17 +1642,17 @@ union bpf_attr {
   * 	Description
   * 		This helper is a "printk()-like" facility for debugging. It
   * 		prints a message defined by format *fmt* (of size *fmt_size*)
- * 		to file *\/sys/kernel/debug/tracing/trace* from DebugFS, if
+ * 		to file *\/sys/kernel/tracing/trace* from TraceFS, if
   * 		available. It can take up to three additional **u64**
   * 		arguments (as an eBPF helpers, the total number of arguments is
   * 		limited to five).
   *
   * 		Each time the helper is called, it appends a line to the trace.
- * 		Lines are discarded while *\/sys/kernel/debug/tracing/trace* is
- * 		open, use *\/sys/kernel/debug/tracing/trace_pipe* to avoid this.
+ * 		Lines are discarded while *\/sys/kernel/tracing/trace* is
+ * 		open, use *\/sys/kernel/tracing/trace_pipe* to avoid this.
   * 		The format of the trace is customizable, and the exact output
   * 		one will get depends on the options set in
- * 		*\/sys/kernel/debug/tracing/trace_options* (see also the
+ * 		*\/sys/kernel/tracing/trace_options* (see also the
   * 		*README* file under the same directory). However, it usually
   * 		defaults to something like:
   *
--

2.39.1.581.gbfd45094c4-goog

#3 lore raw
Quoted 19 lines · Stanislav Fomichev
Quoted 10 lines · Ross Zwisler

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:

Quoted 7 lines

/sys/kernel/debug/tracing

Many comments and samples in the bpf code still refer to this older debugfs path, so let's update them to avoid confusion. There are a few spots where the bpf code explicitly checks both tracefs and debugfs (tools/bpf/bpftool/tracelog.c and tools/lib/api/fs/fs.c) and I've left those alone so that the tools can continue to work with both paths.

Quoted 3 lines

Doesn't seem to apply cleanly to bpf-next?

https://github.com/kernel-patches/bpf/pull/4584

Oh, apologies, I was using Linus's master branch as my baseline. I'll send out a v2.