qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] KVM/hostmem: Support in-place guest-memfd as VM backends
@ 2025-10-23 18:59 Peter Xu
  2025-10-23 18:59 ` [PATCH 1/8] linux-headers: Update to v6.18-rc2 Peter Xu
                   ` (7 more replies)
  0 siblings, 8 replies; 15+ messages in thread
From: Peter Xu @ 2025-10-23 18:59 UTC (permalink / raw)
  To: qemu-devel
  Cc: peterx, Paolo Bonzini, Fabiano Rosas, Chenyi Qiang,
	David Hildenbrand, Alexey Kardashevskiy, Li Xiaoyao, Juraj Marcin

This series allows QEMU to consume guest-memfd in-place, to be a common
memory backend. Before this series, guest-memfd was only used in CoCo and
the fds will be created implicitly whenever CoCo environment is detected.

In the current patchset, I reused the memory-backend-memfd object, rather
than creating a new type of object.  After all, guest-memfd (at least from
userspace POV) really works very similarly like a memfd, except that it was
tailored for VM's use case.

So instead of using a normal memfd backend using:

  -object memory-backend-memfd,id=ID,size=SIZE,share=on

One can also boot a VM with guest-memfd:

  -object memory-backend-memfd,id=ID,size=SIZE,share=on,guest-memfd=on

The in-place guest-memfd here relies on almost the latest linux, as the
mmap() support just landed v6.18-rc2.  When run it on an older qemu, we'll
see errors like:

  qemu-system-x86_64: KVM does not support guest_memfd

One thing to mention is live migration is by default supported, however
postcopy is still currently not supported.  The postcopy support will have
some kernel dependency work that was still being reviewed on mm list, so it
will be a separate work TBD.

Thanks,

Peter Xu (8):
  linux-headers: Update to v6.18-rc2
  kvm: Allow kvm_guest_memfd_supported for non-private use case
  kvm: Detect guest-memfd flags supported
  memory: Rename RAM_GUEST_MEMFD to RAM_GUEST_MEMFD_PRIVATE
  memory: Rename memory_region_has_guest_memfd() to *_private()
  ramblock: Rename guest_memfd to guest_memfd_private
  hostmem: Rename guest_memfd to guest_memfd_private
  hostmem: Support in-place guest memfd to back a VM

 qapi/qom.json                                 |  6 +-
 include/standard-headers/linux/ethtool.h      |  1 +
 include/standard-headers/linux/fuse.h         | 22 +++++-
 .../linux/input-event-codes.h                 |  1 +
 include/standard-headers/linux/input.h        | 22 +++++-
 include/standard-headers/linux/pci_regs.h     | 10 +++
 include/standard-headers/linux/virtio_ids.h   |  1 +
 include/system/hostmem.h                      |  2 +-
 include/system/memory.h                       | 16 ++---
 include/system/ram_addr.h                     |  2 +-
 include/system/ramblock.h                     |  7 +-
 linux-headers/asm-loongarch/kvm.h             |  1 +
 linux-headers/asm-riscv/kvm.h                 | 23 ++++++-
 linux-headers/asm-riscv/ptrace.h              |  4 +-
 linux-headers/asm-x86/kvm.h                   | 34 ++++++++++
 linux-headers/asm-x86/unistd_64.h             |  1 +
 linux-headers/asm-x86/unistd_x32.h            |  1 +
 linux-headers/linux/kvm.h                     |  3 +
 linux-headers/linux/psp-sev.h                 | 10 ++-
 linux-headers/linux/stddef.h                  |  1 -
 linux-headers/linux/vduse.h                   |  2 +-
 linux-headers/linux/vhost.h                   |  4 +-
 accel/kvm/kvm-all.c                           | 26 ++++---
 backends/hostmem-file.c                       |  2 +-
 backends/hostmem-memfd.c                      | 68 +++++++++++++++++--
 backends/hostmem-ram.c                        |  2 +-
 backends/hostmem.c                            |  2 +-
 system/memory.c                               |  6 +-
 system/physmem.c                              | 29 ++++----
 29 files changed, 253 insertions(+), 56 deletions(-)

-- 
2.50.1



^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2025-10-27  5:25 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-23 18:59 [PATCH 0/8] KVM/hostmem: Support in-place guest-memfd as VM backends Peter Xu
2025-10-23 18:59 ` [PATCH 1/8] linux-headers: Update to v6.18-rc2 Peter Xu
2025-10-23 18:59 ` [PATCH 2/8] kvm: Allow kvm_guest_memfd_supported for non-private use case Peter Xu
2025-10-24  2:30   ` Xiaoyao Li
2025-10-23 18:59 ` [PATCH 3/8] kvm: Detect guest-memfd flags supported Peter Xu
2025-10-24  3:52   ` Xiaoyao Li
2025-10-23 18:59 ` [PATCH 4/8] memory: Rename RAM_GUEST_MEMFD to RAM_GUEST_MEMFD_PRIVATE Peter Xu
2025-10-24  9:17   ` Xiaoyao Li
2025-10-23 18:59 ` [PATCH 5/8] memory: Rename memory_region_has_guest_memfd() to *_private() Peter Xu
2025-10-23 18:59 ` [PATCH 6/8] ramblock: Rename guest_memfd to guest_memfd_private Peter Xu
2025-10-23 18:59 ` [PATCH 7/8] hostmem: " Peter Xu
2025-10-23 18:59 ` [PATCH 8/8] hostmem: Support in-place guest memfd to back a VM Peter Xu
2025-10-24  9:01   ` Xiaoyao Li
2025-10-24 15:22     ` Peter Xu
2025-10-27  5:24       ` Xiaoyao Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).