Thread (83 messages) 83 messages, 11 authors, 2026-02-05

Re: [RFC PATCH v1 07/37] KVM: Introduce KVM_SET_MEMORY_ATTRIBUTES2

From: Ackerley Tng <hidden>
Date: 2025-10-27 12:48:58
Also in: cgroups, kvm, linux-doc, linux-fsdevel, linux-kselftest, linux-mm, lkml

Sean Christopherson [off-list ref] writes:
On Fri, Oct 24, 2025, Ackerley Tng wrote:
quoted
Sean Christopherson [off-list ref] writes:
quoted
@@ -486,6 +488,7 @@ struct kvm_vm *__vm_create(struct vm_shape shape, uint32_t nr_runnable_vcpus,
        }
        guest_rng = new_guest_random_state(guest_random_seed);
        sync_global_to_guest(vm, guest_rng);
+       sync_global_to_guest(vm, kvm_has_gmem_attributes);
I ported this [1] except for syncing this value to the guest, because I
think the guest shouldn't need to know this information,
KVM selftests are about practically and testing, what information should or
shouldn't be available to a test from e.g. a safety perspective is completely
irrelevant.  In fact, one of the biggest advantages of selftests over KUT is
that the guest side can know _exactly_ what's going on in the host.

See the usage in 1850e3da4b03 ("KVM: selftests: Update private_mem_conversions_test
to mmap() guest_memfd") from:

  https://github.com/sean-jc/linux.git x86/gmem_inplace
quoted
the host should decide what to do. I think, if the guests really need to know
this, the test itself can do the syncing.
Why force tests to do extra work, and potentially introduce subtle bugs due to
state being stale?
Adding it back. Thanks!

This variable should be sync-able for TDX selftests as well since the
value should be synced before the TD image is loaded.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help