Re: [PATCH v10 09/41] KVM: guest_memfd: Filter both shared and private when invalidating

Suzuki K Poulose <[email protected]>
Newsgroups org.kernel.vger.linux-kselftest,dev.linux.lists.linux-coco,org.kernel.vger.kvm,org.kernel.vger.linux-doc,org.kernel.vger.linux-kernel,org.kernel.vger.linux-trace-kernel,org.kvack.linux-mm
Message-ID <[email protected]>
On 10/08/2026 10:06, David Hildenbrand (Arm) wrote:
> On 8/7/26 23:52, Ackerley Tng via B4 Relay wrote:
>> From: Ackerley Tng <[email protected]>
>>
>> Before conversion, a guest_memfd could be either all shared, or all
> 
> You mean "in-place conversion support" ?

Not necessarily. This is supposed to be :

"At creation, ...

> 
>> private, configured at creation time using the INIT_SHARED flag. Hence,
>> when zapping pages from stage 2 page tables, guest_memfd can filter which
>> to zap based on the initial shared/private state.
>>
>> With conversion, guest_memfd tracks shared/private state on a per-page
> 
> Same here.
> 
>> level, so a range can contain both private and shared pages. Zap both
>> private and shared pages for simplicity.
>>
>> An alternative would be to iterate guest_memfd attributes and only zap both
>> if shared and private pages exist within the range. Setting both the shared
>> and private filters lets the zapping logic do that iteration instead.
> 
> I mean, we just want to zap anything that belongs to guest_memfd, independent of
> shared vs. private, really?
> 
> IOW, it's not about shared vs. private, but really about zapping anything that
> belongs to guest_memfd.

Correct. But we want to control what we "zap" (invalidate range) when we
do the "conversion". e.g., if some ranges are already private, we don't
want to zap those pages, as they might have some data "populated" by the
VMM. For more context:

https://lore.kernel.org/all/[email protected]

Suzuki


> 
> So, couldn't there just be a KVM_FILTER_GMEM thingy instead?
> 
> But I didn't quite digest how these filters are used.
> 
> I can see that kvm_gfn_range_filter_to_root_types() does some magic to them, but
> I am not a KVM MMU expert to know what KVM_MIRROR_ROOTS would mean.
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.