From owner-svn-src-head@freebsd.org Tue Jul 21 22:56:47 2015 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D78D19A748A; Tue, 21 Jul 2015 22:56:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C84FD1A84; Tue, 21 Jul 2015 22:56:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.70]) by repo.freebsd.org (8.14.9/8.14.9) with ESMTP id t6LMulws097991; Tue, 21 Jul 2015 22:56:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.14.9/8.14.9/Submit) id t6LMul0x097990; Tue, 21 Jul 2015 22:56:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201507212256.t6LMul0x097990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 21 Jul 2015 22:56:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r285771 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jul 2015 22:56:47 -0000 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();