lkml.org 
[lkml]   [2000]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: down_trylock doesn't preserve irqstate
   Date: Sat, 26 Feb 2000 23:09:30 +0100
From: almesber@lrc.di.epfl.ch

Hmm, so sleep_on() no longer preserves cli/sti ? I knew sleep_on()
was deprecated, but not that it was broken ... (the ATM code still
has quite a few of them)

If it sleeps, no it does not preserve global cli/sti on SMP. It
preserves local cpu interrupt state only.

When you need to have global IRQs disabled while testing a sleep
state, you should use the wait queues properly, ala:

add_wait_queue(...);
save_flags(flags);
cli();
while(1) {
if (condition_met())
break;
if (signal_pending(...))
break;
... etc. ...
restore_flags(flags);
schedule();
cli();
}
restore_flags(flags);
remove_wait_queue(...);

This gives you precisely what you want, and guarentees that you
won't miss any wake events.

Even better, change your global cli to be real spin lock protection.

I really would like to see global cli removed from all spots where it
is not absolutely necessary (ATM is networking, so you have no excuse
here :-).

The only one subsystem which has an excuse to use global cli() is the
tty layer and drivers, but once that is threaded those cases can go
too. If we keep to this, soon enough global CLI can just die a
painless death.

Later,
David S. Miller
davem@redhat.com

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

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.059 / U:0.244 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site