Bug 196527 - Terrible KVM USB passthrough performance
Summary: Terrible KVM USB passthrough performance
Status: NEW
Alias: None
Product: Virtualization
Classification: Unclassified
Component: kvm (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: virtualization_kvm
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-28 22:42 UTC by Nazar Mokrynskyi
Modified: 2017-08-10 12:38 UTC (History)
1 user (show)

See Also:
Kernel Version: 4.9.32
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Nazar Mokrynskyi 2017-07-28 22:42:09 UTC
Host system is Alpine Linux x86_64 with kernel 4.9.32 and QEMU 2.8.1-r1.
KVM guest is LEDE with Wi-Fi adapter attached to it, chipset used is pc-q35-2.8.
Wi-Fi adapter is USB 2.0, but inserted into USB 3.0 port on the motherboard.
CPU is Intel Celeron N3150.

The problem I'm having is that it can barely cross 30Mbps speed with this Wi-Fi adapter, while both adapter acting as an AP and client device can handle up to 300Mbps, well within USB 2.0 spec and well above what I'm currently seeing.

When USB 2.0 was used in VM download speed was only 10Mpbs, when switched to USB 3.0 it increased to 14Mbps, upload in both cases is 30-32Mbps.

There is some serious bottleneck, is this an expected level of performance or am I missing something?
Comment 1 heyark 2017-08-10 12:34:25 UTC
I have to agree here.
In my case, I tried to use two USB devices inside a KVM VM - and failed with both due to timeout issues.
I pass them through to the VM using kvm parameters -usb -usbdevice host:[vendorId]:[deviceId].

They are visible inside using lsusb. But trying to access them, both cannot be used, while there is no problem using them directly on the host machine (current Ubuntu 16.04.3 on a Core i5 7500).

One is a HomeMatic USB-sender (http://www.fhemwiki.de/wiki/HM-CFG-USB_USB_Konfigurations-Adapter), the other one is a smartcard reader.
In case of the Homematic, the driver (hmland) always says:
 usb-transfer took more than 100ms (125ms), this may lead to timing problems!
And the warning is right: nothing works, nothing gets received (using the stick outside the VM works great).

Maybe the usb passthrough works generally with less sensible devices (did not try an USB stick or something), but obviously the performance in handling this is so bad, that any device that needs a proper timing is not usable.

Probably USB devices at servers are rare in the professional environments where kvm is heavily used, nonetheless this is very disappointing. It definitely limits the use of KVM virtualization.
Probably not a good sign too, that the following page is empty: https://www.linux-kvm.org/page/UsbPassthrough

Is there any chance this will be cared for soon? Some kind of higher priority for handling the USB passthrough?
Thanks!
Comment 2 heyark 2017-08-10 12:38:10 UTC
(of course I meant the higher prio in a technical sense for handling the USB communication of the VM - not an organizational prio that developers care for this - would be great of course)

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