Received: by 10.213.65.68 with SMTP id h4csp912151imn; Fri, 23 Mar 2018 20:55:33 -0700 (PDT) X-Google-Smtp-Source: AG47ELvgY2hoMbmYf6jMz7+Afbcvh9WN4lbLX//++bU2zY0jsHB7RjgA8XwWO8NImLuoqWVnSXBl X-Received: by 10.99.120.196 with SMTP id t187mr23132967pgc.149.1521863733709; Fri, 23 Mar 2018 20:55:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521863733; cv=none; d=google.com; s=arc-20160816; b=ILG8/iL4+8hHZ7AkIRQczXmmmyLm08ajo/sWU27G4j/6khJS82RYp9ikL6hZg98m3I Ck+uHO6ziERIJ7TF7JtQfqGIqogt+uOuM/m8bSUIzJzrFz/5qh6okmIWf17Kzcd1TQop 3HRi1H0HyAGJ6YkR3bIOiWYmZ4YlFqhGiaTv7GEIoHy7Oxuz/ok/HIjeXZRaOBpNagki AFgu9wcGrysK98JuTg8SBL1E1TGEGcQeLjJxut05jg8f30utq6FquWKoeFuSnzy09GAA isURL5olzA1RfPmqYpX9zj+c/aWEECmHM5nMlzWas57YKGx8FfeT80k9Kl68B2+QilYf yYPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dmarc-filter:arc-authentication-results; bh=bLVqVgIfwuV92rqU1CgzAgXYFIY3ci++/4NE1qBk2rw=; b=vzFbzySz4I5e0eWx7h0imH9TAvz21MrUQ8SbNzhuxBXrXYTeAPJQ4IPNQSwxt46pPE uT/yVOl+lsxzMSBKldq4hbhgb5+uFTnWR07V+eKWGxG3OlQtJAOQb5ZJ4MGDZtlSo+5R 7c2ADtODewJ0Lgf2oS8VsMmrjcCI2tYOdl0OvFrJOoEY84d3Gi8lmrSYfsPfjvGk4LYT xWVmCo3Yb5dk0QyJzznx0mypEuEn3zBPdzVc/Z4bw7q3VUqct4wNsSeEUNhLN9FQonAs ag7KAYRbgetVAnOa9IjMHYcT1cxG6UV/EGZESpicKU0UZnTeB4Qdce9Ob7IFnG/IpS8x J3+A== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z124si6935116pgb.811.2018.03.23.20.54.10; Fri, 23 Mar 2018 20:55:33 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751853AbeCXDtw (ORCPT + 99 others); Fri, 23 Mar 2018 23:49:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:48012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751409AbeCXDtu (ORCPT ); Fri, 23 Mar 2018 23:49:50 -0400 Received: from localhost (unknown [69.71.5.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7C8532172B; Sat, 24 Mar 2018 03:49:49 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7C8532172B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=helgaas@kernel.org Date: Fri, 23 Mar 2018 22:49:47 -0500 From: Bjorn Helgaas To: Logan Gunthorpe Cc: Stephen Bates , Sinan Kaya , "linux-kernel@vger.kernel.org" , "linux-pci@vger.kernel.org" , "linux-nvme@lists.infradead.org" , "linux-rdma@vger.kernel.org" , "linux-nvdimm@lists.01.org" , "linux-block@vger.kernel.org" , Christoph Hellwig , Jens Axboe , Keith Busch , Sagi Grimberg , Bjorn Helgaas , Jason Gunthorpe , Max Gurtovoy , Dan Williams , =?iso-8859-1?B?Suly9G1l?= Glisse , Benjamin Herrenschmidt , Alex Williamson Subject: Re: [PATCH v3 01/11] PCI/P2PDMA: Support peer-to-peer memory Message-ID: <20180324034947.GE210003@bhelgaas-glaptop.roam.corp.google.com> References: <3ea80992-a0fc-08f2-d93d-ae0ec4e3f4ce@codeaurora.org> <4eb6850c-df1b-fd44-3ee0-d43a50270b53@deltatee.com> <757fca36-dee4-e070-669e-f2788bd78e41@codeaurora.org> <4f761f55-4e9a-dccb-d12f-c59d2cd689db@deltatee.com> <20180313230850.GA45763@bhelgaas-glaptop.roam.corp.google.com> <20180323215046.GC210003@bhelgaas-glaptop.roam.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 23, 2018 at 03:59:14PM -0600, Logan Gunthorpe wrote: > On 23/03/18 03:50 PM, Bjorn Helgaas wrote: > > Popping way up the stack, my original point was that I'm trying to > > remove restrictions on what devices can participate in > > peer-to-peer DMA. I think it's fairly clear that in conventional > > PCI, any devices in the same PCI hierarchy, i.e., below the same > > host-to-PCI bridge, should be able to DMA to each other. > > Yup, we are working on this. > > > The routing behavior of PCIe is supposed to be compatible with > > conventional PCI, and I would argue that this effectively requires > > multi-function PCIe devices to have the internal routing required > > to avoid the route-to-self issue. > > That would be very nice but many devices do not support the internal > route. We've had to work around this in the past and as I mentioned > earlier that NVMe devices have a flag indicating support. However, > if a device wants to be involved in P2P it must support it and we > can exclude devices that don't support it by simply not enabling > their drivers. Do you think these devices that don't support internal DMA between functions are within spec, or should we handle them as exceptions, e.g., via quirks? If NVMe defines a flag indicating peer-to-peer support, that would suggest to me that these devices are within spec. I looked up the CMBSZ register you mentioned (NVMe 1.3a, sec 3.1.12). You must be referring to the WDS, RDS, LISTS, CQS, and SQS bits. If WDS is set, the controller supports having Write-related data and metadata in the Controller Memory Buffer. That would mean the driver could put certain queues in controller memory instead of in host memory. The controller could then read the queue from its own internal memory rather than issuing a PCIe transaction to read it from host memory. That makes sense to me, but I don't see the connection to peer-to-peer. There's no multi-function device in this picture, so it's not about internal DMA between functions. WDS, etc., tell us about capabilities of the controller. If WDS is set, the CPU (or a peer PCIe device) can write things to controller memory. If it is clear, neither the CPU nor a peer device can put things there. So it doesn't seem to tell us anything about peer-to-peer specifically. It looks like information needed by the NVMe driver, but not by the PCI core. Bjorn