Bug 1012365

Summary: xhci usb storage lost in guest after wakeup from S3
Product: Red Hat Enterprise Linux 7 Reporter: Xu Han <xuhan>
Component: qemu-kvmAssignee: Gerd Hoffmann <kraxel>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: high Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, hhuang, juzhang, kraxel, mazhang, michen, mrezanin, qzhang, rhod, sluo, virt-maint, xfu
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: qemu-kvm-1.5.3-49.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-06-13 11:22:04 UTC Type: Bug
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: 923626    

Description Xu Han 2013-09-26 11:07:20 UTC
Description of problem:
xhci usb storage lost in guest after wakeup from S3.
In qemu could always found the controller and device.
Test this issue in win2012 guest and qemu report same message, but qxl driver has some problem, so cannot login guest to check.

Version-Release number of selected component (if applicable):
qemu-kvm-rhev-1.5.3-6.el7.x86_64
Kernel 3.10.0-28.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.boot guest with xhci controller
# /usr/libexec/qemu-kvm ...
-device nec-usb-xhci,id=xhci \
-device usb-storage,drive=drive-usb-0-0,id=usb-0-0,removable=on,bus=xhci.0,port=1 \
-drive file=/home/usb,if=none,id=drive-usb-0-0,media=disk,format=qcow2

2.check usb device in guest
# lsusb

3.do S3 in guest
# echo -n "mem" > /sys/power/state

4.wakeup from S3
(qemu)system_wakeup

5.check usb device in guest again
# lsusb

Actual results:
after step2:
Bus 002 Device 002: ID 46f4:0001  
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

after wakeup from s3, dmesg show:
[  119.343105] xhci_hcd 0000:00:04.0: xHCI host not responding to stop endpoint command.
[  119.343107] xhci_hcd 0000:00:04.0: Assuming host is dying, halting host.
[  119.343167] xhci_hcd 0000:00:04.0: HC died; cleaning up
[  119.343432] dpm_run_callback(): usb_dev_resume+0x0/0x20 returns -22
[  119.343446] PM: Device 2-1 failed to resume async: error -22
hmp show:
(qemu)
xhci: xhci_kick_ep for disabled slot 1
xhci: slot id 1 not enabled

after step5:
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Expected results:


Additional info:
ehci controller not hit this issue.

Comment 2 Xu Han 2013-09-27 07:14:40 UTC
Test on qemu-kvm 1.5.0-1 hit the same issue.
Test on qemu-kvm 1.4.0-4 hit bug 903105.

Comment 3 Gerd Hoffmann 2013-12-11 10:05:24 UTC
patch posted (upstream f1f8bc218a422081f36f0b325b3de5e6a5078b74)

Comment 5 Miroslav Rezanina 2014-02-19 08:47:46 UTC
Fix included in qemu-kvm-1.5.3-49.el7

Comment 7 mazhang 2014-02-25 08:40:39 UTC
Reproduce this bug with qemu-kvm-1.5.3-41.el7.x86_64.

steps:
1.boot guest with xhci controller
# /usr/libexec/qemu-kvm ...
-device nec-usb-xhci,id=xhci \
-device usb-storage,drive=drive-usb-0-0,id=usb-0-0,removable=on,bus=xhci.0,port=1 \
-drive file=/home/usb,if=none,id=drive-usb-0-0,media=disk,format=qcow2

2.Enter s3 state, and resume.

Result:
dmesg:
[   37.743055] xhci_hcd 0000:00:05.0: xHCI host not responding to stop endpoint command.
[   37.743057] xhci_hcd 0000:00:05.0: Assuming host is dying, halting host.
[   37.743126] xhci_hcd 0000:00:05.0: HC died; cleaning up
[   37.743156] dpm_run_callback(): usb_dev_resume+0x0/0x20 returns -22
[   37.743167] PM: Device 2-1 failed to resume async: error -22
[   37.743348] PM: resume of devices complete after 10117.873 msecs
[   37.743687] usb 2-1: USB disconnect, device number 2
[   37.744613] sd 2:0:0:0: [sda] Synchronizing SCSI cache
[   37.744638] sd 2:0:0:0: [sda]
[   37.744640] Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
[   37.743518] Restarting tasks ... done.

[root@localhost ~]# lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Update qemu-kvm package.

Host:
qemu-kvm-1.5.3-49.el7.x86_64
qemu-kvm-debuginfo-1.5.3-49.el7.x86_64
qemu-kvm-tools-1.5.3-49.el7.x86_64
libvirt-daemon-driver-qemu-1.1.1-22.el7.x86_64
qemu-img-1.5.3-49.el7.x86_64
qemu-kvm-common-1.5.3-49.el7.x86_64

Result:
[   89.471659] ata1.01: configured for MWDMA2
[   89.628397] usb 2-1: reset SuperSpeed USB device number 2 using xhci_hcd
[   89.639656] xhci_hcd 0000:00:05.0: xHCI xhci_drop_endpoint called with disabled ep ffff880037259e80
[   89.639657] xhci_hcd 0000:00:05.0: xHCI xhci_drop_endpoint called with disabled ep ffff880037259ec0
[   89.639875] usb 2-1: Set SEL for device-initiated U1 failed.
[   89.639914] usb 2-1: Set SEL for device-initiated U2 failed.
[   89.640032] PM: resume of devices complete after 320.878 msecs
[   89.640115] Restarting tasks ... done.
[   90.592123] VFS: busy inodes on changed media or resized disk sda

The problem in comment#0 not happening. but got "Set SEL for device-initiated U1 failed", not sure whether expected or not.

Comment 8 juzhang 2014-03-01 10:06:06 UTC
> The problem in comment#0 not happening. but got "Set SEL for
> device-initiated U1 failed", not sure whether expected or not.

Hi Gerd and Hai,

QE filed a new bz[1] about this issue. Free to update your comment in new bz.

[1]Bug 1071524 - Guest dmesg show "usb 2-1: Set SEL for device-initiated U1 failed" error after wakeup from S3

Comment 10 Gerd Hoffmann 2014-06-12 10:45:47 UTC
needinfo is leftover here I think, clearing ...

Comment 11 Ludek Smid 2014-06-13 11:22:04 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.