From owner-svn-src-all@FreeBSD.ORG Fri Sep 14 12:24:49 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 185FE106566C; Fri, 14 Sep 2012 12:24:49 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id DE78E8FC0A; Fri, 14 Sep 2012 12:24:48 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 3F3CDB968; Fri, 14 Sep 2012 08:24:48 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Date: Fri, 14 Sep 2012 08:17:54 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201209131456.03422.jhb@freebsd.org> <2045684227.3044.1347601672495.JavaMail.root@daemoninthecloset.org> <20120914075520.GA37286@deviant.kiev.zoral.com.ua> In-Reply-To: <20120914075520.GA37286@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201209140817.54376.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Fri, 14 Sep 2012 08:24:48 -0400 (EDT) Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Bryan Venteicher , Peter Grehan Subject: Re: svn commit: r240427 - head/sys/dev/virtio X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 14 Sep 2012 12:24:49 -0000 On Friday, September 14, 2012 3:55:20 am Konstantin Belousov wrote: > On Fri, Sep 14, 2012 at 12:47:52AM -0500, Bryan Venteicher wrote: > > > > I also found myself wanting an atomic_load_rel_*() type function. > > > > > > That would be odd I think. _rel barriers only affect stores, so > > > there would be no defined ordering between the load and the > > > subsequent stores. (With our current definitions of _acq and > > > _rel.) If you need a full fence for some reason, than a plain > > > mb() may be the best thing in that case. > > > > > > > I'm able to batch add descriptors (via vq_ring_update_avail()), > > but when checking if I must notify the host, I need to make sure > > the latest avail->idx is visible before checking the flag from > > the host on whether notifications are disabled. Gratuitous > > notifications are fine, but skipping one is not. > > > > In the patch, I kludge this with: > > atomic_add_rel_16(&flags, 0); > > foo = flags; > Don't you need > atomic_store_rel_16(&foo, flags); > instead ? > > You might do a cas_rel over the containing 32bit word as well. Yes, the right barrier here would be to use the barrier on the assignment to foo. That ensures all other writes post before the write to 'foo'. -- John Baldwin