From: Crystal Wood <crwood@redhat.com>
To: Tomas Glozar <tglozar@redhat.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
John Kacur <jkacur@redhat.com>,
linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH 1/4] tracing/osnoise: Per-cpu mutex and fd detachment
Date: Tue, 01 Sep 2026 11:49:04 -0500 [thread overview]
Message-ID: <1aeef720f40a21514c42ed7a76779086e867ebaf.camel@redhat.com> (raw)
In-Reply-To: <CAP4=nvTE0YsxMUTJuC2uT=T-5TX29JDZ1axR6nZBP7XjMNV0WQ@mail.gmail.com>
On Tue, 2026-09-01 at 15:32 +0200, Tomas Glozar wrote:
> On Mon, Aug 24, 2026 at 11:16 PM Crystal Wood <crwood@redhat.com> wrote:
> >
> > Clean up a variety of synchronization issues and related bandaids
> > by having a per-cpu mutex that guards changes to kthread, and
> > fd open/close/revoke.
> >
> > Replace the SIGKILL hack for userspace timerlat threads (that doesn't
> > even work, because we don't wait for the process to actually die) with
> > a mutex-protected detachment mechanism. The mutex should be uncontended
> > during normal timerlat_fd_read() usage.
> >
>
> I agree with detaching the file descriptor, that seems to be the right
> pattern. An alternative would be to make the user process to block the
> tracer until it detaches, but that would make it less consistent with
> kernel thread mode - which owns (creates/stops) the threads - as well
> to make it more prone to locking issues during user process exit.
>
> Can we perhaps clean up the synchronization issues without using a0
> mutex? If one thread is switching timerlat between no thread, user
> thread, and kernel thread, it could mark the osn percpu structure
> "busy" and reject all other switching operations until it is finished.
> As you say, the resource should be uncontended during normal usage, so
> the user shouldn't care about being returned an error instead of
> waiting. Or am I missing something?
The issue is waiting for the completion of an fd operation that has
already passed the "busy" check. Maybe something custom could be done,
but a mutex seemed simplest at the time.
That said, there is another issue with this patch in its current state,
in that you need to wait for the timer to wake the timerlat thread in
order to get the mutex to detach (and maybe longer depending on mutex
fairness issues). So it could take a long time if the user sets a long
period.
I've also recently seen some additional issues that I'm in the process
of debugging.
-Crystal
next prev parent reply other threads:[~2026-09-01 16:49 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
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 [this message]
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=1aeef720f40a21514c42ed7a76779086e867ebaf.camel@redhat.com \
--to=crwood@redhat.com \
--cc=jkacur@redhat.com \
--cc=linux-trace-kernel@vger.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