Re: spin-locks

David Woodhouse (dwmw2@infradead.org)
Fri, 10 May 2002 15:17:50 +0100


root@chaos.analogic.com said:
> Well, here is code that worked on linux 2.2.17. Same CPUs, same
> everything... Just a different version of OS...

I suspect your code was protected by the BKL in 2.2.17, not by your
'spinlocks'.

root@chaos.analogic.com said:
> cli
> lock
> incb (lockf) # Bump lock-value

Ponder what happens if two CPUs get here at the same time. Lock count is
now two.

> 1: cmpb $1,(lockf) # See if we own it
> jnz 1b # Nope, spin until we do.

Now they both spin forever.

--
dwmw2

- 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/