Re: [PATCH] stop_machine: Avoid potential race behaviour of multi_stop_data::state

From: Peter Zijlstra
Date: Tue Oct 17 2023 - 09:14:59 EST


On Tue, Oct 17, 2023 at 11:24:40AM +0100, Mark Rutland wrote:

> That said, if we really want to avoid the non-atomic read, it's probably better
> to have multi_cpu_stop() pass curstate as a paramter to ack_state. That or fold
> ack_state() into multi_cpu_stop() and use curstate directly.

Right. Also, that smp_wmb() needs a comment. Or perhaps
smp_store_release().