Thread (107 messages) flat view 107 messages, 10 authors, 1d ago

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

From: "David Hildenbrand (Arm)" <david@kernel.org>
Date: 2026-08-10 09:07:16
Also in: kvm, linux-coco, linux-doc, linux-kselftest, linux-mm, lkml

On 8/7/26 23:52, Ackerley Tng via B4 Relay wrote:
From: Ackerley Tng <redacted>

Before conversion, a guest_memfd could be either all shared, or all
You mean "in-place conversion support" ?
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.

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.

-- 
Cheers,

David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help