Re: [PATCH v2 3/6] drm/ttm, drm/vmwgfx: directly create writable PTEs when mkwrite is in use

From: Paolo Bonzini

Date: Mon Aug 10 2026 - 06:08:22 EST


On Mon, Aug 10, 2026 at 12:01 PM Christian König
<christian.koenig@xxxxxxx> wrote:
>
>
> > - /* Never error on prefaulted PTEs */
> > + /* Never error on prefaulted PTEs and never map them writable */
> > + mkwrite = false;
>
> As far as I can see that is a really bad idea, we do want the prefaulted PTEs writeable.
>
> The whole prefaulting is essentially an optimization for cases where taking a fault has massively overhead (virtualization for example).
>
> Wasn't vmf_insert_pfn_prot() making them writeable before?

In general yes and they still will be, but not if pfn_mkwrite was used
(as in the vmwgfx driver). I'll change the comment to "never force
them to be writable". Setting mkwrite to false is exactly the same
behavior as before, setting it to true is a superset.

Paolo