From patchwork Thu Jul 16 07:15:26 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jim Paris X-Patchwork-Id: 35824 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6G7FWgK005453 for ; Thu, 16 Jul 2009 07:15:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751002AbZGPHPa (ORCPT ); Thu, 16 Jul 2009 03:15:30 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751062AbZGPHPa (ORCPT ); Thu, 16 Jul 2009 03:15:30 -0400 Received: from jim.sh ([75.150.123.25]:45676 "EHLO psychosis.jim.sh" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751002AbZGPHP3 (ORCPT ); Thu, 16 Jul 2009 03:15:29 -0400 Received: from psychosis.jim.sh (localhost [127.0.0.1]) by psychosis.jim.sh (8.14.3/8.14.3/Debian-5) with ESMTP id n6G7FQ8p004589 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 16 Jul 2009 03:15:26 -0400 Received: (from jim@localhost) by psychosis.jim.sh (8.14.3/8.14.3/Submit) id n6G7FQOZ004588; Thu, 16 Jul 2009 03:15:26 -0400 Date: Thu, 16 Jul 2009 03:15:26 -0400 From: Jim Paris To: G Cc: kvm@vger.kernel.org Subject: Re: KVM crashes when using certain USB device Message-ID: <20090716071526.GA1996@psychosis.jim.sh> References: <20090703161848.GA18195@psychosis.jim.sh> <20090703161848.GA18195@psychosis.jim.sh> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.18 (2008-05-17) X-Virus-Scanned: ClamAV 0.94.2/9573/Thu Jul 16 01:40:42 2009 on psychosis.jim.sh X-Virus-Status: Clean Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Hi G, > >> I've continued my attempts to get the HASP dongle working, but with no success: ... > Good idea. The results from three test runs after that change are in > the attached files. The third was done while also dumping the USB bus, > and the output from that dump is also attached. The gdb output here looks questionable. Only the second trial seems to have USB related stuff in the backtrace, so either gdb is wrong or there's some memory corruption that is causing crashes elsewhere. Maybe valgrind could help? You can also add more debugging to the usb code to try to figure out where things are going wrong. See the attached patch for some printfs that might help. Try again with less memory on the guest, like -m 2048, just to reduce possible problems with the 32-bit guest and address space. I didn't see anything obviously wrong with the usbmon dumps you sent, or the debugging that qemu printed out, but I'm not familiar with this code. Even though you're having problems with -no-kvm, I suspect this is an upstream qemu issue, so you should probably try the qemu list too. -jim diff -urN kvm-87/usb-linux.c kvm-87-debug/usb-linux.c --- kvm-87/usb-linux.c 2009-06-23 09:32:38.000000000 -0400 +++ kvm-87-debug/usb-linux.c 2009-07-16 03:06:22.000000000 -0400 @@ -209,16 +209,21 @@ static AsyncURB *async_alloc(void) { - return (AsyncURB *) qemu_mallocz(sizeof(AsyncURB)); + AsyncURB *aurb = (AsyncURB *) qemu_mallocz(sizeof(AsyncURB)); + dprintf("husb: allocated %p\n", aurb); + return aurb; } static void async_free(AsyncURB *aurb) { + dprintf("husb: freeing %p\n", aurb); qemu_free(aurb); } static void async_complete_ctrl(USBHostDevice *s, USBPacket *p) { + dprintf("husb: complete ctrl, host state %d len %d\n", + s->ctrl.state, s->ctrl.len); switch(s->ctrl.state) { case CTRL_STATE_SETUP: if (p->len < s->ctrl.len) @@ -266,6 +271,7 @@ aurb, aurb->urb.status, aurb->urb.actual_length); if (p) { + dprintf("husb: p=%p\n", p); switch (aurb->urb.status) { case 0: p->len = aurb->urb.actual_length; @@ -280,11 +286,12 @@ p->len = USB_RET_NAK; break; } - + dprintf("husb: completing, p->len=%d\n", p->len); usb_packet_complete(p); } async_free(aurb); + } }