kern/118093: [firewire] firewire bus reset hogs CPU, causing data to be lost

Dieter freebsd at sopwith.solgatos.com
Tue Jan 6 21:20:03 PST 2009


The following reply was made to PR kern/118093; it has been noted by GNATS.

From: Dieter <freebsd at sopwith.solgatos.com>
To: bug-followup at FreeBSD.org, freebsd-firewire at FreeBSD.org
Cc:  
Subject: Re: kern/118093: [firewire] firewire bus reset hogs CPU, causing data to be lost 
Date: Tue, 06 Jan 2009 09:33:21 +0000

 In message <1231222803.21260.17.camel at localhost.localdomain>, Sean Bruno writes:
 
 > > >  	uint32_t fun;
 > > >  
 > > > +	FW_GLOCK(fc);
 > > >  	device_printf(fc->dev, "Initiate bus reset\n");
 > > >  	sc = (struct fwohci_softc *)fc;
 > > >  
 > > > @@ -2487,6 +2495,7 @@
 > > >  	fun |= FW_PHY_ISBR | FW_PHY_RHB;
 > > >  	fun = fwphy_wrdata(sc, FW_PHY_ISBR_REG, fun);
 > > >  #endif
 > > > +	FW_GUNLOCK(fc);
 > > >  }
 > > 
 > > Does the lock need to protect the printf?
 > 
 > These are gross, overpowered, way to heavy handed locks that I'm playing
 > with.  I need to prevent pre-emption of certain events while they are in
 > progress.  One of these events is the firewire's assertion of "bus
 > reset" on the firewire device.  I see the h/w interrupt firing before
 > this code can actually complete, causing the driver to be confused on
 > occasion.
 
 I understand the basic concept of locking, or at least I did many many years
 ago when spls really were levels.  Since then they changed spls to not be levels
 (at least that's what the man page says) and later replaced with mutex.  I assume
 these changes are at least in part to better support SMP.
 
 What I don't understand is things like getting a lock and immediately releasing
 it, which appears to me to protect nothing.  Or why the printf needs to be inside
 the locked section of code.  I thought the goal was to hold a lock for as short a
 time as possible, and it is not clear to me why the printf needs to be protected.


More information about the freebsd-bugs mailing list