Re: enhanced spinlock debugging code for intel

Tachino Nobuhiro (tachino@open.nm.fujitsu.co.jp)
Fri, 03 Aug 2001 11:00:08 +0900


Hello,

At Thu, 02 Aug 2001 13:44:24 -0400,
Brent Baccala wrote:
>
> No longer any race (right?) and we don't lose anything since the one
> processor is about to drop the lock it (presumably) held. I wonder if
> it should check to make sure the same processor that grabbed the lock is
> releasing it. Not exactly a bug, and somebody might write code like
> that, but it seems suspicious. Comments?

last_lock_processor should be initialized as -1, or you have another
race.

cpu0 cpu1
----------------------------------------------------------------------------------------

last_lock_processor is 0

call spin_unlock...

asm(spin_lock_string)

call spin_lock...

if (spin_is_locked(lock)
&& lock->last_lock_processor == my_processor_id)

-------------------------------------------
last_lock_processor and my_processor_id are
both 0 here. So BUG() is called incorrectly.
-------------------------------------------

asm(spin_lock_string)

last_lock_processor = 1;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/