Messages in this thread | | | Date | Thu, 9 Dec 1999 13:05:57 -0800 | From | "Charles 'Buck' Krasic" <> | Subject | spin_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/
| |