From owner-freebsd-current@FreeBSD.ORG Mon Jun 30 04:13:35 2014 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D3E95670 for ; Mon, 30 Jun 2014 04:13:35 +0000 (UTC) Received: from mail.turbocat.net (heidi.turbocat.net [88.198.202.214]) (using TLSv1.1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5AB2527E9 for ; Mon, 30 Jun 2014 04:13:34 +0000 (UTC) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (using TLSv1 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 2CD801FE02D; Mon, 30 Jun 2014 06:13:32 +0200 (CEST) Message-ID: <53B0E3FD.30800@selasky.org> Date: Mon, 30 Jun 2014 06:13:49 +0200 From: Hans Petter Selasky User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: "Lundberg, Johannes" , FreeBSD Current Subject: Re: ucom_free Fatal trap on shutdown / module unload References: <53A79732.6060705@selasky.org> <53A90116.7040306@selasky.org> <53A907E9.5020007@selasky.org> <53A9C37A.7030803@selasky.org> <53AA5A0E.1050704@selasky.org> <53AC8C21.6080504@selasky.org> <53AD01C6.1080005@selasky.org> <53AED789.9070504@selasky.org> In-Reply-To: Content-Type: multipart/mixed; boundary="------------030203080307080705070408" Cc: Fredrik Lindberg X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jun 2014 04:13:36 -0000 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--