Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3783137imm; Mon, 30 Jul 2018 03:29:48 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeKTltkVJmZQo3qyv93lxw1/HKAvk4dwfvF0vF3u9Whuk0xBTPir2jUaf+Uu2hlnOMxFJU8 X-Received: by 2002:a63:c60:: with SMTP id 32-v6mr15971542pgm.155.1532946588367; Mon, 30 Jul 2018 03:29:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532946588; cv=none; d=google.com; s=arc-20160816; b=kU5LEmUan1x12sLCtfGu2aDMCe2Xopr9cGK9V/RxspaERauqpdt2AJaiocDxZueS6C 4yCicxtvRG7PSWiirDlf9dL2Xg19GNGcKu6pCIhqnW17XrQhqlJjuq1Dy+PPhtFFdP+4 iJbmIGH+LNKQig2bSUy7d9PxuKuFBXSVz3R6UGo3hAPilZd6UCLPCeYFxNJ57D+i32v5 tKCRfkD0raupO89o2NTh3ao8APpKi1SW7N81o0J5tVpjsrItvaQUPN1AgmHYcVTLdKzA OUJrjScnI3UgjW48Wgr3jsGaQj3bxbUsHPWu6hntm1tRD1FAavnpL8IGvc8Hlj6qJHMh wAlA== 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=tQBGjOfmZArSkkzhhs6oAt5MqfpgaYKO3q24Wbk+L5k=; b=v0n03k+3F1sqJBqzd5bqRGFQeL9OX94eLRzWuI1izmrXzCMu4yIkILQfjYko4/l7qQ +FrtnuhGETNn1aTVmPOuWFxtRlOsGER4YtoRdFgkMI9KREcjBGse0crpGLE6Wjw1ftGh 2pvdS5xJXaBIDUTae2MbliN3JEaqczKtaETukOSt+kXNt6GjMRDDWubhTwgglZH2zY1l P3xvpvlnZT8CVAyrXFw9s5COMiq7WkNNVtFdSZKKW/p8eNUKOYu5N2FdojV1Yt6JAii2 gLZcUdQRfF1VpatvP+X/BYn6+KfKjEX1LLwsxHYx11T7gzA/mUTSK5SUmWc51tttZjcK KTqQ== 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 b2-v6si9839754plm.202.2018.07.30.03.29.33; Mon, 30 Jul 2018 03:29:48 -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 S1726911AbeG3MCa (ORCPT + 99 others); Mon, 30 Jul 2018 08:02:30 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:38358 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726809AbeG3MCa (ORCPT ); Mon, 30 Jul 2018 08:02:30 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E697E402316D; Mon, 30 Jul 2018 10:28:09 +0000 (UTC) Received: from redhat.com (ovpn-117-50.ams2.redhat.com [10.36.117.50]) by smtp.corp.redhat.com (Postfix) with SMTP id 3B52510F1C0B; Mon, 30 Jul 2018 10:28:04 +0000 (UTC) Date: Mon, 30 Jul 2018 13:28:03 +0300 From: "Michael S. Tsirkin" To: Christoph Hellwig Cc: 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, benh@kernel.crashing.org, 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: <20180730125100-mutt-send-email-mst@kernel.org> References: <20180720035941.6844-1-khandual@linux.vnet.ibm.com> <20180727095804.GA25592@arm.com> <20180730093414.GD26245@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180730093414.GD26245@infradead.org> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 30 Jul 2018 10:28:10 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Mon, 30 Jul 2018 10:28:10 +0000 (UTC) for IP:'10.11.54.3' DOMAIN:'int-mx03.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 Mon, Jul 30, 2018 at 02:34:14AM -0700, Christoph Hellwig wrote: > We really need to distinguish between legacy virtual crappy > virtio (and that includes v1) that totally ignores the bus it pretends > to be on, and sane virtio (to be defined) that sit on a real (or > properly emulated including iommu and details for dma mapping) bus. Let me reply to the "crappy" part first: So virtio devices can run on another CPU or on a PCI bus. Configuration can happen over mupltiple transports. There is a discovery protocol to figure out where it is. It has some warts but any real system has warts. So IMHO virtio running on another CPU isn't "legacy virtual crappy virtio". virtio devices that actually sit on a PCI bus aren't "sane" simply because the DMA is more convoluted on some architectures. Performance impact of the optimizations possible when you know your "device" is in fact just another CPU has been measured, it is real, so we aren't interested in adding all that overhead back just so we can use DMA API. The "correct then fast" mantra doesn't apply to something that is as widely deployed as virtio. And I can accept an argument that maybe the DMA API isn't designed to support such virtual DMA. Whether it should I don't know. With this out of my system: I agree these approaches are hacky. I think it is generally better to have virtio feature negotiation tell you whether device runs on a CPU or not rather than rely on platform specific ways for this. To this end there was a recent proposal to rename VIRTIO_F_IO_BARRIER to VIRTIO_F_REAL_DEVICE. It got stuck since "real" sounds vague to people, e.g. what if it's a VF - is that real or not? But I can see something like e.g. VIRTIO_F_PLATFORM_DMA gaining support. We would then rename virtio_has_iommu_quirk to virtio_has_dma_quirk and test VIRTIO_F_PLATFORM_DMA in addition to the IOMMU thing. -- MST