From owner-freebsd-stable@FreeBSD.ORG Tue Feb 23 14:47:58 2010 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9D73B1065670 for ; Tue, 23 Feb 2010 14:47:58 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.156]) by mx1.freebsd.org (Postfix) with ESMTP id 27A5F8FC13 for ; Tue, 23 Feb 2010 14:47:57 +0000 (UTC) Received: by fg-out-1718.google.com with SMTP id e12so1042756fga.13 for ; Tue, 23 Feb 2010 06:47:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type; bh=7n9TvNfRcd07j9ly1BnU0yZlSR67QJi9DA9e3R4VCYc=; b=cx/Z5PCjRgXMgXOE7TWx8NKM5txefmgiMwfnDtX5gdVSTKD7Q/uE/J52NYNV565aUg 2owA0AhcRo7nvPJFAy7MT7An0kalz92KZuzwgw+4TJO5BseCIGmTcsls9meN5iwBpEYW WkPdIiTPaVC6CH2FHtBcKP5CYGyChusethN7c= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type; b=b45LW4NTjtA4/IunJJIf3ZJp/aZrY6qs9KWY6emCy7pR3Z4SPxSJ8axlXyti881sNc Uw4OhpGOmUiF2VCgO0gpKJ5oaIgYxqG68zz4cWKJtZKRkGdhvhbbs6wCzCrPAJolb3Rx klJSkxoSuJB35vxgVFi//QK6O1vA8vjz+sGEk= Received: by 10.86.20.8 with SMTP id 8mr2270095fgt.38.1266936471316; Tue, 23 Feb 2010 06:47:51 -0800 (PST) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id 14sm2496292fxm.5.2010.02.23.06.47.49 (version=SSLv3 cipher=RC4-MD5); Tue, 23 Feb 2010 06:47:50 -0800 (PST) Sender: Alexander Motin Message-ID: <4B83EA94.5060704@FreeBSD.org> Date: Tue, 23 Feb 2010 16:47:48 +0200 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: =?KOI8-R?Q?=F3=C1=CE=C5=CB_=E7=D5=D2=C9=CE?= References: <4B83DC3C.4080201@icyb.net.ua> In-Reply-To: <4B83DC3C.4080201@icyb.net.ua> X-Enigmail-Version: 0.96.0 Content-Type: multipart/mixed; boundary="------------040900030406090405080203" Cc: freebsd-stable@freebsd.org, Andriy Gapon Subject: Re: FreeBSD 8.0-STABLE freeze X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2010 14:47:58 -0000 This is a multi-part message in MIME format. --------------040900030406090405080203 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 8bit 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@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 --------------040900030406090405080203 Content-Type: text/plain; name="reinit.lock.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="reinit.lock.patch" --- 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 } --------------040900030406090405080203--