Re: spin-locks

Richard B. Johnson (root@chaos.analogic.com)
Fri, 10 May 2002 10:28:55 -0400 (EDT)


On Fri, 10 May 2002, David Woodhouse wrote:

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

Yep. You are correct. Obvious bug that went undetected for over
a year.

Cheers,
Dick Johnson

Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).

Windows-2000/Professional isn't.

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