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

QEMU VM doesn't boot up with OVMF image and libvhost-user device exposed by QSD

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • None
    • rhel-9.5
    • edk2
    • No
    • Moderate
    • sst_virtualization
    • ssg_virtualization
    • None
    • QE ack
    • False
    • Hide

      None

      Show
      None
    • None
    • Red Hat Enterprise Linux
    • None
    • None
    • RegressionOnly
    • x86_64
    • Linux
    • None

      What were you trying to do that didn't work?
      Booting a VM with vhost-user-blk-pci and qemu-storage-daemon exposing the device

      Please provide the package NVR for which bug is seen:
      kernel-5.14.0-480.el9.x86_64
      qemu-kvm-9.0.0-7.el9
      edk2-ovmf-20240524-2.el9.noarch

      How reproducible:
      100%

      Steps to reproduce
      1. Start the qemu-storage daemon pointing to some RHEL OVMF image [1]
      2. Start a VM with the vhost-user-blk-pci
      3. See the messages in qsd and QEMU, after connected through VNC the VM doesn't boot up [3]

      [1]

      # /usr/bin/qemu-storage-daemon --blockdev driver=file,node-name=file,filename=/home/kvm_autotest_root/images/rhel950-64-virtio-scsi-ovmf.qcow2 --blockdev driver=qcow2,node-name=qcow2,file=file --export vhost-user-blk,node-name=qcow2,addr.type=unix,addr.path=/tmp/vhost-user-blk.sock,id=drive0,num-queues=8,writable=on

      [2]

      /usr/libexec/qemu-kvm \
          -name 'vm1' \
          -blockdev '{"node-name": "file_ovmf_code", "driver": "file", "filename": "/usr/share/OVMF/OVMF_CODE.secboot.fd", "auto-read-only": true, "discard": "unmap"}' \
          -blockdev '{"node-name": "drive_ovmf_code", "driver": "raw", "read-only": true, "file": "file_ovmf_code"}' \
          -blockdev '{"node-name": "file_ovmf_vars", "driver": "file", "filename": "/root/avocado/data/avocado-vt/avocado-vt-vm1_rhel950-64-virtio-scsi-ovmf_qcow2_filesystem_VARS.raw", "auto-read-only": true, "discard": "unmap"}' \
          -blockdev '{"node-name": "drive_ovmf_vars", "driver": "raw", "read-only": false, "file": "file_ovmf_vars"}' \
          -machine q35,pflash0=drive_ovmf_code,pflash1=drive_ovmf_vars,memory-backend=mem-machine_mem \
          -device '{"id": "pcie-root-port-0", "driver": "pcie-root-port", "multifunction": true, "bus": "pcie.0", "addr": "0x1", "chassis": 1}' \
          -device '{"id": "pcie-pci-bridge-0", "driver": "pcie-pci-bridge", "addr": "0x0", "bus": "pcie-root-port-0"}'  \
          -nodefaults \
          -nographic \
          -device '{"driver": "VGA", "bus": "pcie.0", "addr": "0x2"}' \
          -device pvpanic,ioport=0x505,id=id5SK4co  \
          -device '{"id": "pcie-root-port-1", "port": 1, "driver": "pcie-root-port", "addr": "0x1.0x1", "bus": "pcie.0", "chassis": 2}' \
          -device '{"id": "pcie-root-port-2", "port": 2, "driver": "pcie-root-port", "addr": "0x1.0x2", "bus": "pcie.0", "chassis": 3}' \
          -device '{"id": "pcie-root-port-3", "port": 3, "driver": "pcie-root-port", "addr": "0x1.0x3", "bus": "pcie.0", "chassis": 4}' \
          -device '{"id": "pcie-root-port-4", "port": 4, "driver": "pcie-root-port", "addr": "0x1.0x4", "bus": "pcie.0", "chassis": 5}' \
          -device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pcie.0,addr=0x3 \
          -drive id=drive_image1,if=none,snapshot=off,aio=threads,cache=none,format=qcow2,file=/home/rhel950-64-virtio-scsi-ovmf.qcow2 \
          -device scsi-hd,id=image1,drive=drive_image1 \
          -device '{"driver": "virtio-net-pci", "mac": "9a:6f:c3:79:a8:58", "id": "id1XH6qg", "netdev": "idhia6GM", "bus": "pcie-root-port-3", "addr": "0x0"}'  \
          -netdev tap,id=idhia6GM,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown,vhost=on \
          -cpu 'host' \
          -smp 8,maxcpus=8,cores=4,threads=1,dies=1,sockets=2  \
          -m 8G,maxmem=32G,slots=4 \
          -object '{"size": 8589934592, "id": "mem-machine_mem", "qom-type": "memory-backend-memfd"}'  \
          -vnc :1  \
          -chardev socket,path=/tmp/vhost-user-blk.sock,id=char0 \
          -device vhost-user-blk-pci,id=blk1,chardev=char0,bus=pcie.0,addr=0x4 \
          -rtc base=utc,clock=host,driftfix=slew  \
          -boot order=cdn,once=c,menu=off,strict=off \
          -enable-kvm \
          -monitor stdio \
          -serial tcp:0:1234,server,nowait \
          -monitor unix:/tmp/monitor3,server,nowait \
          -qmp tcp:0:3333,server,nowait

      [3] qemu-storage-daemon output:
      qemu-storage-daemon: vu_panic: virtio legacy devices aren't supported by libvhost-user

      QEMU output:

      (qemu) qemu-kvm: Failed to read msg header. Read -1 instead of 12. Original request 0.
      qemu-kvm: vhost_set_mem_table failed: Input/output error (5)
      qemu-kvm: Failed to write msg. Wrote -1 instead of 20.
      qemu-kvm: vhost_set_vring_call failed 22
      qemu-kvm: Failed to set msg fds.
      ...
      qemu-kvm: vhost_set_vring_call failed 22
      qemu-kvm: vhost-user-blk: vhost start failed: Error starting vhost: Input/output error

      Expected results
      No failure messages and VM to boot up seamlessly

      Actual results
      VM is not booting up with the setup described above and failure/panic messages are displayed

      Additional information
      This issue is also reproducible upstream and with older QEMU / kernel versions

            virt-maint virt-maint
            mcasquer@redhat.com Mario Casquero
            virt-maint virt-maint
            Mario Casquero Mario Casquero
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: