All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@kernel.org>
To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Shuah Khan <skhan@linuxfoundation.org>
Subject: [PATCH 2/2] tracing/selftests: Add reading all instance files to instance test
Date: Thu, 29 Oct 2026 16:28:51 -0400	[thread overview]
Message-ID: <20261029203205.969033931@kernel.org> (raw)
In-Reply-To: 20261029202849.245864353@kernel.org

From: Steven Rostedt <rostedt@goodmis.org>

Commit f4a771cc684c7 ("tracing: Have show_event_filters/triggers files take
trace array ref") fixed a bug where the show_event_filters and triggers
did not take a trace array reference allowing an instance to be removed
while active. This would have the reader of these files read data that was
freed by the remove.

Update the instance test to read all the files in the instance,
instance/events, instance/events/sched and
instance/events/sched/sched_switch directories (with the exception of not
reading trace or trace_pipe). This would hopefully catch issues with files
not taking references.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 .../ftrace/test.d/instances/instance-event.tc | 20 ++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc b/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc
index b0e9d3abbf2f..9374c20c6aaa 100644
--- a/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc
+++ b/tools/testing/selftests/ftrace/test.d/instances/instance-event.tc
@@ -44,6 +44,19 @@ instance_set() {
         done 2> /dev/null
 }
 
+instance_cat() {
+        while :; do
+		find instances/foo -maxdepth 1 -type f  ! \( -name trace -o -name trace_pipe \) -exec head {} \;
+		sleep 0.1
+		find instances/foo/events -maxdepth 1 -type f  -exec cat {} \;
+		sleep 0.1
+		find instances/foo/events/sched -maxdepth 1 -type f  -exec cat {} \;
+		sleep 0.1
+		find instances/foo/events/sched/sched_waking -maxdepth 1 -type f  -exec cat {} \;
+		sleep 0.1
+        done 2> /dev/null
+}
+
 instance_set &
 p1=$!
 echo $p1
@@ -52,15 +65,20 @@ instance_read &
 p2=$!
 echo $p2
 
+instance_cat &
+p3=$!
+echo $p3
+
 for i in `seq 10`; do
 	instance_slam
 done
 
+kill -1 $p3
 kill -1 $p2
 kill -1 $p1
 
 echo "Wait for processes to finish"
-wait $p1 $p2
+wait $p1 $p2 $p3
 echo "all processes finished, wait for cleanup"
 sleep 1
 
-- 
2.53.0

  parent reply	other threads:[~2026-10-29 20:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 20:28 [PATCH 0/2] testing/selftests: Have instance test stress instances more Steven Rostedt
2026-10-29 20:28 ` [PATCH 1/2] tracing/selftests: Fix instance test to actually test races Steven Rostedt
2026-10-30  1:01   ` Masami Hiramatsu (Google)
2026-10-30  1:20     ` Steven Rostedt
2026-10-29 20:28 ` Steven Rostedt [this message]
2026-10-30  1:24   ` [PATCH 2/2] tracing/selftests: Add reading all instance files to instance test Masami Hiramatsu (Google)

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=20261029203205.969033931@kernel.org \
    --to=rostedt@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.