Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3959650imm; Mon, 30 Jul 2018 06:28:26 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdLLGkrj9X8X6cbYiyH2Xx2nSodRHkZvgelLiorydygkf6mB52c2wPHY/7K4TX/xiqaOvDC X-Received: by 2002:a63:d5b:: with SMTP id 27-v6mr16169982pgn.107.1532957306246; Mon, 30 Jul 2018 06:28:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532957306; cv=none; d=google.com; s=arc-20160816; b=e96WqyAUi79KRhMgfxlQMp2KKNSc6Im3HRGAM81nk3QYmQE+On4bb9EEMNblF04Unz VRgF1BV+6Hmnkpy6xPbqyxWUg3m+huopoyl4rx4gQBCyYyCXerE1zcVsNRIG+GS3xq7P zznQEycVcH6wo+T6EM+fTAtm6bbPc0hnSiEZFGmmUzHnW7OCheWtf0+D/2A8cQkkJUla tojkCzd1NsS8h1bBCCmE3BP2okJAcndDKvRkdgq4apKZonE70rQUFxwU6QE+7LoJ+sl0 GecbvllkdS7tvam5vnsk6Savx6OLnZTLJxu1/Jhmqn9f66TH8LTofiOK/6NDXWq/E/na MNew== 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=RMldx0uSaf1pbfTAzQuUden7qMZXUiPDRIGN3ChAciI=; b=AwGDD6qBIbhsrV6FDMt8laqlXrZpnGuceIGsii1ddNFgPH0LYI2g95yoWx231WPb6T 3D0Bgk28L7kkzkPCWEFcTRW+QXC2iJG5HJ3K64nRDIu/kO8dlaQA0dsCJ3hK5dn6ZP0t xbT+2xRbNlVQcnRcsqBQeeJ4TDKQLj9fOubp18x7mY3fPVUqxXb1Jewrbt4gKszn/bC/ 1BI5GYnerNBO6suAg62g8Gfkab6W6QcA8S2CzlnLOfZciGIUfsETpE3sg2iVU2qFTMEQ JCdU3oUmvlh7ZMejbY/Ad9F4+UYe+CnCFF0lV1UQsqf8POMT8mv+36gGSBG0upRcGDSH hYNA== 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 i23-v6si11464842pgb.246.2018.07.30.06.28.11; Mon, 30 Jul 2018 06:28:26 -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 S1731016AbeG3PBk (ORCPT + 99 others); Mon, 30 Jul 2018 11:01:40 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:60648 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726570AbeG3PBk (ORCPT ); Mon, 30 Jul 2018 11:01:40 -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 4D2C24219DBF; Mon, 30 Jul 2018 13:26:39 +0000 (UTC) Received: from redhat.com (ovpn-117-43.ams2.redhat.com [10.36.117.43]) by smtp.corp.redhat.com (Postfix) with SMTP id 4886E2142F20; Mon, 30 Jul 2018 13:26:33 +0000 (UTC) Date: Mon, 30 Jul 2018 16:26:32 +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: <20180730155633-mutt-send-email-mst@kernel.org> References: <20180720035941.6844-1-khandual@linux.vnet.ibm.com> <20180727095804.GA25592@arm.com> <20180730093414.GD26245@infradead.org> <20180730125100-mutt-send-email-mst@kernel.org> <20180730111802.GA9830@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180730111802.GA9830@infradead.org> 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]); Mon, 30 Jul 2018 13:26:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Mon, 30 Jul 2018 13:26:39 +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 Mon, Jul 30, 2018 at 04:18:02AM -0700, Christoph Hellwig wrote: > On Mon, Jul 30, 2018 at 01:28:03PM +0300, Michael S. Tsirkin wrote: > > 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. > > All of what you said would be true if virtio didn't claim to be > a PCI device. There's nothing virtio claims to be. It's a PV device that uses PCI for its configuration. Configuration is enumerated on the virtual PCI bus. That part of the interface is emulated PCI. Data path is through a PV device enumerated on the virtio bus. > Once it claims to be a PCI device and we also see > real hardware written to the interface I stand to all what I said > above. Real hardware would reuse parts of the interface but by necessity it needs to behave slightly differently on some platforms. However for some platforms (such as x86) a PV virtio driver will by luck work with a PCI device backend without changes. As these platforms and drivers are widely deployed, some people will deploy hardware like that. Should be a non issue as by definition it's transparent to guests. > > 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. > > I don't really care about the exact naming, and indeed a device that > sets the flag doesn't have to be a 'real' device - it just has to act > like one. I explained all the issues that this means (at least relating > to DMA) in one of the previous threads. I believe you refer to this: https://lkml.org/lkml/2018/6/7/15 that was a very helpful list outlining the problems we need to solve, thanks a lot for that! > The important bit is that we can specify exact behavior for both > devices that sets the "I'm real!" flag and that ones that don't exactly > in the spec. I would very much like that, yes. > And that very much excludes arch-specific (or > Xen-specific) overrides. We already committed to a xen specific hack but generally I prefer devices that describe how they work instead of platforms magically guessing, yes. However the question people raise is that DMA API is already full of arch-specific tricks the likes of which are outlined in your post linked above. How is this one much worse? -- MST