From 298670b0dbb9069d963e836d6f9d4ecb70478a99 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Sat, 27 Aug 2011 05:25:47 -0700 Subject: [PATCH] use also the ticket lock workaround for irq save spinlocks --- include/metalsvm/spinlock.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/metalsvm/spinlock.h b/include/metalsvm/spinlock.h index af4a973d..a71be6be 100644 --- a/include/metalsvm/spinlock.h +++ b/include/metalsvm/spinlock.h @@ -183,10 +183,14 @@ inline static int spinlock_irqsave_lock(spinlock_irqsave_t* s) { return 0; } +#if 0 ticket = atomic_int32_inc(&s->queue); while (atomic_int32_read(&s->dequeue) != ticket) { NOP1; } +#else + while( atomic_int32_test_and_set(&s->dequeue,0) ); +#endif s->coreid = CORE_ID; s->flags = flags; @@ -211,7 +215,11 @@ inline static int spinlock_irqsave_unlock(spinlock_irqsave_t* s) { flags = s->flags; s->coreid = (uint32_t) -1; s->flags = 0; +#if 0 atomic_int32_inc(&s->dequeue); +#else + atomic_int32_set(&s->dequeue,1); +#endif irq_nested_enable(flags); }