lkml.org 
[lkml]   [2006]   [Feb]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] Avoid calling down_read and down_write during startup
On Fri, 24 Feb 2006, Benjamin LaHaise wrote:

> On Thu, Feb 23, 2006 at 04:16:31PM -0800, Andrew Morton wrote:
> > down_write() unconditionally (and reasonably) does local_irq_enable() in
> > the uncontended case. And enabling local interrupts early in boot can
> > cause crashes.
>
> Why not do a down_write_trylock() instead first? Then the code doesn't
> have the dependancy on system_state, which seems horribly fragile.

I suggested this to Andrew. His reply was as follows:

> > which means we can't avoid calling down_write. The
> > only solution I can think of is to use down_write_trylock in the
> > blocking_notifier_chain_register and unregister routines, even though
> > doing that is a crock.
> >
> > Or else change __down_read and __down_write to use spin_lock_irqsave
> > instead of spin_lock_irq. What do you think would be best?
>
> Nothing's pretty. Perhaps look at system_state and not do any locking at all
> in early boot?

I admit that the whole things is fragile. IMO the safest approach would
be for __down_read and __down_write not to assume that interrupts are
currently enabled. But that would introduce more overhead as well; at
least this way the overhead is confined to the notifier chain registration
routines.

Alan Stern

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-02-24 16:06    [W:0.193 / U:0.184 seconds]
©2003-2014 Jasper Spaans. Advertise on this site