From patchwork Mon Jul 2 14:26:20 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 168603 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 72F612C009E for ; Tue, 3 Jul 2012 00:26:39 +1000 (EST) Received: from localhost ([::1]:57782 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SlhaH-0001Vd-66 for incoming@patchwork.ozlabs.org; Mon, 02 Jul 2012 10:26:37 -0400 Received: from eggs.gnu.org ([208.118.235.92]:33098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Slha8-0001V0-SI for qemu-devel@nongnu.org; Mon, 02 Jul 2012 10:26:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Slha4-0001mQ-SX for qemu-devel@nongnu.org; Mon, 02 Jul 2012 10:26:28 -0400 Received: from thoth.sbs.de ([192.35.17.2]:24736) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Slha4-0001lz-IY for qemu-devel@nongnu.org; Mon, 02 Jul 2012 10:26:24 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.13.6/8.13.6) with ESMTP id q62EQKsK023743; Mon, 2 Jul 2012 16:26:21 +0200 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id q62EQKhS029969; Mon, 2 Jul 2012 16:26:20 +0200 Message-ID: <4FF1AF8C.5030400@siemens.com> Date: Mon, 02 Jul 2012 16:26:20 +0200 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Gerd Hoffmann References: <4FE4953F.50404@siemens.com> <4FE58C97.5050606@rdsoftware.de> <4FE58F2D.1010307@web.de> <4FEB65E5.1060908@rdsoftware.de> <4FEC5D1B.6040307@siemens.com> <4FEC7060.2010304@siemens.com> <4FF18080.7010305@redhat.com> In-Reply-To: <4FF18080.7010305@redhat.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.2 Cc: Erik Rull , qemu-devel Subject: Re: [Qemu-devel] usb_packet_complete: Assertion ... failed X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On 2012-07-02 13:05, Gerd Hoffmann wrote: > Hi, > >> What I also so in the trace is that the USB core apparently stumbled as >> a request that took very long too complete finally returned, and then >> the assertion triggered over this request. > > Can I get such a trace please? usb_host_req_* and usb_host_urb_* > enabled should show all interesting information. Oh, and replacing the > assert which triggers with a tracepoint (or just a fprintf in case you > use the stderr tracer) would be nice, so I can see how qemu continues > after the assert(). > > A request taking a while shouldn't be a issue. Requests for a specific > endpoint shouldn't be reordered though, and this seems to happen here. You can find a log at http://www.kiszka.org/downloads/usb-log.xz I instrumented the assert as follows: There is a single occurrence of this event in the log. Thanks, Jan diff --git a/hw/usb/core.c b/hw/usb/core.c index 0e02da7..eacda74 100644 --- a/hw/usb/core.c +++ b/hw/usb/core.c @@ -407,7 +407,9 @@ void usb_packet_complete(USBDevice *dev, USBPacket *p) int ret; usb_packet_check_state(p, USB_PACKET_ASYNC); - assert(QTAILQ_FIRST(&ep->queue) == p); + if (QTAILQ_FIRST(&ep->queue) != p) { + trace_usb_assert(usb_bus_from_device(dev)->busnr, dev->port->path, p->ep->nr, p); + } usb_packet_set_state(p, USB_PACKET_COMPLETE); QTAILQ_REMOVE(&ep->queue, p, queue); dev->port->ops->complete(dev->port, p); diff --git a/trace-events b/trace-events index c935ba2..a953898 100644 --- a/trace-events +++ b/trace-events @@ -230,6 +230,7 @@ sun4m_iommu_bad_addr(uint64_t addr) "bad addr %"PRIx64 # hw/usb/core.c usb_packet_state_change(int bus, const char *port, int ep, void *p, const char *o, const char *n) "bus %d, port %s, ep %d, packet %p, state %s -> %s" usb_packet_state_fault(int bus, const char *port, int ep, void *p, const char *o, const char *n) "bus %d, port %s, ep %d, packet %p, state %s, expected %s" +usb_assert(int bus, const char *port, int ep, void *p) "bus %d, port %s, ep %d, packet %p" # hw/usb/bus.c usb_port_claim(int bus, const char *port) "bus %d, port %s"