Bug 1273717 - Host lost usb device file if guest quit as soon as start with "usb-host" option
Host lost usb device file if guest quit as soon as start with "usb-host" option
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
7.2
ppc64le Linux
low Severity low
: rc
: ---
Assigned To: David Gibson
Virtualization Bugs
: Reopened
Depends On:
Blocks: RHV4.1PPC 1288337
  Show dependency treegraph
 
Reported: 2015-10-21 02:10 EDT by Xujun Ma
Modified: 2016-11-07 15:48 EST (History)
10 users (show)

See Also:
Fixed In Version: qemu-2.6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-11-07 15:48:03 EST
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)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2673 normal SHIPPED_LIVE qemu-kvm-rhev bug fix and enhancement update 2016-11-07 20:06:13 EST

  None (edit)
Description Xujun Ma 2015-10-21 02:10:18 EDT
Description of problem:
Host lost usb device file if guest quit as soon as start with "usb-host" option

Version-Release number of selected component (if applicable):
host:
kernel-3.10.0-325.el7.ppc64le
qemu-kvm-rhev-2.3.0-31.el7.ppc64le
SLOF-20150313-5.gitc89b0df.el7.noarch
guest:
kernel-2.6.32-573.el6.ppc64

How reproducible:
100%

Steps to Reproduce:
1.Plug a usb stick onto the host
#lsusb
Bus 001 Device 002: ID 058f:6387 Alcor Micro Corp. Flash Drive
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
# fdisk /dev/sdc -l

Disk /dev/sdc: 2101 MB, 2101346304 bytes, 4104192 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x3394289f

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048     4104191     2051072   83  Linux

/usr/libexec/qemu-kvm \
 -m 16G -smp 16 -monitor stdio -qmp tcp::8888,server,nowait  -vnc :25\
 -usbdevice tablet \
 -netdev tap,id=tap0,script=/etc/qemu-ifup \
 -device virtio-net-pci,netdev=tap0,bootindex=3,id=net0,mac=24:be:05:11:92:11 \
 -drive file=sys.qcow2,if=none,id=drive-0-0-0,format=qcow2,cache=none \
 -device virtio-blk-pci,drive=drive-0-0-0,bootindex=0,id=scsi0-0-0-0  \
 -device usb-ehci,id=usbctr \
 -drive file=usb.qcow2,id=usbs1,if=none \
 -drive file=usb1.qcow2,id=usbs2,if=none \
 -device usb-storage,id=storager1,serial,removable=off,drive=usbs1,bootindex=1 \
 -device usb-storage,id=storager2,serial,removable=off,drive=usbs2,bootindex=2 \
 -device usb-host,hostbus=1,hostaddr=2,id=hostdev0 \
 -device virtio-scsi-pci\
 -device scsi-cd,id=scsi-cd1,drive=scsi-cd1-dr,bootindex=4 \
 -drive file=../iso/RHEL-6.7-20150702.0-Server-ppc64-dvd1.iso,if=none,id=scsi-cd1-dr,readonly=on,format=raw,cache=none \

2.Boot up a guest with option usb-host then quit guest with command "q" as quikly as possible.

/usr/libexec/qemu-kvm \
 -m 16G -smp 16 -monitor stdio -qmp tcp::8888,server,nowait  -vnc :25\
 -usbdevice tablet \
 -netdev tap,id=tap0,script=/etc/qemu-ifup \
 -device virtio-net-pci,netdev=tap0,bootindex=3,id=net0,mac=24:be:05:11:92:11 \
 -drive file=sys.qcow2,if=none,id=drive-0-0-0,format=qcow2,cache=none \
 -device virtio-blk-pci,drive=drive-0-0-0,bootindex=0,id=scsi0-0-0-0  \
 -device usb-ehci,id=usbctr \
 -drive file=usb.qcow2,id=usbs1,if=none \
 -drive file=usb1.qcow2,id=usbs2,if=none \
 -device usb-storage,id=storager1,serial,removable=off,drive=usbs1,bootindex=1 \
 -device usb-storage,id=storager2,serial,removable=off,drive=usbs2,bootindex=2 \
 -device usb-host,hostbus=1,hostaddr=2,id=hostdev0 \
 -device virtio-scsi-pci\
 -device scsi-cd,id=scsi-cd1,drive=scsi-cd1-dr,bootindex=4 \
 -drive file=../iso/RHEL-6.7-20150702.0-Server-ppc64-dvd1.iso,if=none,id=scsi-cd1-dr,readonly=on,format=raw,cache=none \

(qemu)q

3.check usb device file 
#fdisk /dev/sdc -l
fdisk: cannot open /dev/sdc: No such file or directory


Actual results:
there is no usb device file in host

Expected results:
display usb device file in host because guest doestn't use it

Additional info:

it doesn't appear on x86 platform
Comment 2 David Gibson 2015-10-21 23:24:49 EDT
To clarify, I'm assuming step (3) is being executed on the host.  Is that right?

It's correct behaviour for the device to disappear from the host while it is assigned to the guest (simultaneous access would not be safe).  So it looks like the problem is just with reprobing the device once it is returned to the host.

If you leave the host for a while (say a couple of minutes) after quitting the guest, does the device reappear on the host? (I'm trying to determine if the device is never reprobed by the host, or if there's just a delay before it is reattached to the host).
Comment 3 Xujun Ma 2015-10-22 04:01:22 EDT
(In reply to David Gibson from comment #2)
> To clarify, I'm assuming step (3) is being executed on the host.  Is that
> right?

yes,the command of step 3 executed on the host.I'll write steps clearly next time.
> 
> It's correct behaviour for the device to disappear from the host while it is
> assigned to the guest (simultaneous access would not be safe).  So it looks
> like the problem is just with reprobing the device once it is returned to
> the host.
> 
> If you leave the host for a while (say a couple of minutes) after quitting
> the guest, does the device reappear on the host? (I'm trying to determine if
> the device is never reprobed by the host, or if there's just a delay before
> it is reattached to the host).

I have waited for 20 minutes,and the usb device file didn't reappear on the host.it will reappear on the host if you boot up the guest again completely then quit it with hmp command "q".
Comment 4 David Gibson 2016-04-20 02:18:08 EDT
It's possible upstream patch 6110ce5 "Re-attach usb device to kernel while usb_host_open fails" might address this, but we'd have to test.

I'm a bit baffled as to how this could be ppc specific - it's possible it's just that the timing window is smaller x86.
Comment 5 David Gibson 2016-06-01 00:43:40 EDT
6110ce5 was included in qemu-2.6 and therefore in our qemu-2.6 downstream rebase.

Can you please retest with a qemu-2.6 based downstream and see if the problem persists.
Comment 6 Xujun Ma 2016-06-02 02:27:52 EDT
(In reply to David Gibson from comment #5)
> 6110ce5 was included in qemu-2.6 and therefore in our qemu-2.6 downstream
> rebase.
> 
> Can you please retest with a qemu-2.6 based downstream and see if the
> problem persists.

Ok,but I need to send a ticket for plugging usb stick to my host,so need some  time.
Comment 7 David Gibson 2016-06-05 22:49:53 EDT
Xujun,

Make sure you get a USB 2.0 stick.  A USB 3.0 stick is likely to hit a hardware/firmware problem where USB 3.0 devices disappear after a reboot and don't reappear until replugged.  IBM apparently has a firmware fix in the works, but it's not released yet.  In the meantime you should be able to check *this* bug with a USB 2.0 device.
Comment 8 Xujun Ma 2016-06-05 23:22:35 EDT
(In reply to David Gibson from comment #7)
> Xujun,
> 
> Make sure you get a USB 2.0 stick.  A USB 3.0 stick is likely to hit a
> hardware/firmware problem where USB 3.0 devices disappear after a reboot and
> don't reappear until replugged.  IBM apparently has a firmware fix in the
> works, but it's not released yet.  In the meantime you should be able to
> check *this* bug with a USB 2.0 device.

ok,got it
Comment 9 Xujun Ma 2016-06-14 22:57:16 EDT
(In reply to David Gibson from comment #5)
> 6110ce5 was included in qemu-2.6 and therefore in our qemu-2.6 downstream
> rebase.
> 
> Can you please retest with a qemu-2.6 based downstream and see if the
> problem persists.

Qemu:qemu-kvm-rhev-2.6.0-2.el7.ppc64le
Usb stick: 2.0 8G

The issue didn't appear with qemu-2.6,the usb stick can return back to host everytime after quit guest quickly.
So the bug have been fixed in qemu-2.6.
Comment 10 David Gibson 2016-06-15 01:59:12 EDT
Ok, thanks for the confirmation.
Comment 16 Xujun Ma 2016-07-06 01:52:11 EDT
Reproduced the issue on old version:

Version-Release number of selected component (if applicable):
kernel-3.10.0-325.el7.ppc64le
qemu-kvm-rhev-2.3.0-31.el7.ppc64le
SLOF-20150313-5.gitc89b0df.el7.noarch
guest:kernel-2.6.32-573.el6.ppc64

Steps to Reproduce:
1.Plug a usb stick onto the host
#lsusb
Bus 001 Device 002: ID 058f:6387 Alcor Micro Corp. Flash Drive
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
# fdisk /dev/sdc -l

Disk /dev/sdc: 2101 MB, 2101346304 bytes, 4104192 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x3394289f

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048     4104191     2051072   83  Linux

2.Boot up a guest with option usb-host then quit guest with command "q" as quikly as possible.

/usr/libexec/qemu-kvm \
 -m 16G -smp 16 -monitor stdio -qmp tcp::8888,server,nowait  -vnc :25\
 -usbdevice tablet \
 -netdev tap,id=tap0,script=/etc/qemu-ifup \
 -device virtio-net-pci,netdev=tap0,bootindex=3,id=net0,mac=24:be:05:11:92:11 \
 -drive file=sys.qcow2,if=none,id=drive-0-0-0,format=qcow2,cache=none \
 -device virtio-blk-pci,drive=drive-0-0-0,bootindex=0,id=scsi0-0-0-0  \
 -device usb-ehci,id=usbctr \
 -drive file=usb.qcow2,id=usbs1,if=none \
 -drive file=usb1.qcow2,id=usbs2,if=none \
 -device usb-storage,id=storager1,serial,removable=off,drive=usbs1,bootindex=1 \
 -device usb-storage,id=storager2,serial,removable=off,drive=usbs2,bootindex=2 \
 -device usb-host,hostbus=1,hostaddr=2,id=hostdev0 \
 -device virtio-scsi-pci\
 -device scsi-cd,id=scsi-cd1,drive=scsi-cd1-dr,bootindex=4 \
 -drive file=../iso/RHEL-6.7-20150702.0-Server-ppc64-dvd1.iso,if=none,id=scsi-cd1-dr,readonly=on,format=raw,cache=none \

(qemu)q

3.check usb device file 
#fdisk /dev/sdc -l
fdisk: cannot open /dev/sdc: No such file or directory


Actual results:
there is no usb device file in host


Verified the issue on the latest build:
Version-Release number of selected component (if applicable):
kernel-3.10.0-325.el7.ppc64le
qemu-kvm-rhev-2.6.0-2.el7.ppc64le
SLOF-20160223-4.gitdbbfda4.el7.noarch
guest:kernel-2.6.32-573.el6.ppc64

Steps to Reproduce:
1.Plug a usb stick onto the host
#lsusb
Bus 001 Device 002: ID 058f:6387 Alcor Micro Corp. Flash Drive
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
# fdisk /dev/sdc -l

Disk /dev/sdc: 2101 MB, 2101346304 bytes, 4104192 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x3394289f

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048     4104191     2051072   83  Linux

2.Boot up a guest with option usb-host then quit guest with command "q" as quikly as possible.

/usr/libexec/qemu-kvm \
 -m 16G -smp 16 -monitor stdio -qmp tcp::8888,server,nowait  -vnc :25\
 -usbdevice tablet \
 -netdev tap,id=tap0,script=/etc/qemu-ifup \
 -device virtio-net-pci,netdev=tap0,bootindex=3,id=net0,mac=24:be:05:11:92:11 \
 -drive file=sys.qcow2,if=none,id=drive-0-0-0,format=qcow2,cache=none \
 -device virtio-blk-pci,drive=drive-0-0-0,bootindex=0,id=scsi0-0-0-0  \
 -device usb-ehci,id=usbctr \
 -drive file=usb.qcow2,id=usbs1,if=none \
 -drive file=usb1.qcow2,id=usbs2,if=none \
 -device usb-storage,id=storager1,serial,removable=off,drive=usbs1,bootindex=1 \
 -device usb-storage,id=storager2,serial,removable=off,drive=usbs2,bootindex=2 \
 -device usb-host,hostbus=1,hostaddr=2,id=hostdev0 \
 -device virtio-scsi-pci\
 -device scsi-cd,id=scsi-cd1,drive=scsi-cd1-dr,bootindex=4 \
 -drive file=../iso/RHEL-6.7-20150702.0-Server-ppc64-dvd1.iso,if=none,id=scsi-cd1-dr,readonly=on,format=raw,cache=none \

(qemu)q

3.check usb device file 
#fdisk /dev/sdc -l
fdisk: cannot open /dev/sdc: No such file or directory


Actual results:
the usb stick can return back to host everytime after quit guest quickly.
The bug has been fixed in qemu-kvm-rhev-2.6.0-2.el7.ppc64le
Comment 17 Xujun Ma 2016-07-11 00:53:15 EDT
modify of step 3 of bug verification:

#fdisk /dev/sdc -l
Disk /dev/sdc: 2101 MB, 2101346304 bytes, 4104192 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x3394289f

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1   *        2048     4104191     2051072   83  Linux
Comment 19 errata-xmlrpc 2016-11-07 15:48:03 EST
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.

https://rhn.redhat.com/errata/RHBA-2016-2673.html

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