RE: [PATCH] mm/vmalloc: fix mischeck pfn valid in vmap_pfns

From: Kasireddy, Vivek
Date: Tue Mar 25 2025 - 02:32:30 EST


Hi Huan,

> Subject: Re: [PATCH] mm/vmalloc: fix mischeck pfn valid in vmap_pfns
>
> HI Hillf,
>
> Thanks fo your suggestion.
>
> 在 2025/3/19 19:26, Hillf Danton 写道:
> > On Wed, 19 Mar 2025 09:08:51 +0100 Christoph Hellwig wrote:
> >> On Wed, Mar 19, 2025 at 01:03:55PM +0800, Hillf Danton wrote:
> >>> A quick fix is to add a vmap_pfn variant to walk around the pfn
> >>> check in question, like the following diff (just for idea show).
> >> No.
> >>
> > Patient to see your fix, given no low hanging peach left for Mr Folio
> > in case of HVO, (feel free to ignore, who is likely about 2.6-mile
> > less tough than you could be).
>
> I now believe there are two way to resolve the HVO folio can't vmap in
> udmabuf.
>
> 1. simple copy vmap_pfn code, don't bother common vmap_pfn, use by itself
> and remove pfn_valid check.
>
> 2. implement folio array based vmap(vmap_folios), which can given a range of
> each folio(offset, nr_pages), so can suit HVO folio's vmap.
>
> 1 is simple and can fast fix this issue, but may not too good. I need discuss with
> bot Christoph and udmabuf's maintainer.
>
> 2 is hard, but may worth to research, which I also will try to do. :)
Another option is to just limit udmabuf's vmap() to only shmem folios but I guess
it may not work as expected if THP is also enabled.
Bingbu, what exactly is your use-case? Could you please describe the scenario that
requires you to use udmabuf's vmap()?

Thanks,
Vivek

>