Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-90625

Fails to enable preallocation for hugepage backed virtio-mem device

Linking RHIVOS CVEs to...Migration: Automation ...Sync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • rhel-10.1
    • rhel-10.1, rhel-9.7
    • libvirt / General
    • None
    • libvirt-11.4.0-1.el10
    • No
    • Moderate
    • rhel-virt-core-libvirt-1
    • ssg_virtualization
    • 21
    • None
    • Dev ack
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • s390x
    • 11.4.0
    • None

      What were you trying to do that didn't work?

      When setting a guest vm with virtio-mem device and memory backing with preallocation and hugepage enabled. Start the guest then check qemu cmdline find that virtio-mem memory is not preallocated is not set correctly.

      Please provide the package NVR for which the bug is seen:

       

      # rpm -q libvirt qemu-kvm
      libvirt-11.2.0-1.el10.s390x
      qemu-kvm-10.0.0-0.rc3.el10.preview.s390x

       

      How reproducible is this bug?:100%

      Steps to reproduce

      1. enable kvm hugepage support on s390x
      # modprobe -r kvm
      # modprobe kvm hpage=1
      1. allocate hugepages
      # echo 3072 > /sys/kernel/mm/hugepages/hugepages-1024kB/nr_hugepages
      1. Define a guest with below config:
        <maxMemory unit='KiB'>15242880</maxMemory>
          <memory unit='KiB'>3145728</memory>
          <currentMemory unit='KiB'>1048576</currentMemory>
        <memoryBacking>
                  <hugepages/>
                  <allocation mode="immediate" threads='8'/>
          </memoryBacking>
        ...
        <memory model='virtio-mem' >
            <target>
              <size unit='KiB'>2097152</size>
              <block unit='KiB'>1024</block>
              <requested unit='KiB'>2097152</requested>
            </target>
          </memory>
      2. Start the guest
      # virsh start avocado-vt-vm1
      Domain 'avocado-vt-vm1' started
      1. Check the qemu cmdline
      2. ps -ef | grep qemu-kvm
        ... -object {"qom-type":"memory-backend-file","id":"memvirtiomem0","mem-path":"/dev/hugepages/libvirt/qemu/5-avocado-vt-vm1","reserve":false,"size":2147483648} -device {"driver":"virtio-mem-ccw","block-size":1048576,"requested-size":2147483648,"memdev":"memvirtiomem0","id":"virtiomem0","devno":"fe.0.0009"} ...
      3. Check the hugepage usage
      # virsh freepages --all
      Node 0:
      4KiB: 5102353
      1024KiB: 1746

      Expected results

      The preallocation and allocation threads should be seen in qemu cmdline, and there should be no 1M hugepage left after starting the guest(virtio-mem related 2G hugepages should be allocated).

      Actual results

      The preallocation and allocation threads are not seen in qemu cmdline, and there stil 1746 hugepages are not allocated.

              lcong@redhat.com Liang Cong
              lcong@redhat.com Liang Cong
              Michal Privoznik Michal Privoznik
              Liang Cong Liang Cong
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

                Created:
                Updated: