ivshmem: allow the sharing of hugepages
PATCH v4 1/1 ivshmem: allow the sharing of hugepages
This patch permits to share memory areas that do not specifically belong to /dev/shm. In such case, the file must be already present when launching qemu. A new parameter 'file' has been added to specify the file to use.
A use case for this patch is sharing huge pages available through a hugetlbfs mountpoint.
---
2 years passed since the last review of this, and the original author never came back. So i decided
to pick up this work because my project is interested in this feature. I am keeping patch version numbering, but the original changelog was lost.
Relevant thread here: https://lists.gnu.org/archive/html/qemu-trivial/2013-09/msg00148.html
v3 => v4:
- Fixed documentation and wordings according to the last review
- Report also actual error messages
- Added missing exit()
- Fixed up code style according to latest checkpatch rules
--- docs/specs/ivshmem_device_spec.txt | 7 ++-- hw/misc/ivshmem.c | 67 +++++++++++++++++++++++++------------- 2 files changed, 50 insertions(+), 24 deletions(-)
docs/specs/ivshmem_device_spec.txt +5 -2
@@ -4,8 +4,11 @@ Device Specification for Inter-VM shared memory device The Inter-VM shared memory device is designed to share a region of memory to userspace in multiple virtual guests. The memory region does not belong to any -guest, but is a POSIX memory object on the host. Optionally, the device may -support sending interrupts to other guests sharing the same memory region. +guest, but is a either a POSIX memory object or a mmap'd file (for instance, +hugepage-backed file) on the host. + +Optionally, the device may support sending interrupts to other guests sharing +the same memory region. The Inter-VM PCI device
hw/misc/ivshmem.c +45 -22
97 lines not on this page · raw message
Signature · 1 line
1.9.5.msysgit.0
Quoted 6 lines · Pavel Fedin
This patch permits to share memory areas that do not specifically belong to
/dev/shm. In such case, the file must be already present when launching qemu. A new parameter 'file' has been added to specify the file to use.A use case for this patch is sharing huge pages available through a hugetlbfs mountpoint.
ivshmem is getting a big reboot right now. See this series "[PATCH v5 00/48] ivshmem improvements". Part of that work is to better support sharing huge pages. Please look at that series first, and if there's still something missing, then additional patches to that series should be posted.
Thanks,
drew
Hello!
Quoted 3 lines
ivshmem is getting a big reboot right now. See this series "[PATCH v5 00/48] ivshmem improvements". Part of that work is to better support sharing huge pages.
I see there's a PULL, and i was waiting for it to be merged in order to test. But, is it going to
happen? I see there's some strong authorship-related conflict around it.
Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia
Hi
Quoted 2 lines · Pavel Fedin
I see there's a PULL, and i was waiting for it to be merged in order to test. But, is it going to
happen? I see there's some strong authorship-related conflict around it.
The authorship conflict is related to a single commit that could easily be dropped in the next pull request. It's worth it if you could test before it before it's actually merge!
thanks
Signature · 1 line
Marc-André Lureau
Hello!
Quoted 3 lines
The authorship conflict is related to a single commit that could easily be dropped in the next pull request. It's worth it if you could test before it before it's actually merge!
Ok. In this case a single question. How to configure qemu to use ivshmem with the series. I have seen that "ivshmem can now use host memory backend", but how to set it up? I checked documentation patch, did not find good explanation there. But, well, programmers never read docs :)
Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia
Hi
Quoted 1 line · Pavel Fedin
Ok. In this case a single question. How to configure qemu to use ivshmem with the series. I have seen that "ivshmem can now use host memory backend", but how to set it up? I checked documentation patch, did not find good explanation there. But, well, programmers never read docs :)
It is like other memdev properties, and there is an example in the patch adding a test:
-object memory-backend-ram,size=1M,id=mb1 -device ivshmem,memdev=mb1
I will work on a patch to update the documentation.
Signature · 1 line
Marc-André Lureau
Hello!
Quoted 3 lines
It is like other memdev properties, and there is an example in the patch adding a test:
-object memory-backend-ram,size=1M,id=mb1 -device ivshmem,memdev=mb1
But what will cause memory-backend-ram to use hugetlb instead of just a RAM?
P.S. Sorry if the question is stupid, i'm not really familiar in hugetlb details. I only know that managing huge pages is done via hugetlbfs.
Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia
Hi
Quoted 3 lines · Pavel Fedin
But what will cause memory-backend-ram to use hugetlb instead of just a RAM?
P.S. Sorry if the question is stupid, i'm not really familiar in hugetlb details. I only know that managing huge pages is done via hugetlbfs.
Ah right, docs/memory-hotplug.txt should give you more details:
memory-backend-file,id=mem1,size=1G,mem-path=/mnt/hugepages-1GB
I wish they would have documented this in qemu-docs.texi too
Signature · 1 line
Marc-André Lureau
Hi!
Quoted 2 lines
P.S. Sorry if the question is stupid, i'm not really familiar in hugetlb details. I only know
that managing huge pages is done via hugetlbfs.
Ops, i was double-stupid. :) The question should have actually been: "How to configure ivshmem to use hugetlb with the series?"
Kind regards,
Pavel Fedin
Expert Engineer
Samsung Electronics Research center Russia