From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: oe-lkp@lists.linux.dev, lkp@intel.com,
linux-kernel@vger.kernel.org,
Shuah Khan <skhan@linuxfoundation.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
linux-trace-kernel@vger.kernel.org, oliver.sang@intel.com
Subject: [PATCH] selftests/tracing: Fix flakiness in trigger-hist-poll.tc by waiting for task exit
Date: Tue, 21 Jul 2026 09:20:36 +0900 [thread overview]
Message-ID: <178459323652.354837.10711230683477156733.stgit@devnote2> (raw)
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Commit c5c413534d40 ("selftests/tracing: Have trigger-hist-poll.tc use
sched_process_exit") changed the target event from sched_process_free to
sched_process_exit to avoid timeouts under CONFIG_RCU_LAZY.
However, sched_process_exit fires inside do_exit() before the exiting task
completes teardown and before the parent shell reaps it. When poll unblocks
upon sched_process_exit, checking whether /proc/${BGPID} exists immediately
after poll returns causes a race condition between poll exiting and the
parent shell reaping the child process.
Fix this by waiting for the background sleep process (wait ${BGPID}) and
removing the fragile /proc/${BGPID} check. Checking whether the event was
logged in the trace buffer already verifies that poll did not exit before
the event occurred.
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202607161651.ab0a5bf6-lkp@intel.com
Fixes: c5c413534d40 ("selftests/tracing: Have trigger-hist-poll.tc use sched_process_exit")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
.../ftrace/test.d/trigger/trigger-hist-poll.tc | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-poll.tc b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-poll.tc
index 04eb8546fc07..d54d54f9ec77 100644
--- a/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-poll.tc
+++ b/tools/testing/selftests/ftrace/test.d/trigger/trigger-hist-poll.tc
@@ -38,11 +38,7 @@ BGPID=$!
${POLL} -I -t 4000 ${EVENT}/hist
echo 0 > tracing_on
-if [ -d /proc/${BGPID} ]; then
- echo "poll exits too soon"
- kill -KILL ${BGPID} ||:
- exit_fail
-fi
+wait ${BGPID} 2>/dev/null ||:
if ! grep -qw "sleep" trace; then
echo "poll exits before event happens"
@@ -60,11 +56,7 @@ BGPID=$!
${POLL} -P -t 4000 ${EVENT}/hist
echo 0 > tracing_on
-if [ -d /proc/${BGPID} ]; then
- echo "poll exits too soon"
- kill -KILL ${BGPID} ||:
- exit_fail
-fi
+wait ${BGPID} 2>/dev/null ||:
if ! grep -qw "sleep" trace; then
echo "poll exits before event happens"
@@ -72,3 +64,5 @@ if ! grep -qw "sleep" trace; then
fi
exit_pass
+
+
reply other threads:[~2026-07-21 0:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=178459323652.354837.10711230683477156733.stgit@devnote2 \
--to=mhiramat@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-lkp@lists.linux.dev \
--cc=oliver.sang@intel.com \
--cc=rostedt@goodmis.org \
--cc=skhan@linuxfoundation.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®