From patchwork Fri Mar 31 05:45:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 745506 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3vvVq32d5Nz9s0Z for ; Fri, 31 Mar 2017 16:46:03 +1100 (AEDT) Received: from localhost ([::1]:38981 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctpNn-0006vG-RO for incoming@patchwork.ozlabs.org; Fri, 31 Mar 2017 01:45:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43988) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ctpNW-0006v4-3q for qemu-devel@nongnu.org; Fri, 31 Mar 2017 01:45:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ctpNS-0000Ld-Oq for qemu-devel@nongnu.org; Fri, 31 Mar 2017 01:45:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:51758) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ctpNS-0000Kw-Fk for qemu-devel@nongnu.org; Fri, 31 Mar 2017 01:45:38 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0628161D16 for ; Fri, 31 Mar 2017 05:45:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0628161D16 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=kraxel@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0628161D16 Received: from nilsson.home.kraxel.org (ovpn-116-47.ams2.redhat.com [10.36.116.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C2DB78DCF; Fri, 31 Mar 2017 05:45:36 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 09D6680FDA; Fri, 31 Mar 2017 07:45:33 +0200 (CEST) Message-ID: <1490939133.1877.3.camel@redhat.com> From: Gerd Hoffmann To: "Dr. David Alan Gilbert" Date: Fri, 31 Mar 2017 07:45:33 +0200 In-Reply-To: <20170330174242.GM2800@work-vm> References: <20170330122354.GF2800@work-vm> <1490883039.28523.25.camel@redhat.com> <20170330174242.GM2800@work-vm> Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 31 Mar 2017 05:45:37 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: Re: [Qemu-devel] xhci migration breakage X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Hi, > dest: > (qemu) red_dispatcher_loadvm_commands: > usb-storage msd post_load 0x7f45f510ee50 sig=0 tag=0 > > I added these as debug on the 'usb-storage' vmsd element; but > the signature/tag being 0 I assume they're not the culprit. Yep, no inflight transfer, so highly unlikely (also note that ehci works fine according to bugzilla). > #6 0x00007febabacae27 in xhci_kick_epctx (epctx=, xfer=, xhci=) > at /root/1436616/qemu/hw/usb/hcd-xhci.c:2103 <- right at the end of xhci_submit > #7 0x00007febabacae27 in xhci_kick_epctx (epctx=, xfer=, xhci=) > at /root/1436616/qemu/hw/usb/hcd-xhci.c:2112 right at end of xhci_fire_transfer > #8 0x00007febabacae27 in xhci_kick_epctx (epctx=0x7febaec395a0, streamid=0) > at /root/1436616/qemu/hw/usb/hcd-xhci.c:2240 Recursive xhci_kick_epctx calls, not good. Does the attached patch (not tested yet) make any difference? cheers, Gerd From 1b10b10445ab438c3fa1107f9962add3ae0716c6 Mon Sep 17 00:00:00 2001 From: Gerd Hoffmann Date: Fri, 31 Mar 2017 07:40:45 +0200 Subject: [PATCH] xhci: set kick_active for retried xfers too Signed-off-by: Gerd Hoffmann --- hw/usb/hcd-xhci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c index f0af852..8958f95 100644 --- a/hw/usb/hcd-xhci.c +++ b/hw/usb/hcd-xhci.c @@ -2083,6 +2083,7 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid) return; } + epctx->kick_active++; if (epctx->retry) { XHCITransfer *xfer = epctx->retry; @@ -2093,6 +2094,7 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid) mfindex = xhci_mfindex_get(xhci); xhci_check_intr_iso_kick(xhci, xfer, epctx, mfindex); if (xfer->running_retry) { + epctx->kick_active--; return; } xfer->timed_xfer = 0; @@ -2101,6 +2103,7 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid) if (xfer->iso_xfer) { /* retry iso transfer */ if (xhci_setup_packet(xfer) < 0) { + epctx->kick_active--; return; } usb_handle_packet(xfer->packet.ep->dev, &xfer->packet); @@ -2109,10 +2112,12 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid) } else { /* retry nak'ed transfer */ if (xhci_setup_packet(xfer) < 0) { + epctx->kick_active--; return; } usb_handle_packet(xfer->packet.ep->dev, &xfer->packet); if (xfer->packet.status == USB_RET_NAK) { + epctx->kick_active--; return; } xhci_try_complete_packet(xfer); @@ -2126,6 +2131,7 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid) if (epctx->state == EP_HALTED) { DPRINTF("xhci: ep halted, not running schedule\n"); + epctx->kick_active--; return; } @@ -2134,6 +2140,7 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid) uint32_t err; stctx = xhci_find_stream(epctx, streamid, &err); if (stctx == NULL) { + epctx->kick_active--; return; } ring = &stctx->ring; @@ -2145,7 +2152,6 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid) } assert(ring->dequeue != 0); - epctx->kick_active++; while (1) { length = xhci_ring_chain_length(xhci, ring); if (length <= 0) { -- 1.8.3.1