[libvirt-users] what is the xml fomat about memory-backend-file

Hi, I want to use virsh to create a VM with the qemu parameter '-object memory-backend-file,id=mem,size=2048M,mem-path=/mnt/huge,share=on -numa node,memdev=mem'. How to write the XML file?

On 09/24/2014 02:05 AM, Linhaifeng wrote:
Hi,
I want to use virsh to create a VM with the qemu parameter '-object memory-backend-file,id=mem,size=2048M,mem-path=/mnt/huge,share=on -numa node,memdev=mem'.
Looking at tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.args, I see several instances of "-object memory-backend-file...", so look at the counterpart .xml file for some examples: <memoryBacking> <hugepages> <page size='2048' unit='KiB' nodeset='1'/> <page size='1048576' unit='KiB' nodeset='0,2-3'/> </hugepages> </memoryBacking> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 2014/9/25 2:05, Eric Blake wrote:
On 09/24/2014 02:05 AM, Linhaifeng wrote:
Hi,
I want to use virsh to create a VM with the qemu parameter '-object memory-backend-file,id=mem,size=2048M,mem-path=/mnt/huge,share=on -numa node,memdev=mem'.
Looking at tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.args, I see several instances of "-object memory-backend-file...", so look at the counterpart .xml file for some examples:
<memoryBacking> <hugepages> <page size='2048' unit='KiB' nodeset='1'/> <page size='1048576' unit='KiB' nodeset='0,2-3'/> </hugepages> </memoryBacking>
Thank you. I use this xml: <cpu> <numa> <cell id='0' cpus='0' memory='1073741824' memAccess='shared'/> <cell id='1' cpus='1' memory='1073741824' memAccess='shared'/> </numa> </cpu> <memoryBacking> <hugepages> <page size="2" unit="M" nodeset="0,1"/> </hugepages> </memoryBacking> but there is also some error: [2014-09-28T05:28:32.373335Z] migration_configure:652 Parameter 'cache size' expects exceeds guest ram size [2014-09-28T05:28:32.373422Z] main:3517 start memory options parse 2014-09-28T05:28:32.373802Z qemu-kvm: -object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,size=1048576M,id=ram-node0: unable to map backing store for hugepages: Cannot allocate memory 2014-09-28T05:28:32.373895Z qemu-kvm: -object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,size=1048576M,id=ram-node1: unable to map backing store for hugepages: Cannot allocate memory

On 09/28/2014 01:38 PM, Linhaifeng wrote:
On 2014/9/25 2:05, Eric Blake wrote:
Hi,
I want to use virsh to create a VM with the qemu parameter '-object memory-backend-file,id=mem,size=2048M,mem-path=/mnt/huge,share=on -numa node,memdev=mem'. Looking at tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.args, I see several instances of "-object memory-backend-file...", so look at
On 09/24/2014 02:05 AM, Linhaifeng wrote: the counterpart .xml file for some examples:
<memoryBacking> <hugepages> <page size='2048' unit='KiB' nodeset='1'/> <page size='1048576' unit='KiB' nodeset='0,2-3'/> </hugepages> </memoryBacking>
Thank you.
I use this xml: <cpu> <numa> <cell id='0' cpus='0' memory='1073741824' memAccess='shared'/> <cell id='1' cpus='1' memory='1073741824' memAccess='shared'/> </numa> </cpu> <memoryBacking> <hugepages> <page size="2" unit="M" nodeset="0,1"/> </hugepages> </memoryBacking>
but there is also some error: [2014-09-28T05:28:32.373335Z] migration_configure:652 Parameter 'cache size' expects exceeds guest ram size [2014-09-28T05:28:32.373422Z] main:3517 start memory options parse 2014-09-28T05:28:32.373802Z qemu-kvm: -object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,size=1048576M,id=ram-node0: unable to map backing store for hugepages: Cannot allocate memory 2014-09-28T05:28:32.373895Z qemu-kvm: -object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,size=1048576M,id=ram-node1: unable to map backing store for hugepages: Cannot allocate memory
get total number of the hugepages you could use: # cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages From your xml: <cell id='0' cpus='0' memory='1073741824' memAccess='shared'/> <cell id='1' cpus='1' memory='1073741824' memAccess='shared'/> I guess your machine doesn't have so much hugepage memory: sum(1073741824 + 1073741824)=2048G !!!
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users

On 2014/9/28 16:19, Jincheng Miao wrote:
On 09/28/2014 01:38 PM, Linhaifeng wrote:
On 2014/9/25 2:05, Eric Blake wrote:
Hi,
I want to use virsh to create a VM with the qemu parameter '-object memory-backend-file,id=mem,size=2048M,mem-path=/mnt/huge,share=on -numa node,memdev=mem'. Looking at tests/qemuxml2argvdata/qemuxml2argv-hugepages-pages.args, I see several instances of "-object memory-backend-file...", so look at
On 09/24/2014 02:05 AM, Linhaifeng wrote: the counterpart .xml file for some examples:
<memoryBacking> <hugepages> <page size='2048' unit='KiB' nodeset='1'/> <page size='1048576' unit='KiB' nodeset='0,2-3'/> </hugepages> </memoryBacking>
Thank you.
I use this xml: <cpu> <numa> <cell id='0' cpus='0' memory='1073741824' memAccess='shared'/> <cell id='1' cpus='1' memory='1073741824' memAccess='shared'/> </numa> </cpu> <memoryBacking> <hugepages> <page size="2" unit="M" nodeset="0,1"/> </hugepages> </memoryBacking>
but there is also some error: [2014-09-28T05:28:32.373335Z] migration_configure:652 Parameter 'cache size' expects exceeds guest ram size [2014-09-28T05:28:32.373422Z] main:3517 start memory options parse 2014-09-28T05:28:32.373802Z qemu-kvm: -object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,size=1048576M,id=ram-node0: unable to map backing store for hugepages: Cannot allocate memory 2014-09-28T05:28:32.373895Z qemu-kvm: -object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,size=1048576M,id=ram-node1: unable to map backing store for hugepages: Cannot allocate memory
get total number of the hugepages you could use: # cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
From your xml: <cell id='0' cpus='0' memory='1073741824' memAccess='shared'/> <cell id='1' cpus='1' memory='1073741824' memAccess='shared'/> I guess your machine doesn't have so much hugepage memory: sum(1073741824 + 1073741824)=2048G !!!
Thank you. Yes,you are right.This is my mistake.Actually i want to use 1G.
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users
_______________________________________________ libvirt-users mailing list libvirt-users@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-users
participants (3)
-
Eric Blake
-
Jincheng Miao
-
Linhaifeng