Re: [PATCH 2/3] mm: provide mapping_wrprotect_page() function

Christoph Hellwig
2025-02-04T05:36:56Z

Hi Simona,

On Mon, Feb 03, 2025 at 04:49:34PM +0100, Simona Vetter wrote:
>
> Could we go one step further and entirely drop the struct page? Similar to
> unmap_mapping_range for VM_SPECIAL mappings, except it only updates the
> write protection. The reason is that ideally we'd like fbdev defio to
> entirely get rid of any struct page usage, because with some dma_alloc()
> memory regions there's simply no struct page for them (it's a carveout).

Umm, for dma_alloc* where * is not _pages you never can get a page or
PFN form them. They are block boxes and drivers must not attempt to
translated them into either a page or PFN or things will go wrong.
Only the kernel virtual address and dma_address may be used.

> See e.g. Sa498d4d06d6 ("drm/fbdev-dma: Only install deferred I/O if
> necessary") for some of the pain this has caused.

The commit hash is corrupted, I guess this is 5a498d4d06d6 as the
subject line matches. And that commit (just like the code it is trying
to fix) is completely broken as it violates the above.