Bug 1879052 - IOMMU enable failed on "vhost-vsock-pci" device (QEMU)
Summary: IOMMU enable failed on "vhost-vsock-pci" device (QEMU)
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: qemu-kvm
Version: 8.3
Hardware: All
OS: Unspecified
high
medium
Target Milestone: rc
: 8.3
Assignee: Stefano Garzarella
QA Contact: Qinghua Cheng
URL:
Whiteboard:
Depends On: 1894101
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-09-15 10:42 UTC by Zhenyu Zhang
Modified: 2021-11-16 08:00 UTC (History)
12 users (show)

Fixed In Version: qemu-5.2 384c2561bddfa00cd3eaf9edbc1af6c7c120511f
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1894101 (view as bug list)
Environment:
Last Closed: 2021-11-16 07:51:01 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2021:4684 0 None None None 2021-11-16 07:51:22 UTC

Internal Links: 1928840

Description Zhenyu Zhang 2020-09-15 10:42:39 UTC
Description of problem:
When set 'iommu_platform=on' on "vhost-vsock-pci" device, the following error is encountered:
(qemu) qemu-kvm: vhost_set_features failed: Operation not supported (95)
qemu-kvm: Error starting vhost: 95


Version-Release number of selected component (if applicable):
Host name: ibm-x3850x6-04.lab.eng.pek2.redhat.com
Host Distro: RHEL-8.3.0-20200912.n.0 BaseOS x86_64 
Host Kernel: 4.18.0-236.el8.x86_64
Guest Kernel: 4.18.0-236.el8.x86_64
Qemu-kvm: qemu-kvm-5.1.0-6.module+el8.3.0+8041+42ff16b8


How reproducible:
100%

Steps to Reproduce:
1. boot guest enable IOMMU:
/usr/libexec/qemu-kvm \
-name 'avocado-vt-vm1'  \
-sandbox on  \
-machine q35 \
-device pcie-root-port,id=pcie-root-port-0,multifunction=on,bus=pcie.0,addr=0x1,chassis=1 \
-device pcie-pci-bridge,id=pcie-pci-bridge-0,addr=0x0,bus=pcie-root-port-0  \
-nodefaults \
-device VGA,bus=pcie.0,addr=0x2 \
-m 30720  \
-smp 40,maxcpus=40,cores=20,threads=1,dies=1,sockets=2  \
-cpu 'IvyBridge',+kvm_pv_unhalt \
-chardev socket,server,nowait,id=qmp_id_qmpmonitor1,path=/var/tmp/monitor-qmpmonitor1  \
-mon chardev=qmp_id_qmpmonitor1,mode=control \
-device pvpanic,ioport=0x505,id=idnEJdcf \
-chardev socket,server,nowait,id=chardev_serial0,path=/var/tmp/serial-serial0 \
-device isa-serial,id=serial0,chardev=chardev_serial0  \
-chardev socket,id=seabioslog_id_20200915-055422-8y4xDLCa,path=/var/tmp/seabios,server,nowait \
-device isa-debugcon,chardev=seabioslog_id_20200915-055422-8y4xDLCa,iobase=0x402 \
-device pcie-root-port,id=pcie-root-port-1,port=0x1,addr=0x1.0x1,bus=pcie.0,chassis=2 \
-device qemu-xhci,id=usb1,bus=pcie-root-port-1,addr=0x0 \
-device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1 \
-device pcie-root-port,id=pcie-root-port-2,port=0x2,addr=0x1.0x2,bus=pcie.0,chassis=3 \
-device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pcie-root-port-2,addr=0x0 \
-blockdev node-name=file_image1,driver=file,aio=threads,filename=/home/test/os.qcow2,cache.direct=on,cache.no-flush=off \
-blockdev node-name=drive_image1,driver=qcow2,cache.direct=on,cache.no-flush=off,file=file_image1 \
-device scsi-hd,id=image1,drive=drive_image1,write-cache=on \
-device pcie-root-port,id=pcie-root-port-3,port=0x3,addr=0x1.0x3,bus=pcie.0,chassis=4 \
-device virtio-net-pci,mac=9a:af:90:80:2a:4f,id=idxXK3e9,netdev=idbkX3jT,bus=pcie-root-port-3,addr=0x0  \
-netdev tap,id=idbkX3jT,vhost=on \
-device pcie-root-port,id=pcie-root-port-4,port=0x4,addr=0x1.0x4,bus=pcie.0,chassis=5 \
-device vhost-vsock-pci,id=vhost_vsock0,guest-cid=3,bus=pcie-root-port-4,addr=0x0,iommu_platform=on  \
-vnc :20  \
-rtc base=utc,clock=host,driftfix=slew  \
-boot menu=off,order=cdn,once=c,strict=off \
-enable-kvm \
-device pcie-root-port,id=pcie_extra_root_port_0,multifunction=on,bus=pcie.0,addr=0x3,chassis=6

2. Hit this issue:
qemu-kvm: vhost_set_features failed: Operation not supported (95)
qemu-kvm: Error starting vhost: 95

3. Login guest:
[root@vm-74-49 home]# lsmod|grep vsock 
vmw_vsock_virtio_transport    16384  0
vmw_vsock_virtio_transport_common    32768  1 vmw_vsock_virtio_transport
vsock                  45056  2 vmw_vsock_virtio_transport_common,vmw_vsock_virtio_transport

[root@vm-74-49 home]# gcc -o nc-vsock nc-vsock.c
gcc: error: nc-vsock.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.


Actual results:
IOMMU enable failed on "vhost-vsock-pci" device

Expected results:
IOMMU can be enabled on the "vhost-vsock-pci" device

Additional info:

Comment 1 Amnon Ilan 2020-09-25 12:31:13 UTC
Jon, should it be triaged by someone working on vsock?

Comment 2 John Ferlan 2020-09-25 13:55:52 UTC
Stefano - is there any relationship to bug 1868449 here? or is this something new?

Comment 3 Stefano Garzarella 2020-09-28 08:21:38 UTC
(In reply to John Ferlan from comment #2)
> Stefano - is there any relationship to bug 1868449 here? or is this
> something new?

No, I think it is not related. It seems that vhost-vsock doesn't support iommu-platform=on since the very beginning:
https://patchew.org/QEMU/20200226094357.25061-1-jasowang@redhat.com

I'll take a closer look!

Comment 5 Stefano Garzarella 2020-11-03 14:44:35 UTC
QEMU should work as is, but I found a little issue that I fixed upstream:
https://lists.gnu.org/archive/html/qemu-devel/2020-10/msg09077.html

The patch was already merged: 384c2561bd ("vhost-vsock: set vhostfd to non-blocking mode")

The issue is mainly related to the vhost-vsock kernel module that doesn't have IOTLB API support, so I'll create a new BZ for kernel.

Comment 6 Ademar Reis 2021-01-15 16:39:02 UTC
Merged upstream in QEMU-5.2: 384c2561bddfa00cd3eaf9edbc1af6c7c120511f - set vhostfd to non-blocking mode

But it depends on a kernel patch, so leaving it as POST + TestOnly.

Comment 25 Danilo de Paula 2021-05-12 15:18:56 UTC
Since this is testOnly, I'm moving it to ON_QA

Comment 26 Qinghua Cheng 2021-05-25 12:09:42 UTC
Verified on RHEL8.5

kernel: 4.18.0-307.el8.x86_64
qemu-kvm: qemu-kvm-6.0.0-16.module+el8.5.0+10848+2dccc46d.x86_64

Enable iommu in command line for vsock, guest vm startup successfully. 

Command line 1:

....
-machine q35,kernel-irqchip=split \
-device intel-iommu,intremap=on,device-iotlb=on \
-device vhost-vsock-pci,guest-cid=3,iommu_platform=on,ats=on \
....

Command line 2:

...
-device vhost-vsock-pci,id=vhost_vsock0,guest-cid=3,bus=pcie-root-port-4,addr=0x0,iommu_platform=on  \
...

Comment 29 errata-xmlrpc 2021-11-16 07:51:01 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (virt:av bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:4684


Note You need to log in before you can comment on or make changes to this bug.