From: Zorro Lang <zlang@kernel.org>
To: fstests@vger.kernel.org
Subject: [PATCH] common/tracing: use /sys/kernel/tracing at first
Date: Fri, 10 May 2024 12:33:39 +0800 [thread overview]
Message-ID: <20240510043339.1238462-1-zlang@kernel.org> (raw)
To avoid the dependence of debugfs, tracefs is mounted on another
place -- /sys/kernel/tracing now. But for the compatibility, the
/sys/kernel/debug/tracing is still there. So change _require_ftrace
helper, try to use the new /sys/kernel/tracing path at first, or
fallback to the old one if it's not supported.
xfs/499 uses ftrace, so call _require_ftrace in it.
Signed-off-by: Zorro Lang <zlang@kernel.org>
---
common/tracing | 13 +++++++++----
tests/xfs/499 | 6 +++---
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/common/tracing b/common/tracing
index b3051c27..8613d044 100644
--- a/common/tracing
+++ b/common/tracing
@@ -4,11 +4,16 @@
#
# Routines for dealing with ftrace (or any other tracing).
-FTRACE_INSTANCES_DIR="/sys/kernel/debug/tracing/instances/"
-
_require_ftrace() {
- test -d "$FTRACE_INSTANCES_DIR" || \
- _notrun "kernel does not support ftrace"
+ if [ -d /sys/kernel/tracing/instances/ ];then
+ FTRACE_ROOT="/sys/kernel/tracing"
+ FTRACE_INSTANCES_DIR="/sys/kernel/tracing/instances"
+ elif [ -d /sys/kernel/debug/tracing/instances/ ];then
+ FTRACE_ROOT="/sys/kernel/debug/tracing"
+ FTRACE_INSTANCES_DIR="/sys/kernel/debug/tracing/instances"
+ else
+ _notrun "The ftrace is not supported, or tracefs is not mounted"
+ fi
}
_ftrace_cleanup() {
diff --git a/tests/xfs/499 b/tests/xfs/499
index 9672f95d..883415dc 100755
--- a/tests/xfs/499
+++ b/tests/xfs/499
@@ -14,18 +14,18 @@ _begin_fstest auto quick
_register_cleanup "_cleanup" BUS
# Import common functions.
+. ./common/tracing
# real QA test starts here
_supported_fs xfs
+_require_ftrace
_require_command "$CC_PROG" "cc"
cprog=$tmp.ftrace.c
oprog=$tmp.ftrace
sedprog=$tmp.ftrace.sed
-ftrace_dir=$DEBUGFS_MNT/tracing/events/xfs
-
-test -d $ftrace_dir || _notrun "ftrace not enabled"
+ftrace_dir=$FTRACE_ROOT/events/xfs
# The second argument to __print_symbolic is stringified in the tracepoint's
# fmt file, so we look for "{ NUM, STRING }" and try to separate each of them
--
2.44.0
next reply other threads:[~2024-05-10 4:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-10 4:33 Zorro Lang [this message]
2024-05-10 15:17 ` [PATCH] common/tracing: use /sys/kernel/tracing at first Darrick J. Wong
2024-05-11 4:46 ` Zorro Lang
2024-05-11 14:53 ` Darrick J. Wong
2024-05-17 15:58 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240510043339.1238462-1-zlang@kernel.org \
--to=zlang@kernel.org \
--cc=fstests@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox