Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 5 product line. The current stable release is 5.10. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 510806

Summary: KVM: invoke pci_reset_function() when PCI device assigned or deassigned to a guest
Product: Red Hat Enterprise Linux 5 Reporter: Don Dutile (Red Hat) <ddutile>
Component: kvmAssignee: Don Dutile (Red Hat) <ddutile>
Status: CLOSED ERRATA QA Contact: Lawrence Lim <llim>
Severity: medium Docs Contact:
Priority: medium    
Version: 5.4CC: chrisw, ddutile, lihuang, mjenner, sghosh, tburke, tools-bugs, virt-maint, ykaul
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: kvm-83-94.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-02 09:28:41 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: 510805    
Bug Blocks:    
Attachments:
Description Flags
V2 of patch that is compatible w/upstream & RHEL5 none

Description Don Dutile (Red Hat) 2009-07-10 21:07:24 UTC
Description of problem:
See BZ 510805 for description.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.
  
Actual results:


Expected results:


Additional info:
At this moment, pci_reset_function() is stubbed out in KVM-RHEL5-kmod.
To use it:

Trivial patch:

--- a/kernel/external-module-compat-comm.h
+++ b/kernel/external-module-compat-comm.h
@@ -631,6 +631,7 @@ static inline ktime_t kvm_hrtimer_expires_remaining(const struct hrtimer *timer)
 #endif
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
+#if defined(RHEL_RELEASE_CODE) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(5,4)
 
 static inline int pci_reset_function(struct pci_dev *dev)
 {
@@ -638,6 +639,7 @@ static inline int pci_reset_function(struct pci_dev *dev)
 }
 
 #endif
+#endif
 
 #ifndef KMEM_CACHE
 /*

Comment 1 Don Dutile (Red Hat) 2009-07-16 18:05:27 UTC
Created attachment 354027 [details]
V2 of patch that is compatible w/upstream & RHEL5

Post V2 of patch.

Comment 8 lihuang 2009-07-26 14:51:15 UTC
Hi Don
   Could you tell how to reproduce/verify this bug ?
   I have tried to  assign a NIC to guest. then shutdown the guest. everything seems ok. ( even with the pre-patched kvm-83-90.el5). Is it enough for this bug ?

Comment 9 lihuang 2009-07-31 03:21:55 UTC
Reply from Don

This is not a bug, it is a feature.

One would have to have a PCIe logic analyzer to prove
the functionality is working 100%,  or a broken card that is
only fixed by the reset ... but working good enough not to
crash either a KVM guest or it's host.

The way we checked/verified it's functionality:
(a) ported from upstream, and code source is from Intel
(b) I created a trace version of the code that outputted
    what the code was doing as it executed (or didn't execute)
    the code (it only is run on a PCIe device that has FLR support,
    which is optional).  Chris Wright tested it against PCIe devices
    that had & didn't have FLR support.

I'm not sure how a qe test could verify or not verify the functionality,
since it is primarily a hw reset of a PCIe device.

- Don

Comment 10 lihuang 2009-07-31 03:31:42 UTC
verified the patch is applied in kvm-83-94.el5.
rpm -q --changelog kvm  | grep 510806
- kvm-Use-pci_reset_function-in-RHEL5.4-so-FLR-done-proper.patch [bz#510806]
- Resolves: bz#510806

In the acceptance testing . no regression of this patch was found.

setting to verified.

Comment 12 errata-xmlrpc 2009-09-02 09:28:41 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/RHEA-2009-1272.html