Thread (154 messages) 154 messages, 12 authors, 2d ago

Re: [PATCH v8 09/46] KVM: guest_memfd: Introduce function to check GFN private/shared status

From: Binbin Wu <hidden>
Date: 2026-06-25 01:39:55
Also in: kvm, linux-coco, linux-doc, linux-kselftest, linux-mm, lkml


On 6/24/2026 10:38 PM, Ackerley Tng wrote:
Binbin Wu [off-list ref] writes:
quoted
[...snip...]
quoted
+bool kvm_gmem_is_private(struct kvm *kvm, gfn_t gfn)
+{
+	struct kvm_memory_slot *slot = gfn_to_memslot(kvm, gfn);
+	struct inode *inode;
+
+	/*
+	 * If this gfn has no associated memslot, there's no chance of the gfn
+	 * being backed by private memory, since guest_memfd must be used for
+	 * private memory,
"guest_memfd must be used for private memory" is a bit confusing to me.
Hmm good point. Is the source of confusion that guest_memfd can be used
for both shared and private memory?
Yes.
Perhaps this can be rephrased as:

guest_memfd is the only provider of private memory and guest_memfd must
be used with a memslot, hence if there's no associated memslot, there's
no chance of this gfn being private.
LGTM.
quoted
quoted
and guest_memfd must be associated with some memslot.
+	 */
+	if (!slot)
+		return 0;
+

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