From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D330AEA2 for ; Thu, 29 Sep 2022 03:53:43 +0000 (UTC) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4MdKGS0GhJz4xGk; Thu, 29 Sep 2022 13:53:36 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1664423616; bh=a/sK6v7yZRJ0VJjyQV/gPRH2mYTnyGH5ukZnBIGnTKA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iknbLKFSxAJ2xqPJ69NucNzKBkEpAm8fIJsAZQZZ01X31zW5PlXE3G4TDU40UaBGd /eQPysjRLhl/1vxHkHN9KWhNc4jphjulEpscimedPy5tC6XgkR6oGeea2IV2zDoEOs hEo6TSOLiVce2S5kYJmMdDyoTpdeYgebw/M5NFIQ= Date: Thu, 29 Sep 2022 13:47:55 +1000 From: David Gibson To: Jason Gunthorpe Cc: Alex Williamson , Lu Baolu , Chaitanya Kulkarni , Cornelia Huck , Daniel Jordan , Eric Auger , Eric Farman , iommu@lists.linux.dev, Jason Wang , Jean-Philippe Brucker , Joao Martins , Kevin Tian , kvm@vger.kernel.org, Matthew Rosato , "Michael S. Tsirkin" , Nicolin Chen , Niklas Schnelle , Shameerali Kolothum Thodi , Yi Liu , Keqian Zhu Subject: Re: [PATCH RFC v2 02/13] iommufd: Overview documentation Message-ID: References: <0-v2-f9436d0bde78+4bb-iommufd_jgg@nvidia.com> <2-v2-f9436d0bde78+4bb-iommufd_jgg@nvidia.com> Precedence: bulk X-Mailing-List: iommu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5yfa0rt9VpEbXa+D" Content-Disposition: inline In-Reply-To: --5yfa0rt9VpEbXa+D Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 27, 2022 at 02:33:31PM -0300, Jason Gunthorpe wrote: > On Mon, Sep 12, 2022 at 08:40:20PM +1000, David Gibson wrote: >=20 > > > > > +The iopt_pages is the center of the storage and motion of PFNs. = Each iopt_pages > > > > > +represents a logical linear array of full PFNs. PFNs are stored = in a tiered > > > > > +scheme: > > > > > + > > > > > + 1) iopt_pages::pinned_pfns xarray > > > > > + 2) An iommu_domain > > > > > + 3) The origin of the PFNs, i.e. the userspace pointer > > > >=20 > > > > I can't follow what this "tiered scheme" is describing. > > >=20 > > > Hum, I'm not sure how to address this. > > >=20 > > > Is this better? > > >=20 > > > 1) PFNs that have been "software accessed" stored in theiopt_pages::= pinned_pfns > > > xarray > > > 2) PFNs stored inside the IOPTEs accessed through an iommu_domain > > > 3) The origin of the PFNs, i.e. the userspace VA in a mm_struct > >=20 > > Hmm.. only slightly. What about: > >=20 > > Each opt_pages represents a logical linear array of full PFNs. The > > PFNs are ultimately derived from userspave VAs via an mm_struct. > > They are cached in .. > data structures> >=20 > Ok, I have this now: >=20 > Each iopt_pages represents a logical linear array of full PFNs. The PFNs= are > ultimately derived from userspave VAs via an mm_struct. Once they have be= en > pinned the PFN is stored in an iommu_domain's IOPTEs or inside the pinned= _pages > xarray if they are being "software accessed". >=20 > PFN have to be copied between all combinations of storage locations, depe= nding > on what domains are present and what kinds of in-kernel "software access"= users > exists. The mechanism ensures that a page is pinned only once. LGTM, thanks. --=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 --5yfa0rt9VpEbXa+D Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEoULxWu4/Ws0dB+XtgypY4gEwYSIFAmM1FVMACgkQgypY4gEw YSK2hA/9Hrv1lp1/s5YVngIqn5RydDQnnFdY+f9IOEQtPQtNESsPgpfloIY0Y3WN CqWlew+XwKokqMFLTIS1M9BVZlr4ybORItcGyfJOgmTXx/VJ2w81DPzvQezzQ7iy dppTIlbfAxm/+A2W7gGUsLsrRv+XuM74oQJ0gYlzZHqvRRvd01/MjCaISVYUG3lT V6hjxvQjCJdGnkotOE8hX3r4UAajwQSr4duncZi/jSvrUj5vKHZWjxesWTYFH6zP THMrxHQFxl70b8nQwryHCXbPXo5mOKyK62NREfaq7NYISiPpk3BP/iaFT5o90ixq 3m4k/3Zl56Lq9ehXY73i9TfRFhfCgTpItXR5Mf/6SwlKf5sMsdBis+A6ytqf1xIt jEeniP9u0JdVBz8F5XuBpWm+i5N4Cnv6EbS/RTgjLgR2BTteBP9Mp1tOZI5h6apH VVUFjUii+ZoG1GlAS4cSKkGFER2413QYLFb54CYn5cZ5gs57VMy/fUEd+wN8bmoe OZlAxTJrwSEAr9xEis7aLRZOVDpH+aUIBsM3qmqPz05sAJbg8iDCo00hpAe9G7/f aIihuTyTTMW6sWJ5oLV/Y6snOzAWQp46HMwiyokpzsCwF2duNSyVbIEnOqmIaUVy 7bk3rgd1i0IuY3XSERNUgQEFG2FxXB8/4j9jf3AdVes4twhAlLU= =L8Hd -----END PGP SIGNATURE----- --5yfa0rt9VpEbXa+D--