Author: kib Date: Tue Jul 21 22:56:46 2015 New Revision: 285771 URL: https://svnweb.freebsd.org/changeset/base/285771
Log: 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 Modified: head/sys/kern/subr_smp.c Modified: head/sys/kern/subr_smp.c ============================================================================== --- head/sys/kern/subr_smp.c Tue Jul 21 21:46:24 2015 (r285770) +++ head/sys/kern/subr_smp.c Tue Jul 21 22:56:46 2015 (r285771) @@ -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(); _______________________________________________ svn-src-head@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"