Subject: Re: Heads up
To: Iain Hibbert <plunky@rya-online.net>
From: Andrew Doran <ad@netbsd.org>
List: current-users
Date: 12/03/2007 18:21:59
On Mon, Dec 03, 2007 at 03:56:56PM +0000, Iain Hibbert wrote:
> On Mon, 3 Dec 2007, Andrew Doran wrote:
>
> > I just made a jumbo commit with changes to interrupt handling. While it has
> > seen testing on numerous ports, there are likely to be some problems.
>
> can you make a quick summary of these changes?
A description is here, although I didn't do the rename (vm -> low, sched ->
mid) as that seemed a bit pointless:
http://mail-index.netbsd.org/tech-kern/2007/05/05/0005.html
- It's now safe to use spinlocks initialized for any of the hardware ipls
(IPL_VM, IPL_SCHED, IPL_HIGH). Previously this was difficult to get right
and so prone to deadlock because of interrupts and ordering constraints
against the global kernel_lock. Those constraints are by and large gone
now. So basically, you can spinlock against a driver's interrupt handler
and don't have to worry about nasty lock ordering issues against
kernel_lock any more: you just need to worry about what your local locking
is doing.
- Soft interrupts are now threaded, so it's possible to take adaptive mutexes
and reader/writer locks from a soft interrupt (for example, in a callout).
These have no ordering constraint against kernel_lock and so are "deadlock
free" in that respect.
To sum up, the newlock2 changes made it possible to use lightweight locks to
synchronize with other threads. This change makes it easy to use the same
locks to synchronize with other threads _and_ interrupt handlers.
Thanks,
Andrew