1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

The smp_rendezvous_cpus() function should ensure that all accesses

done by the functions called on other CPUs, are visible to the caller.
Pair otherwise useless acquire on smp_rv_waiters[3] with a release add
to ensure synchronized with relation, which guarantees visibility.

Reviewed by:	alc
Sponsored by:	The FreeBSD Foundation
MFC after:	3 weeks
This commit is contained in:
Konstantin Belousov 2015-07-21 22:56:46 +00:00
parent 705f4d9c6a
commit e637a6e3f9
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=285771

View File

@ -455,8 +455,13 @@ smp_rendezvous_action(void)
* This means that no member of smp_rv_* pseudo-structure will be
* accessed by this target CPU after this point; in particular,
* memory pointed by smp_rv_func_arg.
*
* The release semantic ensures that all accesses performed by
* the current CPU are visible when smp_rendezvous_cpus()
* returns, by synchronizing with the
* atomic_load_acq_int(&smp_rv_waiters[3]).
*/
atomic_add_int(&smp_rv_waiters[3], 1);
atomic_add_rel_int(&smp_rv_waiters[3], 1);
td->td_critnest--;
KASSERT(owepreempt == td->td_owepreempt,
@ -522,6 +527,11 @@ smp_rendezvous_cpus(cpuset_t map,
* CPUs to finish the rendezvous, so that smp_rv_*
* pseudo-structure and the arg are guaranteed to not
* be in use.
*
* Load acquire synchronizes with the release add in
* smp_rendezvous_action(), which ensures that our caller sees
* all memory actions done by the called functions on other
* CPUs.
*/
while (atomic_load_acq_int(&smp_rv_waiters[3]) < ncpus)
cpu_spinwait();