Bug 603039

Summary: Reattach a pci device which is using by guest to host output wrong info
Product: Red Hat Enterprise Linux 6 Reporter: Johnny Liu <jialiu>
Component: libvirtAssignee: Chris Lalancette <clalance>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 6.0CC: ajia, clalance, dallan, dyuan, gren, jdenemar, llim, mzhan, rwu, veillard, virt-maint, xen-maint, yoyzhang, yupzhang
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: libvirt-0.9.4-rc1-1.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 559122 Environment:
Last Closed: 2011-12-06 10:44:27 UTC Type: ---
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: 559122    
Bug Blocks: 621776    

Comment 2 RHEL Program Management 2010-06-11 12:13:09 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.

Comment 4 Suzanne Logcher 2011-03-28 21:08:59 UTC
Since RHEL 6.1 External Beta has begun, and this bug remains 
unresolved, it has been rejected as it is not proposed as an 
exception or blocker.

Red Hat invites you to ask your support representative to 
propose this request, if appropriate and relevant, in the 
next release of Red Hat Enterprise Linux.

Comment 10 yuping zhang 2011-08-03 03:01:17 UTC
Verified this with with :

kernel-2.6.32-172.el6.x86_64
qemu-kvm-0.12.1.2-2.172.el6.x86_64
libvirt-0.9.4-0rc2.el6.x86_64

Steps to Reproduce:
1. Select a network pci device from host
 # virsh nodedev-dumpxml pci_0000_00_19_0
<device>
  <name>pci_0000_00_19_0</name>
  <parent>computer</parent>
  <driver>
    <name>e1000e</name>
  </driver>
  <capability type='pci'>
    <domain>0</domain>
    <bus>0</bus>
    <slot>25</slot>
    <function>0</function>
    <product id='0x10de'>82567LM-3 Gigabit Network Connection</product>
    <vendor id='0x8086'>Intel Corporation</vendor>
  </capability>
</device>

2. Dettach a network pci device from host
   # virsh nodedev-dettach pci_0000_00_19_0
   Device pci_0000_00_19_0 dettached
   # virsh nodedev-reset pci_0000_00_19_0
   Device pci_0000_00_19_0
3. Add this pci device info into guest xml config file
    <hostdev mode='subsystem' type='pci'>
      <source>
      <address bus='0' slot='25' function='0'/>
      </source>
    </hostdev>
4. Run the guest
   # virsh define dom.xml
   # virsh start dom
   Domain dom started
   #virsh dumpxml dom
   ...
      <hostdev mode='subsystem' type='pci' managed='no'>
      <source>
        <address domain='0x0000' bus='0x00' slot='0x19' function='0x0'/>
      </source>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
    </hostdev>
   ...
5. In guest
#lspci
00:06.0 Ethernet controller:Intel Corporation 82567LM-3 Gigabit network Connection (rev 02)
  The pci device works well in the guest
6. In host, try to reattach the assigned pci device
# virsh nodedev-reattach pci_0000_00_19_0
error: Failed to re-attach device pci_0000_00_19_0
error: internal error Not reattaching active device 0000:00:19.0
7.# readlink /sys/bus/pci/devices/0000\:00\:19.0/driver/

8. # virsh destroy dom

 shutdown the guest and remove the pci device from guest

9. # virsh nodedev-reattach pci_0000_00_19_0
Device pci_0000_00_19_0 re-attached

10. # virsh nodedev-reset pci_0000_00_19_0
Device pci_0000_00_19_0 reset

11. # readlink /sys/bus/pci/devices/0000\:00\:19.0/driver
../../../bus/pci/drivers/e1000e

At step 6,it pops up error message and cannot reattach the pci device,and also the device works well in guest.
So change the bug status to VERIFIED.

Comment 11 dyuan 2011-08-04 10:33:23 UTC
(In reply to comment #10)
> Verified this with with :
> 
> kernel-2.6.32-172.el6.x86_64
> qemu-kvm-0.12.1.2-2.172.el6.x86_64
> libvirt-0.9.4-0rc2.el6.x86_64
> 
> Steps to Reproduce:
> 1. Select a network pci device from host
>  # virsh nodedev-dumpxml pci_0000_00_19_0

Tiny update of the steps:

For the kernel -172, should run the following commands before start domain:
1.modprove -r kvm
2.modprobe kvm allow_unsafe_assigned_interrupts=1"

For the kernel -169, domain start successfully without "allow_unsafe_assigned_interrupts=1".

>    # virsh start dom
>    Domain dom started

Comment 12 errata-xmlrpc 2011-12-06 10:44:27 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-2011-1513.html