Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 920108

Summary: Rhel7.0 guest Max can recognize 38 usb storage devices when booting guest with 53 usb storage devices in one xhci controller
Product: Red Hat Enterprise Linux 7 Reporter: FuXiangChun <xfu>
Component: qemu-kvmAssignee: Gerd Hoffmann <kraxel>
Status: CLOSED DUPLICATE QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: acathrow, hhuang, juzhang, lnovich, michen, qzhou, rhod, virt-maint
Target Milestone: rcFlags: xfu: needinfo-
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-05-14 14:27:26 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: 924149    
Bug Blocks:    
Attachments:
Description Flags
boot guest command line
none
full command line
none
changed command line none

Description FuXiangChun 2013-03-11 11:14:05 UTC
Description of problem:
Boot guest with 53 usb devices in one xhci controller, qemu can see 53 usb storage device via 'info qtree' or 'info block, but only 38 usb device can be recognized in guest(via fdisk -l or dmesg).

Version-Release number of selected component (if applicable):
# uname -r
3.8.0-0.37.el7.x86_64
# rpm -qa|grep qemu
qemu-kvm-1.3.0-8.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.added command line to attchment
2.
3.
  
Actual results:
38 usb devices are recognized in guest

Expected results:
all usb devices can be recognized in guest.

Additional info:

Comment 1 FuXiangChun 2013-03-11 11:14:47 UTC
Created attachment 708311 [details]
boot guest command line

Comment 4 Gerd Hoffmann 2013-03-20 13:55:13 UTC
qemu will automagically plug in a new usb hub into the last free port if it runs out of ports.  That creates a chain of hubs (nicely visible with lsusb -t inside the guest).  Nesting deeper than 5 hubs isn't allowed though, thats why the devices are not visible to the guest.

So for creating *lots* of devices you have to create a hub hierarchy which isn't nested that deep:

qemu -device usb-hub,port=1
-device usb-hub,port=1.1
-device usb-hub,port=1.2
-device usb-hub,port=1.3
-device usb-hub,port=1.4
-device usb-hub,port=1.5
-device usb-hub,port=1.6
-device usb-hub,port=1.7

and then add the storage devices.

Comment 5 FuXiangChun 2013-03-21 09:37:17 UTC
(In reply to comment #4)
> qemu will automagically plug in a new usb hub into the last free port if it
> runs out of ports.  That creates a chain of hubs (nicely visible with lsusb
> -t inside the guest).  Nesting deeper than 5 hubs isn't allowed though,
> thats why the devices are not visible to the guest.
> 
> So for creating *lots* of devices you have to create a hub hierarchy which
> isn't nested that deep:
> 
> qemu -device usb-hub,port=1
> -device usb-hub,port=1.1
> -device usb-hub,port=1.2
> -device usb-hub,port=1.3
> -device usb-hub,port=1.4
> -device usb-hub,port=1.5
> -device usb-hub,port=1.6
> -device usb-hub,port=1.7
> 
> and then add the storage devices.

Re-tested this issue with command line in attachment(the following is only part).

-device nec-usb-xhci,id=xhci0 \
-drive file=storage/usb-storage1.qcow2,if=none,id=drive-usb-0-1,media=disk,format=qcow2,cache=none,aio=native -device usb-storage,drive=drive-usb-0-1,id=usb-0-1,removable=on,port=1  \
-drive file=storage/usb-storage2.qcow2,if=none,id=drive-usb-0-2,media=disk,format=qcow2,cache=none,aio=native -device usb-storage,drive=drive-usb-0-2,id=usb-0-2,removable=on,port=2 \
-drive file=storage/usb-storage3.qcow2,if=none,id=drive-usb-0-3,media=disk,format=qcow2,cache=none,aio=native -device usb-storage,drive=drive-usb-0-3,id=usb-0-3,removable=on,port=3 \
-device usb-hub,port=1,port=4 \
-device usb-hub,port=4.1
-device usb-hub,port=4.2
-device usb-hub,port=4.3
-device usb-hub,port=4.4
-device usb-hub,port=4.5
-device usb-hub,port=4.6
-device usb-hub,port=4.7
-drive file=storage/usb-storage4.qcow2,if=none,id=drive-usb-0-4,media=disk,format=qcow2,cache=none,aio=native -device usb-storage,drive=drive-usb-0-4,id=usb-0-4,removable=on,port=4.1.1 \
................

Test result:
qemu and rhel7.0 guest only can recognize 3 usb storage devices.
1.qemu:
(qemu) info block
drive-system-disk: removable=0 io-status=ok file=/home//rhel7-new-bak.qcow2 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
drive-usb-0-1: removable=1 locked=0 tray-open=0 io-status=ok file=storage/usb-storage1.qcow2 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
drive-usb-0-2: removable=1 locked=0 tray-open=0 io-status=ok file=storage/usb-storage2.qcow2 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
drive-usb-0-3: removable=1 locked=0 tray-open=0 io-status=ok file=storage/usb-storage3.qcow2 ro=0 drv=qcow2 encrypted=0 bps=0 bps_rd=0 bps_wr=0 iops=0 iops_rd=0 iops_wr=0
floppy0: removable=1 locked=0 tray-open=0 [not inserted]
sd0: removable=1 locked=0 tray-open=0 [not inserted]

2.inside guest:
# lsusb -t
lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
    |__ Port 2: Dev 3, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
    |__ Port 3: Dev 4, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 480M
    |__ Port 4: Dev 2, If 0, Class=Hub, Driver=hub/8p, 12M
        |__ Port 1: Dev 3, If 0, Class=Hub, Driver=hub/8p, 12M

qemu version:        qemu-kvm-1.4.0-1.el7.x86_64
guest and hostkernel:3.8.0-0.40.el7.x86_64

Comment 6 FuXiangChun 2013-03-21 09:39:24 UTC
Created attachment 713687 [details]
full command line

Comment 7 Gerd Hoffmann 2013-03-22 07:32:00 UTC
The hubs should come first.

Slashes ('\') at the end of line are missing, you've added it to the first hub but not the second and all following ones, so the command line simply ends after the second hub ...

Comment 8 FuXiangChun 2013-04-02 10:31:31 UTC
(In reply to comment #7)
> The hubs should come first.
> 
> Slashes ('\') at the end of line are missing, you've added it to the first
> hub but not the second and all following ones, so the command line simply
> ends after the second hub ...

according to your request, I changed command line(in attachment). but guest boot fail. and guest repeatedly print as "soft lockup-CPU#0 stuck for 23s!......".

Comment 9 FuXiangChun 2013-04-02 10:32:20 UTC
Created attachment 730678 [details]
changed command line

Comment 10 Gerd Hoffmann 2013-04-02 12:23:54 UTC
The soft lockup is bug 924149, adding dependency.

Comment 11 Gerd Hoffmann 2013-05-14 14:27:26 UTC

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