]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests: livepatch: use canonical ftrace path
authorFushuai Wang <wangfushuai@baidu.com>
Fri, 10 Oct 2025 12:07:27 +0000 (20:07 +0800)
committerPetr Mladek <pmladek@suse.com>
Wed, 15 Oct 2025 12:50:46 +0000 (14:50 +0200)
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.

Signed-off-by: Fushuai Wang <wangfushuai@baidu.com>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Tested-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
tools/testing/selftests/livepatch/functions.sh

index 46991a029f7c64ace3945727b3540521ffe2e529..8ec0cb64ad94a6c3094e8d1a2a1eff028fc672dd 100644 (file)
@@ -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