* [PATCH] selftests/tracing: Have trigger-hist-poll.tc use sched_process_exit
@ 2026-07-08 20:34 Steven Rostedt
2026-07-08 20:35 ` Steven Rostedt
0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2026-07-08 20:34 UTC (permalink / raw)
To: LKML, Linux Trace Kernel, linux-kselftest
Cc: Masami Hiramatsu, Mathieu Desnoyers, Shuah Khan, Shuah Khan
From: Steven Rostedt <rostedt@goodmis.org>
Currently trigger-hist-poll.tc uses sched_process_free to test the polling
of the histogram file. The way it does that is to run sleep, then execute
the poll.c code that polls on the sched_process_free for up to 4 seconds
to test that when sleep triggers the sched_process_free trace event, it
will update the histogram and wake the poll.c code up.
The issue is that sched_process_free trace event is called by
delayed_put_task_struct() which is called after a RCU grace period has
ended. If CONFIG_RCU_LAZY is enabled, RCU callbacks are batched together
and do not execute right away. This causes the delayed_put_task_struct()
to be called after the poll.c function finishes and it will report an
error that it did not wake up on the event. That's because the event
didn't trigger during its wait time.
Use sched_process_exit instead, which is called when a process exits and
doesn't depend on RCU callbacks that may be delayed.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
.../selftests/ftrace/test.d/trigger/trigger-hist-poll.tc | 4 ++--
1 file changed, 2 insertions(+), 2 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 8d275e3238d9..04eb8546fc07 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
@@ -1,7 +1,7 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# description: event trigger - test poll wait on histogram
-# requires: set_event events/sched/sched_process_free/trigger events/sched/sched_process_free/hist
+# requires: set_event events/sched/sched_process_exit/trigger events/sched/sched_process_exit/hist
# flags: instance
POLL=${FTRACETEST_ROOT}/poll
@@ -11,7 +11,7 @@ if [ ! -x ${POLL} ]; then
exit_unresolved
fi
-EVENT=events/sched/sched_process_free/
+EVENT=events/sched/sched_process_exit/
# Check poll ops is supported. Before implementing poll on hist file, it
# returns soon with POLLIN | POLLOUT, but not POLLPRI.
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] selftests/tracing: Have trigger-hist-poll.tc use sched_process_exit
2026-07-08 20:34 [PATCH] selftests/tracing: Have trigger-hist-poll.tc use sched_process_exit Steven Rostedt
@ 2026-07-08 20:35 ` Steven Rostedt
2026-07-08 20:37 ` Steven Rostedt
0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2026-07-08 20:35 UTC (permalink / raw)
To: LKML, Linux Trace Kernel, linux-kselftest
Cc: Masami Hiramatsu, Mathieu Desnoyers, Shuah Khan, Shuah Khan
On Wed, 8 Jul 2026 16:34:36 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> From: Steven Rostedt <rostedt@goodmis.org>
>
> Currently trigger-hist-poll.tc uses sched_process_free to test the polling
> of the histogram file. The way it does that is to run sleep, then execute
> the poll.c code that polls on the sched_process_free for up to 4 seconds
> to test that when sleep triggers the sched_process_free trace event, it
> will update the histogram and wake the poll.c code up.
>
> The issue is that sched_process_free trace event is called by
> delayed_put_task_struct() which is called after a RCU grace period has
> ended. If CONFIG_RCU_LAZY is enabled, RCU callbacks are batched together
> and do not execute right away. This causes the delayed_put_task_struct()
> to be called after the poll.c function finishes and it will report an
> error that it did not wake up on the event. That's because the event
> didn't trigger during its wait time.
>
> Use sched_process_exit instead, which is called when a process exits and
> doesn't depend on RCU callbacks that may be delayed.
>
> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
> ---
I forgot to mention that I tested this with and without CONFIG_RCU_LAZY.
With that config disabled, the test passes. With it enabled, it always
fails.
-- Steve
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/tracing: Have trigger-hist-poll.tc use sched_process_exit
2026-07-08 20:35 ` Steven Rostedt
@ 2026-07-08 20:37 ` Steven Rostedt
2026-07-09 4:58 ` Masami Hiramatsu
0 siblings, 1 reply; 4+ messages in thread
From: Steven Rostedt @ 2026-07-08 20:37 UTC (permalink / raw)
To: LKML, Linux Trace Kernel, linux-kselftest
Cc: Masami Hiramatsu, Mathieu Desnoyers, Shuah Khan, Shuah Khan
On Wed, 8 Jul 2026 16:35:39 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> I forgot to mention that I tested this with and without CONFIG_RCU_LAZY.
> With that config disabled, the test passes. With it enabled, it always
> fails.
And I also traced it with:
trace-cmd set -p function_graph -l event_hist_poll -O funcgraph-retval
and it shows the sched_process_free being called for the sleep process
*after* the poll finishes.
-- Steve
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] selftests/tracing: Have trigger-hist-poll.tc use sched_process_exit
2026-07-08 20:37 ` Steven Rostedt
@ 2026-07-09 4:58 ` Masami Hiramatsu
0 siblings, 0 replies; 4+ messages in thread
From: Masami Hiramatsu @ 2026-07-09 4:58 UTC (permalink / raw)
To: Steven Rostedt
Cc: LKML, Linux Trace Kernel, linux-kselftest, Masami Hiramatsu,
Mathieu Desnoyers, Shuah Khan, Shuah Khan
On Wed, 8 Jul 2026 16:37:31 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> On Wed, 8 Jul 2026 16:35:39 -0400
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > I forgot to mention that I tested this with and without CONFIG_RCU_LAZY.
> > With that config disabled, the test passes. With it enabled, it always
> > fails.
>
> And I also traced it with:
>
> trace-cmd set -p function_graph -l event_hist_poll -O funcgraph-retval
>
> and it shows the sched_process_free being called for the sleep process
> *after* the poll finishes.
Thanks for fix and tested!!
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> -- Steve
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-07-09 4:58 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-08 20:34 [PATCH] selftests/tracing: Have trigger-hist-poll.tc use sched_process_exit Steven Rostedt
2026-07-08 20:35 ` Steven Rostedt
2026-07-08 20:37 ` Steven Rostedt
2026-07-09 4:58 ` Masami Hiramatsu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox