From: Jaewon Jung <jaewon8868@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
Shuah Khan <shuah@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org
Subject: [PATCH] selftests/ftrace: Add debugfs requirement suffix
Date: Sun, 25 Oct 2026 16:29:41 +0900 [thread overview]
Message-ID: <20261025072956.1739981-1-jaewon8868@gmail.com> (raw)
Add a :debugfs requirement suffix to check interfaces under debugfs.
Use it in the kprobe optimization test to report unsupported instead
of failed when debugfs is unavailable.
Tested on x86_64 with QEMU:
- debugfs not mounted: UNSUPPORTED
- debugfs mounted: PASS
Signed-off-by: Jaewon Jung <jaewon8868@gmail.com>
---
tools/testing/selftests/ftrace/test.d/functions | 10 ++++++++++
.../selftests/ftrace/test.d/kprobe/kprobe_opt_types.tc | 4 ++--
tools/testing/selftests/ftrace/test.d/template | 1 +
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/ftrace/test.d/functions b/tools/testing/selftests/ftrace/test.d/functions
index 826141e299e5..3cf8ac5fb4d4 100644
--- a/tools/testing/selftests/ftrace/test.d/functions
+++ b/tools/testing/selftests/ftrace/test.d/functions
@@ -145,6 +145,7 @@ check_requires() { # Check required files and tracers
p=${i%:program}
r=${i%:README}
t=${i%:tracer}
+ d=${i%:debugfs}
if [ "$p" != "$i" ]; then
if ! which "$p" ; then
echo "Required program $p is not found."
@@ -166,6 +167,15 @@ check_requires() { # Check required files and tracers
echo "Required feature pattern \"$r\" is not in README."
exit_unsupported
fi
+ elif [ "$d" != "$i" ]; then
+ DEBUGFS_DIR=$(awk '$3 == "debugfs" { print $2; exit }' /proc/mounts)
+ if [ -z "$DEBUGFS_DIR" ]; then
+ echo "Required filesystem debugfs is not mounted."
+ exit_unsupported
+ elif [ ! -e "$DEBUGFS_DIR/$d" ]; then
+ echo "Required debugfs interface $d doesn't exist."
+ exit_unsupported
+ fi
elif [ ! -e "$i" ]; then
echo "Required feature interface $i doesn't exist."
exit_unsupported
diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_opt_types.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_opt_types.tc
index 9f5d99328086..25f7192f887b 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_opt_types.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_opt_types.tc
@@ -2,7 +2,7 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2023 Akanksha J N, IBM corporation
# description: Register/unregister optimized probe
-# requires: kprobe_events
+# requires: kprobe_events kprobes/list:debugfs
case `uname -m` in
x86_64)
@@ -22,7 +22,7 @@ for i in `seq 0 255`; do
echo "p:testprobe $FUNCTION_FORK+${i}" > kprobe_events || continue
echo 1 > events/kprobes/enable || continue
(echo "forked")
- PROBE=$(grep $FUNCTION_FORK /sys/kernel/debug/kprobes/list)
+ PROBE=$(grep $FUNCTION_FORK "$DEBUGFS_DIR/kprobes/list")
echo 0 > events/kprobes/enable
echo > kprobe_events
if echo $PROBE | grep -q OPTIMIZED; then
diff --git a/tools/testing/selftests/ftrace/test.d/template b/tools/testing/selftests/ftrace/test.d/template
index 2cd8947edf72..d4a2500498f6 100644
--- a/tools/testing/selftests/ftrace/test.d/template
+++ b/tools/testing/selftests/ftrace/test.d/template
@@ -5,6 +5,7 @@
# The required tracer needs :tracer suffix, e.g. function:tracer
# The required README string needs :README suffix, e.g. "x8/16/32/64":README
# and the README string is treated as a fixed-string instead of regexp pattern.
+# The required debugfs interface needs :debugfs suffix, e.g. kprobes/list:debugfs
# you have to add ".tc" extention for your testcase file
# Note that all tests are run with "errexit" option.
--
2.43.0
next reply other threads:[~2026-10-25 7:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-25 7:29 Jaewon Jung [this message]
2026-10-26 8:52 ` Masami Hiramatsu
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=20261025072956.1739981-1-jaewon8868@gmail.com \
--to=jaewon8868@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=shuah@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
all inboxes | Powered by JetHome®