Date: Wed, 09 Aug 2006 00:16:38 -0600 (MDT) From: "M. Warner Losh" <imp@bsdimp.com> To: hselasky@freebsd.org Cc: perforce@freebsd.org Subject: Re: PERFORCE change 103330 for review Message-ID: <20060809.001638.353412754.imp@bsdimp.com> In-Reply-To: <200608061116.k76BGtmo043289@repoman.freebsd.org> References: <200608061116.k76BGtmo043289@repoman.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <200608061116.k76BGtmo043289@repoman.freebsd.org> Hans Petter Selasky <hselasky@freebsd.org> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20060809.001638.353412754.imp>