Re: udmabuf vmap failed (Revert "udmabuf: fix vmap_udmabuf error page set" can help)
From: Christoph Hellwig
Date: Wed Mar 12 2025 - 01:32:56 EST
On Tue, Mar 11, 2025 at 11:14:28AM +0000, Ryan Roberts wrote:
> Hi,
>
> On 11/03/2025 09:34, Huan Yang wrote:
> > Hi Christoph and Ryan,
> >
> > Can you help us check vmap_pfn's pfn check is right? Did here mischecked pfn_valid?
>
> I'm no expert on this piece of code, but I believe pfn_valid() is checking to
> see if a pfn is valid *memory*. i.e. does it have a corresponding struct page?
>
> I'm guessing that vmap_pfn() is only intended to be used for non-memory pfns,
> e.g. mmio regions. You probably want either vmap() or vm_map_ram()?
Exactly. vmap_pfn is a special case for mapping non-page backed memory.
Wjile looking ad udmabuf, the crap it does with dma mapping to the
misc device-attached struct device also can't work except by chance in a
few very exceptional setups. So as far as I can tell udmabuf isn't
really something usable to start with, which might explain why the
issues with vmap/vmap_pfn weren't easily noticed.