Received: by 10.223.185.116 with SMTP id b49csp8004882wrg; Thu, 1 Mar 2018 15:16:56 -0800 (PST) X-Google-Smtp-Source: AG47ELvLP0+0CcFrVsmfsKFtJcIEP0SxhcAeWzR0eUkFK4c48EOYO67ACUBXUguv+8gghpS6jBC9 X-Received: by 10.99.2.140 with SMTP id 134mr2937949pgc.117.1519946216009; Thu, 01 Mar 2018 15:16:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519946215; cv=none; d=google.com; s=arc-20160816; b=g0tmiIAMsggdKOWaoyC4BZEEQCNP4ncCIHO0CDKOpeGoEXKwoTgE91m2X3Quimnixa ZaVSgnQtv95aQAkuxENAyCI6ALfuahr8I2yT+L1i14U0mRAluwYrlAmn6UkjNVHpUgGt MWQU0NO7855Yt6TPh8zKkvKne6s709KTsPtlFK4p2O7CrPGgKZoXELJbVfwZ0p3MJB6t zBnEz6vS0woq8UvGFyW1EYfDONgthnzgJDUEzaLyyVxxMQwnLYaQ84binssTDvKvBDH2 dPEqhrBG1NCQEU0M9yNUcSucQcGBctvDgNzBmVhHyiIqu3YVdqGEgKwKvBOKFnbnTtJP xa9w== 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=HYHiTklUIXYAn13mw2eQyLHjSQFs/jau0XnkvyynHcQ=; b=N4rnVlGQi56dCMmtXC7rJRs4Yb4D44brATt707KsZgr9tHBqgz98YgVSFPq+dNRmC2 jcFv4ASmsJh3Xfs2tmTZ8jWiZQHlfudGEC3zvq9m8pXlAd0DV/t/edtOckgA13QWHjaX UpHF7+EaJ5lynrLm7aH3zeiEJOc2eYxbft1mwcUxwsKtTrB69jS8lJh2JG44f0PkhnbA GoYeE0zygpZYjcHKN9Cx8Kk31jOtEi9bYLKe9SFwgN27DZcHclmKliUk24GGhcAgqqix /LGzrCL7z2UhNszuVntXZqbAX3XnUPLPLTUATQgO34L5mZYmXUuGTg/cmWjfd/9W56cl 7NFQ== 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 j2si2560700pff.214.2018.03.01.15.16.41; Thu, 01 Mar 2018 15:16:55 -0800 (PST) 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 S1162922AbeCAXPl (ORCPT + 99 others); Thu, 1 Mar 2018 18:15:41 -0500 Received: from mail.kernel.org ([198.145.29.99]:35076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1162872AbeCAXPj (ORCPT ); Thu, 1 Mar 2018 18:15:39 -0500 Received: from localhost (unknown [69.71.4.158]) (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 4842921741; Thu, 1 Mar 2018 23:15:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4842921741 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: Thu, 1 Mar 2018 17:15:36 -0600 From: Bjorn Helgaas To: Stephen Bates Cc: 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" , 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 v2 04/10] PCI/P2PDMA: Clear ACS P2P flags for all devices behind switches Message-ID: <20180301231536.GB74737@bhelgaas-glaptop.roam.corp.google.com> References: <20180228234006.21093-1-logang@deltatee.com> <20180228234006.21093-5-logang@deltatee.com> <20180301180257.GH13722@bhelgaas-glaptop.roam.corp.google.com> <0D05579B-789C-4A19-B3A2-C1A630BE31C0@raithlin.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0D05579B-789C-4A19-B3A2-C1A630BE31C0@raithlin.com> 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 Thu, Mar 01, 2018 at 06:54:01PM +0000, Stephen Bates wrote: > Thanks for the detailed review Bjorn! > > >> + Enabling this option will also disable ACS on all ports behind > >> + any PCIe switch. This effictively puts all devices behind any > >> + switch into the same IOMMU group. > > > Does this really mean "all devices behind the same Root Port"? > > Not necessarily. You might have a cascade of switches (i.e switches > below a switch) to achieve a very large fan-out (in an NVMe SSD > array for example) and we will only disable ACS on the ports below > the relevant switch. The question is what the relevant switch is. We call pci_enable_acs() on every PCI device, including Root Ports. It looks like this relies on get_upstream_bridge_port() to filter out some things. I don't think get_upstream_bridge_port() is doing the right thing, so we need to sort that out first, I guess. > > What does this mean in terms of device security? I assume it means, > > at least, that individual devices can't be assigned to separate VMs. > > This was discussed during v1 [1]. Disabling ACS on all downstream > ports of the switch means that all the EPs below it have to part of > the same IOMMU grouping. However it was also agreed that as long as > the ACS disable occurred at boot time (which is does in v2) then the > virtualization layer will be aware of it and will perform the IOMMU > group formation correctly. > > > I don't mind admitting that this patch makes me pretty nervous, and I > > don't have a clear idea of what the implications of this are, or how > > to communicate those to end users. "The same IOMMU group" is a pretty > > abstract idea. > > Alex gave a good overview of the implications in [1]. > > [1] https://marc.info/?l=linux-pci&m=151512320031739&w=2 This might be a good start, but whatever the implications are, they need to be distilled and made clear directly in the changelog and the Kconfig help text. Bjorn