[libvirt] with vhostuser I cannot use hugepages

Mooney, Sean K sean.k.mooney at intel.com
Wed Jan 24 20:51:42 UTC 2018



From: libvir-list-bounces at redhat.com [mailto:libvir-list-bounces at redhat.com] On Behalf Of Adnan Mundres
Sent: Wednesday, January 24, 2018 6:54 PM
To: libvir-list at redhat.com
Subject: [libvirt] with vhostuser I cannot use hugepages

In my setup I am using qemu-kvm without openstack. I am trying to use ovs with dpdk. In my xml file I added following lines for the dpdkvhostuser

<cpu mode='host-passthrough'>
    <numa>
      <cell id="0" cpus="0-6" memory="16777216" unit='KiB' memAccess="shared"/>
    </numa>
 </cpu>
[Mooney, Sean K] this xml snippit is not requsting the use of huge page memory.
It is requesting memory to be allocated form a single numa node  and for that to be mmaped shared.
Dpdk does not actually need the guest to use hugepages it just improves the performance. What it requires
Is that the gues uses file descriptor backed, pre allocated, locked, shared memory.
e.g.
  <memoryBacking>
    <locked/>
    <source type='file'/>
    <access mode='shared'/>
    <allocation mode='immediate'/>
  </memoryBacking>

Hugepages will enable all of the above features implicitly.

to enable hugepages  add

<memoryBacking>
<hugepages>
      <page size="16" unit="G" nodeset="0"/>
    </hugepages>
</memoryBacking>

I have enabled hugepages during boot time

ot at mvmgptb11hyp01 hyp-1]# cat /proc/meminfo | grep -i huge
AnonHugePages: 126976 kB
HugePages_Total: 100
HugePages_Free: 80
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 1048576 kB

But When I start my vm (virsh start vm1.xml) I am seeing that this vm is not using memory from hugepages, rather it is taking memory from total memory. When I checked the log file I see that it is using

-object memory-backend-file,id=ram-node0,prealloc=yes,mem-path=/var/lib/libvirt/qemu/ram,share=yes

It should use backend memory as following

-object memory-backend-file,id=ram-node0,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu/vm1,share=yes

Any idea how can I use memory from hugepages
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20180124/ff319bf0/attachment-0001.htm>


More information about the libvir-list mailing list