Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4190876pxb; Sun, 24 Oct 2021 22:31:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztThKyC0yrKXK+WtjcWaWXHaGfECfO5XdfW2Zo1zZuGUoprTPK/3CZWqDHpGNKQaT7q8+v X-Received: by 2002:a63:6b03:: with SMTP id g3mr12000928pgc.123.1635139901698; Sun, 24 Oct 2021 22:31:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635139901; cv=none; d=google.com; s=arc-20160816; b=OLretcVYwnEWuG9xKMfs7Eb/pver2HrJQSoFT4OigQ9mbV1skA5VH1Y9ycOKJZu6uF nP9qgM7LqkxrHk8/B+AUs4zQ17pTT9EmYlViMnCuQgyT8rdksi4jFqLzHu4jXX789boF xf9mS5R5Teto5LVkGF+MaWppOD9bYMo7cUKUl8ecohO5w6o/P3688RFQ52W0RBzpO/Tn /nvJm7zFsuMFzxqYxEk6H5gEIgXLNxRBTNZnjbr20G1AdUCFxdMG55A73faxFs8BooPr MKwXQmso9OXqlDO+rYSi1Ws8TwQYz933NQ0S4zp9baZ7NYIoHBU4dOVuUvrrNdWAAizy HYZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6zAr2dccLE+Xq46zC4THi7D5zvFV8MFg187CSJj4PoU=; b=OmGMgBsV8Y62FOzfeqHsxPnxfGgV4OmR51ksbPU/LSg0ibj4+pE+PoYq1sD/2Dsn9o 5BeV+P0cIoMZSXFMmaVQJ0DvVeGb3l+8BX/KqiV4T0iY4JW95ddCkWSoOztPyQro6mUl 4yUHqEGzTcZDy/PxYoUH+ser6IfuFgqrUAmN3r5yWRMRla4ATjFGD5ySDMagdRWXHQbM PoESfQOkKmggtbnNKUSBaA+NsBUKYtSQw2uDjgn+p4l0gH9uw3LzRfT4oZr29+VP7h8M cmsu5whcUMgjp4lZ8TTly7HVeYDWsF66YafKQyAcdv4VXsdkyFhTrdjMTGsE3R9vtm/B gpjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=Soao14g4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h8si21194422pls.225.2021.10.24.22.31.29; Sun, 24 Oct 2021 22:31:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gibson.dropbear.id.au header.s=201602 header.b=Soao14g4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229925AbhJYFbx (ORCPT + 99 others); Mon, 25 Oct 2021 01:31:53 -0400 Received: from gandalf.ozlabs.org ([150.107.74.76]:48605 "EHLO gandalf.ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229735AbhJYFbt (ORCPT ); Mon, 25 Oct 2021 01:31:49 -0400 Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Hd3RV3yc5z4xZ1; Mon, 25 Oct 2021 16:29:26 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1635139766; bh=6zAr2dccLE+Xq46zC4THi7D5zvFV8MFg187CSJj4PoU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Soao14g4N+KZ/f9ElfqcTacz+edrkXvdUyuFDgkOIFFrK9kUH2lpbmN3vk8hW17/H /q6A0UCMXTV3UhexzZ6bC1Lh9qDYDc6E15yfCAZayVk1HT/60wXMetI0KviTXKvKnr Elq25upo6pL91ZXHBgCljcx5VZBkiMuPs8pKxLok= Date: Mon, 25 Oct 2021 16:14:56 +1100 From: David Gibson To: Jason Gunthorpe Cc: "Tian, Kevin" , "Liu, Yi L" , "alex.williamson@redhat.com" , "hch@lst.de" , "jasowang@redhat.com" , "joro@8bytes.org" , "jean-philippe@linaro.org" , "parav@mellanox.com" , "lkml@metux.net" , "pbonzini@redhat.com" , "lushenming@huawei.com" , "eric.auger@redhat.com" , "corbet@lwn.net" , "Raj, Ashok" , "yi.l.liu@linux.intel.com" , "Tian, Jun J" , "Wu, Hao" , "Jiang, Dave" , "jacob.jun.pan@linux.intel.com" , "kwankhede@nvidia.com" , "robin.murphy@arm.com" , "kvm@vger.kernel.org" , "iommu@lists.linux-foundation.org" , "dwmw2@infradead.org" , "linux-kernel@vger.kernel.org" , "baolu.lu@linux.intel.com" , "nicolinc@nvidia.com" Subject: Re: [RFC 13/20] iommu: Extend iommu_at[de]tach_device() for multiple devices group Message-ID: References: <20210919063848.1476776-1-yi.l.liu@intel.com> <20210919063848.1476776-14-yi.l.liu@intel.com> <20211018163238.GO2744544@nvidia.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="yxRtDnBMBAGaMdJf" Content-Disposition: inline In-Reply-To: <20211018163238.GO2744544@nvidia.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --yxRtDnBMBAGaMdJf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Oct 18, 2021 at 01:32:38PM -0300, Jason Gunthorpe wrote: > On Mon, Oct 18, 2021 at 02:57:12PM +1100, David Gibson wrote: >=20 > > The first user might read this. Subsequent users are likely to just > > copy paste examples from earlier things without fully understanding > > them. In general documenting restrictions somewhere is never as > > effective as making those restrictions part of the interface signature > > itself. >=20 > I'd think this argument would hold more water if you could point to > someplace in existing userspace that cares about the VFIO grouping. My whole point here is that the proposed semantics mean that we have weird side effects even if the app doesn't think it cares about groups. e.g. App's input is a bunch of PCI addresses for NICs. It attaches each one to a separate IOAS and bridges packets between them all. As far as the app is concerned, it doesn't care about groups, as you say. Except that it breaks if any two of the devices are in the same group. Worse, it has a completely horrible failure mode: no syscall returns an, it just starts trying to do dma with device A, and the packets get written into the IOAS that belongs to device B instead. Sounds like a complete nightmare to debug if you don't know about groups, because you never thought you cared. And yes, for a simple bridge like this app, attaching all the devices to the same IOAS is a more likely setup. But using an IOAS per device is a perfectly valid configuration as well, and with the current draft nothing will warn the app that this is a bad idea. > From what I see the applications do what the admin tells them to do - > and if the admin says to use a certain VFIO device then that is > excatly what they do. I don't know of any applications that ask the > admin to tell them group information. >=20 > What I see is aligning what the kernel provides to the APIs the > applications have already built. >=20 > Jason >=20 --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --yxRtDnBMBAGaMdJf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAmF2PVAACgkQbDjKyiDZ s5LUJhAAqfdhIEiSLBVFINn04mkXp8wdf6ByN7npipHdyHzSj76wY3CwovNLbLyM VVz+ua0VowY3482C4CbDxOEKQeYGIn5xD0nsr/gOl7PLm3uBsk4/NVXprgHblYFZ Xlb4YtykCSVsxn/QPLYNTX4xhcWL8gUC0FS5n9Ga4N9/8JeT93aWbRMDO+hTTTv0 Enk/XhH3r4JtHXFUdr2CyU1MXmgJNd0J/Pz48U6OSqq/NP/vOhu9TnqYBLuNyV9J ktLJe/vccmavhgscTZRH8hRTCQNgzsYC0OggrREEujZzOV6+uNFr8wCG3GvbGS4h 5+zL1kkHJ4KAIS38aQxylEOsbCIExyrSixQzdSorJWEGcNdDSy8cSmYeVzWoJMZX jEVcCWXFkWobgB9GynbW9nj5sKZUe/8O9eVDpd9g1UDIagzdmD2yNUdLDwrx++Ef YtJIFiYSHenbzzIfAoPcxCLLh7O/oXFTp654dODuIuZPfO2FLTdHNRznRn4r0aWW x6u4e9KgdC9A5yeN74/Ho0U5snn5PDDxLam/tNz7/xiUBaxgKp96NS5peNU0BMOL mI43kdEhXxrXlT3a4k+XZU+WHRTeFh69g9OyJqW6x1dkp5N/3DYgNF3nThc/x1s0 6tZg+nTGqnEAMV0QYgbR/4H5El5fMHJekab+aaMO69Ny5NnU110= =Mlw2 -----END PGP SIGNATURE----- --yxRtDnBMBAGaMdJf--