From: Crystal Wood <crwood@redhat.com>
To: Steven Rostedt <rostedt@goodmis.org>, sashiko-bot@kernel.org
Cc: sashiko-reviews@lists.linux.dev, linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] tracing/osnoise: Per-cpu mutex and fd detachment
Date: Wed, 26 Aug 2026 16:19:29 -0500 [thread overview]
Message-ID: <588ce7912915573ccba7439d7e50a90d7941c764.camel@redhat.com> (raw)
In-Reply-To: <20260826153132.1333fac6@gandalf.local.home>
On Wed, 2026-08-26 at 15:31 -0400, Steven Rostedt wrote:
> On Mon, 24 Aug 2026 21:30:37 +0000
> sashiko-bot@kernel.org wrote:
>
> > [Severity: High]
> > Can holding osn_var->lock while calling kthread_stop() cause a deadlock?
> >
> > kthread_stop() blocks waiting for the target kthread to exit. However, if
> > the kthread is currently handling a migration request in
> > osnoise_migration_pending() (shown slightly earlier in the diff), it will
> > attempt to acquire this same osn_var->lock before it can clear its state and
> > exit:
>
> This code has a lot of nastiness in the locking with regard to the thread.
> I haven't looked deeply at your patch, but the fact that Sashiko pointed
> out a possible deadlock I think you may be hitting the mess I was hitting.
>
> Have you looked at this thread: https://lore.kernel.org/all/20240820130001.124768-1-tglozar@redhat.com/
That thread is about user fd sync, which is what this patch is trying to
address.
This particular deadlock is with kernel threads, in a corner case of
getting migrated even though we try to pin them to one cpu. We can get
rid of this migration code and just have stop_kthread() take care of it,
adding a get/put_task_struct() so that it's OK for the thread to die
early. This way we can also handle any other abnormal thread exits.
I'll respond to the rest of the Sashiko comments soon.
>
> It has some tests I ran along with tracing that detected issues. Of course,
> everything needs to be run with lockdep enabled too.
I did run with lockdep (and some custom hacky state tracking) but
forcing migration is a hole in my test coverage.
Is there a particular test you're suggesting?
-Crystal
next prev parent reply other threads:[~2026-08-26 21:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-24 21:15 [PATCH 0/4] tracing/osnoise: Synchronization fixes Crystal Wood
2026-08-24 21:15 ` [PATCH 1/4] tracing/osnoise: Per-cpu mutex and fd detachment Crystal Wood
2026-08-24 21:30 ` sashiko-bot
2026-08-26 19:31 ` Steven Rostedt
2026-08-26 21:19 ` Crystal Wood [this message]
2026-08-27 0:41 ` Steven Rostedt
2026-08-27 9:04 ` Tomas Glozar
2026-08-26 22:34 ` Crystal Wood
2026-09-01 13:32 ` Tomas Glozar
2026-09-01 16:49 ` Crystal Wood
2026-08-24 21:15 ` [PATCH 2/4] tracing/osnoise: timerlat_main: Disable migration before per-cpu access Crystal Wood
2026-08-24 21:29 ` sashiko-bot
2026-08-24 21:15 ` [PATCH 3/4] tracing/osnoise: start_kthread: Always check OSN_WORKLOAD Crystal Wood
2026-08-24 21:15 ` [PATCH 4/4] tracing/osnoise: Take trace_types_lock in timerlat_fd_open Crystal Wood
2026-08-24 21:24 ` sashiko-bot
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=588ce7912915573ccba7439d7e50a90d7941c764.camel@redhat.com \
--to=crwood@redhat.com \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=sashiko-bot@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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.