Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp56717imm; Thu, 2 Aug 2018 13:53:59 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdFb2rE6wKLdW7ehKOGbxdT2S2V/scIGxzP+JDM4eVOtQADNTElBp1Vx4nywjSb+iLy65Xj X-Received: by 2002:a17:902:b08d:: with SMTP id p13-v6mr935806plr.0.1533243239014; Thu, 02 Aug 2018 13:53:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533243238; cv=none; d=google.com; s=arc-20160816; b=FiWQpaPbjKmR84Do3KYqc8ovJFhrkyYlQpIR4aYlrySGe9QqqyIeGe7v1wCP4Ka6wC DI3rZUY0S4hbauBRhkBlQo0kmnVoZUkSoZ/N6TI86W6/Wj0S9MqzsDMmnfuvhdw11p71 8VR8joPrhglcTViw5I1Nz8TblM3RbIfN54PLZ6LO9utwQsJMyTXGhrey1RysXtwNW4/m A+k1intIiMl0fX4lPXA4vz9AC4Hu58aR9yfUXY75zCsC0YDo2ckc9jjATeMYoGNkTB/f 8Z8IioKWKphOyo+47bBcYYuGzZkB0Nqvz8q6wV4r7z8D6Y8lKzAPZZOuiRb104/SIUja ySjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=kuxPAMHitRo5S2QIr0jlPVQVaRJwMqX+ot3JDcmjYuk=; b=nLAPn7Pn67kMBlpEXXhW0byndv0Mc0iNLfP9R5j77MvhbFPJknoZlma3DaXxuu5rlq jpMQnqLWchi2eMDUHQW0c6zMlKK0vHV1quYtwWKWKgg/5XEFSZ96TifqWdUMJsJ+JQvF UUfCu4z0tzLdOUMTa6gYhZB1vzJxKmP4Od1uG1Cs6rz36cXBTzdV8qWWYyYj4glXrwr6 QLJOQ1185Kf2KwIwOOeRL//qfmU/q71k9AP9ZKfhal0lkKQmBvpNErC/fNBqHQaYSf6E LxFMcXWQgBYu8jQ+xeyrSfA9hbh9kR48DnUTj8Trm8PlAL6V+YPtz2Alac2gwaq6XlXl xjOw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x5-v6si2079905plo.57.2018.08.02.13.53.44; Thu, 02 Aug 2018 13:53:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731905AbeHBWpI (ORCPT + 99 others); Thu, 2 Aug 2018 18:45:08 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:48532 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730951AbeHBWpH (ORCPT ); Thu, 2 Aug 2018 18:45:07 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC7C140241F2; Thu, 2 Aug 2018 20:52:16 +0000 (UTC) Received: from redhat.com (ovpn-117-57.ams2.redhat.com [10.36.117.57]) by smtp.corp.redhat.com (Postfix) with SMTP id 7B722215670D; Thu, 2 Aug 2018 20:52:11 +0000 (UTC) Date: Thu, 2 Aug 2018 23:52:10 +0300 From: "Michael S. Tsirkin" To: Benjamin Herrenschmidt Cc: Christoph Hellwig , Will Deacon , Anshuman Khandual , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, aik@ozlabs.ru, robh@kernel.org, joe@perches.com, elfring@users.sourceforge.net, david@gibson.dropbear.id.au, jasowang@redhat.com, mpe@ellerman.id.au, linuxram@us.ibm.com, haren@linux.vnet.ibm.com, paulus@samba.org, srikar@linux.vnet.ibm.com, robin.murphy@arm.com, jean-philippe.brucker@arm.com, marc.zyngier@arm.com Subject: Re: [RFC 0/4] Virtio uses DMA API for all devices Message-ID: <20180802225738-mutt-send-email-mst@kernel.org> References: <20180730155633-mutt-send-email-mst@kernel.org> <20180731173052.GA17153@infradead.org> <3d6e81511571260de1c8047aaffa8ac4df093d2e.camel@kernel.crashing.org> <20180801081637.GA14438@arm.com> <20180801083639.GF26378@infradead.org> <26c1d3d50d8e081eed44fe9940fbefed34598cbd.camel@kernel.crashing.org> <20180802182959-mutt-send-email-mst@kernel.org> <82ccef6ec3d95ee43f3990a4a2d0aea87eb45e89.camel@kernel.crashing.org> <20180802200646-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 02 Aug 2018 20:52:17 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Thu, 02 Aug 2018 20:52:17 +0000 (UTC) for IP:'10.11.54.6' DOMAIN:'int-mx06.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 02, 2018 at 12:53:41PM -0500, Benjamin Herrenschmidt wrote: > On Thu, 2018-08-02 at 20:19 +0300, Michael S. Tsirkin wrote: > > > > I see. So yes, given that device does not know or care, using > > virtio features is an awkward fit. > > > > So let's say as a quick fix for you maybe we could generalize the > > xen_domain hack, instead of just checking xen_domain check some static > > branch. Then teach xen and others to enable that.> > > > OK but problem then becomes this: if you do this and virtio device appears > > behind a vIOMMU and it does not advertize the IOMMU flag, the > > code will try to use the vIOMMU mappings and fail. > > > > It does look like even with trick above, you need a special version of > > DMA ops that does just swiotlb but not any of the other things DMA API > > might do. > > > > Thoughts? > > Yes, this is the purpose of Anshuman original patch (I haven't looked > at the details of the patch in a while but that's what I told him to > implement ;-) : > > - Make virtio always use DMA ops to simplify the code path (with a set > of "transparent" ops for legacy) > > and > > - Provide an arch hook allowing us to "override" those "transparent" > DMA ops with some custom ones that do the appropriate swiotlb gunk. > > Cheers, > Ben. > Right but as I tried to say doing that brings us to a bunch of issues with using DMA APIs in virtio. Put simply DMA APIs weren't designed for guest to hypervisor communication. When we do (as is the case with PLATFORM_IOMMU right now) this adds a bunch of overhead which we need to get rid of if we are to switch to PLATFORM_IOMMU by default. We need to fix that. -- MST