Bug 991334

Summary: Libvirt lost error messages when starting a domain with pci hostdev after setting iommu off.
Product: Red Hat Enterprise Linux 6 Reporter: Hu Jianwei <jiahu>
Component: libvirtAssignee: Ján Tomko <jtomko>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: acathrow, bili, dallan, dyuan, honzhang, mzhan, xuzhang, ydu
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.10.2-23.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-21 09:07:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Hu Jianwei 2013-08-02 07:38:26 UTC
Description of problem:
Libvirt lost error messages when starting a domain with pci hostdev after setting iommu off.
 
Version-Release number of selected component (if applicable):
libvirt-0.10.2-21.el6.x86_64
qemu-kvm-rhev-0.12.1.2-2.381.el6.x86_64
kernel-2.6.32-401.el6.x86_64


How reproducible:
100%

Steps:
1.In grub config file, remove "intel_iommu=on" from kernel command line, reboot host pc.

2.Define a domain and add the similar following xml to domain.
<hostdev mode='subsystem' type='pci'>
<source>
<address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</source>
</hostdev>

3.Start the domain.
[root@sriov2 ~]# virsh start r6
error: Failed to start domain r6
error: internal error process exited while connecting to monitor:


Actual results:
Missing details error messages, as step 3 shown.

Expected results:
I can not reproduce this issue on libvirt-0.10.2-18.el6_4.9.x86_64 version. We can reproduce it since libvirt-0.10.2-19.el6.x86_64.

Libvirt should pop up some messages, just like below:
[root@sriov2 ~]# virsh start r6
error: Failed to start domain r6
error: internal error process exited while connecting to monitor: char device redirected to /dev/pts/2
assigned_dev_register_regions: Error: Couldn't mmap 0xe7200000!
qemu-kvm: -device pci-assign,host=01:00.0,id=hostdev0,configfd=25,bus=pci.0,addr=0x7: Device 'pci-assign' could not be initialized
(This message showed on libvirt-0.10.2-18.el6_4.9.x86_64 version.)

or
[root@sriov2 ~]# virsh attach-device r6 hostdev.xml
error: Failed to attach device from hostdev.xml
error: internal error unable to execute QEMU command 'device_add': Device 'pci-assign' could not be initialized
(Message showed on libvirt-0.10.2-21.el6.x86_64 using attach-device command.)

Comment 2 Hu Jianwei 2013-08-02 09:59:45 UTC
There is a similar error.
 
1.Turn OFF VT-d in BOIS.

2. Dettach this pci device from host
# virsh nodedev-dettach pci_0000_01_00_0

3.Add below xml file to domain.
<hostdev mode='subsystem' type='pci'>
<source>
<address domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
</source>
</hostdev> 

4.Start domain.
[root@sriov2 ~]# virsh start r6_1
error: Failed to start domain r6_1
error: internal error Process exited while reading console log output: 


Note,no details information showed, should display some like below:

[root@sriov2 ~]# virsh attach-device r6_1 hostdev.xml
error: Failed to attach device from hostdev.xml
error: internal error unable to execute QEMU command 'device_add': Device 'pci-assign' could not be initialized

Comment 3 yanbing du 2013-08-05 02:37:21 UTC
Actually, this bug should be introduced by bug 954248.

Comment 4 Ján Tomko 2013-08-15 13:10:37 UTC
Upstream patch proposed:
https://www.redhat.com/archives/libvir-list/2013-August/msg00696.html

Comment 5 Ján Tomko 2013-08-15 13:37:02 UTC
Now fixed upstream:
commit 9ceaaa08e9b2281a5b58ac2f896761b2703d8791
Author:     Ján Tomko <jtomko>
AuthorDate: 2013-08-15 15:05:29 +0200
Commit:     Ján Tomko <jtomko>
CommitDate: 2013-08-15 15:05:29 +0200

    Fix qemuProcessReadLog with non-zero offset
    
    This restores the error message when QMP probing is not used.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=991334

git describe: v1.1.1-142-g9ceaaa0 

Downstream patch posted:
http://post-office.corp.redhat.com/archives/rhvirt-patches/2013-August/msg01000.html

Comment 7 Xuesong Zhang 2013-08-23 06:36:05 UTC
Verify this bug on build libvirt-0.10.2-23.el6.x86_64.


steps of scenario 1:
1.In grub config file, remove "intel_iommu=on" from kernel command line, reboot host pc.

2.Define a domain and add the similar following xml to domain.
<hostdev mode='subsystem' type='pci' manage='yes'>
<source>
<address domain='0x0000' bus='0x86' slot='0x00' function='0x0'/>
</source>
</hostdev>

3. start the guest with the xml in step 2.
# virsh start a
error: Failed to start domain a
error: internal error process exited while connecting to monitor: char device redirected to /dev/pts/1
No IOMMU found.  Unable to assign device "hostdev0"
qemu-kvm: -device pci-assign,host=86:00.0,id=hostdev0,configfd=30,bus=pci.0,addr=0x6: Device 'pci-assign' could not be initialized

4. attach the pci to guest.
# virsh attach-device a interface.xml 
error: Failed to attach device from interface.xml
error: internal error unable to execute QEMU command 'device_add': Device 'pci-assign' could not be initialized

steps of scenario 2:
1.Turn OFF VT-d in BOIS.
2.Define a domain and add the similar following xml to domain.
<hostdev mode='subsystem' type='pci' manage='yes'>
<source>
<address domain='0x0000' bus='0x86' slot='0x00' function='0x0'/>
</source>
</hostdev>

3. start the guest with the xml in step 2.
# virsh start rhel65
error: Failed to start domain rhel65
error: internal error Process exited while reading console log output: char device redirected to /dev/pts/1
No IOMMU found.  Unable to assign device "hostdev0"
qemu-kvm: -device pci-assign,host=00:19.0,id=hostdev0,configfd=27,bus=pci.0,addr=0x6: Device 'pci-assign' could not be initialized


4. attach the pci to guest.
# virsh attach-device rhel65 interface2.xml 
error: Failed to attach device from interface2.xml
error: internal error unable to execute QEMU command 'device_add': Device 'pci-assign' could not be initialized

Comment 9 errata-xmlrpc 2013-11-21 09:07:46 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, and where to find the updated
files, follow the link below.

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

http://rhn.redhat.com/errata/RHBA-2013-1581.html