Re: [PATCH RFC v2 31/50] KVM: guest_memfd: Support getting PFNs for stage 2 from providers
From: Fred Griffoul
Date: Fri Oct 23 2026 - 13:24:09 EST
> + int (*get_pfn)(void *provider, pgoff_t index, unsigned long *pfn,
> + int *max_order);
Should get_pfn() also return attributes of the frame? Only the provider
knows them, and every mapping of the frame has to follow them. Two
examples:
- Read only. A provider may lend a page that the guest can read but not
write. I know you dropped this from the sample to keep things simple,
but without it guest_memfd maps every frame writable, and there is no
other way to make a guest_memfd page read only.
- Aliased. The frame is also reachable somewhere else, e.g. a ring
shared with a device. Such a frame must not become private; see my
reply to 34/50.
A u32 of flags, with 0 for today's behaviour, would cover both and
leave room for more later.
Fred