Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Jun 2014 06:13:49 +0200
From:      Hans Petter Selasky <hps@selasky.org>
To:        "Lundberg, Johannes" <johannes@brilliantservice.co.jp>,  FreeBSD Current <freebsd-current@freebsd.org>
Cc:        Fredrik Lindberg <fli@shapeshifter.se>
Subject:   Re: ucom_free Fatal trap on shutdown / module unload
Message-ID:  <53B0E3FD.30800@selasky.org>
In-Reply-To: <CAASDrVnGMb81FxfJBQrdYwf_W=mpd=xvfgWTneOuuL=9cexDOA@mail.gmail.com>
References:  <CAASDrVkFfhyU8Jb4EB%2B4V32skfFijX9TKLSysjGK=0ye=G9GgA@mail.gmail.com> <53A79732.6060705@selasky.org> <CAASDrVkBjqoKFTF48Vyv3dRRUxKfVpCZ5uMjb7P%2BMy_tnGOF7w@mail.gmail.com> <53A90116.7040306@selasky.org> <CAASDrVnfxR40OsJLRLQUfyzhBHuHynYAqmaq=9EBUxZHMUCYnw@mail.gmail.com> <CAASDrVmYCdZ8UOsp7yESpi2KBDvQgG2HvSGrWGUyiETcpz7Y_g@mail.gmail.com> <53A907E9.5020007@selasky.org> <CAASDrVkPK0M2caZ0wmfwJrTGF5h99-4s71KfuRcNFEOcWtAqCA@mail.gmail.com> <53A9C37A.7030803@selasky.org> <CAASDrV=CDX4mSdZRNcSgNgWWscntt8xd4a2sfGnKuBmPKkd-%2BA@mail.gmail.com> <53AA5A0E.1050704@selasky.org> <CAASDrV=a0kc0QAxa3MuVq1qvfW_yun%2BeUr0E360oCsPF7tWTvg@mail.gmail.com> <53AC8C21.6080504@selasky.org> <CAASDrV=AupNhXrXQfoecidm4sWokxrG4qfa3tMJ4raYQUSaJEA@mail.gmail.com> <53AD01C6.1080005@selasky.org> <CAASDrVnezuH4iyAU5CbBZdWziVxgmoa7EuBX1ESNB7kXN5w4vA@mail.gmail.com> <53AED789.9070504@selasky.org> <CAASDrVnGMb81FxfJBQrdYwf_W=mpd=xvfgWTneOuuL=9cexDOA@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------030203080307080705070408
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

On 06/30/14 06:01, Lundberg, Johannes wrote:
> As I mention in earlier mail, it is when I comment out following lines it
> works
>
> # For full debugger support use (turn off in stable branch):
> options         DDB                     # Support DDB.
> options         GDB                     # Support remote GDB.
> options         DEADLKRES               # Enable the deadlock resolver
> options         INVARIANTS              # Enable calls of extra sanity
> checking
> options         INVARIANT_SUPPORT       # Extra sanity checks of internal
> structures, required by INVARIANTS
> options         WITNESS                 # Enable checks to detect deadlocks
> and cycles
> options         WITNESS_SKIPSPIN        # Don't run witness on spinlocks
> for speed
> options         MALLOC_DEBUG_MAXZONES=8 # Separate malloc(9) zones
>
>
> I have tried different levels of debugging and I have narrowed it down to
> INVARIANTS.
>

Hi,

What happens if you put ucom and uhso in the kernel config file, instead 
of loading them as modules.

Please find attached a patch you can try. It ensures that the ucom mtx 
is not destroyed before we are finished using it at shutdown.

--HPS


--------------030203080307080705070408
Content-Type: text/x-patch;
 name="ucom.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="ucom.diff"

=== dev/usb/serial/usb_serial.c
==================================================================
--- dev/usb/serial/usb_serial.c	(revision 268010)
+++ dev/usb/serial/usb_serial.c	(local)
@@ -200,7 +200,7 @@
 
 	mtx_destroy(&ucom_mtx);
 }
-SYSUNINIT(ucom_uninit, SI_SUB_KLD - 2, SI_ORDER_ANY, ucom_uninit, NULL);
+SYSUNINIT(ucom_uninit, SI_SUB_KLD - 3, SI_ORDER_ANY, ucom_uninit, NULL);
 
 /*
  * Mark a unit number (the X in cuaUX) as in use.
=== dev/usb/serial/usb_serial.h
==================================================================
--- dev/usb/serial/usb_serial.h	(revision 268010)
+++ dev/usb/serial/usb_serial.h	(local)
@@ -195,7 +195,7 @@
 #define	UCOM_MTX_LOCK(sc) mtx_lock((sc)->sc_mtx)
 #define	UCOM_MTX_UNLOCK(sc) mtx_unlock((sc)->sc_mtx)
 #define	UCOM_UNLOAD_DRAIN(x) \
-SYSUNINIT(var, SI_SUB_KLD - 3, SI_ORDER_ANY, ucom_drain_all, 0)
+SYSUNINIT(var, SI_SUB_KLD - 2, SI_ORDER_ANY, ucom_drain_all, 0)
 
 #define	ucom_cfg_do_request(udev,com,req,ptr,flags,timo) \
     usbd_do_request_proc(udev,&(com)->sc_super->sc_tq,req,ptr,flags,NULL,timo)

--------------030203080307080705070408--



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