lib/on-cpus: Add barrier after func call
It's reasonable for users of on_cpu() and on_cpumask() to assume they can read data that 'func' has written when the call completes. Ensure the caller doesn't observe a completion (target cpus are again idle) without also being able to observe any writes which were made by func(). Do so by adding barriers to implement the following target-cpu calling-cpu ---------- ----------- func() /* store something */ /* wait for target to be idle */ smp_wmb(); smp_rmb(); set_cpu_idle(smp_processor_id(), true); /* load what func() stored */ Suggested-by:Alexandru Elisei <alexandru.elisei@arm.com> Reviewed-by:
Eric Auger <eric.auger@redhat.com> Signed-off-by:
Andrew Jones <andrew.jones@linux.dev>
Loading
Please register or sign in to comment