lkml.org 
[lkml]   [1999]   [Dec]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectspin_trylock broken on UP?

I just wrote somes code that calls spin_trylock from interrupt
context, in bottom half code. My process context code uses just plain
spin_lock().

The idea is that if my interrupt can't get the lock without
contention, it will just give up. My code is structured so that a
lock held means that the work an interrupt would do is already in
progress anyway (i.e. some polling is going on at process context).

Since the interrupt is not going to block on the lock, I can avoid
cli()/sti() in my process-context code. I want this for latency
reasons.

I'm a little puzzled by the uniprocessor code for spinlocks in
include/asm-i386/spinlock.h. Parsing through the DEBUG_SPINLOCK
business, I see that default is to make all the spinlock operations
total NOPs. I expect that with DEBUG_SPINLOCK = 0, my code is totally
broken. It is OK with DEBUG_SPINLOCK is 1.

Conceptually, I think my code is valid. Am I missing an obvious
reason why spin_trylock shouldn't be allowed from an interrupt?

-- Buck

ps Please CC in responses. My reception of the mailing list is
unreliable lately.














-
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:55    [W:0.056 / U:0.264 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site