On Mon, 2026-05-18 at 13:54 +0200, Gabriele Monaco wrote:
> Something like:
>
> void __ha_monitor_timer_callback() {
> guard(rcu)(); //this is only for waiters, let them wait more
>
> if (unlikely(!da_monitor_handling_event(&ha_mon->da_mon)))
> return;
> smp_rmb();
> curr_state = READ_ONCE(ha_mon->da_mon.curr_state);
> ...
> }
>
> void da_monitor_reset() {
> da_monitor_reset_hook(da_mon);
> WRITE_ONCE(da_mon->monitoring, 0);
> smp_wmb();
> WRITE_ONCE(da_mon->curr_state, model_get_initial_state());
> }
That's obviously not going to work unless I read curr_state earlier (and use the
acquire/release helpers while at it):
void __ha_monitor_timer_callback() {
guard(rcu)(); //this is only for waiters, let them wait more
curr_state = smp_load_acquire(&ha_mon->da_mon.curr_state);
if (unlikely(!da_monitor_handling_event(&ha_mon->da_mon)))
return;
...
}
void da_monitor_reset() {
da_monitor_reset_hook(da_mon);
WRITE_ONCE(da_mon->monitoring, 0);
smp_store_release(&da_mon->curr_state, model_get_initial_state());
}