Using -usbdevice host: slows the guest OS down to a crawl

Bug #258771 reported by Matt Zimmerman
4
Affects Status Importance Assigned to Milestone
kvm (Ubuntu)
Won't Fix
Low
Unassigned
qemu (Ubuntu)
Won't Fix
Undecided
Unassigned
qemu-kvm (Ubuntu)
Triaged
Low
Unassigned

Bug Description

Binary package hint: kvm

When accessing a USB device on the host, the entire guest OS slows down to a crawl, to the point where mouse navigation becomes impossible. stracing KVM shows many USBDEVFS_BULK ioctls returning -ETIMEDOUT, corresponding to the frequent pauses of the guest.

Despite this, the device actually does work. In my case, it was a 3G modem (which shows up as USB serial ports), and sending even one "AT" command slowed down the entire guest for minutes at a time, but eventually it returned to normal operation.

I believe this affects qemu as well, but I haven't verified it myself. There is at least one independent report at http://qemu-forum.ipi.fi/viewtopic.php?f=4&t=4559 which claims this is a problem with USB devices which provide multiple interfaces.

Matt Zimmerman (mdz)
description: updated
Changed in kvm:
importance: Undecided → Low
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Matt-

Can you still reproduce this in Jaunty?

If so, what command line are you using to launch kvm?

:-Dustin

Changed in kvm:
status: New → Incomplete
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

If you're running Hardy, could you please test this using the kvm-84 package in this PPA:
 * https://launchpad.net/~ubuntu-virt/+archive/ppa

Does this solve the issue, or is it reproducible?

:-Dustin

Revision history for this message
Matt Zimmerman (mdz) wrote : Re: [Bug 258771] Re: Using -usbdevice host: slows the guest OS down to a crawl

On Mon, Mar 09, 2009 at 08:29:00PM -0000, Dustin Kirkland wrote:
> Can you still reproduce this in Jaunty?

I no longer have the VM in question, which was a Windows system.

> If so, what command line are you using to launch kvm?

I used kvm -usbdevice host:vvvv:pppp

Could you check into why USBDEVFS_BULK would return -ETIMEDOUT? That seems
to be related.

--
 - mdz

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Some USB devices have higher polling frequencies than others. An abnormally high polling frequency could easily cause a guest to crawl to a halt. Also, it could be that your device is a USB 2.0 device that is falling back to USB 1.1 in the guest, which could also slow things down considerably. Otherwise, this could be an issue in the kernel's USB code. None of these are solutions to the bug, but I'm trying to capture a few ideas...

:-Dustin

Changed in kvm (Ubuntu):
status: Incomplete → Won't Fix
Changed in qemu (Ubuntu):
status: New → Won't Fix
Changed in qemu-kvm (Ubuntu):
status: New → Incomplete
importance: Undecided → Low
Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Marking won't fix against qemu and kvm, which no longer exist in Ubuntu.

Marking incomplete against qemu-kvm in karmic. If this is still an issue, please confirm it there.

Thanks!
:-Dustin

Revision history for this message
Dustin Kirkland  (kirkland) wrote :

Hi Matt-

I actually believe this bug to be fixed in Lucid's qemu-kvm 0.12.3.

Similar to your original report, I fired up a VM with usb attached to my Palm Pre phone, which can act as a USB dongle. I was able to successfully connect to the internet in the VM with:

$ sudo kvm -m 512 -hda testdrive-disk-nMLT3b.img -usb -usbdevice host:0830:0101
usb_create: no bus specified, using "usb.0" for "usb-host"
husb: open device 2.7
husb: config #5 need -1
husb: 4 interfaces claimed for configuration 5
husb: grabbed usb device 2.7
husb: config #5 need 5
husb: 4 interfaces claimed for configuration 5
husb: config #5 need 5
husb: 4 interfaces claimed for configuration 5
husb: config #5 need 5
husb: 4 interfaces claimed for configuration 5
husb: config #5 need 5
husb: 4 interfaces claimed for configuration 5

And in the guest, it was able to connect through the dongle to the internet. There was no noticeable degradation in performance in either the host or guest. Screenshot attached. I think this is fix-released!

Changed in qemu-kvm (Ubuntu):
status: Incomplete → Fix Released
Revision history for this message
Matt Zimmerman (mdz) wrote : Re: [Bug 258771] Re: Using -usbdevice host: slows the guest OS down to a crawl

On Mon, Mar 01, 2010 at 11:34:39PM -0000, Dustin Kirkland wrote:
> Hi Matt-
>
> I actually believe this bug to be fixed in Lucid's qemu-kvm 0.12.3.
>
> Similar to your original report, I fired up a VM with usb attached to my
> Palm Pre phone, which can act as a USB dongle. I was able to
> successfully connect to the internet in the VM with:

Were you able to replicate the bug with the previous version of KVM? If
not, it's hard to tell whether the problem is fixed, or if your case didn't
trigger it.

One hint from the original report was that the device in question had
multiple interfaces. Did your device have that property?

--
 - mdz

Revision history for this message
Dustin Kirkland  (kirkland) wrote : Re: [Bug 258771] Re: Using -usbdevice host: slows the guest OS down to a crawl

On Sat, Mar 13, 2010 at 6:57 AM, Matt Zimmerman <email address hidden> wrote:
> Were you able to replicate the bug with the previous version of KVM?  If
> not, it's hard to tell whether the problem is fixed, or if your case didn't
> trigger it.

I had tried USB passthrough in the past without success.

> One hint from the original report was that the device in question had
> multiple interfaces.  Did your device have that property?

My device did not have a multiple interfaces.

We can reopen this bug report, if you think the problem still exists in Lucid.

Revision history for this message
Matt Zimmerman (mdz) wrote : Re: [Bug 258771] Re: Using -usbdevice host: slows the guest OS down to a crawl

On Sat, Mar 13, 2010 at 10:08:17PM -0000, Dustin Kirkland wrote:
> On Sat, Mar 13, 2010 at 6:57 AM, Matt Zimmerman <email address hidden> wrote:
> > Were you able to replicate the bug with the previous version of KVM?  If
> > not, it's hard to tell whether the problem is fixed, or if your case didn't
> > trigger it.
>
> I had tried USB passthrough in the past without success.
>
> > One hint from the original report was that the device in question had
> > multiple interfaces.  Did your device have that property?
>
> My device did not have a multiple interfaces.
>
> We can reopen this bug report, if you think the problem still exists in
> Lucid.

I don't have the device handy to try to reconfirm the original issue, so
let's leave it closed for now. If the problem turns up again, hopefully
this bug will be found again.

--
 - mdz

Revision history for this message
Matt Zimmerman (mdz) wrote :

Reproduced with qemu-kvm 0.12.3-0ubuntu15 on current lucid

Changed in qemu-kvm (Ubuntu):
status: Fix Released → Triaged
Revision history for this message
Wout van Heeswijk (wout-) wrote :

I tried connecting several different devices to my Microsoft Windows 7 Virtual Machine. non of them working. Among them:
- USB Mass storage device
   *When inserting the device in my laptop it doesn't show up in nautilus on the host when added to a vm. (Something is going right). It doesn't show up in the guest os' Windows Explorer. (somethings not going right)
- HTC winmo phone
   * Nothing happens at all.

I've enabled USB access in apparmor.:
/etc/apparmor.d/abstractions/libvirt-qemu
  # WARNING: uncommenting these gives the guest direct access to host hardware.
  # This is required for USB pass through but is a security risk. You have been
  # warned.
  /sys/bus/usb/devices/ r,
  /sys/devices/*/*/usb[0-9]*/** r,
  /dev/bus/usb/*/[0-9]* rw,

qemu-kvm - QEMU PC emulator version 0.12.3
"uname -a": Linux laptop-24 2.6.32-17-generic #26-Ubuntu SMP Sat Mar 20 02:23:45 UTC 2010 x86_64 GNU/Linux
libvirtd --version: libvirtd (libvirt) 0.7.5
virt-manager: version 0.8.2

I am available for testing new packages

Revision history for this message
Matt Zimmerman (mdz) wrote :

On Tue, Mar 30, 2010 at 08:49:22AM -0000, Wout wrote:
> I tried connecting several different devices to my Microsoft Windows 7 Virtual Machine. non of them working. Among them:
> - USB Mass storage device
> *When inserting the device in my laptop it doesn't show up in nautilus on the host when added to a vm. (Something is going right). It doesn't show up in the guest os' Windows Explorer. (somethings not going right)
> - HTC winmo phone
> * Nothing happens at all.

You have a different problem; please file a new bug.

--
 - mdz

Revision history for this message
Wout van Heeswijk (wout-) wrote :

Thanks Matt, will do.

Revision history for this message
Serge Hallyn (serge-hallyn) wrote :

As per https://wiki.ubuntu.com/VirtFeatureVerification, I did not see this problem when testing USB with lucid and maverick. Certainly data transfer could be slow, but I never saw a slowdown of the guest OS. Can you confirm whether you can still reproduce this?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.