From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755336AbbJ1CvG (ORCPT ); Tue, 27 Oct 2015 22:51:06 -0400 Received: from mx2.suse.de ([195.135.220.15]:53366 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755302AbbJ1CvB (ORCPT ); Tue, 27 Oct 2015 22:51:01 -0400 Date: Wed, 28 Oct 2015 11:50:47 +0900 From: Joerg Roedel To: David Woodhouse Cc: Andy Lutomirski , linux-kernel@vger.kernel.org, Christian Borntraeger , Cornelia Huck , Sebastian Ott , Paolo Bonzini , Christoph Hellwig , benh@kernel.crashing.org, KVM , Martin Schwidefsky , linux-s390 , Andy Lutomirski Subject: Re: [PATCH 3/3] virtio_pci: Use the DMA API Message-ID: <20151028025047.GF18467@suse.de> References: <20151028021530.GC18467@suse.de> <1445998972.3405.174.camel@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1445998972.3405.174.camel@infradead.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 28, 2015 at 11:22:52AM +0900, David Woodhouse wrote: > On Wed, 2015-10-28 at 11:15 +0900, Joerg Roedel wrote: > > I think a good test for that is to boot a virtio kvm-guest with > > swiotlb=force and see if it still works. > > That's useful but doesn't cover the cases where dma_wmb() is needed, > right? > > We should make sure we're handling descriptors properly as we would for > real hardware, and ensuring that addresses etc. are written to the > descriptor (and a write barrier occurs) *before* the bit is set which > tells the 'hardware' that it owns that descriptor. Hmm, good question. The virtio code has virtio_rmb/wmb and should already call it in the right places. The virtio-barriers default to rmb()/wmb() unless weak_barriers is set, in which case it calls dma_rmb()/wmb(), just a compiler barrier on x86. And weak_barriers is set by the virtio drivers when creating the queue, and the drivers should know what they are doing. Saying this, I think the virtio-drivers should already get this right. Joerg