[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 15/22] combined-packet: Add a workaround for Linux u
From: |
Hans de Goede |
Subject: |
[Qemu-devel] [PATCH 15/22] combined-packet: Add a workaround for Linux usbfs + live migration |
Date: |
Mon, 15 Oct 2012 12:38:24 +0200 |
Older versions (anything but the latest) of Linux usbfs + libusb(x),
will submit larger (bulk) transfers split into multiple 16k submissions,
which means that rather then all tds getting linked into the queue in
one atomic operarion they get linked in a bunch at a time, which could
cause problems if:
1) We scan the queue while libusb is in the middle of submitting a split
bulk transfer
2) While this bulk transfer is pending we migrate to another host.
The problem is that after 2, the new host will rescan the queue and
combine the packets in one large transfer, where as 1) has caused the
original host to see them as 2 transfers. This patch fixes this by stopping
combinging if we detect a 16k transfer with its int_req flag set.
This should not adversely effect performance for other cases as:
1) Linux never sets the interrupt flag on packets other then the last
2) Windows does set the in_req flag on each td, but will submit large
transfers in 20k tds thus never triggering the check
Signed-off-by: Hans de Goede <address@hidden>
---
hw/usb/combined-packet.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/hw/usb/combined-packet.c b/hw/usb/combined-packet.c
index b6fcb2c..d347324 100644
--- a/hw/usb/combined-packet.c
+++ b/hw/usb/combined-packet.c
@@ -120,7 +120,7 @@ void usb_ep_combine_input_packets(USBEndpoint *ep)
USBPacket *p, *u, *next, *prev = NULL, *first = NULL;
USBPort *port = ep->dev->port;
USBDeviceClass *klass = USB_DEVICE_GET_CLASS(ep->dev);
- int ret;
+ int ret, totalsize;
assert(ep->pipeline);
assert(ep->pid == USB_TOKEN_IN);
@@ -165,8 +165,11 @@ void usb_ep_combine_input_packets(USBEndpoint *ep)
}
/* Is this packet the last one of a (combined) transfer? */
+ totalsize = (p->combined) ? p->combined->iov.size : p->iov.size;
if ((p->iov.size % ep->max_packet_size) != 0 || !p->short_not_ok ||
- next == NULL) {
+ next == NULL ||
+ /* Work around for Linux usbfs bulk splitting + migration */
+ (totalsize == 16348 && p->int_req)) {
ret = klass->handle_combined_data(ep->dev, first);
assert(ret == USB_RET_ASYNC);
if (first->combined) {
--
1.7.12.1
- [Qemu-devel] [PATCH 05/22] ehci: Improve latency of interrupt delivery and async schedule scanning, (continued)
- [Qemu-devel] [PATCH 05/22] ehci: Improve latency of interrupt delivery and async schedule scanning, Hans de Goede, 2012/10/15
- [Qemu-devel] [PATCH 10/22] usb: Add USB_RET_ADD_TO_QUEUE packet result code, Hans de Goede, 2012/10/15
- [Qemu-devel] [PATCH 09/22] usb: Rename __usb_packet_complete to usb_packet_complete_one, Hans de Goede, 2012/10/15
- [Qemu-devel] [PATCH 13/22] usb: Add an int_req flag to USBPacket, Hans de Goede, 2012/10/15
- [Qemu-devel] [PATCH 16/22] usb-redir: When a packet contains data on a stall, ignore the stall, Hans de Goede, 2012/10/15
- [Qemu-devel] [PATCH 17/22] usb-redir: Add support for 32 bits bulk packet length, Hans de Goede, 2012/10/15
- [Qemu-devel] [PATCH 12/22] usb: Move short-not-ok handling to the core, Hans de Goede, 2012/10/15
- [Qemu-devel] [PATCH 11/22] usb: Move clearing of queue on halt to the core, Hans de Goede, 2012/10/15
- [Qemu-devel] [PATCH 15/22] combined-packet: Add a workaround for Linux usbfs + live migration,
Hans de Goede <=
- [Qemu-devel] [PATCH 14/22] usb: Add packet combining functions, Hans de Goede, 2012/10/15
- [Qemu-devel] [PATCH 22/22] usb-redir: Allow redirecting super speed devices to high speed controllers, Hans de Goede, 2012/10/15
- [Qemu-devel] [PATCH 20/22] usb-redir: Use reject rather the disconnect on bad ep info, Hans de Goede, 2012/10/15
- [Qemu-devel] [PATCH 18/22] usb-redir: Add support for input pipelining, Hans de Goede, 2012/10/15
- [Qemu-devel] [PATCH 21/22] usb-redir: Allow to attach USB 2.0 devices to 1.1 host controller, Hans de Goede, 2012/10/15
- [Qemu-devel] [PATCH 19/22] usb-redir: Add an usbredir_setup_usb_eps() helper function, Hans de Goede, 2012/10/15