[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250506125222.GW2260709@nvidia.com>
Date: Tue, 6 May 2025 09:52:22 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Nicolin Chen <nicolinc@...dia.com>
Cc: Pranjal Shrivastava <praan@...gle.com>, kevin.tian@...el.com,
corbet@....net, will@...nel.org, bagasdotme@...il.com,
robin.murphy@....com, joro@...tes.org, thierry.reding@...il.com,
vdumpa@...dia.com, jonathanh@...dia.com, shuah@...nel.org,
jsnitsel@...hat.com, nathan@...nel.org, peterz@...radead.org,
yi.l.liu@...el.com, mshavit@...gle.com, zhangzekun11@...wei.com,
iommu@...ts.linux.dev, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-tegra@...r.kernel.org, linux-kselftest@...r.kernel.org,
patches@...ts.linux.dev, mochs@...dia.com, alok.a.tiwari@...cle.com,
vasant.hegde@....com
Subject: Re: [PATCH v2 13/22] iommufd: Add mmap interface
On Mon, May 05, 2025 at 12:50:56PM -0700, Nicolin Chen wrote:
> I wanted to ask: what should we pass in to the "entry"? An mmap
> structure that hold the pfn range? Or just pfn_start?
Some kind of struct telling you what is behind that pfn range so you
can invoke the right driver callback and retun the right pfns..
> With that being said, it seems that I have been misusing the
> mtree data structure, treating it as an xarray. In your very
> first email suggesting the mmap design, where you mentioned
> "xarray" first and "maple tree" following. So, I thought they
> can be used in the similar way, especially after reading this:
> https://lwn.net/Articles/846175/
This job requires a range based datastructure. Meaning you insert PFNs
A->B and then a lookup would search for any intersection with A->B.
In maple tree you can do this rather directly since it is inherently
range based.
In xarray you can do it with the multi-order feature or you can do it
by replicating the entry across the whole range.
Jason
Powered by blists - more mailing lists