Bug 2215500

Summary: [QSD] VM boot failed on "Unexpected end-of-file" with vhost-user-blk-pci device [RHEL-9]
Product: Red Hat Enterprise Linux 9 Reporter: qing.wang <qinwang>
Component: qemu-kvmAssignee: Kevin Wolf <kwolf>
qemu-kvm sub component: virtio-blk,scsi QA Contact: qing.wang <qinwang>
Status: CLOSED MIGRATED Docs Contact:
Severity: high    
Priority: medium CC: chayang, coli, jinzhao, juzhang, kwolf, lijin, qizhu, vgoyal, virt-maint, xuwei, zhenyzha
Version: 9.3Keywords: MigratedToJIRA, Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-09-22 16:20:15 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description qing.wang 2023-06-16 08:59:06 UTC
Description of problem:

Boot vm with vhost-user-blk-pci device.
It failed on 
qemu-kvm: Unexpected end-of-file before all data were read
qemu-kvm: Failed to set msg fds.
qemu-kvm: Failed to set msg fds.
qemu-kvm: vhost VQ 0 ring restore failed: -22: Invalid argument (22)

And the qemu-storage-daemon display message:
 vu_panic: remapping queue 0 for new memory region


Version-Release number of selected component (if applicable):
Red Hat Enterprise Linux release 9.3 Beta (Plow)
5.14.0-316.el9.x86_64
qemu-kvm-8.0.0-5.el9.x86_64


How reproducible:
100%

Steps to Reproduce:
1. Prepare the image

[ -f /home/kvm_autotest_root/images/stg1.qcow2 ] || qemu-img create -f qcow2 /home/kvm_autotest_root/images/stg1.qcow2 1G
mkdir -p /home/qsd_tmp

2. Boot QSD

/usr/bin/qemu-storage-daemon \
  --chardev socket,server=on,wait=off,path=/home/qsd_tmp/qsd1_monitor.sock,id=qsd_monitor_qsd1 \
  --monitor chardev=qsd_monitor_qsd1,mode=control  \
  --blockdev '{"driver": "file", "node-name": "prot_stg1", "filename": "/home/kvm_autotest_root/images/stg1.qcow2", "auto-read-only": true, "discard": "unmap"}' \
  --blockdev '{"driver": "qcow2", "node-name": "fmt_stg1", "file": "prot_stg1"}' \
  --export '{"type": "vhost-user-blk", "id": "id_stg1", "node-name": "fmt_stg1", "writable": true, "num-queues": 1, "addr": {"type": "unix", "path": "/home/qsd_tmp/qsd1_vhost_user_stg1.sock"}}' \
  --pidfile /home/qsd_tmp/qsd1.pid

3. Boot VM
/usr/libexec/qemu-kvm \
     -name 'avocado-vt-vm1'  \
     -sandbox on  \
     -machine q35,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 \
     -device '{"driver": "VGA", "bus": "pcie-pci-bridge-0", "addr": "0x1"}' \
     -m 12288 \
     -object '{"size": 12884901888, "share": true, "id": "mem-machine_mem", "qom-type": "memory-backend-memfd"}'  \
     -smp 10,maxcpus=10,cores=5,threads=1,dies=1,sockets=2  \
     -cpu 'Cascadelake-Server',ss=on,vmx=on,pdcm=on,hypervisor=on,tsc-adjust=on,umip=on,pku=on,md-clear=on,stibp=on,arch-capabilities=on,xsaves=on,ibpb=on,ibrs=on,amd-stibp=on,amd-ssbd=on,rdctl-no=on,ibrs-all=on,skip-l1dfl-vmentry=on,mds-no=on,pschange-mc-no=on,tsx-ctrl=on,hle=off,rtm=off,kvm_pv_unhalt=on \
     -device '{"id": "pcie-root-port-1", "port": 1, "driver": "pcie-root-port", "addr": "0x1.0x1", "bus": "pcie.0", "chassis": 2}' \
     -device '{"driver": "qemu-xhci", "id": "usb1", "bus": "pcie-root-port-1", "addr": "0x0"}' \
     -device '{"driver": "usb-tablet", "id": "usb-tablet1", "bus": "usb1.0", "port": "1"}' \
     -object '{"qom-type": "iothread", "id": "iothread0"}' \
     -object '{"qom-type": "iothread", "id": "iothread1"}' \
     -device '{"id": "pcie-root-port-2", "port": 2, "driver": "pcie-root-port", "addr": "0x1.0x2", "bus": "pcie.0", "chassis": 3}' \
     -device '{"id": "virtio_scsi_pci0", "driver": "virtio-scsi-pci", "bus": "pcie-root-port-2", "addr": "0x0", "iothread": "iothread0"}' \
     -blockdev '{"node-name": "file_image1", "driver": "file", "auto-read-only": true, "discard": "unmap", "aio": "threads", "filename": "/home/kvm_autotest_root/images/rhel890-64-virtio-scsi.qcow2", "cache": {"direct": true, "no-flush": false}}' \
     -blockdev '{"node-name": "drive_image1", "driver": "qcow2", "read-only": false, "cache": {"direct": true, "no-flush": false}, "file": "file_image1"}' \
     -device '{"driver": "scsi-hd", "id": "image1", "drive": "drive_image1", "write-cache": "on"}' \
     -device '{"id": "pcie-root-port-3", "port": 3, "driver": "pcie-root-port", "addr": "0x1.0x3", "bus": "pcie.0", "chassis": 4}' \
     -device '{"driver": "virtio-net-pci", "mac": "9a:0f:bc:ba:bb:3e", "id": "id6buZsc", "netdev": "iddM4d8u", "bus": "pcie-root-port-3", "addr": "0x0"}'  \
     -netdev tap,id=iddM4d8u,vhost=on  \
     -vnc :5 \
     -monitor stdio \
     -qmp tcp:0:5955,server=on,wait=off \
     -rtc base=utc,clock=host,driftfix=slew  \
     -boot menu=off,order=cdn,once=c,strict=off \
     -enable-kvm \
     -device pcie-root-port,id=pcie_vubp_root_port_6,bus=pcie.0,addr=6  \
     -chardev socket,path=/home/qsd_tmp/qsd1_vhost_user_stg1.sock,id=char_qsd_qsd1,server=off \
     -device vhost-user-blk-pci,id=vubp_stg1,chardev=char_qsd_qsd1,num-queues=1,bus=pcie_vubp_root_port_6 \


Actual results:
VM boot failed

Expected results:
VM boot succeed

Additional info:
This issue also exist old version like 
qemu-kvm-7.2.0-14.el9_2.x86_64


It may succeed replace VGA device to:
-device '{"driver": "VGA", "bus": "pcie.0", "addr": "0x2"}' \

Comment 4 RHEL Program Management 2023-09-22 16:19:30 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 5 RHEL Program Management 2023-09-22 16:20:15 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.