DragonFly kernel List (threaded) for 2008-01
DragonFly BSD
DragonFly kernel List (threaded) for 2008-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: ahc/ahd locking


From: "Sepherosa Ziehau" <sepherosa@xxxxxxxxx>
Date: Tue, 1 Jan 2008 11:20:47 +0800

On Jan 1, 2008 8:19 AM, Peter Avalos <pavalos@theshell.com> wrote:
>
> On Mon, Dec 31, 2007 at 05:21:45PM -0500, Peter Avalos wrote:
> > On Mon, Dec 31, 2007 at 08:32:40AM -0800, Matthew Dillon wrote:
> > >
> > >     I suggest trying to use the serializing locks (kern/lwkt_serialize.c).
> > >     Look at various network device drivers on how to install a serializing
> > >     lock w/ the interrupt.  Note that some reworking of the code might be
> > >     needed since the ahc/ahd interrupt code probably tries to release/reaquire
> > >     and/or do other nasty things when, in fact, you just want it to hold the
> > >     lock through the whole mess.
> > >
> >
> > So basically put a serializer lock in the sotfc, then use that lock when
> > calling bus_setup_intr?
> >
> > Are there any particular rules w/ tsleep? Can I use msleep on a serializer?
> >
>
> Attached is what I have right now, also available at
> http://www.theshell.com/~pavalos/wip/aic7xxx-locking2.patch
>
> Some questions:
>
> 1. I'm not quite understanding the interaction w/ bus_setup_intr and the
> serializer.  Is the usage correct in ahd_platform_intr, or should I be
> using lwkt_serialize_handler_enable somewhere?
>
> 2. How should the tsleep()s be handled?

Assum serializer 'ser' is held.

. ..
/* Your code */
. ..
crit_enter();
tsleep_interlock(your_cond);
lwkt_serialize_exit(ser);
error = tsleep(your_cond, 0, "name", to);
crit_exit();
lwkt_serialize_enter(ser);
. ..
/* Your code */
. ..

Best Regards,
sephe

-- 
Live Free or Die



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]