Subject: Re: timedwork
To: Andrew Doran <ad@netbsd.org>
From: Iain Hibbert <plunky@rya-online.net>
List: tech-kern
Date: 01/20/2007 22:17:39
On Sat, 20 Jan 2007, Andrew Doran wrote:

> > -	s = splsched();							\
> > +	s = splclock();							\
>
> I'm not sure about this change. splsched() seems more appropriate to me as
> it's a symbolic level.

I'm easy on that, but it seemed to me that splclock() is more appropriate
because the requirement is only to block hardclock(), which is IPL_CLOCK
interrupt?

> > error = ltsleep(q, PUSER - 1, "callout", 0, &callout_slock);
>
> Actually, thinking about it this could lead to deadlock. Since the lock
> order is sched_lock -> callout_slock, entering tsleep() at this point
> would acquire sched_lock while we already hold callout_slock.
[..]
> > wakeup(&timeout_work);
>
> There is the same lock order reversal here - callout_slock needs to be
> dropped before calling wakeup().

I'm confused now, I thought that was the point of the interlock that you
could do that?

What do you mean re the lock order?

iain