Skip to contentSkip to conversation

How to send memory info

Qemu-devel Linhaifeng 1 participant 3 messages Dec 11, 2014 – Dec 12, 2014

lore
Share & tools
lore

Linhaifeng

author
#0 lore raw

Hi,all

Yestoday i tested the set_mem_table message found that qemu not send all the memory info(fd and size) when VM memory size is 2G and have two numa nodes(two hugepage files).If VM memory size is 4G and have two numa nodes will send all the memory info.

Here is my understand,is this right?
If qemu not send all the memory infomation about hugepage files,vhost-user couldn't map all the VM memory. If vhost-user couldn't map all the VM memory vhost-user maybe couldn't read the packets which allocate by Guest.

1.Information about VM who has 2G and two numa nodes(vhost-user couldn't read the packets from tx_ring of Guest):
xml:
<cpu>

    <numa>
      <cell id='0' cpus='0' memory='1048576' memAccess='shared'/>
      <cell id='1' cpus='1' memory='1048576' memAccess='shared'/>
    </numa>
  </cpu>
 <memoryBacking>
    <hugepages>
      <page size="2" unit="M" nodeset="0,1"/>
    </hugepages>
 </memoryBacking>
 <interface type='vhostuser'>
    <mac address='52:54:00:3b:83:1a'/>
    <source type='unix' path='/var/run/vhost-user/port1' mode='client'/>
    <model type='virtio'/>

</interface>

qemu command:
-m 2048 -smp 2,sockets=2,cores=1,threads=1
-object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,share=on,size=1024M,id=ram-node0 -numa node,nodeid=0,cpus=0,memdev=ram-node0 -object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,share=on,size=1024M,id=ram-node1 -numa node,nodeid=1,cpus=1,memdev=ram-node1

memory regions:

        gpa = 0xC0000
        size = 2146697216
        ua = 0x2aaaaacc0000
        offset = 786432

        gpa = 0x0
        size = 655360
        ua = 0x2aaaaac00000
        offset = 0

hugepage:
cat /proc/pidof qemu/maps
2aaaaac00000-2aaaeac00000 rw-s 00000000 00:18 10357788 /dev/hugepages/libvirt/qemu/qemu_back_mem._objects_ram-node0.MvcPyi (deleted)
2aaaeac00000-2aab2ac00000 rw-s 00000000 00:18 10357789 /dev/hugepages/libvirt/qemu/qemu_back_mem._objects_ram-node1.tjAVin (deleted)

The memory size of each region is not match to the size of each hugepage file,is this ok?How does vhost-user to mmap all the hugepage?

2.Information about VM who has 4G and two numa nodes(vhost-user could read the packets from tx_ring of Guest):
xml:
<cpu>

    <numa>
      <cell id='0' cpus='0' memory='2097152' memAccess='shared'/>
      <cell id='1' cpus='1' memory='2097152' memAccess='shared'/>
    </numa>

</cpu>

<memoryBacking>

    <hugepages>
      <page size="2" unit="M" nodeset="0,1"/>
    </hugepages>

</memoryBacking>

qemu command:
-m 4096 -smp 2,sockets=2,cores=1,threads=1
-object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,share=on,size=2048M,id=ram-node0 -numa node,nodeid=0,cpus=0,memdev=ram-node0 -object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,share=on,size=2048M,id=ram-node1 -numa node,nodeid=1,cpus=1,memdev=ram-node1

memory regions:

        gpa = 0xC0000
        size = 3220439040
        ua = 0x2aaaaacc0000
        offset = 786432

        gpa = 0x100000000
        size = 1073741824
        ua = 0x2aab6ac00000
        offset = 1073741824

        gpa = 0x0
        size = 655360
        ua = 0x2aaaaac00000
        offset = 0

hugepage:
cat /proc/pidof qemu/maps
2aaaaac00000-2aab2ac00000 rw-s 00000000 00:18 10756623 /dev/hugepages/libvirt/qemu/qemu_back_mem._objects_ram-node0.If4Qkf (deleted)
2aab2ac00000-2aabaac00000 rw-s 00000000 00:18 10756624 /dev/hugepages/libvirt/qemu/qemu_back_mem._objects_ram-node1.jQZPcI (deleted)

Signature · 2 lines
Regards,
Haifeng
author
#1 lore raw

[Qemu-devel] vhost_user: How to send memory info

Quoted 95 lines · Linhaifeng

Hi,all

Yestoday i tested the set_mem_table message found that qemu not send all the memory info(fd and size) when VM memory size is 2G and have two numa nodes(two hugepage files).If VM memory size is 4G and have two numa nodes will send all the memory info.

Here is my understand,is this right?
If qemu not send all the memory infomation about hugepage files,vhost-user couldn't map all the VM memory. If vhost-user couldn't map all the VM memory vhost-user maybe couldn't read the packets which allocate by Guest.

1.Information about VM who has 2G and two numa nodes(vhost-user couldn't read the packets from tx_ring of Guest):
xml:
<cpu>

    <numa>
      <cell id='0' cpus='0' memory='1048576' memAccess='shared'/>
      <cell id='1' cpus='1' memory='1048576' memAccess='shared'/>
    </numa>
  </cpu>
 <memoryBacking>
    <hugepages>
      <page size="2" unit="M" nodeset="0,1"/>
    </hugepages>
 </memoryBacking>
 <interface type='vhostuser'>
    <mac address='52:54:00:3b:83:1a'/>
    <source type='unix' path='/var/run/vhost-user/port1' mode='client'/>
    <model type='virtio'/>

</interface>

qemu command:

(quoted diff) +0 -3
-m 2048 -smp 2,sockets=2,cores=1,threads=1
-object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,share=on,size=1024M,id=ram-node0 -numa node,nodeid=0,cpus=0,memdev=ram-node0
-object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,share=on,size=1024M,id=ram-node1 -numa node,nodeid=1,cpus=1,memdev=ram-node1

memory regions:

        gpa = 0xC0000
        size = 2146697216
        ua = 0x2aaaaacc0000
        offset = 786432

        gpa = 0x0
        size = 655360
        ua = 0x2aaaaac00000
        offset = 0

hugepage:
cat /proc/pidof qemu/maps
2aaaaac00000-2aaaeac00000 rw-s 00000000 00:18 10357788 /dev/hugepages/libvirt/qemu/qemu_back_mem._objects_ram-node0.MvcPyi (deleted)
2aaaeac00000-2aab2ac00000 rw-s 00000000 00:18 10357789 /dev/hugepages/libvirt/qemu/qemu_back_mem._objects_ram-node1.tjAVin (deleted)

The memory size of each region is not match to the size of each hugepage file,is this ok?How does vhost-user to mmap all the hugepage?

2.Information about VM who has 4G and two numa nodes(vhost-user could read the packets from tx_ring of Guest):
xml:
<cpu>

    <numa>
      <cell id='0' cpus='0' memory='2097152' memAccess='shared'/>
      <cell id='1' cpus='1' memory='2097152' memAccess='shared'/>
    </numa>

</cpu>

<memoryBacking>

    <hugepages>
      <page size="2" unit="M" nodeset="0,1"/>
    </hugepages>

</memoryBacking>

qemu command:

(quoted diff) +0 -3
-m 4096 -smp 2,sockets=2,cores=1,threads=1
-object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,share=on,size=2048M,id=ram-node0 -numa node,nodeid=0,cpus=0,memdev=ram-node0
-object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,share=on,size=2048M,id=ram-node1 -numa node,nodeid=1,cpus=1,memdev=ram-node1

memory regions:

        gpa = 0xC0000
        size = 3220439040
        ua = 0x2aaaaacc0000
        offset = 786432

        gpa = 0x100000000
        size = 1073741824
        ua = 0x2aab6ac00000
        offset = 1073741824

        gpa = 0x0
        size = 655360
        ua = 0x2aaaaac00000
        offset = 0

hugepage:
cat /proc/pidof qemu/maps
2aaaaac00000-2aab2ac00000 rw-s 00000000 00:18 10756623 /dev/hugepages/libvirt/qemu/qemu_back_mem._objects_ram-node0.If4Qkf (deleted)
2aab2ac00000-2aabaac00000 rw-s 00000000 00:18 10756624 /dev/hugepages/libvirt/qemu/qemu_back_mem._objects_ram-node1.jQZPcI (deleted)

Signature · 2 lines
Regards,
Haifeng
author
#2 lore raw

Re: [Qemu-devel] vhost-user:How to send memory info

In reply to Linhaifeng

here is qemu's log :
file_ram_alloc filename[/dev/hugepages/libvirt/qemu/qemu_back_mem._objects_ram-node0.okpjmP] fd[7] size[1073741824] file_ram_alloc filename[/dev/hugepages/libvirt/qemu/qemu_back_mem._objects_ram-node1.3b43YF] fd[8] size[1073741824]

	region fd[7]:
        gpa = 0xC0000
        size = 2146697216
        ua = 0x2aaaaacc0000
        offset = 786432

        region fd[7]:
        gpa = 0x0
        size = 655360
        ua = 0x2aaaaac00000
        offset = 0

we can see memory region only contain one hugepage.Is this a bug?

Quoted 95 lines · Linhaifeng

Hi,all

Yestoday i tested the set_mem_table message found that qemu not send all the memory info(fd and size) when VM memory size is 2G and have two numa nodes(two hugepage files).If VM memory size is 4G and have two numa nodes will send all the memory info.

Here is my understand,is this right?
If qemu not send all the memory infomation about hugepage files,vhost-user couldn't map all the VM memory. If vhost-user couldn't map all the VM memory vhost-user maybe couldn't read the packets which allocate by Guest.

1.Information about VM who has 2G and two numa nodes(vhost-user couldn't read the packets from tx_ring of Guest):
xml:
<cpu>

    <numa>
      <cell id='0' cpus='0' memory='1048576' memAccess='shared'/>
      <cell id='1' cpus='1' memory='1048576' memAccess='shared'/>
    </numa>
  </cpu>
 <memoryBacking>
    <hugepages>
      <page size="2" unit="M" nodeset="0,1"/>
    </hugepages>
 </memoryBacking>
 <interface type='vhostuser'>
    <mac address='52:54:00:3b:83:1a'/>
    <source type='unix' path='/var/run/vhost-user/port1' mode='client'/>
    <model type='virtio'/>

</interface>

qemu command:

(quoted diff) +0 -3
-m 2048 -smp 2,sockets=2,cores=1,threads=1
-object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,share=on,size=1024M,id=ram-node0 -numa node,nodeid=0,cpus=0,memdev=ram-node0
-object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,share=on,size=1024M,id=ram-node1 -numa node,nodeid=1,cpus=1,memdev=ram-node1

memory regions:

        gpa = 0xC0000
        size = 2146697216
        ua = 0x2aaaaacc0000
        offset = 786432

        gpa = 0x0
        size = 655360
        ua = 0x2aaaaac00000
        offset = 0

hugepage:
cat /proc/pidof qemu/maps
2aaaaac00000-2aaaeac00000 rw-s 00000000 00:18 10357788 /dev/hugepages/libvirt/qemu/qemu_back_mem._objects_ram-node0.MvcPyi (deleted)
2aaaeac00000-2aab2ac00000 rw-s 00000000 00:18 10357789 /dev/hugepages/libvirt/qemu/qemu_back_mem._objects_ram-node1.tjAVin (deleted)

The memory size of each region is not match to the size of each hugepage file,is this ok?How does vhost-user to mmap all the hugepage?

2.Information about VM who has 4G and two numa nodes(vhost-user could read the packets from tx_ring of Guest):
xml:
<cpu>

    <numa>
      <cell id='0' cpus='0' memory='2097152' memAccess='shared'/>
      <cell id='1' cpus='1' memory='2097152' memAccess='shared'/>
    </numa>

</cpu>

<memoryBacking>

    <hugepages>
      <page size="2" unit="M" nodeset="0,1"/>
    </hugepages>

</memoryBacking>

qemu command:

(quoted diff) +0 -3
-m 4096 -smp 2,sockets=2,cores=1,threads=1
-object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,share=on,size=2048M,id=ram-node0 -numa node,nodeid=0,cpus=0,memdev=ram-node0
-object memory-backend-file,prealloc=yes,mem-path=/dev/hugepages/libvirt/qemu,share=on,size=2048M,id=ram-node1 -numa node,nodeid=1,cpus=1,memdev=ram-node1

memory regions:

        gpa = 0xC0000
        size = 3220439040
        ua = 0x2aaaaacc0000
        offset = 786432

        gpa = 0x100000000
        size = 1073741824
        ua = 0x2aab6ac00000
        offset = 1073741824

        gpa = 0x0
        size = 655360
        ua = 0x2aaaaac00000
        offset = 0

hugepage:
cat /proc/pidof qemu/maps
2aaaaac00000-2aab2ac00000 rw-s 00000000 00:18 10756623 /dev/hugepages/libvirt/qemu/qemu_back_mem._objects_ram-node0.If4Qkf (deleted)
2aab2ac00000-2aabaac00000 rw-s 00000000 00:18 10756624 /dev/hugepages/libvirt/qemu/qemu_back_mem._objects_ram-node1.jQZPcI (deleted)

Signature · 2 lines
Regards,
Haifeng