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

Marc-André Lureau posted 9 patches 6 years, 5 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20171023141815.17709-1-marcandre.lureau@redhat.com
Test checkpatch passed
Test docker passed
Test s390x passed
There is a newer version of this series
include/qemu/memfd.h     |   4 +-
backends/hostmem-memfd.c | 168 +++++++++++++++++++++++++++++++++++++++++++++++
hw/virtio/vhost.c        |   8 ++-
tests/vhost-user-test.c  | 160 +++++++++++++++++++++++++++-----------------
util/memfd.c             | 115 ++++++++++++++++++++------------
backends/Makefile.objs   |   2 +
qemu-options.hx          |  23 +++++++
7 files changed, 378 insertions(+), 102 deletions(-)
create mode 100644 backends/hostmem-memfd.c
[Qemu-devel] [PATCH v6 0/9] Add memfd memory backend
Posted by Marc-André Lureau 6 years, 5 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.

Since Linux 4.14, memfd supports explicit hugetlb, however without
sealing.

v6:
- add hugetlbsize option
- run vhost-user read-guest-mem test with memfile & memfd backend

v5:
- add memfd hugetlb support
- add seal and hugeltb options to memfd memory backend
- update qemu-option to explain sharing works with vhost-user for now
- rebased, misc code changes

v4:
- rebased, now that preliminary patches are merged

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):
  memfd: split qemu_memfd_alloc()
  memfd: remove needless include
  memfd: add error argument, instead of perror()
  memfd: add hugetlb support
  memfd: add hugetlbsize argument
  Add memfd based hostmem
  tests: keep compiling failing vhost-user tests
  vhost-user-test: make read-guest-mem setup its own qemu
  tests: use memfd in vhost-user-test

 include/qemu/memfd.h     |   4 +-
 backends/hostmem-memfd.c | 168 +++++++++++++++++++++++++++++++++++++++++++++++
 hw/virtio/vhost.c        |   8 ++-
 tests/vhost-user-test.c  | 160 +++++++++++++++++++++++++++-----------------
 util/memfd.c             | 115 ++++++++++++++++++++------------
 backends/Makefile.objs   |   2 +
 qemu-options.hx          |  23 +++++++
 7 files changed, 378 insertions(+), 102 deletions(-)
 create mode 100644 backends/hostmem-memfd.c

-- 
2.15.0.rc0.40.gaefcc5f6f


Re: [Qemu-devel] [PATCH v6 0/9] Add memfd memory backend
Posted by Marc-André Lureau 6 years, 3 months ago
Hi

On Mon, Oct 23, 2017 at 4:18 PM, Marc-André Lureau
<marcandre.lureau@redhat.com> 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.
>
> Since Linux 4.14, memfd supports explicit hugetlb, however without
> sealing.

A little update here, 4.16 is likely to support sealing with hugetlb
too (patches are in -mm tree). This should make memfd the prefered
backend for sharing memory with a vhost-user backend.

please review.
thanks

>
> v6:
> - add hugetlbsize option
> - run vhost-user read-guest-mem test with memfile & memfd backend
>
> v5:
> - add memfd hugetlb support
> - add seal and hugeltb options to memfd memory backend
> - update qemu-option to explain sharing works with vhost-user for now
> - rebased, misc code changes
>
> v4:
> - rebased, now that preliminary patches are merged
>
> 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):
>   memfd: split qemu_memfd_alloc()
>   memfd: remove needless include
>   memfd: add error argument, instead of perror()
>   memfd: add hugetlb support
>   memfd: add hugetlbsize argument
>   Add memfd based hostmem
>   tests: keep compiling failing vhost-user tests
>   vhost-user-test: make read-guest-mem setup its own qemu
>   tests: use memfd in vhost-user-test
>
>  include/qemu/memfd.h     |   4 +-
>  backends/hostmem-memfd.c | 168 +++++++++++++++++++++++++++++++++++++++++++++++
>  hw/virtio/vhost.c        |   8 ++-
>  tests/vhost-user-test.c  | 160 +++++++++++++++++++++++++++-----------------
>  util/memfd.c             | 115 ++++++++++++++++++++------------
>  backends/Makefile.objs   |   2 +
>  qemu-options.hx          |  23 +++++++
>  7 files changed, 378 insertions(+), 102 deletions(-)
>  create mode 100644 backends/hostmem-memfd.c
>
> --
> 2.15.0.rc0.40.gaefcc5f6f
>
>



-- 
Marc-André Lureau

Re: [Qemu-devel] [PATCH v6 0/9] Add memfd memory backend
Posted by Eduardo Habkost 6 years, 2 months ago
On Fri, Dec 22, 2017 at 07:48:43PM +0100, Marc-André Lureau wrote:
> Hi
> 
> On Mon, Oct 23, 2017 at 4:18 PM, Marc-André Lureau
> <marcandre.lureau@redhat.com> 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.
> >
> > Since Linux 4.14, memfd supports explicit hugetlb, however without
> > sealing.
> 
> A little update here, 4.16 is likely to support sealing with hugetlb
> too (patches are in -mm tree). This should make memfd the prefered
> backend for sharing memory with a vhost-user backend.
> 
> please review.
> thanks

I've queued patches 1-2 on machine-next.  I plan to review the
rest soon.  Sorry for the long delay.

-- 
Eduardo