svn commit: r192604 - in user/kmacy/releng_7_2_fcs/sys: dev/hwpmc sys

John Baldwin jhb at freebsd.org
Tue May 26 18:52:12 UTC 2009


On Tuesday 26 May 2009 2:41:03 pm Kip Macy wrote:
> ter.
> >
> > Umm, that doesn't help.  Your kthread's main routine is "physically" 
located
> > in your kld.  It needs to get into the text of kthread_exit() before it is
> > safe for your module to unload, and so you have to sleep on the 
kthread/kproc
> > pointer to wait for the wakeup in kthread_exit() to fire.  You could have
> > easily used msleep_spin() for this w/o hacking up condvar's to support 
spin
> > locks too, FWIW.
> >
> 
> Good point.
> 
> Which gets to my next question. Why is condvar preferred to msleep /
> wakeup for everything BUT spin locks? This seems a bit hackish.

Because too many people use spin locks. :)  They are really only suitable for 
a limited set of problems, and many of those are for scheduler internals that 
don't use higher level primitives like sleep and wakeup.  I can buy that pmc 
might be low-level enough to warrant use of a spin lock if you are 
interfacing with the NMI handler, but in that case I think msleep_spin() is 
probably sufficient for what you need.

-- 
John Baldwin


More information about the svn-src-user mailing list