From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934808AbbLQOCQ (ORCPT ); Thu, 17 Dec 2015 09:02:16 -0500 Received: from casper.infradead.org ([85.118.1.10]:37539 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756149AbbLQOCP (ORCPT ); Thu, 17 Dec 2015 09:02:15 -0500 Date: Thu, 17 Dec 2015 15:02:12 +0100 From: Peter Zijlstra To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Jason Wang , qemu-devel@nongnu.org Subject: Re: [PATCH] virtio_ring: use smp_store_mb Message-ID: <20151217140212.GB6344@twins.programming.kicks-ass.net> References: <1450347932-16325-1-git-send-email-mst@redhat.com> <20151217112222.GC6375@twins.programming.kicks-ass.net> <20151217151705-mutt-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151217151705-mutt-send-email-mst@redhat.com> User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 17, 2015 at 03:26:29PM +0200, Michael S. Tsirkin wrote: > > Note that virtio_mb() is weirdly inconsistent with virtio_[rw]mb() in > > that they use dma_* ops for weak_barriers, while virtio_mb() uses > > smp_mb(). > > It's a hack really. I think I'll clean it up a bit to > make it more consistent. > > To simplify things, you may consider things before > the optimization brought in by > commit 9e1a27ea42691429e31f158cce6fc61bc79bb2e9 > Author: Alexander Duyck > Date: Mon Apr 13 21:03:49 2015 +0930 > > virtio_ring: Update weak barriers to use dma_wmb/rmb That commit doesn't make any sense. dma_*mb() explicitly does _NOT_ cover the smp_*mb() part. Again, look at the ARM definitions, the smp_*mb() primitives use the inner coherence stuff, while the dma_*mb() primitives use the outer coherent stuff. the *mb() primitives cover both. From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9Z8P-0006hm-0Y for qemu-devel@nongnu.org; Thu, 17 Dec 2015 09:02:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9Z8L-0006RU-0P for qemu-devel@nongnu.org; Thu, 17 Dec 2015 09:02:20 -0500 Received: from casper.infradead.org ([85.118.1.10]:36769) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9Z8K-0006RP-S9 for qemu-devel@nongnu.org; Thu, 17 Dec 2015 09:02:16 -0500 Date: Thu, 17 Dec 2015 15:02:12 +0100 From: Peter Zijlstra Message-ID: <20151217140212.GB6344@twins.programming.kicks-ass.net> References: <1450347932-16325-1-git-send-email-mst@redhat.com> <20151217112222.GC6375@twins.programming.kicks-ass.net> <20151217151705-mutt-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151217151705-mutt-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 03:26:29PM +0200, Michael S. Tsirkin wrote: > > Note that virtio_mb() is weirdly inconsistent with virtio_[rw]mb() in > > that they use dma_* ops for weak_barriers, while virtio_mb() uses > > smp_mb(). > > It's a hack really. I think I'll clean it up a bit to > make it more consistent. > > To simplify things, you may consider things before > the optimization brought in by > commit 9e1a27ea42691429e31f158cce6fc61bc79bb2e9 > Author: Alexander Duyck > Date: Mon Apr 13 21:03:49 2015 +0930 > > virtio_ring: Update weak barriers to use dma_wmb/rmb That commit doesn't make any sense. dma_*mb() explicitly does _NOT_ cover the smp_*mb() part. Again, look at the ARM definitions, the smp_*mb() primitives use the inner coherence stuff, while the dma_*mb() primitives use the outer coherent stuff. the *mb() primitives cover both.