Date: Mon, 6 May 2019 09:41:23 -0500 From: Kyle Evans <kevans@freebsd.org> To: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= <royger@freebsd.org> Cc: src-committers <src-committers@freebsd.org>, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r347183 - head/sys/geom Message-ID: <CACNAnaFmt18t6f0EezZ%2BJX2u=TY6X4vw0FF6bGb%2BG2KjOy8PjA@mail.gmail.com> In-Reply-To: <201905060948.x469mZiw004587@repo.freebsd.org> References: <201905060948.x469mZiw004587@repo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, May 6, 2019 at 4:48 AM Roger Pau Monn=C3=A9 <royger@freebsd.org> wr= ote: > > Author: royger > Date: Mon May 6 09:48:34 2019 > New Revision: 347183 > URL: https://svnweb.freebsd.org/changeset/base/347183 > > Log: > geom: fix initialization order > > There's a race between the initialization of devsoftc.mtx (by devinit) > and the creation of the geom worker thread g_run_events, which calls > devctl_queue_data_f. Both of those are initialized at SI_SUB_DRIVERS > and SI_ORDER_FIRST, which means the geom worked thread can be created > before the mutex has been initialized, leading to the panic below: > > wpanic: mtx_lock() of spin mutex (null) @ /usr/home/osstest/build.1353= 17.build-amd64-freebsd/freebsd/sys/kern/subr_bus.c:620 > cpuid =3D 3 > time =3D 1 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe00= 3b968710 > vpanic() at vpanic+0x19d/frame 0xfffffe003b968760 > panic() at panic+0x43/frame 0xfffffe003b9687c0 > __mtx_lock_flags() at __mtx_lock_flags+0x145/frame 0xfffffe003b968810 > devctl_queue_data_f() at devctl_queue_data_f+0x6a/frame 0xfffffe003b96= 8840 > g_dev_taste() at g_dev_taste+0x463/frame 0xfffffe003b968a00 > g_load_class() at g_load_class+0x1bc/frame 0xfffffe003b968a30 > g_run_events() at g_run_events+0x197/frame 0xfffffe003b968a70 > fork_exit() at fork_exit+0x84/frame 0xfffffe003b968ab0 > fork_trampoline() at fork_trampoline+0xe/frame 0xfffffe003b968ab0 > --- trap 0, rip =3D 0, rsp =3D 0, rbp =3D 0 --- > KDB: enter: panic > [ thread pid 13 tid 100029 ] > Stopped at kdb_enter+0x3b: movq $0,kdb_why > > Fix this by initializing geom at SI_ORDER_SECOND instead of > SI_ORDER_FIRST. > > Sponsored by: Citrix Systems R&D > Reviewed by: kevans, markj > Differential revision: https://reviews.freebsd.org/D20148 > Hi, Any objections to my MFC'ing this on ~Thursday with the tun change that sparked it? Thanks, Kyle Evans
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CACNAnaFmt18t6f0EezZ%2BJX2u=TY6X4vw0FF6bGb%2BG2KjOy8PjA>