Skip to content

KVM: guest_memfd: use write for population

Nikita Kalyazin kvm linux-kselftest lkml 2 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 0 repliesNew
  2. v2 RFC2 patches 1 replySuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2KVM: guest_memfd: add generic population via writevirt/kvm/guest_memfd.c+91 -30 replies
2/2KVM: selftests: update guest_memfd write teststools/testing/selftests/kvm/guest_memfd_test.c+79 -60 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [v3 PATCH 0/2] KVM: guest_memfd: use write for population

This series is rebased on top of Fuad's v4 for shared mapping of guest_memfd [1].

Change since v2 [2]:
- David/Mike D: Only compile support for the write syscall if CONFIG_KVM_GMEM_SHARED_MEM introduced in [1] is enabled.

In non-CoCo use cases where the host can access guest memory, guest_memfd can be allocated and populated via the write syscall. Even though the same can also be achieved via userspace mapping and memcpy from userspace, write provides a more performant option because it 1) avoids double initialisation as the kernel does not need to zero pages and 2) does not require setting up page tables.

Nikita

[1] https://lore.kernel.org/kvm/[email protected]/T/
[2] https://lore.kernel.org/kvm/[email protected]/T/

Nikita Kalyazin (2):
KVM: guest_memfd: add generic population via write
KVM: selftests: update guest_memfd write tests

 .../testing/selftests/kvm/guest_memfd_test.c  | 85 +++++++++++++++--
 virt/kvm/guest_memfd.c                        | 94 ++++++++++++++++++-
 2 files changed, 170 insertions(+), 9 deletions(-)

base-commit: 005f6404708d430abab7fab9b422d0daf6e0c2fe

Signature · 1 line
2.47.1