Bug 1008883

Summary: The guest was crashed while detach the 82576 vf card from the guest
Product: Red Hat Enterprise Linux 7 Reporter: zhenfeng wang <zhwang>
Component: qemu-kvmAssignee: Bandan Das <bdas>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, alex.williamson, chayang, cwei, dyuan, gsun, hhuang, juzhang, mzhan, virt-maint, xuzhang, ydu, zhwang
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-01-30 17:30:32 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:

Description zhenfeng wang 2013-09-17 09:40:26 UTC
Description
The guest was crashed while detach the 82576 vf card from the guest which has been attached
the same vf twice.

Versions
kernel-3.10.0-18.el7.x86_64
libvirt-1.1.1-5.el7.x86_64
qemu-kvm-1.5.3-3.el7.x86_64

Steps
1.Prepare a runnig guest
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 3     rhelnew3                       running

2.Prepare a vf's xml
# virsh nodedev-dumpxml pci_0000_0f_10_7
<device>
  <name>pci_0000_0f_10_7</name>
  <path>/sys/devices/pci0000:00/0000:00:1c.6/0000:0c:00.0/0000:0d:02.0/0000:0f:10.7</path>
  <parent>pci_0000_0d_02_0</parent>
  <driver>
    <name>igbvf</name>
  </driver>
  <capability type='pci'>
    <domain>0</domain>
    <bus>15</bus>
    <slot>16</slot>
    <function>7</function>
    <product id='0x10ca'>82576 Virtual Function</product>
    <vendor id='0x8086'>Intel Corporation</vendor>

# cat vf.xml
<hostdev mode='subsystem' type='pci' managed='yes'>
            <source>
              <address bus='15' slot='16' function='7'/>
            </source>
  </hostdev>

3.Attach the vf to the guest
# virsh attach-device rhelnew3 vf.xml
Device attached successfully

4.Attach it again
# virsh attach-device rhelnew3 vf.xml
error: Failed to attach device from vf.xml
error: Requested operation is not valid: PCI device 0000:0f:10.7 is in use by domain rhelnew3

5.Detach the vf from the guest, vf will be detached successfully, however, the guest was destroyed automatically
# virsh detach-device rhelnew3 vf.xml
Device detached successfully

Check the guest's status
# virsh list --all
 Id    Name                           State
----------------------------------------------------
 -     rhelnew3                       shut off



6.Check the log in libvirtd.log
2013-09-17 05:05:06.743+0000: 20588: error : qemuMonitorIORead:515 : Unable to read from monitor: Connection reset by peer

check the log in qemu's log
char device redirected to /dev/pts/4 (label charserial0)
qemu: hardware error: pci write failed, ret = -1 errno = 13

CPU #0:
RAX=0000000000000006 RBX=0000000000000000 RCX=00000000000010ae RDX=0000000000000cfc
RSI=0000000000000097 RDI=0000000080004004 RBP=ffff88003d4a3b48 RSP=ffff88003d4a3b20
R8 =0000000000000002 R9 =0000000000000006 R10=0000000000000040 R11=0000000000000001
R12=0000000000000002 R13=0000000000000000 R14=0000000000000006 R15=0000000000000040
RIP=ffffffff814d35a7 RFL=00000046 [---Z-P-] CPL=0 II=0 A20=1 SMM=0 HLT=0
ES =0000 0000000000000000 ffffffff 00c00000
CS =0010 0000000000000000 ffffffff 00a09b00 DPL=0 CS64 [-RA]
SS =0018 0000000000000000 ffffffff 00c09300 DPL=0 DS   [-WA]
DS =0000 0000000000000000 ffffffff 00c00000
FS =0000 0000000000000000 ffffffff 00c00000
GS =0000 ffff88003fc00000 ffffffff 00c00000
LDT=0000 0000000000000000 ffffffff 00c00000
TR =0040 ffff88003fc11a00 00002087 00008b00 DPL=0 TSS64-busy
GDT=     ffff88003fc0a000 0000007f
IDT=     ffffffffff529000 00000fff
CR0=8005003b CR2=00007f0ccc648f84 CR3=000000003c29f000 CR4=000006f0
DR0=0000000000000000 DR1=0000000000000000 DR2=0000000000000000 DR3=0000000000000000
DR6=00000000ffff0ff0 DR7=0000000000000400
EFER=0000000000000d01
FCW=037f FSW=0000 [ST=0] FTW=00 MXCSR=00009fc0
FPR0=0000000000000000 0000 FPR1=0000000000000000 0000
FPR2=0000000000000000 0000 FPR3=0000000000000000 0000
FPR4=0000000000000000 0000 FPR5=0000000000000000 0000
FPR6=0000000000000000 0000 FPR7=0000000000000000 0000
XMM00=6e69616d6f646c61636f6c2e74736f68 XMM01=ffffffffffffffffffffffffffffffff
XMM02=00000000000000000000000000000000 XMM03=00000000000000000000000000000000
XMM04=00000000000000000000000000000000 XMM05=40404040404040404040404040404040
XMM06=5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b5b XMM07=20202020202020202020202020202020
XMM08=00000000000000200000002000000000 XMM09=ff000000000000ffff0000ffff000000
XMM10=00000000000000000000000000000000 XMM11=ffffffffffffffffffffffffffffffff
XMM12=00000000000000000000000000000000 XMM13=00000000000000000000000000000000
XMM14=00000000000000000000000000000000 XMM15=00000000000000000000000000000000
2013-09-17 05:05:06.744+0000: shutting down


Actual result
The guest was crashed  while detach the vf the from the guest

Expect result
The guest shouldn't be crashed while detach the vf from the guest

Comment 5 Bandan Das 2014-01-30 17:30:32 UTC
I am closing this based on QE's input that they can't reproduce this issue with a recent version of kernel and libvirt. Please feel free to reopen if you think otherwise. Thanks.