On Tue, 8 Jul 2025 09:42:19 +0200
Nam Cao <nam...@linutronix.de> wrote:

> So yes, smp_rmb() is only useful inbetween reads, and smp_wmb() is
> only userful inbetween writes.

Hmm, I wonder if barriers isn't needed but atomic values are?

That is, it looks like rv_monitoring_on() is looking to read the
current state, where as turn_monitoring_on/off() changes the state.

Perhaps instead of barriers, it should use atomics?

 bool rv_monitoring_on(void)
 {
        return atomic_read(&monitoring_on);
 }
 
 static void turn_monitoring_off(void)
 {
        atomic_set(&monitoring_on, 0);
 }
 

Doesn't atomic make sure the values are seen when they are changed?

As this code is more about looking at state and not ordering, and I
think that's what atomics are about.

-- Steve

Reply via email to