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

Error msg should be meaningful while hotplug nvdimm device with unaligned address

    • None
    • Moderate
    • rhel-sst-virtualization
    • ssg_virtualization
    • None
    • QE ack
    • False
    • Hide

      None

      Show
      None
    • None
    • Red Hat Enterprise Linux
    • None
    • None
    • None
    • None

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

      Error msg prompts is not meaningful while attaching a nvdimm device with unaligned address 

      Please provide the package NVR for which bug is seen:

      rpm -q libvirt qemu-kvm
      libvirt-9.5.0-7.el9_3.x86_64
      qemu-kvm-8.1.0-3.el9.x86_64

      How reproducible:

      100%

      Steps to reproduce

      1. Start a guest with below config xml:

      <maxMemory slots="16" unit="KiB">20485760</maxMemory>
      <memory unit="KiB">2097152</memory>
      <currentMemory unit="KiB">2097152</currentMemory>

      ...
      <numa>
            <cell id="0" cpus="0-5" memory="2097152" unit="KiB"/>
      </numa>

       

      virsh start vm1
      Domain 'vm1' started

      2. Prepare nvdimm backed file

       # truncate -s 128M /tmp/nvdimm

       

      3. Attach a nvdimm device with unaligned address:

      cat mem.xml 
      <memory model='nvdimm'>
        <source>
          <path>/tmp/nvdimm</path>

          <alignsize unit='KiB'>2048</alignsize>
        </source>     
        <target>       
          <size unit='KiB'>131072</size>       
          <node>0</node>
        </target> 
        <address type='dimm' slot='0' base='0x100000001'/>   
      </memory>

       

       # virsh attach-device vm1 mem.xml 
      error: Failed to attach device from mem.xml
      error: internal error: unable to execute QEMU command 'device_add': nvdimm is not enabled: missing 'nvdimm' in '-M'

      Expected results

      Error msg should be more meaningful to indicate the root cause or the correct way to config

      Actual results

      Error msg "nvdimm is not enabled: missing 'nvdimm' in '-M'" makes the user confused

       

      Additional info

      When start a nvdimm device with unaligned address the error msg is showing the correct config:

      guest config xml like below:

      <maxMemory slots="16" unit="KiB">20485760</maxMemory>
      <memory unit="KiB">2228224</memory>
      <currentMemory unit="KiB">2097152</currentMemory>

      ...
      <numa>
            <cell id="0" cpus="0-5" memory="2097152" unit="KiB"/>

       </numa>

      ...

      <memory model="nvdimm">
            <source>
              <path>/tmp/nvdimm</path>
              <alignsize unit="KiB">2048</alignsize>
            </source>
            <target>
              <size unit="KiB">131072</size>
              <node>0</node>
            </target>
            <address type="dimm" slot="0" base="0x100000001"/>
      </memory>

      virsh start vm1
      error: Failed to start domain 'vm1'
      error: internal error: QEMU unexpectedly closed the monitor (vm='vm1'): 2023-11-06T05:38:27.690433Z qemu-kvm: -device {"driver":"nvdimm","node":0,"memdev":"memnvdimm0","id":"nvdimm0","slot":0,"addr":4294967297}: address must be aligned to 0x200000 bytes 

              virt-maint virt-maint
              lcong@redhat.com Liang Cong
              virt-maint virt-maint
              Liang Cong Liang Cong
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: