Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Jun 2014 15:34:51 +0000
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        Hans Petter Selasky <hselasky@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r266394 - in head/sys/dev/usb: . controller
Message-ID:  <20140607153448.GA1566@gmail.com>
In-Reply-To: <201405180913.s4I9DT3x044147@svn.freebsd.org>
References:  <201405180913.s4I9DT3x044147@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

On Sun, May 18, 2014 at 09:13:29AM +0000, Hans Petter Selasky wrote:
> Author: hselasky
> Date: Sun May 18 09:13:29 2014
> New Revision: 266394
> URL: http://svnweb.freebsd.org/changeset/base/266394
> 
> Log:
>   - Add softc pointer argument to FIFO functions as an optimisation.
>   - Implement support for interrupt filters in the DWC OTG driver, to
>   reduce the amount of CPU task switching when only feeding the FIFOs.
>   - Add common spinlock to the USB bus structure.

I observe panic on WITNESS enabled kernel:

 lock (xhci0) spin mutex does not match earlier (sleep mutex) lock.

in 

_mtx_init()
usb_bus_mem_alloc_all
xchi_init
xhci_pci_attach
device_attach

> 
> Modified: head/sys/dev/usb/controller/usb_controller.c
> ==============================================================================
> --- head/sys/dev/usb/controller/usb_controller.c	Sun May 18 04:33:24 2014	(r266393)
> +++ head/sys/dev/usb/controller/usb_controller.c	Sun May 18 09:13:29 2014	(r266394)
> @@ -901,6 +901,9 @@ usb_bus_mem_alloc_all(struct usb_bus *bu
>  	mtx_init(&bus->bus_mtx, device_get_nameunit(bus->parent),
>  	    NULL, MTX_DEF | MTX_RECURSE);
>  
> +	mtx_init(&bus->bus_spin_lock, device_get_nameunit(bus->parent),
> +	    NULL, MTX_SPIN | MTX_RECURSE);
> +

I think because sleep mutex bus_mtx and spin mutex bus_spin_lock are
initilized with the same name here.

The pacth below fixes the issue for me. Not sure about its correctnes,
did not find quickly a good example in the source.

Index: sys/dev/usb/controller/usb_controller.c
===================================================================
--- sys/dev/usb/controller/usb_controller.c	(revision 267176)
+++ sys/dev/usb/controller/usb_controller.c	(working copy)
@@ -898,10 +898,10 @@
 	bus->alloc_failed = 0;
 
 	mtx_init(&bus->bus_mtx, device_get_nameunit(bus->parent),
-	    NULL, MTX_DEF | MTX_RECURSE);
+	    "bus_mtx", MTX_DEF | MTX_RECURSE);
 
 	mtx_init(&bus->bus_spin_lock, device_get_nameunit(bus->parent),
-	    NULL, MTX_SPIN | MTX_RECURSE);
+	    "bus_spin_lock", MTX_SPIN | MTX_RECURSE);
 
 	usb_callout_init_mtx(&bus->power_wdog,
 	    &bus->bus_mtx, 0);

-- 
Mikolaj Golub



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140607153448.GA1566>