From 5e047d6b9648f2f52f53509d49d5a9a2495c5cdb Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Fri, 26 Aug 2011 03:11:58 -0700 Subject: [PATCH] bug in ticket lock! => switch (temporary) to a "normal" spinlock --- include/metalsvm/spinlock.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/metalsvm/spinlock.h b/include/metalsvm/spinlock.h index 50909bf8..af4a973d 100644 --- a/include/metalsvm/spinlock.h +++ b/include/metalsvm/spinlock.h @@ -92,12 +92,16 @@ inline static int spinlock_lock(spinlock_t* s) { return 0; } +#if 0 ticket = atomic_int32_inc(&s->queue); while(atomic_int32_read(&s->dequeue) != ticket) { NOP1; } s->owner = curr_task->id; s->counter = 1; +#else + while( atomic_int32_test_and_set(&s->dequeue,0) ); +#endif return 0; } @@ -114,7 +118,11 @@ inline static int spinlock_unlock(spinlock_t* s) { s->counter--; if (!s->counter) { s->owner = MAX_TASKS; +#if 0 atomic_int32_inc(&s->dequeue); +#else + atomic_int32_set(&s->dequeue,1); +#endif } return 0;