From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46865) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9WBH-0003gb-Q0 for qemu-devel@nongnu.org; Thu, 17 Dec 2015 05:53:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9WBE-00059Q-5j for qemu-devel@nongnu.org; Thu, 17 Dec 2015 05:53:07 -0500 Received: from bombadil.infradead.org ([2001:1868:205::9]:33309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9WBD-00056z-WD for qemu-devel@nongnu.org; Thu, 17 Dec 2015 05:53:04 -0500 Date: Thu, 17 Dec 2015 11:52:38 +0100 From: Peter Zijlstra Message-ID: <20151217105238.GA6375@twins.programming.kicks-ass.net> References: <1450347932-16325-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1450347932-16325-1-git-send-email-mst@redhat.com> Subject: Re: [Qemu-devel] [PATCH] virtio_ring: use smp_store_mb List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org, Jason Wang , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org On Thu, Dec 17, 2015 at 12:32:53PM +0200, Michael S. Tsirkin wrote: > +static inline void virtio_store_mb(bool weak_barriers, > + __virtio16 *p, __virtio16 v) > +{ > +#ifdef CONFIG_SMP > + if (weak_barriers) > + smp_store_mb(*p, v); > + else > +#endif > + { > + WRITE_ONCE(*p, v); > + mb(); > + } > +} This is a different barrier depending on SMP, that seems wrong. smp_mb(), as (should be) used by smp_store_mb() does not provide a barrier against IO. mb() otoh does. Since this is virtIO I would expect you always want mb().