Bug 517460

Summary: libvirt should allow PCI PM reset on multi-function devices
Product: Red Hat Enterprise Linux 5 Reporter: Mark McLoughlin <markmc>
Component: libvirtAssignee: Mark McLoughlin <markmc>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.5CC: berrange, clalance, crobinso, gren, itamar, jane.lv, jvillalo, luyu, markmc, mjenner, rpacheco, veillard, virt-maint, virt-maint, xen-maint
Target Milestone: rc   
Target Release: 5.5   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-03-30 08:09:34 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:    
Bug Blocks: 516837, 532386, 533941    
Attachments:
Description Flags
nodedev-list output
none
lscpi-vvv-n output none

Description Mark McLoughlin 2009-08-14 07:42:47 UTC
This bug prevents multi-function PCI devices from being assigned to a KVM guest using libvirt.

+++ This bug was initially created as a clone of Bug #515689 +++

This code is wrong:

    /* For now, we just refuse to do a power management reset
     * if there are other functions on this device.                     
     * In future, we could allow it so long as those functions                    
     * are not in use by the host or other guests. 
     */
    if (pciDeviceContainsOtherFunctions(conn, dev)) {
        VIR_WARN("%s contains other functions, not resetting", dev->name);
        return -1;
    }

It turns out that PM reset does not affect other functions on a mutli-function device.

--- Additional comment from markmc on 2009-08-14 03:34:06 EDT ---

Patch committed upstream:

  http://libvirt.org/git/?p=libvirt.git;a=commitdiff;h=64a6682b93

Comment 1 Daniel Veillard 2009-12-04 15:34:41 UTC
libvirt-0.6.3-23.el5 has been built in dist-5E-qu-candidate with
the patches,

Daniel

Comment 3 Gunannan Ren 2010-01-05 10:07:38 UTC
Hi Daniel:

  I don't know how to verify the bug, if the multi-function PCI devices are type of the PCI device with the support for SR/IOV like intel82576 NIC?
  I tried libvirt-0.6.3-22.el5 version on KVM host with version kvm-83-140.el5, it seems ok to assign VF to guest. 
  Thank you for your more information.

Comment 4 Mark McLoughlin 2010-01-07 18:46:27 UTC
What you're looking for is a machine where by if you do:

  $> virsh nodedev-dettach ...
  $> virsh nodedev-reset ...

on RHEL5.4 (or any libvirt version before libvirt-0.6.3-23.el5) that nodedev-reset fails and prints a "contains other functions, not resetting" message to /var/log/messages

once you've found suitable hardware to do that, then you can update libvirt and check if nodedev-reset now succeeds

Comment 5 Gunannan Ren 2010-01-27 08:03:44 UTC
The bug has been fixed on libvirt-0.6.3-30.el5

I reproduced the bug on libvirt-0.6.3-22.el5
Is is necessary to have a machine with multi-function PCI device which doesn't support FLR feature and support Power Management feature.
then, 
    virsh nodedev-dettach ...
    virsh nodedev-reset ...
It reports errors to standard output device:

error: Failed to reset device pci_10df_fe00
error: this function is not supported by the hypervisor: No PCI reset capability available for 0000:01:00.1

and simultaneously, prints a error log into /var/log/messages, like:

Jan 27 15:51:43 intel-5504-12-1 libvirtd: 15:51:43.259: warning : 0000:01:00.1 contains other functions, not resetting
Jan 27 15:51:43 intel-5504-12-1 libvirtd: 15:51:43.259: error : this function is not supported by the hypervisor: No PCI reset capability available for 0000:01:00.1

on libvirt-0.6.3-30.el5, no errors occurred.

Comment 6 Gunannan Ren 2010-01-27 08:04:55 UTC
Created attachment 387003 [details]
nodedev-list output

Comment 7 Gunannan Ren 2010-01-27 08:07:22 UTC
Created attachment 387004 [details]
lscpi-vvv-n output

Comment 10 errata-xmlrpc 2010-03-30 08:09:34 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2010-0205.html