From owner-p4-projects@FreeBSD.ORG Wed Aug 9 06:17:36 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id E202616A4E5; Wed, 9 Aug 2006 06:17:35 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9107F16A4DA; Wed, 9 Aug 2006 06:17:35 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2210243D45; Wed, 9 Aug 2006 06:17:35 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost.village.org [127.0.0.1] (may be forged)) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id k796GXZK021628; Wed, 9 Aug 2006 00:16:33 -0600 (MDT) (envelope-from imp@bsdimp.com) Date: Wed, 09 Aug 2006 00:16:38 -0600 (MDT) Message-Id: <20060809.001638.353412754.imp@bsdimp.com> To: hselasky@freebsd.org From: "M. Warner Losh" In-Reply-To: <200608061116.k76BGtmo043289@repoman.freebsd.org> References: <200608061116.k76BGtmo043289@repoman.freebsd.org> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Wed, 09 Aug 2006 00:16:33 -0600 (MDT) Cc: perforce@freebsd.org Subject: Re: PERFORCE change 103330 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Aug 2006 06:17:36 -0000 In message: <200608061116.k76BGtmo043289@repoman.freebsd.org> Hans Petter Selasky writes: : http://perforce.freebsd.org/chv.cgi?CH=103330 : : Change 103330 by hselasky@hselasky_mini_itx on 2006/08/06 11:16:46 : : Try to get the mii-locking right. Until further lock the : driver's private lock, sc->sc_mtx, from all mii-callbacks, : hence during attach there are some problems, and it is not : possible to hold sc->sc_mtx when calling "mii_phy_probe()", : because this function calls memory allocation functions that : can sleep. Add some more debugging statements. Cleanup some : comments. Move an include file further up. And some other : small things. : + u_int8_t eaddr[min(ETHER_ADDR_LEN,6)]; That's a gratuitous gcc extention. Just use ETHER_ADDR_LEN. : /* reset the adapter */ : aue_cfg_reset(sc); : : + /* set default value */ : + bzero(eaddr, sizeof(eaddr)); : + : /* get station address from the EEPROM */ : aue_cfg_read_eeprom(sc, eaddr, 0, 3); : : @@ -900,17 +921,20 @@ : ifp->if_init = aue_init_cb; : ifp->if_snd.ifq_maxlen = IFQ_MAXLEN; : : - /* XXX: we need Giant when we : - * clobber with the bus: : - * : - * FIXME: right here we are locking : - * in the wrong order: : + /* XXX need Giant when accessing : + * the device structures ! : */ : : mtx_unlock(&(sc->sc_mtx)); : : mtx_lock(&Giant); : : + error = mii_phy_probe(sc->sc_dev, &(sc->sc_miibus), : + &aue_ifmedia_upd_cb, : + &aue_ifmedia_sts_cb); : + : + mtx_unlock(&Giant); : + : mtx_lock(&(sc->sc_mtx)); This lock shouldn't be held during probe/attach anyway. It is a common wpaul driver error :-(. Warner