qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-discuss] QEMU/KVM with startup RAM in shared single 1GB hugepage


From: Koehrer Mathias (ETAS/EHE1)
Subject: [Qemu-discuss] QEMU/KVM with startup RAM in shared single 1GB hugepage
Date: Thu, 16 Nov 2017 08:42:47 +0000

Hi all,

I am trying to get the following setup to fly:
I want to have a qemu-system-x86_64 (kvm) running with 1GB of RAM that is 
totally located in a 
single 1GB hugepage memory mapped file.
The full 1GB of RAM of the guest should be accessible from other programs 
running on the host.

To have the hugepage support, I have built my host kernel with the support for 
it and started it
with the kernel parameters
default_hugepagesz=1G hugepagesz=1G hugepages=2
This works fine as /proc/meminfo shows me that the 1G hugepages are available.
I mounted the hugepages to /hugepages
by using the following line in /etc/fstab
hugetlbfs /hugepages hugetlbfs defaults 0 2

This works perfectly.

What I want to achieve is that I can access the guest's memory from outside.
In the guest I run a minimal Debian Linux (x86_64).

Test
-------------
For testing I have created a tiny tool to run in the guest's Linux that 
accesses the memory via /dev/mem
and writes a magic string onto the physical address 0x10000.
My assumption is that I can see this very same magic string on the host side by 
performing a mmap
on the hugepage file on offset 0x10000.
However I was never able to get this working.


I have tried a couple of approaches:

1.  numa node
----------------------------
I added the following options to the command line of kvm (=qemu-system-x86_64):
-m 1G -object 
memory-backend-file,id=mymem,size=1G,mem-path=/hugepages/mymem,share=on  -numa 
node,memdev=mymem
I can see that the file /hugepages/mymem will be created.
However my test from above fails. 
I assume this has to do as I have not actively added a numa memory node in my 
guest OS.

2. ivshmem-plain
---------------------------
I added the following options to the command line of kvm (=qemu-system-x86_64):
-m 1G -object 
memory-backend-file,size=1G,share=on,mem-path=/hugepages/mymem,id=mb1  -device 
ivshmem-plain,memdev=mb1
I can see that the file /hugepages/mymem will be created.
However my test from above fails again. 

3. mem-prealloc
--------------------------
I added the following options to the command line of kvm (=qemu-system-x86_64):
-m 1G -mem-prealloc -mem-path /hugepages/mymem
I can see that the file /hugepages/mymem will be created.
However my test from above fails again,
Is there an option to make the prellocated memory to be mapped in shared mode 
by qemu?


Unfortunately, I have not further idea how to proceed.
Any help on this topic is highly welcome.

Thanks a lot

Regards
Mathias






reply via email to

[Prev in Thread] Current Thread [Next in Thread]