ahc/ahd locking

Sepherosa Ziehau sepherosa at gmail.com
Mon Dec 31 19:25:12 PST 2007


On Jan 1, 2008 8:19 AM, Peter Avalos <pavalos at 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





More information about the Kernel mailing list