Received: by 10.213.65.68 with SMTP id h4csp555184imn; Tue, 13 Mar 2018 12:54:40 -0700 (PDT) X-Google-Smtp-Source: AG47ELtKOOlhGS7dDTi39cZU4W5HDsEIEKbfH9TWNltHJT3udo8Cc7OWn2HMtz9+B6JDTtbXvgTm X-Received: by 10.98.133.193 with SMTP id m62mr1749475pfk.74.1520970880586; Tue, 13 Mar 2018 12:54:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520970880; cv=none; d=google.com; s=arc-20160816; b=rbro9dME3BqniLoIZQQrCxzPSyGSnVLGsEa/5OIiwOKzSHQQxFRsk6xuNE8AwR07Ko 0ZMZNVDL0GRx2dtvqE4wD/zw+KnQfLC1cpR72TYCHbthKCMpZzDjxbFzmV1IQ8XPrBxJ RToCeWTd9VsF52+ideOEQ9QICkTcNJXdfQTYeMn2kJBI0DxBBIbqKuup+hccmczazdGu J/zcElq8agKlFRLGwKdookfTwFE1iMhLZrMT2IpFULcNLmNEGupH8YhRlXQoVVGnw7ir DWQTYQil52j4lfe5Y8i3bqJCtW8WIDoBZsug9JblclwXaEJUjsZ9+80a+5wUCVSrPd6H aFfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=y729QPgynWtLn+uKDtTyU864fiVyc5k4G+/DZ4hcjok=; b=XLdexhRRoCnUeSeBA3lEwcqU0q5pOGKSCh0QpuL+wn9EkEqFheVEnZLikUqng5uADY SF8689OrQfBeKeVo9wypiBUy2GiNdFjGjcrle1pMgUvvMPquutaYS3II2n6Z5aitQZHm 7SWzEFDJemKZTqWSJOEsjoWF1PpDYLZ/Zy6SZNEvlSdqcnT2kEQMEbqNtuKQ0qQQzBst /3GcFEpvxY6EkA+3VV+ZLc+twMmb6QsVBDN9nxwVlwj9/GajuudEdu9yvbiBbYA+rlvw xlPMq3gklpuS9JxAqFY/AiTNeTrOfzspmeWz5Opz6JKAdDP2UZ7Cbr4ibsRi5MiCSWua gW/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=UoWjb0YX; dkim=pass header.i=@codeaurora.org header.s=default header.b=YWwwcUon; 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 f12si562223pgo.625.2018.03.13.12.54.26; Tue, 13 Mar 2018 12:54:40 -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; dkim=pass header.i=@codeaurora.org header.s=default header.b=UoWjb0YX; dkim=pass header.i=@codeaurora.org header.s=default header.b=YWwwcUon; 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 S932555AbeCMTxZ (ORCPT + 99 others); Tue, 13 Mar 2018 15:53:25 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:48404 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932498AbeCMTxX (ORCPT ); Tue, 13 Mar 2018 15:53:23 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8A5E760851; Tue, 13 Mar 2018 19:53:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520970802; bh=oDwUT1PWd7jcinkLeIu1knEcx0kGDPj/KPLtD/6X1WI=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=UoWjb0YXi9+6bhPyneJRuwPTlWL5LXZVmPVbAcObdzKkMUd4+tI/uASirLucX6f+w wlstcjnRTkr2HrmwScuvdaPFxuB55PcKHBwxBxz7CUE3ZaazkirTWlSAzWlkyDaedw 3lZIXOzvjx9fWksI1a4I7c/RQUt3FarjghUravmw= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.235.228.150] (global_nat1_iad_fw.qualcomm.com [129.46.232.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: okaya@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 9C18A60591; Tue, 13 Mar 2018 19:53:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520970801; bh=oDwUT1PWd7jcinkLeIu1knEcx0kGDPj/KPLtD/6X1WI=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=YWwwcUonYhyufsBmkWbN7XI53lc2oNBkphSvwrULuC6LOhGRMuINwUXGwzVZ7aC1j fnppqMVC7cWIpGQtqtUyG5tKybY349zrgxeDgTnqaseAipyJv/67+GFHISInn1YGHQ +BJmlfMNi8DPZr25ETCTIHvdJt+O/hLaNxEBnLrA= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 9C18A60591 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=okaya@codeaurora.org Subject: Re: [PATCH v3 01/11] PCI/P2PDMA: Support peer-to-peer memory To: Logan Gunthorpe , 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 Cc: Stephen Bates , 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: <20180312193525.2855-1-logang@deltatee.com> <20180312193525.2855-2-logang@deltatee.com> <59fd2f5d-177f-334a-a9c4-0f8a6ec7c303@codeaurora.org> <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> From: Sinan Kaya Message-ID: <3ea80992-a0fc-08f2-d93d-ae0ec4e3f4ce@codeaurora.org> Date: Tue, 13 Mar 2018 15:53:18 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/13/2018 3:19 PM, Logan Gunthorpe wrote: > > > On 13/03/18 01:10 PM, Sinan Kaya wrote: >> I was thinking of this for the pci_p2pdma_add_client() case for the >> parent pointer. >> >> +struct pci_p2pdma_client { >> + struct list_head list; >> + struct pci_dev *client; >> + struct pci_dev *provider; >> +}; > > Yeah, that structure only exists in a list owned by the client and we > only check the upstream bridge once per entry so I don't see the point. > >> But then, Why bother searching for the switch at all? > > Huh? We have to make sure all the client and provider devices are behind > the same switch. How can we do that without "searching" for the switch? > Sorry, I was thinking of ACS case you described below. The only thing code cares is if the device is behind a switch or not at this moment. > In the ACS case, we only disable ACS on downstream ports of switches. No > sense disabling it globally as that's worse from an isolation point of > view and not worth it given we require all P2P transactions to be behind > a switch. I agree disabling globally would be bad. Somebody can always say I have ten switches on my system. I want to do peer-to-peer on one switch only. Now, this change weakened security for the other switches that I had no intention with doing P2P. Isn't this a problem? Can we specify the BDF of the downstream device we want P2P with during boot via kernel command line? > >> Even if the switch is there, there is no guarantee that it is currently >> being used for P2P. > > IOMMU groups are set at boot time and, at present, there's no way to > dynamically change ACS bits without messing up the groups. So switches > not used for P2P will not have ACS enabled when CONFIG_PCI_P2PDMA is set > and I don't know of any good solution to that. Please see the ACS > discussions in v1 and v2. Given the implementation limitations, this might be OK as a short-term solution. It depends on if Alex is comfortable with this. > >> It seems that we are going with the assumption that enabling this config >> option implies you want P2P, then we can simplify this code as well. > > How so? > > Logan > > > -- Sinan Kaya Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.