RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 2101633 - libvirt live xml shows options which qemu do not support, and no error msg in libvirtd.log
Summary: libvirt live xml shows options which qemu do not support, and no error msg in...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Michal Privoznik
QA Contact: yalzhang@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-06-28 02:25 UTC by yalzhang@redhat.com
Modified: 2023-05-09 08:06 UTC (History)
8 users (show)

Fixed In Version: libvirt-8.7.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-05-09 07:26:34 UTC
Type: Bug
Target Upstream Version: 8.7.0
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker LIBVIRTAT-13620 0 None None None 2022-10-25 07:07:36 UTC
Red Hat Issue Tracker RHELPLAN-126418 0 None None None 2022-06-28 02:29:11 UTC
Red Hat Product Errata RHBA-2023:2171 0 None None None 2023-05-09 07:27:25 UTC

Description yalzhang@redhat.com 2022-06-28 02:25:25 UTC
Description of problem:
libvirt live xml shows options which qemu do not support, and no error msg in libvirtd.log

Version-Release number of selected component (if applicable):
Host:
libvirt-8.4.0-3.el9.x86_64
qemu-kvm-7.0.50-6.el9.wrb220615.x86_64
Guest:
kernel-5.14.0-104.mr955_220602_1540.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Configure the vm with virtio iommu and start the vm
# virsh start rhel
Domain 'rhel' started

# virsh dumpxml  rhel 
...
<iommu model='virtio'>
      <driver intremap='on' caching_mode='on' eim='on' iotlb='on'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </iommu>
......

2. check the qemu cmd line, there is no options for the iommu device:
# ps aux | grep iommu
...
-device {"driver":"virtio-iommu","bus":"pcie.0","addr":"0x4"}
...

Actual results:
The libvirt set options are ignored since it is not supported, but there is no error msg in the log

Expected results:
There should be some error msg in the libvirtd.log, or libvirt should ignore the setting in the live xml 

Additional info:
for intel iommu:
<iommu model='intel'>
      <driver intremap='on' caching_mode='on' eim='on' iotlb='on'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </iommu>
will end up with:
-device {"driver":"intel-iommu","intremap":"on","caching-mode":true,"eim":"on","device-iotlb":true}

Comment 1 Michal Privoznik 2022-07-04 10:33:23 UTC
I'm not sure what's going on here. I mean, in the XML you have model='intel' but in the cmd line there's virtio-iommu. I could not reproduce this problem, can you share full domain XML please? Meanwhile, it's only virtio IOMMU that can have an <address/>, let me post patches for that.

Comment 2 Michal Privoznik 2022-07-04 11:09:49 UTC
Improvements posted here:

https://listman.redhat.com/archives/libvir-list/2022-July/232686.html

Comment 3 Michal Privoznik 2022-07-04 13:05:31 UTC
Merged upstream as:

43e9d322be domain_validate: Disallow non-virtio IOMMU with an <address/>
92678703ce docs: Document <address/> for IOMMU device
4a9c86ee2f qemu_domain_address: Drop needless virDomainIOMMUModel typecast

v8.5.0-50-g43e9d322be

Comment 4 yalzhang@redhat.com 2022-07-05 01:36:23 UTC
(In reply to Michal Privoznik from comment #1)
> I'm not sure what's going on here. I mean, in the XML you have model='intel'
> but in the cmd line there's virtio-iommu. I could not reproduce this
> problem, can you share full domain XML please? Meanwhile, it's only virtio
> IOMMU that can have an <address/>, let me post patches for that.

Sorry, I must have copy-paste error there. I have updated the description in comment 0.
# virsh dumpxml rhel 
<disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' iommu='on' ats='on'/>
      <source file='/var/lib/libvirt/images/RHEL-9.1.0-20220518.1-x86_64-ovmf.qcow2' index='1'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <boot order='1'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
    </disk>
<interface type='network'>
      <mac address='52:54:00:2b:f0:91'/>
      <source network='default' portid='28469d51-52ab-40f6-b40d-f1623a3d9df6' bridge='virbr0'/>
      <target dev='vnet12'/>
      <model type='virtio'/>
      <driver iommu='on' ats='on'/>
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
    </interface>
......
    <iommu model='virtio'>
      <driver intremap='on' caching_mode='on' eim='on' iotlb='on'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </iommu>

Related qemu cmd line:
-device {"driver":"virtio-iommu","bus":"pcie.0","addr":"0x4"}
-blockdev {"node-name":"libvirt-1-format","read-only":false,"driver":"qcow2","file":"libvirt-1-storage","backing":null} 
-device {"driver":"virtio-blk-pci","iommu_platform":true,"ats":true,"bus":"pci.5","addr":"0x0","drive":"libvirt-1-format","id":"virtio-disk0","bootindex":1}
-netdev tap,fd=23,vhost=on,vhostfd=25,id=hostnet0
-device {"driver":"virtio-net-pci","iommu_platform":true,"ats":true,"netdev":"hostnet0","id":"net0","mac":"52:54:00:2b:f0:91","bus":"pci.3","addr":"0x0"}

There is another qemu bug about the ats support(Bug 2101632) since virtio iommu do not support ats and device-iotlb.

Comment 6 yalzhang@redhat.com 2022-07-05 01:46:56 UTC
(In reply to Michal Privoznik from comment #1)
> problem, can you share full domain XML please? Meanwhile, it's only virtio
> IOMMU that can have an <address/>, let me post patches for that.

Yes, from the test results, only virtio iommu will have an <address/>, intel iommu does not have an <address/>.

Comment 7 Michal Privoznik 2022-07-08 10:50:40 UTC
Patches posted here:

https://listman.redhat.com/archives/libvir-list/2022-July/232726.html

Comment 9 Michal Privoznik 2022-08-08 15:01:51 UTC
commit c5bc752666ab0fc9799e7b9139e1035fe279e97f
Author:     Michal Prívozník <mprivozn>
AuthorDate: Fri Jul 8 11:33:02 2022 +0200
Commit:     Michal Prívozník <mprivozn>
CommitDate: Mon Aug 8 16:59:55 2022 +0200

    conf: Check IOMMU for unsupported attributes
    
    Currently, it's possible to pass various attributes to an IOMMU's
    <driver/> element hoping that we enable them in underlying
    hypervisor. However, depending on the IOMMU model, some of these
    attributes can't be enabled and are simply ignored. This is
    suboptimal and we should reject such configuration in the
    validate phase.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2101633
    Signed-off-by: Michal Privoznik <mprivozn>
    Reviewed-by: Ján Tomko <jtomko>

v8.6.0-64-gc5bc752666

Comment 10 yalzhang@redhat.com 2022-09-16 01:40:42 UTC
Test on libvirt-8.7.0-1.el9.x86_64, either of the attributes: 'intremap', 'caching_mode', 'eim', 'iotlb' or 'aw_bits' can not be validated, which is expected.

# virsh edit rhel
error: XML error: iommu model 'virtio' doesn't support additional attributes
Failed. Try again? [y,n,i,f,?]:

To define a vm with the unsupported attributes:
# virsh define rhel.xml
error: Failed to define domain from rhel.xml
error: XML error: iommu model 'virtio' doesn't support additional attributes

Comment 15 errata-xmlrpc 2023-05-09 07:26:34 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 (libvirt 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-2023:2171


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