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

Jincheng Miao jmiao at redhat.com
Sun Sep 28 08:19:13 UTC 2014


On 09/28/2014 01:38 PM, Linhaifeng wrote:
>
> 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

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 at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users




More information about the libvirt-users mailing list