[Qemu-devel] [PATCH v3 0/9] Add memfd memory backend

Marc-André Lureau posted 9 patches 8 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20170602141229.15326-1-marcandre.lureau@redhat.com
Test FreeBSD passed
Test checkpatch passed
Test docker passed
Test s390x passed
There is a newer version of this series
include/exec/memory.h    |  31 ++++++++-----
include/exec/ram_addr.h  |   3 ++
include/qemu/memfd.h     |   2 +
backends/hostmem-memfd.c |  67 +++++++++++++++++++++++++++
exec.c                   | 116 ++++++++++++++++++++++++++++-------------------
hw/misc/ivshmem.c        |  14 +++---
memory.c                 |  26 +++++++----
tests/vhost-user-test.c  |  68 +++++++++++++++++----------
util/memfd.c             |  42 ++++++++++-------
backends/Makefile.objs   |   2 +
qemu-options.hx          |  11 +++++
11 files changed, 266 insertions(+), 116 deletions(-)
create mode 100644 backends/hostmem-memfd.c
[Qemu-devel] [PATCH v3 0/9] Add memfd memory backend
Posted by Marc-André Lureau 8 years, 8 months ago
Add a new Linux-specific memory backend, similar to hostmem-file,
except that it doesn't need file path. It also try to enforce memory
sealing if available. It is thus slightly easier and secure, and is
compatible with transparent huge-pages since Linux 4.8.

The first 6 patches are mostly cleanups and could be considered
regardless of memfd hostmem acceptability.

v3:
- make vhost-user-test use memfd only if possible
- rebased

v1->v2:
- make it linux-specific
- minor changes and commit message tweaks

Marc-André Lureau (9):
  exec: check kvm mmu notifiers earlier
  exec: split file_ram_alloc()
  exec: split qemu_ram_alloc_from_file()
  Add memory_region_init_ram_from_fd()
  ivshmem: use ram_from_fd()
  memory: remove memory_region_set_fd
  memfd: split qemu_memfd_alloc()
  Add memfd based hostmem
  tests: use memfd in vhost-user-test

 include/exec/memory.h    |  31 ++++++++-----
 include/exec/ram_addr.h  |   3 ++
 include/qemu/memfd.h     |   2 +
 backends/hostmem-memfd.c |  67 +++++++++++++++++++++++++++
 exec.c                   | 116 ++++++++++++++++++++++++++++-------------------
 hw/misc/ivshmem.c        |  14 +++---
 memory.c                 |  26 +++++++----
 tests/vhost-user-test.c  |  68 +++++++++++++++++----------
 util/memfd.c             |  42 ++++++++++-------
 backends/Makefile.objs   |   2 +
 qemu-options.hx          |  11 +++++
 11 files changed, 266 insertions(+), 116 deletions(-)
 create mode 100644 backends/hostmem-memfd.c

-- 
2.13.0.91.g00982b8dd


Re: [Qemu-devel] [PATCH v3 0/9] Add memfd memory backend
Posted by Daniel P. Berrange 8 years, 8 months ago
On Fri, Jun 02, 2017 at 06:12:20PM +0400, Marc-André Lureau wrote:
> Add a new Linux-specific memory backend, similar to hostmem-file,
> except that it doesn't need file path. It also try to enforce memory
> sealing if available. It is thus slightly easier and secure, and is
> compatible with transparent huge-pages since Linux 4.8.

What about explicit huge pages ?  They are the key scenario scenario where
libvirt uses hostmem-file.  AFAICT, there's no way to request explicit
huge pages with memfd_create() syscall :-(

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

Re: [Qemu-devel] [PATCH v3 0/9] Add memfd memory backend
Posted by Marc-André Lureau 8 years, 8 months ago
On Fri, Jun 2, 2017 at 6:25 PM Daniel P. Berrange <berrange@redhat.com>
wrote:

> On Fri, Jun 02, 2017 at 06:12:20PM +0400, Marc-André Lureau wrote:
> > Add a new Linux-specific memory backend, similar to hostmem-file,
> > except that it doesn't need file path. It also try to enforce memory
> > sealing if available. It is thus slightly easier and secure, and is
> > compatible with transparent huge-pages since Linux 4.8.
>
> What about explicit huge pages ?  They are the key scenario scenario where
> libvirt uses hostmem-file.  AFAICT, there's no way to request explicit
> huge pages with memfd_create() syscall :-(
>

 Sadly, I don't think it's yet possible either.
-- 
Marc-André Lureau