login
Header Space

 
 

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

Score:
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: <jonathan@...>, Jason Thorpe <thorpej@...>, Matt Thomas <matt@...>, <tech-kern@...>
Date: Thursday, February 22, 2007 - 12:44 pm

On Wed, Feb 21, 2007 at 09:48:25PM -0800, Bill Studenmund wrote:


In that case, CPU2 would busy-wait until it gets the mutex. Blocking
unconditionally would be expensive. In order to be able to release a mutex
without using atomic instructions, we actually can't easily block while a
running LWP holds it. They block in two cases:

- the owner is not running on a CPU anywhere in the system
- the owner is spinning on the kernel_lock; we yield to prevent deadlock

In most cases blocking should be the exception to the rule, but there are
situations where that kind of approach would kill us with context switching,
so in the interim we still need to ability to do:

	s = splfoo();
	mutex_enter(&foo_mutex);
	... do something ...
	mutex_exit(&foo_mutex);
	splx(s);

Longer term we need to deal with those kinds of concurrency problems on a
case-by-case basis.

The reader / writer locks always use blocking to synchronize, so they're not
really useful for synchronization from an interrupt handler. At a minimum,
you don't want to try and grab a write hold on the lock from an ISR; there
could be lots of readers to drain out before it's acquired.

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 ..., Andrew Doran, (Thu Feb 22, 12:44 pm)
Re: Interrupt, interrupt threads, continuations, and kernel ..., Steven M. Bellovin, (Wed Feb 21, 10:21 pm)
speck-geostationary