svn commit: r266394 - in head/sys/dev/usb: . controller

Mikolaj Golub trociny at FreeBSD.org
Sat Jun 7 15:34:58 UTC 2014


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


More information about the svn-src-all mailing list