Skip to contentSkip to conversation

selftests: livepatch: use canonical ftrace path

PATCH In review Fushuai Wang 2 participants 3 messages Oct 10, 2025 – Oct 15, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 selftests: livepatch: use canonical ftrace path

Since v4.1 kernel, a new interface for ftrace called "tracefs" was introduced, which is usually mounted in /sys/kernel/tracing. Therefore, tracing files can now be accessed via either the legacy path /sys/kernel/debug/tracing or the newer path /sys/kernel/tracing.

---
 tools/testing/selftests/livepatch/functions.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
tools/testing/selftests/livepatch/functions.sh +5 -1
index 46991a029f7c..8ec0cb64ad94 100644
@@ -10,7 +10,11 @@ SYSFS_KERNEL_DIR="/sys/kernel"
 SYSFS_KLP_DIR="$SYSFS_KERNEL_DIR/livepatch"
 SYSFS_DEBUG_DIR="$SYSFS_KERNEL_DIR/debug"
 SYSFS_KPROBES_DIR="$SYSFS_DEBUG_DIR/kprobes"
-SYSFS_TRACING_DIR="$SYSFS_DEBUG_DIR/tracing"
+if [[ -e /sys/kernel/tracing/trace ]]; then
+	SYSFS_TRACING_DIR="$SYSFS_KERNEL_DIR/tracing"
+else
+	SYSFS_TRACING_DIR="$SYSFS_DEBUG_DIR/tracing"
+fi
 
 # Kselftest framework requirement - SKIP code is 4
 ksft_skip=4
Signature · 1 line
2.36.1
maintainer Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 6 lines · Fushuai Wang

Since v4.1 kernel, a new interface for ftrace called "tracefs" was introduced, which is usually mounted in /sys/kernel/tracing. Therefore, tracing files can now be accessed via either the legacy path /sys/kernel/debug/tracing or the newer path /sys/kernel/tracing.

Looks good to me:

Best Regards,
Petr

maintainer
#2 lore raw
In reply to Fushuai Wang
Quoted 6 lines · Fushuai Wang

Since v4.1 kernel, a new interface for ftrace called "tracefs" was introduced, which is usually mounted in /sys/kernel/tracing. Therefore, tracing files can now be accessed via either the legacy path /sys/kernel/debug/tracing or the newer path /sys/kernel/tracing.

JFYI, the patch has been comitted into livepatching.git, branch for-6.19/trivial.

Best Regards,
Petr