From owner-freebsd-stable@FreeBSD.ORG Fri Aug 19 16:32:19 2011 Return-Path: Delivered-To: freebsd-stable@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0AB08106566C for ; Fri, 19 Aug 2011 16:32:19 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from citadel.icyb.net.ua (citadel.icyb.net.ua [212.40.38.140]) by mx1.freebsd.org (Postfix) with ESMTP id 5A21C8FC16 for ; Fri, 19 Aug 2011 16:32:17 +0000 (UTC) Received: from odyssey.starpoint.kiev.ua (alpha-e.starpoint.kiev.ua [212.40.38.101]) by citadel.icyb.net.ua (8.8.8p3/ICyb-2.3exp) with ESMTP id TAA02153; Fri, 19 Aug 2011 19:32:13 +0300 (EEST) (envelope-from avg@FreeBSD.org) Message-ID: <4E4E900D.8010506@FreeBSD.org> Date: Fri, 19 Aug 2011 19:32:13 +0300 From: Andriy Gapon User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:5.0) Gecko/20110705 Thunderbird/5.0 MIME-Version: 1.0 To: Hans Petter Selasky References: <4E4D460A.2080100@FreeBSD.org> <201108182324.58276.hselasky@c2i.net> In-Reply-To: <201108182324.58276.hselasky@c2i.net> X-Enigmail-Version: 1.2pre Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: freebsd-stable@FreeBSD.org Subject: Re: USB/coredump hangs in 8 and 9 X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 16:32:19 -0000 on 19/08/2011 00:24 Hans Petter Selasky said the following: > On Thursday 18 August 2011 19:04:10 Andriy Gapon wrote: >> If you can help Hans to figure out what you is wrong with USB subsystem in >> this respect that would help us all. > > Hi, > > usb_busdma.c: /* we use "mtx_owned()" instead of this function */ > usb_busdma.c: owned = mtx_owned(uptag->mtx); > usb_compat_linux.c: do_unlock = mtx_owned(&Giant) ? 0 : 1; > usb_compat_linux.c: do_unlock = mtx_owned(&Giant) ? 0 : 1; > usb_compat_linux.c: do_unlock = mtx_owned(&Giant) ? 0 : 1; > usb_hub.c: if (mtx_owned(&bus->bus_mtx)) { > usb_transfer.c: if (!mtx_owned(info->xfer_mtx)) { > usb_transfer.c: if (mtx_owned(xfer->xroot->xfer_mtx)) { > usb_transfer.c: while (mtx_owned(&xroot->udev->bus->bus_mtx)) { > usb_transfer.c: while (mtx_owned(xroot->xfer_mtx)) { > > One fix you will need to do, if mtx_owned is not giving correct value is: First, could you please clarify what is the correct, or rather - expected, value in this case. It's not immediately clear to me if we should consider all locks as owned or un-owned in a situation where all locks are actually skipped behind the scenes. Maybe USB code should explicitly check for that condition as to not make any unsafe assumptions. Second, it's not clear to me what the above list actually represents in the context of this discussion. > static void > usbd_callback_wrapper(struct usb_xfer_queue *pq) > { > struct usb_xfer *xfer = pq->curr; > struct usb_xfer_root *info = xfer->xroot; > > USB_BUS_LOCK_ASSERT(info->bus, MA_OWNED); > if (!mtx_owned(info->xfer_mtx)) { > > The above "if" should be anded with && !paniced && !dumping ... or maybe the > new not scheduling variable is good for this purpose? > > /* > * Cases that end up here: > * > > #if USB_HAVE_BUSDMA > if (mtx_owned(xfer->xroot->xfer_mtx)) { > struct usb_xfer_queue *pq; > > > This case is more like a BUS-DMA error case, and is not so important to > execute. > > --HPS -- Andriy Gapon