Received: by 10.192.165.148 with SMTP id m20csp4878854imm; Tue, 8 May 2018 16:32:36 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrcJecs0e7z0ekBPk7yoTZ23skBJP6AdkbYm9rViVZbGA963SwsuvHxMCjeuiHRh/bpsFik X-Received: by 2002:a65:4805:: with SMTP id h5-v6mr19856488pgs.96.1525822356532; Tue, 08 May 2018 16:32:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525822356; cv=none; d=google.com; s=arc-20160816; b=cCJtuBPOoSY+lJqRa0FyrJjokjHYCEgnfzO8jkdX06w/JUXyfwWl3piagwIuEt6/I4 fZn7+TXzGX33lM7kXjj15AUHB7Hxyvp4e541MxJuXCamnIvJJ8i13PsNeLNOTFxbPXBV QB0BbJHBLpr7Piz+HbnPBZpyowWvWPuc1CvvMD7oTCyp6tu9FdnQ57Fpx+PXU7bgJxCs VmRjg8v9rYJ0TYkVbLIvvADA0k0adfig1FL5/WsUgR9SH3H/y55nCmVAHu4zEWS7A5Cb 8/SAcgn5ebzDspRvLixvqWaYdbSHA5VDYN2rYrp5SRdF9D5I2MLnbaVr+aPu9Vtjpk3f 65Vw== 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=rmPfzfK6+aQalFGblBA30HHTgeg22DKBoavkofyF/0U=; b=mHfyTJDHjkcCH8A5Dr6Ae7C0bWKuUUrpTrzW5orqDVYpKFjtzKxkHIX1C9QNPIeqio +l0YQjn+0nadnkisJyEJUo66AWLLEIaOdSnp3inQ6C4aiYSLwD0Ojv+PRfESdZa0TX3f Zdq0FOtSPNyyYk8pPWl4azaEkSGnh771bfAe5ycJfAgL+43U1KOL8AeKBEHbuKSCCz8K abkBxo6FiclMpvgpwgMcdDTjEOTxaFWz7kHaRj7MeDtt15CjcARkUe4zSZu0c8LbdckE qOGDPORA4mprhARCuKWPnJI2QhpEPNJ4aFPgHJz+1JP1QrOQa/ql4bb1KjUhnYwepHPY W1Tg== 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 89-v6si25302953plc.444.2018.05.08.16.32.21; Tue, 08 May 2018 16:32:36 -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 S933152AbeEHXcJ (ORCPT + 99 others); Tue, 8 May 2018 19:32:09 -0400 Received: from ale.deltatee.com ([207.54.116.67]:34120 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754148AbeEHXcH (ORCPT ); Tue, 8 May 2018 19:32:07 -0400 Received: from guinness.priv.deltatee.com ([172.16.1.162]) by ale.deltatee.com with esmtp (Exim 4.89) (envelope-from ) id 1fGC5J-0001I6-BZ; Tue, 08 May 2018 17:31:54 -0600 To: Alex Williamson , Stephen Bates Cc: =?UTF-8?Q?Christian_K=c3=b6nig?= , Bjorn Helgaas , "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 References: <20180423233046.21476-1-logang@deltatee.com> <20180423233046.21476-5-logang@deltatee.com> <20180507231306.GG161390@bhelgaas-glaptop.roam.corp.google.com> <0b4183ef-e720-204b-9e85-b9eaf7a4136a@deltatee.com> <3584a6ac-95c7-5d23-1859-aee30605776e@deltatee.com> <20180508133407.57a46902@w520.home> <5fc9b1c1-9208-06cc-0ec5-1f54c2520494@deltatee.com> <20180508141331.7cd737cb@w520.home> <20180508144341.0441b676@w520.home> <20180508152631.50fd583c@w520.home> <354F7407-0DC7-470C-B9AA-74FDF9C46B08@raithlin.com> <20180508160336.0935ddde@w520.home> <20905682-9440-7d4b-0260-99d3dc794c3d@deltatee.com> <20180508171150.0e8fd291@w520.home> From: Logan Gunthorpe Message-ID: <0a0a1782-04b2-c571-63c7-bfff68312946@deltatee.com> Date: Tue, 8 May 2018 17:31:48 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180508171150.0e8fd291@w520.home> 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: 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, helgaas@kernel.org, christian.koenig@amd.com, sbates@raithlin.com, alex.williamson@redhat.com 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 autolearn=ham autolearn_force=no version=3.4.1 Subject: Re: [PATCH v4 04/14] PCI/P2PDMA: Clear ACS P2P flags for all devices behind switches 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 08/05/18 05:11 PM, Alex Williamson wrote: > On to the implementation details... I already mentioned the BDF issue > in my other reply. If we had a way to persistently identify a device, > would we specify the downstream points at which we want to disable ACS > or the endpoints that we want to connect? The latter has a problem > that the grouping upstream of an endpoint is already set by the time we > discover the endpoint, so we might need to unwind to get the grouping > correct. The former might be more difficult for users to find the > necessary nodes, but easier for the kernel to deal with during > discovery. I was envisioning the former with kernel helping by printing a dmesg in certain circumstances to help with figuring out which devices need to be specified. Specifying a list of endpoints on the command line and having the kernel try to figure out which downstream ports need to be adjusted while we are in the middle of enumerating the bus is, like you said, a nightmare. > A runtime, sysfs approach has some benefits here, > especially in identifying the device assuming we're ok with leaving > the persistence problem to userspace tools. I'm still a little fond of > the idea of exposing an acs_flags attribute for devices in sysfs where > a write would do a soft unplug and re-add of all affected devices to > automatically recreate the proper grouping. Any dynamic change in > routing and grouping would require all DMA be re-established anyway and > a soft hotplug seems like an elegant way of handling it. Thanks, This approach sounds like it has a lot more issues to contend with: For starters, a soft unplug/re-add of all the devices behind a switch is going to be difficult if a lot of those devices have had drivers installed and their respective resources are now mounted or otherwise in use. Then, do we have to redo a the soft-replace every time we change the ACS bit for every downstream port? That could mean you have to do dozens soft-replaces before you have all the ACS bits set which means you have a storm of drivers being added and removed. This would require some kind of fancy custom setup software that runs at just the right time in the boot sequence or a lot of work on the users part to unbind all the resources, setup the ACS bits and then rebind everything (assuming the soft re-add doesn't rebind it every time you adjust one ACS bit). Ugly. IMO, if we need to do the sysfs approach then we need to be able to adjust the groups dynamically in a sensible way and not through the large hammer that is soft-replaces. I think this would be great but I don't think we will be tackling that with this patch set. Logan