FreeBSD 8.0-STABLE freeze
Alexander Motin
mav at FreeBSD.org
Tue Feb 23 14:47:58 UTC 2010
Andriy Gapon wrote:
> on 23/02/2010 12:03 Санек Гурин said the following:
>> FreeBSD freeze
>>
>> After update few weeks ago freebsd began to freeze from time to time. Can't find any reason in logs or other way. System may halt after an hour of work, or may work few days. Before halt it may respond to shell commands very-very slow....
>>
>> MB: MSI P45 NEO3-FR. BIOS ATA configured as AHCI. JMicron ATA controller is disabled.
>>
>> % uname -a
>> FreeBSD wk.kiev.ua 8.0-STABLE FreeBSD 8.0-STABLE #3 r204163: Sun Feb 21 10:07:59 EET 2010 root at wk.kiev.ua:/usr/obj/usr/src/sys/GNRDBG amd64
>>
>> Kernel Config: http://xdevs.com/wk/kernel_config.txt
>> dmesg output: http://xdevs.com/wk/dmesg.txt
>>
>>
>> panic: _mtx_lock_sleep: recursed on non-recursive mutex ATA state lock @ /usr/sys/dev/ata/ata-all.c:334
>>
>> cpuid = 1
>> KDB: stack backtrace:
>> db_trace_self_wrapper() at 0xffffffff801e05c5a = db_trace_self_wrapper+0x2a
>> panic() at 0xffffffff8058d692 = panic+0x182
>> _mtx_lock_sleep() at 0xffffffff8057ec52 = _mtx_lock_sleep+0x152
>> _mtx_lock_flags() at 0xffffffff8057ed41 = _mtx_lock_flags+exe1
>> ata_reinit() at 0xffffffff802723f3 = ata_reinit+0xb3
>> ata_conn_event() at 0xffffffff80272b7e = ata_conn_event+0xe3
>> taskqueue_run() at 0xffffffff805c9e01 = taskqueue_run+0x91
>> taskqueue_thread_loop() at 0xffffffff805c9f8f = taskqueue_thread_loop+0x3f
>> fork_exit() at 0xffffffff80564f3a = fork_exit+0x12a
>> fork_trampoline() at 0xffffffff8085b84e = fork_trampoline+0xe
>> --- trap 0, rip = 0, rsp = 0xffffff80000b9d30, rbp = 0 ---
>> Uptime: 19s
>> Cannot dump. Device not defined or unavailable.
>> Automatic reboot in 15 seconds - press a key on the console to abort
>> VOP_STRATEGY: bp in not locked but should be
>
> I believe that this a (well known?) bug in ata driver: state_mtx is not
> initialized as recursive, but is used as such.
> E.g. it is locked in ata_conn_event and then ata_reinit locks it again.
> Of course, an external condition is needed to trigger ata_conn_event in the first
> place.
Looks like my fault. Attached patch should fix that. But if you need
really working hot-plug (and many other tasty things) - look to the new
CAM-based ATA implementation.
--
Alexander Motin
-------------- next part --------------
--- ata-all.c.prev 2010-02-23 09:17:04.000000000 +0200
+++ ata-all.c 2010-02-23 16:23:49.000000000 +0200
@@ -289,15 +289,13 @@ static void
ata_conn_event(void *context, int dummy)
{
device_t dev = (device_t)context;
- struct ata_channel *ch = device_get_softc(dev);
#ifdef ATA_CAM
+ struct ata_channel *ch = device_get_softc(dev);
union ccb *ccb;
-#endif
mtx_lock(&ch->state_mtx);
ata_reinit(dev);
mtx_unlock(&ch->state_mtx);
-#ifdef ATA_CAM
if ((ccb = xpt_alloc_ccb()) == NULL)
return;
if (xpt_create_path(&ccb->ccb_h.path, NULL,
@@ -307,6 +305,8 @@ ata_conn_event(void *context, int dummy)
return;
}
xpt_rescan(ccb);
+#else
+ ata_reinit(dev);
#endif
}
More information about the freebsd-stable
mailing list