Bug 1142642

Summary: update PF nodedev information related to VF timely
Product: Red Hat Enterprise Linux 7 Reporter: Jincheng Miao <jmiao>
Component: libvirtAssignee: Laine Stump <laine>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: low Docs Contact:
Priority: medium    
Version: 7.1CC: dyuan, honzhang, mzhan, rbalakri
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: 2015-05-06 16:20:29 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 Jincheng Miao 2014-09-17 07:10:40 UTC
Description of problem:
For SR-IOV node devices, libvirt should update PF nodedev information
related to VF timely.
When the SR-IOV driver is removed, related VF will disappear, then
nodedev-dumpxml should not list VF information for related PF.

Version-Release number of selected component (if applicable):
libvirt-1.2.8-2.el7.x86_64.rpm
kernel-3.10.0-160.el7.x86_64

How reproducible:
always

Steps to Reproduce:
1. list SRIOV PFs and VFs:
# lspci | grep Eth
44:00.0 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
44:00.1 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
44:10.0 Ethernet controller: Intel Corporation 82599 Ethernet Controller Virtual Function (rev 01)
44:10.1 Ethernet controller: Intel Corporation 82599 Ethernet Controller Virtual Function (rev 01)

2. dump a PF
# virsh nodedev-dumpxml pci_0000_44_00_0
<device>
  <name>pci_0000_44_00_0</name>
<path>/sys/devices/pci0000:40/0000:40:0b.0/0000:44:00.0</path>
  <parent>pci_0000_40_0b_0</parent>
  <driver>
    <name>ixgbe</name>
  </driver>
  <capability type='pci'>
    <domain>0</domain>
    <bus>68</bus>
    <slot>0</slot>
    <function>0</function>
    <product id='0x10fb'>82599ES 10-Gigabit SFI/SFP+ Network Connection</product>
    <vendor id='0x8086'>Intel Corporation</vendor>
    <capability type='virt_functions'>
      <address domain='0x0000' bus='0x44' slot='0x10' function='0x0'/>
    </capability>
    <iommuGroup number='16'>
      <address domain='0x0000' bus='0x44' slot='0x00' function='0x0'/>
      <address domain='0x0000' bus='0x44' slot='0x00' function='0x1'/>
    </iommuGroup>
    <pci-express>
      <link validity='cap' port='0' speed='5' width='8'/>
      <link validity='sta' speed='5' width='8'/>
    </pci-express>
  </capability>
</device>

3. remove ixgbe driver, then VF disappears
# modprobe -r ixgbe

# lspci | grep Eth
44:00.0 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)
44:00.1 Ethernet controller: Intel Corporation 82599ES 10-Gigabit SFI/SFP+ Network Connection (rev 01)

4. dump that PF, VF information is still there
# virsh nodedev-dumpxml pci_0000_44_00_0
<device>
  <name>pci_0000_44_00_0</name>
<path>/sys/devices/pci0000:40/0000:40:0b.0/0000:44:00.0</path>
  <parent>pci_0000_40_0b_0</parent>
  <capability type='pci'>
    <domain>0</domain>
    <bus>68</bus>
    <slot>0</slot>
    <function>0</function>
    <product id='0x10fb'>82599ES 10-Gigabit SFI/SFP+ Network Connection</product>
    <vendor id='0x8086'>Intel Corporation</vendor>
    <capability type='virt_functions'>
      <address domain='0x0000' bus='0x44' slot='0x10' function='0x0'/>
    </capability>
    <iommuGroup number='16'>
      <address domain='0x0000' bus='0x44' slot='0x00' function='0x0'/>
      <address domain='0x0000' bus='0x44' slot='0x00' function='0x1'/>
    </iommuGroup>
    <pci-express>
      <link validity='cap' port='0' speed='5' width='8'/>
      <link validity='sta' speed='5' width='8'/>
    </pci-express>
  </capability>
</device>

Expected result:
in step 4, no following:
    <capability type='virt_functions'>
      <address domain='0x0000' bus='0x44' slot='0x10' function='0x0'/>
    </capability>

Comment 1 Laine Stump 2015-02-12 17:39:43 UTC
I could have sworn there was a BZ about this (and a fix) quite some time ago...

The problem was (and apparently still is?) that the nodedev driver reads all the device info once when libvirt starts and caches it, which turns out to be a very bad idea. I'll try to see what happened to that.

Comment 2 Laine Stump 2015-05-06 16:20:29 UTC
Okay, now I've found the original report: Bug 981546

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