Bug 1273717 - Host lost usb device file if guest quit as soon as start with "usb-host" option
Summary: Host lost usb device file if guest quit as soon as start with "usb-host" option
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev
Version: 7.2
Hardware: ppc64le
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: David Gibson
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks: 1288337 RHV4.1PPC
TreeView+ depends on / blocked
 
Reported: 2015-10-21 06:10 UTC by Xujun Ma
Modified: 2016-11-07 20:48 UTC (History)
10 users (show)

Fixed In Version: qemu-2.6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-07 20:48:03 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System 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-08 01:06:13 UTC

Description Xujun Ma 2015-10-21 06:10:18 UTC
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-22 03:24:49 UTC
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 08:01:22 UTC
(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 06:18:08 UTC
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 04:43:40 UTC
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 06:27:52 UTC
(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-06 02:49:53 UTC
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-06 03:22:35 UTC
(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-15 02:57:16 UTC
(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 05:59:12 UTC
Ok, thanks for the confirmation.

Comment 16 Xujun Ma 2016-07-06 05:52:11 UTC
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 04:53:15 UTC
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 20:48:03 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.

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.