Bug 769745

Summary: Released usb stick after passthrough fails to be reused on host
Product: Red Hat Enterprise Linux 6 Reporter: Shaolong Hu <shu>
Component: qemu-kvmAssignee: Gerd Hoffmann <kraxel>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3CC: acathrow, bsarathy, juzhang, michen, minovotn, mkenneth, qzhang, qzhou, rhod, tburke, virt-maint
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-0.12.1.2-2.222.el6 Doc Type: Bug Fix
Doc Text:
Cause: USB release function was not called in the exit notifier Consequence: Host was unable to reuse USB device after it has been removed from the guest. Fix: Call release function in the exit notifier too. Result: Host still can reuse the USB device after removal from the guest.
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-06-20 11:38:05 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 Shaolong Hu 2011-12-22 03:23:09 UTC
Description of problem:
------------------------
Released usb stick after passthrough fails to be reused on host, according to test plan, this is not correct:

[passthrough] Release the physical USB stick/webcam from guest, check if it works well on host
Remove USB stick/webcam from guest.
Verify USB stick/webcam works correctly on host, no errors found in console of host, dmesg output of host. 

Version-Release number of selected component (if applicable):
--------------------------------------------------------------
qemu-kvm-0.12.1.2-2.213.el6.x86_64

How reproducible:
-------------------
100%

Steps to Reproduce:
--------------------
1.boot guest with "-readconfig ich9-ehci-uhci.cfg"
2.in qemu monitor, passthrough host usb stick to guest
3.in qemu monitor, delete the usb stick
  
Actual results:
-----------------
After step 3, on host:
1. lsusb can show the usb stick
2. fdisk -l fails to show the usb stick
3. ls /dev/sd* fails to show the stick

Expected results:
------------------
The best: Usb stick can be used on host automatically.
Workaround: Some manual configuration, like pci device passthrough, and if this is feasible, better qemu-kvm does it automatically.
Currently: Re-plug the stick.

Comment 1 Gerd Hoffmann 2012-01-04 11:54:13 UTC
What monitor commands do you issue for steps (2) + (3) ?

Comment 2 Shaolong Hu 2012-01-05 02:31:54 UTC
(In reply to comment #1)
> What monitor commands do you issue for steps (2) + (3) ?

2.(qemu)device_add usb-host,hostbus=X,hostaddr=X,id=hostusb1
3.(qemu)device_del hostusb1

Comment 4 Shaolong Hu 2012-02-09 02:58:02 UTC
Verified on qemu-kvm-0.12.1.2-2.223.el6.x86_64:

With steps in Description:

After step 3, on host:
1. lsusb shows the usb stick
2. fdisk -l shows the usb stick
3. ls /dev/sd* shows the usb stick
4. mount /dev/sdb1 /mnt, the usb stick can be used correctly

Verified.

Comment 6 Michal Novotny 2012-05-04 09:37:35 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Cause:
USB release function was not called in the exit notifier

Consequence:
Host was unable to reuse USB device after it has been removed from the guest.

Fix:
Call release function in the exit notifier too.

Result:
Host still can reuse the USB device after removal from the guest.

Comment 7 errata-xmlrpc 2012-06-20 11:38:05 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2012-0746.html