From: Crystal Wood <crwood@redhat.com>
To: Tomas Glozar <tglozar@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
John Kacur <jkacur@redhat.com>,
Luis Goncalves <lgoncalv@redhat.com>,
LKML <linux-kernel@vger.kernel.org>,
Linux Trace Kernel <linux-trace-kernel@vger.kernel.org>
Subject: Re: [PATCH] tracing/osnoise: Fix OSN_WORKLOAD-related crash
Date: Wed, 14 Jan 2026 13:49:17 -0600 [thread overview]
Message-ID: <bbb834f13cb1480b2517497481a1b3e0137d089a.camel@redhat.com> (raw)
In-Reply-To: <20260114123547.583859-1-tglozar@redhat.com>
On Wed, 2026-01-14 at 13:35 +0100, Tomas Glozar wrote:
> A kernel panic was observed in the timerlat tracer with the following
> reproducer:
>
> #!/bin/bash
> while true; do
> rtla timerlat hist -u -d 5s & PID=$!
> sleep 2
> echo OSNOISE_WORKLOAD > /sys/kernel/tracing/osnoise/options
> rtla timerlat hist -k -d 1s
> done
>
> The kernel first displays several WARN traces with the following pattern:
>
> WARNING: CPU: 1 PID: 1822 at kernel/trace/trace_osnoise.c:1959 stop_kthread+0xb7/0xc0
The line number doesn't match up for me; is this the first or second
WARN_ON in that function?
> and finally a null pointer reference BUG:
>
> BUG: kernel NULL pointer dereference, address: 0000000000000030
> ...
> CPU: 1 UID: 0 PID: 2155 Comm: timerlatu/1
> ...
> Call Trace:
> ...
> ? timerlat_fd_read+0xf2/0x370
> ? timerlat_fd_read+0xee/0x370
> vfs_read+0xe8/0x370
> ksys_read+0x6d/0xf0
> do_syscall_64+0x7d/0x160
> ...
> entry_SYSCALL_64_after_hwframe+0x76/0x7e
What's the actual fault location? And those ? lines in the call trace
are "considered to be additional clues" rather than actual unwound
frames; what was in the ... above them?
> static int osnoise_options_open(struct inode *inode, struct file *file)
> {
> return seq_open(file, &osnoise_options_seq_ops);
> @@ -2229,6 +2254,10 @@ static ssize_t osnoise_options_write(struct file *filp, const char __user *ubuf,
> if (option < 0)
> return -EINVAL;
>
> + retval = osnoise_validate_option(option, enable);
> + if (retval != 0)
> + return retval;
> +
> /*
> * trace_types_lock is taken to avoid concurrency on start/stop.
> */
Shouldn't this be done under interface_lock to avoid concurrent
timerlat_fd_open()? FWIW, your test script doesn't appear to cover the
case of option setting racing with timerlat starting (due to the 2
second delay).
Of course, this is complicated by stop_per_cpu_kthreads() happening
before interface_lock is acquired. Do we know why that happens outside
the lock? That might even be the actual cause of this bug.
Though even in the non-race case, we might still want to return -EBUSY
rather than just killing the thread (which might still have races since
we don't wait for the user thread to die).
-Crystal
next prev parent reply other threads:[~2026-01-14 19:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-14 12:35 Tomas Glozar
2026-01-14 19:49 ` Crystal Wood [this message]
2026-01-15 13:32 ` Tomas Glozar
2026-01-15 15:52 ` Steven Rostedt
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=bbb834f13cb1480b2517497481a1b3e0137d089a.camel@redhat.com \
--to=crwood@redhat.com \
--cc=jkacur@redhat.com \
--cc=lgoncalv@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mhiramat@kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglozar@redhat.com \
/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®