Bug 667609

Summary: libvirt need to know if a PCI device is in use or not from kernel.
Product: Red Hat Enterprise Linux 6 Reporter: Osier Yang <jyang>
Component: kernelAssignee: Alex Williamson <alex.williamson>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: high    
Version: 6.1CC: dallan, ddutile, knoel, lwang, rwu, whuang, yuzhang
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-05 04:02:33 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: 614811    

Description Osier Yang 2011-01-06 08:35:16 UTC
Description of problem:
see bug: https://bugzilla.redhat.com/show_bug.cgi?id=614811

When we trying to reattach device to host, while the device is still in use by some guest, the host will crash. Now we don't have any method to detect if the PCI device is actually in use or not.

What we need is something like "using" in sysfs to tell if the device is actually in use or not.

More info, see https://bugzilla.redhat.com/show_bug.cgi?id=614811#c7

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


How reproducible:


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


Expected results:


Additional info:

Comment 2 RHEL Program Management 2011-01-07 04:17:56 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. 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. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 3 Suzanne Logcher 2011-01-07 16:06:03 UTC
This request was erroneously denied for the current release of Red Hat
Enterprise Linux.  The error has been fixed and this request has been
re-proposed for the current release.

Comment 4 RHEL Program Management 2011-02-01 05:50:56 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. 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. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 5 RHEL Program Management 2011-02-01 19:04:14 UTC
This request was erroneously denied for the current release of
Red Hat Enterprise Linux.  The error has been fixed and this
request has been re-proposed for the current release.

Comment 6 RHEL Program Management 2011-04-04 02:26:01 UTC
Since RHEL 6.1 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
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 8 RHEL Program Management 2011-10-07 15:20:20 UTC
Since RHEL 6.2 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
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 9 Don Dutile (Red Hat) 2012-07-09 17:22:12 UTC
Need to create a new sysfs file that reports the state of a
PCI device's (pdev->flags & PCI_DEV_FLAGS_ASSIGNED) value.

Comment 10 Alex Williamson 2012-07-09 18:45:34 UTC
(In reply to comment #9)
> Need to create a new sysfs file that reports the state of a
> PCI device's (pdev->flags & PCI_DEV_FLAGS_ASSIGNED) value.

Hmm, the request is [emphasis added]:

"When we trying to REATTACH device TO HOST, while the device is STILL IN USE BY some GUEST, the host will crash. Now we don't have any method to detect if the PCI device is actually in use or not."

In other words, libvirt is not checking that the device was actually successfully removed from the guest before trying to return it to the host ('info pci' in the monitor reports this).  Or it's losing track of the state of devices, potentially from a libvirt restart.

Exposing flags in sysfs doesn't really prevent the crash.  Do we need to add device reference counting in pci-stub so devices can't be unbound while "in use"?  That introduces a whole new usage model for pci-stub...