spinlock __raw_spin_unlock : comment disagrees with Wikipedia article
From: David Schwartz
Date: Wed Feb 22 2006 - 19:50:37 EST
The code for __raw_spin_unlock contains the following comment:
/*
* __raw_spin_unlock based on writing $1 to the low byte.
* This method works. Despite all the confusion.
* (except on PPro SMP or if we are using OOSTORE, so we use xchgb there)
* (PPro errata 66, 92)
*/
Yet the Wikipedia article on spinlocks says:
http://en.wikipedia.org/wiki/Spinlock
"In theory, spin_unlock could use an unlocked MOV instead of the locked
XCHG, however some processors (notably, some Cyrix processors and some
revisions of the Intel Pentium III) will do the wrong thing and data
protected by the lock could be corrupted."
Does anyone know for sure who is right? I assume if the Linux kernel was
wrong, it would probably be blowing up by now. Or does it rely on something
that isn't guaranteed but happens to work on all current hardware? Or
perhaps it's some kind of very rare issue. What is the source for the
comment about "some revisions of the Intel Pentium II"? Does one know?
Is 'movb' okay, but perhaps some other type of instructions might not
work, such as a 32-bit operation?
DS
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/