login
Header Space

 
 

Re: Interrupt, interrupt threads, continuations, and kernel lwps

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Matt Thomas <matt@...>
Cc: <tech-kern@...>
Date: Wednesday, February 21, 2007 - 6:09 am

Hi Matt,

On Wed, Feb 21, 2007 at 12:08:36AM -0800, Matt Thomas wrote:


Fair enough, but why so?


I gave this a lot of thought too. As a general solution, I really don't like
it because it is unnecessarily expensive, both in terms of execution time
and (perhaps more importantly) the effort involved in converting all of our
drivers to work this way. Conversely, the changes I have to handle
interrupts using LWPs add 29 instructions to a typical interrupt chain on
x86, to swap stack and curlwp. It works, and it's a solution that can just
be "dropped in".

To reiterate, there are two reasons I want to use LWPs to handle interrupts:
signficantly cheaper locking primitives on MP systems, and the ability to
eliminate the nasty deadlocks associated with interrupts/MP and interrupt
priority levels. The intent is *not* to rely heavily on blocking as the main
synchronization mechanism between the top and bottom halfs. That's why in
the near term I want to preseve the SPL system for places where it really
does matter. I did a lot of profiling to see where we would need to do this,
and the network stack is once place.


To add a bit of information about what I am proposing: the interrupt
priority levels continue to exist, and map onto scheduling priorities.
Interrupts at or below IPL_VM are provided with LWP context on execution,
above that level things would work (for the most part) as they do now,
with spinlocks being used to provide MP atomicity where needed.

To contrast a bit with the FreeBSD implementation, since it has been said we
are going to endure the same kind of performance degredation they have seen:
interrupts involve a lengthy path through C code, after which (from my
reading) a thread is scheduled to handle the interrupt, and the preempted
thread yields the CPU via mi_switch(). That involves taking multiple locks
along the way, touching lots of additional cache lines, making multiple
context switches and so on.

Cheers,
Andrew
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Interrupt, interrupt threads, continuations, and kernel ..., Joerg Sonnenberger, (Thu Feb 22, 5:59 pm)
Re: Interrupt, interrupt threads, continuations, and kernel ..., Steven M. Bellovin, (Wed Feb 21, 10:21 pm)
Re: Interrupt, interrupt threads, continuations, and kernel ..., Andrew Doran, (Wed Feb 21, 6:09 am)
speck-geostationary