This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1260599 - 'firstport' 0-2 for the companion controllers 'pci-ohci' to 'ich9-usb-ehci1' does not take effect
'firstport' 0-2 for the companion controllers 'pci-ohci' to 'ich9-usb-ehci1'...
Status: CLOSED DUPLICATE of bug 1069590
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt (Show other bugs)
7.2
All Unspecified
medium Severity medium
: rc
: ---
Assigned To: Libvirt Maintainers
Virtualization Bugs
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-09-07 06:57 EDT by Gu Nini
Modified: 2015-09-10 07:54 EDT (History)
13 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-09-10 07:54:55 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Gu Nini 2015-09-07 06:57:46 EDT
Description of problem:
'firstport'  0-2 for the companion controllers "-device ich9-usb-ehci1,addr=1d.7,multifunction=on,id=ehci1 -device pci-ohci,addr=1d.0,multifunction=on,masterbus=ehci1.0,firstport=#" does not take effect

Version-Release number of selected component (if applicable):
Host kernel: 3.10.0-306.0.1.el7.ppc64le
Guest kernel: 3.10.0-306.0.1.el7.ppc64le
Qemu-kvm-rhev: qemu-kvm-rhev-2.3.0-22.el7.ppc64le

How reproducible:
100%

Steps to Reproduce:
Boot guests in each steps with following shell script:

# cat ehciohci.sh
#!/bin/sh

CLI="/usr/libexec/qemu-kvm -name virtioblk-0828-le1 -machine pseries,accel=kvm,usb=off -m 2048M -realtime mlock=off -smp 152,sockets=1,cores=20,threads=8 -uuid 95346a10-1828-403a-a610-ac5a52a29415 -no-user-config -nodefaults -monitor stdio -rtc base=utc,clock=host -no-shutdown -boot strict=on -drive id=drive_image1,if=none,cache=none,snapshot=off,aio=native,format=qcow2,file=/home/virtioblk-0828-le1 -device virtio-blk-pci,id=image1,drive=drive_image1,bus=pci.0,addr=04,bootindex=1 -netdev tap,id=hostnet0,script=/etc/qemu-ifup,downscript=/etc/qemu-ifdown -device spapr-vlan,netdev=hostnet0,id=net0,mac=52:54:00:c4:e7:15,reg=0x2000 -msg timestamp=on ****-device ich9-usb-ehci1,addr=1d.7,multifunction=on,id=ehci1 -device pci-ohci,addr=1d.0,multifunction=on,masterbus=ehci1.0,firstport=3****"

while [ ${i:=0} -lt ${1:-1} ]
do
    CLI="$CLI -drive file=/home/disk/disk$i.qcow2,if=none,id=drive-usb-0-$i,media=disk,format=qcow2,cache=none,aio=native"
    CLI="$CLI -device usb-storage,drive=drive-usb-0-$i,id=usb-0-$i,removable=on"
    i=$((i+1))
done

$CLI

1. Boot guest with 'firstport=3' as that in the script, and with 10 usb disks; check the usb disks with hmp cmd 'info usb':
# ./ehciohci.sh 10

2. Boot guest by changing 'firstport=0'/'firstport=1'/'firstport=2' in the script in turn, and all with 10 usb disks:
# ./ehciohci.sh 10

3. Boot guest by changing 'firstport=0'/'firstport=1'/'firstport=2' in the script in turn, and all with 6 usb disks; check the usb disks with hmp cmd 'info usb':
# ./ehciohci.sh 6


Actual results:
In step1, can boot up the guest successfully, and the 'info usb' is as follows:

# ./usb-xhci-storage.sh 6
char device redirected to /dev/pts/3 (label charserial0)
QEMU 2.3.0 monitor - type 'help' for more information
(qemu) info usb
  Device 0.0, Port 1, Speed 480 Mb/s, Product QEMU USB MSD
  Device 0.0, Port 2, Speed 480 Mb/s, Product QEMU USB MSD
  Device 0.0, Port 3, Speed 480 Mb/s, Product QEMU USB MSD
  Device 0.1, Port 4, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.2, Port 5, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.3, Port 6, Speed 12 Mb/s, Product QEMU USB Hub
  Device 0.4, Port 6.1, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.5, Port 6.2, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.6, Port 6.3, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.7, Port 6.4, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.8, Port 6.5, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.9, Port 6.6, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.10, Port 6.7, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.11, Port 6.8, Speed 12 Mb/s, Product QEMU USB Hub
  Device 0.12, Port 6.8.1, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.0, Port 6.8.2, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.0, Port 6.8.3, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.0, Port 6.8.4, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.0, Port 6.8.5, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.0, Port 6.8.6, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.0, Port 6.8.7, Speed 12 Mb/s, Product QEMU USB MSD
  Device 0.0, Port 6.8.8, Speed 12 Mb/s, Product QEMU USB Hub
  Device 0.0, Port 6.8.8.1, Speed 12 Mb/s, Product QEMU USB MSD

In step2, for all 3 tries, all a failure, i.e. could not boot up the guest with following prompt:

# ./usb-xhci-storage.sh 10
char device redirected to /dev/pts/3 (label charserial0)
QEMU 2.3.0 monitor - type 'help' for more information
(qemu) 2015-09-07T10:47:40.620264Z qemu-kvm: -device usb-storage,drive=drive-usb-0-6,id=usb-0-6,removable=on: tried to attach usb device QEMU USB MSD to a bus with no free ports
2015-09-07T10:47:40.620321Z qemu-kvm: -device usb-storage,drive=drive-usb-0-6,id=usb-0-6,removable=on: Device 'usb-storage' could not be initialized

In step3, for all 3 tries, all can boot up the guest successfully, the 'info usb' is as follows:

# ./usb-xhci-storage.sh 6
char device redirected to /dev/pts/3 (label charserial0)
QEMU 2.3.0 monitor - type 'help' for more information
(qemu) 
(qemu) info usb
  Device 0.0, Port 1, Speed 480 Mb/s, Product QEMU USB MSD
  Device 0.0, Port 2, Speed 480 Mb/s, Product QEMU USB MSD
  Device 0.0, Port 3, Speed 480 Mb/s, Product QEMU USB MSD
  Device 0.0, Port 4, Speed 480 Mb/s, Product QEMU USB MSD
  Device 0.0, Port 5, Speed 480 Mb/s, Product QEMU USB MSD
  Device 0.0, Port 6, Speed 480 Mb/s, Product QEMU USB MSD
(qemu) 

In conclusion, the when 'firstport' for the companion controllers is set to 0-2, it seems take no effect

Expected results:
When 'firstport' for the companion controllers is set to 0-2, it should take effect

Additional info:
Comment 2 Laurent Vivier 2015-09-08 09:40:06 EDT
Tested on x86_64, the result is exactly the same, so change Hardware to "All" and re-assign to virt-maint@redhat.com.
Comment 3 David Gibson 2015-09-08 23:32:23 EDT
Laurent, was that testing on x86 with OHCI, or UHCI?
Comment 4 Laurent Vivier 2015-09-09 02:34:58 EDT
I was testing with OHCI.
Comment 5 Gu Nini 2015-09-09 03:02:13 EDT
Besides, if boot up the guest with 25 or more usb disks, there is always following error:

[root@ibm-p8-rhevm-10 home]# ./ehciohci.sh 25
char device redirected to /dev/pts/1 (label charserial0)
QEMU 2.3.0 monitor - type 'help' for more information
(qemu) ehci: Bad asynchronous state 0. Resetting to active
**
ERROR:hw/usb/hcd-ehci.c:2139:ehci_advance_async_state: code should not be reached

Please note the script name should be 'ehciohci.sh' instead of 'usb-xhci-storage.sh' in the bug Description, I have made a mistake.



BTW, there is bz1261288 pci-ohci related.
Comment 6 Laurent Vivier 2015-09-09 03:15:14 EDT
It doesn't work better if I change OHCI by UHCI, but it works fine if I use "-readconfig /home/lvivier/Projects/qemu/docs/ich9-ehci-uhci.cfg" from qemu source tree.

Sounds like a command line parameters problem.
Comment 7 Karen Noel 2015-09-09 07:26:43 EDT
(In reply to Laurent Vivier from comment #6)
> It doesn't work better if I change OHCI by UHCI, but it works fine if I use
> "-readconfig /home/lvivier/Projects/qemu/docs/ich9-ehci-uhci.cfg" from qemu
> source tree.
> 
> Sounds like a command line parameters problem.

Gu Nini, Can you check this? Thanks.
Comment 8 Gerd Hoffmann 2015-09-09 09:08:58 EDT
ehci has 6 ports, ohci has three, so you need two ohci controllers to make things work correctly, like this in libvirt syntax:

    <controller type='usb' index='2' model='ich9-ehci1'>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x7' multifunction='on'/>
    </controller>
    <controller type='usb' index='2' model='pci-ohci'>
      <master startport='0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x0' multifunction='on'/>
    </controller>
    <controller type='usb' index='2' model='pci-ohci'>
      <master startport='3'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x1d' function='0x1' multifunction='on'/>
    </controller>

which libvirt translates to:

-device ich9-usb-ehci1,id=usb2,bus=pci.0,multifunction=on,addr=0x1d.0x7 -device pci-ohci,masterbus=usb2.0,firstport=0,bus=pci.0,multifunction=on,addr=0x1d -device pciohci,masterbus=usb2.0,firstport=3,bus=pci.0,multifunction=on,addr=0x1d.0x1
Comment 9 Laurent Vivier 2015-09-09 09:30:27 EDT
Thanks Gerd, in my case (ppc64le and x86_64), it works fine.
Comment 10 Gu Nini 2015-09-10 06:36:48 EDT
(In reply to Karen Noel from comment #7)
> (In reply to Laurent Vivier from comment #6)
> > It doesn't work better if I change OHCI by UHCI, but it works fine if I use
> > "-readconfig /home/lvivier/Projects/qemu/docs/ich9-ehci-uhci.cfg" from qemu
> > source tree.
> > 
> > Sounds like a command line parameters problem.
> 
> Gu Nini, Can you check this? Thanks.


Yes, it can work now with the way Gerd Hoffmann provided, is there anywhere we can check the usage of this type scenarios, otherwise should we record it to somewhere?
Comment 12 Ján Tomko 2015-09-10 07:54:55 EDT
Libvirt does not check if the companion controllers cover all the ports of the master controllers.

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

Note You need to log in before you can comment on or make changes to this bug.