Bug 840450

Summary: Report QMP event when PCI device is released by guest OS
Product: Red Hat Enterprise Linux 6 Reporter: Jiri Denemark <jdenemar>
Component: qemu-kvmAssignee: Virtualization Maintenance <virt-maint>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.3CC: acathrow, ajia, alex.williamson, amit.shah, bsarathy, dallan, dyasny, dyuan, juzhang, mkenneth, mzhan, rwu, virt-maint, weizhan
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 807023 Environment:
Last Closed: 2012-07-18 13:08:08 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:

Description Jiri Denemark 2012-07-16 12:16:30 UTC
+++ This bug was initially created as a clone of Bug #807023 +++

Description of problem:
libvirt appears to always assume a device_del is successful.  This is not always the case.  Issuing a device_del simply registers a request to eject the device with the guest, it doesn't guarantee removal.  There are numerous reasons a guest may fail to release the device, however, when this happens libvirt does not report error and continues as if the removal was successful.

In my case I see this with a tg3 devices assigned to the guest.  The guest driver attempts to do a power state transition on the device, which doesn't work, and gets stuck.  The guest never calls the eject method for the device, but libvirt continues to unbind the device from pci-stub and pretend the removal was successful.

We need a QMP event to be reported when a device is released by a guest so that libvirt can detect successful device_del.

Version-Release number of selected component (if applicable):
libvirt-0.9.10-5.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Assign a tg3 device to a guest
2. Bring up the interface in the guest
3. Try to remove the device
  
Actual results:
libvirt reports success and unbinds the device from pci-stub, meanwhile the guest still owns the device (/proc/pid/fd still reports all the device file descriptors open).

Expected results:
libvirt checks for device removal and reports error after some timeout and doesn't unbind device from pci-stub.

Additional info:

--- Additional comment from dallan on 2012-03-28 15:23:45 UTC ---

This seems like a situation that's going to be difficult for libvirt to resolve without additional information from qemu.  Jiri, what do you think?

--- Additional comment from jdenemar on 2012-03-29 15:00:19 UTC ---

It won't be easy even with additional information from qemu. We would need to change detach API to be just a request for detaching and generate an event (emitted by qemu) when the device gets detached. However, this would mean the semantics of the api changed so it might be difficult to deal with, although one can argue that it didn't work with current semantics anyway.

Comment 2 Amit Shah 2012-07-18 10:46:01 UTC
Dup of bug 813748?

Comment 3 Jiri Denemark 2012-07-18 13:08:08 UTC
Oh, yes, sorry for the noise.

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