PERFORCE change 103330 for review

M. Warner Losh imp at bsdimp.com
Wed Aug 9 06:17:36 UTC 2006


In message: <200608061116.k76BGtmo043289 at repoman.freebsd.org>
            Hans Petter Selasky <hselasky at freebsd.org> writes:
: http://perforce.freebsd.org/chv.cgi?CH=103330
: 
: Change 103330 by hselasky at 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


More information about the p4-projects mailing list