Received: by 10.213.65.68 with SMTP id h4csp646595imn; Tue, 13 Mar 2018 16:23:03 -0700 (PDT) X-Google-Smtp-Source: AG47ELtUX4A+5X3/kK+8RJiCD2okfiObWZ2ND8/8ZG8WQmfYeUuWMSdwxxrH2E5gvIF7hH7iuWUF X-Received: by 2002:a17:902:bd05:: with SMTP id p5-v6mr2076461pls.137.1520983383508; Tue, 13 Mar 2018 16:23:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520983383; cv=none; d=google.com; s=arc-20160816; b=lm0TbjjULdIvLrhqGaAfIOxBB3XQKa5lFibBJaB7rtAj6R4c6k65xiaQtNdZZk0wnO fyLsjCTbTboiQl9cg1z7MTICN8e6v+4C6jijdDsqfBFqSGmFGP7Qoh7P1SdRVzODtx6w flke5shn39sniBXbjrHQaajfgFQ4kOeIl/wZK1YTF8JCF5ifpXYTYt+pu1vE5Vk3zZVl WcVZgeuNxcW2nnbvHDmh67TOi87c4knxLcp/0WOekkZbntTHC6gdIXLGrl/RRaw/UIZV 1RO26tmffmDhX4DF9Oj+kQtYiXte4XZx4diV5iomZ7yVG+vpKbzdKXrcOWgmU/kqdXc8 XBcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:subject:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:arc-authentication-results; bh=NLr8o0c/dE+1WEGu9Usex8OWacMB+AtXpVOwFMZY7Y0=; b=HhSqTm4M5CtWh5bhjqAgX9u3NfmQT0g7l5SPwhw27EkRzhWAdawNeB+XfobcPGfW4/ BICTeK8Nm9CFcqiIbqXunaEnfTsZEL7xA9GWLtpdrUSFwt5RYtTp+Xu7goVLwpU5rOKK 9Bytq4xQOscIDoaRrR/QpOhJg1c5I91u4vCjYY9OUrl13ibIvXptfCnlgnzmbVoccWdK vMgHxlSa9ZYuqsB6ESXEoXgX/p05cpMNtthSEdiEQrPAF7rMcZWdWQBjj3zkSAi7UWEm 9MGl0YQaQ/O3WF9vH7nJ7ADNEktjyg7ZYIIsL86DqI/GvWZoAInWFt1PxMP9gEH9ga29 pGJg== 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 z134si986330pfc.27.2018.03.13.16.22.49; Tue, 13 Mar 2018 16:23:03 -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 S932850AbeCMXVs (ORCPT + 99 others); Tue, 13 Mar 2018 19:21:48 -0400 Received: from ale.deltatee.com ([207.54.116.67]:36276 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932710AbeCMXVq (ORCPT ); Tue, 13 Mar 2018 19:21:46 -0400 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.89) (envelope-from ) id 1evtET-0000NK-5A; Tue, 13 Mar 2018 17:21:26 -0600 To: Bjorn Helgaas , Stephen Bates Cc: 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 , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , Benjamin Herrenschmidt , Alex Williamson References: <24d8e5c2-065d-8bde-3f5d-7f158be9c578@deltatee.com> <52cbbbc4-c488-f83f-8d02-14d455b4efd7@codeaurora.org> <3e738f95-d73c-4182-2fa1-8664aafb1ab7@deltatee.com> <703aa92c-0c1c-4852-5887-6f6e6ccde0fb@codeaurora.org> <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> From: Logan Gunthorpe Message-ID: <8de5d3dd-a78f-02d5-0eea-4365364143b6@deltatee.com> Date: Tue, 13 Mar 2018 17:21:20 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180313230850.GA45763@bhelgaas-glaptop.roam.corp.google.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: alex.williamson@redhat.com, benh@kernel.crashing.org, jglisse@redhat.com, dan.j.williams@intel.com, maxg@mellanox.com, jgg@mellanox.com, bhelgaas@google.com, sagi@grimberg.me, keith.busch@intel.com, axboe@kernel.dk, hch@lst.de, linux-block@vger.kernel.org, linux-nvdimm@lists.01.org, linux-rdma@vger.kernel.org, linux-nvme@lists.infradead.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, okaya@codeaurora.org, sbates@raithlin.com, helgaas@kernel.org X-SA-Exim-Mail-From: logang@deltatee.com X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on ale.deltatee.com X-Spam-Level: X-Spam-Status: No, score=-8.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, GREYLIST_ISWHITE,T_RP_MATCHES_RCVD autolearn=ham autolearn_force=no version=3.4.1 Subject: Re: [PATCH v3 01/11] PCI/P2PDMA: Support peer-to-peer memory X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 13/03/18 05:08 PM, Bjorn Helgaas wrote: > On Tue, Mar 13, 2018 at 10:31:55PM +0000, Stephen Bates wrote: > If it *is* necessary because Root Ports and devices below them behave > differently than in conventional PCI, I think you should include a > reference to the relevant section of the spec and check directly for a > Root Port. I would prefer that over trying to exclude Root Ports by > looking for two upstream bridges. Well we've established that we don't want to allow root ports. But we need to, at a minimum, do two pci_upstream_bridge() calls... Remember, we need to check that a number of devices are behind the same switch. So we need to find a _common_ upstream port for several devices. Excluding the multifunction device case (which I don't think is applicable for reasons we've discussed before), this will *never* be the first upstream port for a given device. We need to find the upstream port of the switch and ensure all devices share that same port. If a device is behind a switch, it's pci_upstream_bridge() is the downstream switch port which is unique to that device. So a peer device would have a different pci_upstream_bridge() port but share the same pci_upstream_bridge(pci_upstream_bridge()) port (assuming they are on the same switch). The alternative, is to walk the entire tree of upstream ports and check that all devices have a common port somewhere in the tree that isn't the root complex. Arguably this is the right way to do it and would support a network of switches but is a fair bit more complex to code. Logan