# Re: \[PATCH 2/3\] mm: provide mapping\_wrprotect\_page() function

- From: Christoph Hellwig \<hch@infradead.org\>
- Date: 2025-02-04 05:36:46 
- List: linux-fbdev
- Page: https://ratatoskr.run/linux-fbdev/2025/02/2910761
- Thread: https://ratatoskr.run/linux-fbdev/2025/01/2907871/t.md

```text
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.

```
