]> git.ipfire.org Git - thirdparty/linux.git/commit
rv: Ensure synchronous cleanup for HA monitors
authorGabriele Monaco <gmonaco@redhat.com>
Mon, 1 Jun 2026 15:38:35 +0000 (17:38 +0200)
committerGabriele Monaco <gmonaco@redhat.com>
Wed, 3 Jun 2026 10:33:25 +0000 (12:33 +0200)
commit74e17bd6fc8ed7e30363bb78d4c50b38cfd71efe
tree7837b0678bcab5d3473259d46c8fed0c758cb6a5
parent700782ec8f6589c5792b323efd6e004dd183328b
rv: Ensure synchronous cleanup for HA monitors

HA monitors may start timers, all cleanup functions currently stop the
timers asynchronously to avoid sleeping in the wrong context.
Nothing makes sure running callbacks terminate on cleanup.

Run the entire HA timer callback in an RCU read-side critical section,
this way we can simply synchronize_rcu() with any pending timer and are
sure any cleanup using kfree_rcu() runs after callbacks terminated.
Additionally make sure any unlikely callback running late won't run any
code if the monitor is marked as disabled or if destruction started.
Use memory barriers to serialise with racing resets.

Fixes: f5587d1b6ec9 ("rv: Add Hybrid Automata monitor type")
Fixes: 4a24127bd6cb ("rv: Add support for per-object monitors in DA/HA")
Reviewed-by: Nam Cao <namcao@linutronix.de>
Link: https://lore.kernel.org/r/20260601153840.124372-9-gmonaco@redhat.com
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
include/rv/da_monitor.h
include/rv/ha_monitor.h