Linux Trace Kernel
 help / color / mirror / Atom feed
From: Gabriele Monaco <gmonaco@redhat.com>
To: linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Nam Cao	 <namcao@linutronix.de>,
	linux-trace-kernel@vger.kernel.org
Cc: Karl Mehltretter <kmehltretter@gmail.com>, Wen Yang <wen.yang@linux.dev>
Subject: Re: [PATCH] rv: Represent uninitialised and dying DA monitors
Date: Tue, 01 Dec 2026 16:36:10 +0100	[thread overview]
Message-ID: <d8ea35200c3b007b01f9e54f21d771652e4b6325.camel@redhat.com> (raw)
In-Reply-To: <20261201073453.56226-2-gmonaco@redhat.com>

On Tue, 2026-12-01 at 08:34 +0100, Gabriele Monaco wrote:
> DA monitors overload the monitoring field to represent states that don't
> belong to it. For example, it is used to understand whether a timer (HA)
> was set up and hence needs cancelling.
> Racing events may cause a monitor to reset it's monitoring flag while
> concurrently a timer is started, so the monitoring flag loses meaning.
> 
> Add 2 new flags in the struct da_monitor without increasing it's size:
> * started: the monitor was started at least once
> * dead: the destruction of the monitor was started
> 
> These flags keep their status on reset and allow to understand when a
> monitor needs a timer to be set-up, can cancel an already initialised
> timer, or should stop starting/handling events to avoid races.
> 
> These flags don't avoid use after free issues by themselves, but coupled
> with an RCU grace period before freeing monitors (where applicable), can
> guarantee no resources are used after free.
> 
> Fixes: 700782ec8f65 ("rv: Add automatic cleanup handlers for per-task HA
> monitors")
> Fixes: f5587d1b6ec9 ("rv: Add Hybrid Automata monitor type")
> Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
> ---

This approach is yet again opening a can of worms..

In the end of the day what Karl proposed (initialise timers once at the
beginning) is probably the best and simplest solution.

I'm going to try and draft something like that, adding a path for per-task
monitors too.

Gabriele

      parent reply	other threads:[~2026-12-01 15:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01  7:34 [PATCH] rv: Represent uninitialised and dying DA monitors Gabriele Monaco
2026-12-01  7:57 ` sashiko-bot
2026-12-01 15:36 ` Gabriele Monaco [this message]

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=d8ea35200c3b007b01f9e54f21d771652e4b6325.camel@redhat.com \
    --to=gmonaco@redhat.com \
    --cc=kmehltretter@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=namcao@linutronix.de \
    --cc=rostedt@goodmis.org \
    --cc=wen.yang@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox