Bug 1030789

Summary: qemu crash when hotplug one VF with same boot index 1
Product: Red Hat Enterprise Linux 7 Reporter: hongming <honzhang>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, dallan, dyuan, jdenemar, mzhan, xuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1030796 (view as bug list) Environment:
Last Closed: 2014-04-02 09:14:47 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:
Bug Depends On:    
Bug Blocks: 1030796    

Description hongming 2013-11-15 06:58:54 UTC
Description of problem:
qemu crash when hotplug one VF with same boot index 1. libvirt should forbid to do this operation.

Version-Release number of selected component (if applicable):
libvirt-1.1.1-12.el7.x86_64
qemu-kvm-1.5.3-19.el7.x86_64
kernel-3.10.0-51.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
# lsmod |grep vfio_pci
vfio_pci               36474  0 
vfio                   20777  2 vfio_iommu_type1,vfio_pci

2. make sure the following parameter of vfio module is "Y".
# cat /sys/module/vfio_iommu_type1/parameters/allow_unsafe_interrupts 
Y


# virsh start r7
Domain r7 started

# virsh dumpxml r7|grep 'boot dev'
    <boot dev='hd'/>


# virsh net-list
 Name                 State      Autostart     Persistent
----------------------------------------------------------
 default              active     yes           yes
 hostnet              active     no            yes

# virsh net-dumpxml hostnet
<network>
  <name>hostnet</name>
  <uuid>c1fb4ead-21b8-4d69-8ad9-669c55b3dfc7</uuid>
  <forward mode='hostdev' managed='yes'>
    <driver name='vfio'/>
    <address type='pci' domain='0x0000' bus='0x0f' slot='0x10' function='0x0'/>
    <address type='pci' domain='0x0000' bus='0x0f' slot='0x10' function='0x2'/>
    <address type='pci' domain='0x0000' bus='0x0f' slot='0x10' function='0x4'/>
    <address type='pci' domain='0x0000' bus='0x0f' slot='0x10' function='0x6'/>
  </forward>
</network>

# cat vfpool_bootorder.xml
<interface type='network'>
  <source network='hostnet'/>
  <boot order='1'/>
</interface>

# virsh attach-device r7 vfpool_bootorder.xml
error: Failed to attach device from vfpool_bootorder.xml
error: Unable to read from monitor: Connection reset by peer

# cat /var/log/libvirt/qemu/r7.log

2013-11-13 08:14:05.171+0000: starting up
LC_ALL=C PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin QEMU_AUDIO_DRV=spice /usr/libexec/qemu-kvm -name r7 -S -machine pc-i440fx-rhel7.0.0,accel=kvm,usb=off -m 1024 -realtime mlock=off -smp 1,sockets=1,cores=1,threads=1 -uuid 7662b180-39e4-4e5d-8635-a39458a0621b -no-user-config -nodefaults -chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/r7.monitor,server,nowait -mon chardev=charmonitor,id=monitor,mode=control -rtc base=utc -no-shutdown -device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 -device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x5 -drive file=/var/lib/libvirt/images/r7.img,if=none,id=drive-ide0-0-0,format=raw,cache=none -device ide-hd,bus=ide.0,unit=0,drive=drive-ide0-0-0,id=ide0-0-0,bootindex=1 -spice port=5900,addr=127.0.0.1,disable-ticketing,seamless-migration=on -vga qxl -global qxl-vga.ram_size=67108864 -global qxl-vga.vram_size=67108864 -device intel-hda,id=sound0,bus=pci.0,addr=0x4 -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
Two devices with same boot index 1
2013-11-13 08:15:27.201+0000: shutting down


Actual results:
qemu crash when hotplug one VF with same boot index 1.

Expected results:
libvirt should forbid to do this operation.

Additional info:

Comment 2 Laine Stump 2013-11-27 15:00:16 UTC
Note that the problem of qemu exiting in this case (it is an "orderly" shutdown, not a crash) is a longstanding bug in qemu: Bug 771545. Apparently there have been patches posted to fix it, but apparently nothing pushed yet.

In any case, libvirt should be catching this itself, so I'll work up a patch that checks the boot index of existing devices when a new device is added, and fails with an appropriate error before ever getting to the point of calling qemu.

Comment 3 Dave Allan 2013-12-10 19:37:33 UTC
It's not clear to me that there can never be a valid use of multiple devices with the same boot index, for example, perhaps a disaster recovery architecture would set two devices as equally valid.  Maybe it's valid, maybe it's not, but I don't think we have enough information at this point to say.

Comment 4 Jiri Denemark 2014-04-02 09:14:47 UTC

*** This bug has been marked as a duplicate of bug 1007759 ***