From owner-freebsd-current@FreeBSD.ORG Mon Nov 26 22:35:08 2007 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 91CF016A46D for ; Mon, 26 Nov 2007 22:35:08 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.169]) by mx1.freebsd.org (Postfix) with ESMTP id 2FB7913C46B for ; Mon, 26 Nov 2007 22:35:06 +0000 (UTC) (envelope-from jfvogel@gmail.com) Received: by ug-out-1314.google.com with SMTP id y2so1323223uge for ; Mon, 26 Nov 2007 14:34:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=XCcxxVBLYrBMFhW5fjQ7EiWu2yN1WuynWPgWP1E+gYw=; b=rBVzag3DI+9quQNr2OD22AW1m9eJ5VuzPvbcRbzKRHtrlUxSKdgzIS/uU9Uftyu27QkCvI9lwRK6OCF9RqkO/61Dyd+5P3Y3r2wJ9tSdqW/Ul6ziz6JRBkTJViufUG9oroozgodUh8NG7QWpszpJ7kI8g/93CFsONGiQkSLRbo4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=MNAWKAhGhYi2oZ1ylxSHF52NiGccLeAghlVas10CKNfbpekgCSscrhVv4XbbTgXnBpjxk18jbWPyuXQpuBphuTGzT0GQe7SxxqNJ0yKpdFbdqJcVCTYvLAk1Bhd6HwOFxdrRNud2Si8YODbBYGe+wNCjKgU4nsYypZsgnRldYxk= Received: by 10.86.50.8 with SMTP id x8mr3172152fgx.1196116493836; Mon, 26 Nov 2007 14:34:53 -0800 (PST) Received: by 10.86.100.19 with HTTP; Mon, 26 Nov 2007 14:34:53 -0800 (PST) Message-ID: <2a41acea0711261434u817eb06xe05eba8447afc3ae@mail.gmail.com> Date: Mon, 26 Nov 2007 14:34:53 -0800 From: "Jack Vogel" To: "Attilio Rao" In-Reply-To: <3bbf2fe10711261431s1b1bd697n46d370900d5fe9c0@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <4744EBA4.7020209@clearchain.com> <3bbf2fe10711220408t30136430s15fdba0ebcbbfa66@mail.gmail.com> <3bbf2fe10711220427s38561159k4879d0c792d09694@mail.gmail.com> <474B4876.9020209@clearchain.com> <3bbf2fe10711261431s1b1bd697n46d370900d5fe9c0@mail.gmail.com> Cc: Jack F Vogel , freebsd-current@freebsd.org, Benjamin Close Subject: Re: em0 panic: mutex em0 not owned X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 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, 26 Nov 2007 22:35:08 -0000 On Nov 26, 2007 2:31 PM, Attilio Rao wrote: > 2007/11/26, Benjamin Close : > > > Attilio Rao wrote: > > > 2007/11/22, Attilio Rao : > > > > > >> 2007/11/22, Benjamin Close : > > >> > > >>> Hi Folks, > > >>> With a recent current I'm now getting panics when em0 tries to come up: > > >>> > > >>> panic: mutex em0 not owned at ../../../kern/kern_mutex.c:144 > > >>> > > >>> _mtx_assert() + 0xdc > > >>> _callout_stop_safe()+0x5d > > >>> em_stop() + 0x50 (if_em.c:2546) > > >>> em_init_locked()+0x47 (if_em.c:1256) > > >>> em_ioctl()+0x466 > > >>> ifhwioctl() + 0x75f > > >>> ifioctl() +0xb0 > > >>> kern_ioctl() + 0xa3 > > >>> > > >>> This is even after atillos, latest patch. > > >>> > > >> Yes, this is a race access to callout_stop() in em driver. > > >> callout_stop() needs to be called with callout-specific lock held > > >> otherwise you can get a race and this seems not happening. I just > > >> inserted this assertions in order to catch bugs like these. > > >> I have no time to double-check it, can you do? > > >> > > > > > > Ok, basically em_stop() both wants to stop core callout and tx channel > > > callout but it only holds core lock. It needs to hold both in order to > > > stop both. As I'm not sure about lock ordering there I can't produce a > > > patch now so the ball is in jfv@ court (CC'ed). > > > > > The attached patch fixes the panic at the cost of a lock order reversal: > > jfv@ today should have fixed it. > Please cvsup and try again. > > > Attilio Yup, version 1.188 is the fix for this. Cheers, Jack