From owner-freebsd-current@FreeBSD.ORG Fri Dec 11 17:31:02 2009 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 1BC7B1065670; Fri, 11 Dec 2009 17:31:02 +0000 (UTC) (envelope-from brooks@lor.one-eyed-alien.net) Received: from lor.one-eyed-alien.net (lor.one-eyed-alien.net [69.66.77.232]) by mx1.freebsd.org (Postfix) with ESMTP id A73F08FC0A; Fri, 11 Dec 2009 17:31:01 +0000 (UTC) Received: from lor.one-eyed-alien.net (localhost [127.0.0.1]) by lor.one-eyed-alien.net (8.14.3/8.14.3) with ESMTP id nBBHTjhh033625; Fri, 11 Dec 2009 11:29:45 -0600 (CST) (envelope-from brooks@lor.one-eyed-alien.net) Received: (from brooks@localhost) by lor.one-eyed-alien.net (8.14.3/8.14.3/Submit) id nBBHTjKK033624; Fri, 11 Dec 2009 11:29:45 -0600 (CST) (envelope-from brooks) Date: Fri, 11 Dec 2009 11:29:45 -0600 From: Brooks Davis To: pluknet Message-ID: <20091211172945.GC33467@lor.one-eyed-alien.net> References: <20091210210901.GA23550@lor.one-eyed-alien.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Clx92ZfkiYIKRjnr" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-3.0 (lor.one-eyed-alien.net [127.0.0.1]); Fri, 11 Dec 2009 11:29:45 -0600 (CST) Cc: jfv@freebsd.org, freebsd-current@freebsd.org Subject: Re: panic with em(4) in current 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: Fri, 11 Dec 2009 17:31:02 -0000 --Clx92ZfkiYIKRjnr Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Dec 11, 2009 at 01:20:08AM +0300, pluknet wrote: > 2009/12/11 Brooks Davis : > > Something with the latest e1000 update in current causes a panic during > > attach on my laptop. ?Rolling sys/dev/e1000 back to the previous version > > fixes the problem. ?Here's the hand transcribed panic: > > > > panic: mtx_lock() of spin mutex &dev_spec->swflag_mutex @ ../../../dev/= e1000/e1000_ich8lan.c:651 > > > > The back trace places me at: e1000_acquire_swflag_ich8lan()+0x30 >=20 > Hi, I see bug there: > +#define E1000_MUTEX_INIT(mutex) mtx_init((mutex), #mutex, \ > + MTX_NETWORK_LOCK, \ > + MTX_DEF | MTX_SPIN) >=20 > mtx_init() first looks for MTX_SPIN flag and assign > lock_class_mtx_spin class to mutex. > Then mtx_lock() on spin mutex called. I can confirm that removing MTX_SPIN fixes the panic. This is invalid code because MTX_DEF and MTX_SPIN are exclusive flags. Unfortunately, MTX_DEF is 0x0 so there's no way to check for that error at runtime. If a spin mutex were actually needed here then the _LOCK and _UNLOCK macros need to be change and the unused _TRYLOCK macro needs to be removed. -- Brooks --Clx92ZfkiYIKRjnr Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (FreeBSD) iD8DBQFLIoGJXY6L6fI4GtQRAgaFAKDnrqmpAFZtNwbvzKmoWqg2yDuSbQCgi23Z gpyRaqmnF0ylGuvXp94KoG8= =4noO -----END PGP SIGNATURE----- --Clx92ZfkiYIKRjnr--