Subject: Re: SMP API things, lock debugging, etc.
To: Jason Thorpe <thorpej@nas.nasa.gov>
From: Bill Sommerfeld <sommerfeld@orchard.arlington.ma.us>
List: tech-smp
Date: 07/27/1999 05:53:48
> The following functions or macros will be exported by <machine/lock.h>:
>
> void cpu_simple_lock_init(__volatile struct simplelock *alp);
> void cpu_simple_lock(__volatile struct simplelock *alp);
while (alp->lock_data != 0) /* spin */;
alp->lock_data = 1;
> int cpu_simple_lock_try(__volatile struct simplelock *alp);
> void cpu_simple_unlock(__volatile struct simplelock *alp);
...
> alp->lock_data = 0;
Is the intent here that lock_data always be "1" for locked and "0" for
unlocked? Is it intended to be OK for code to examine lock_data
directly? or should only cpu_simple_lock_try be used for that?
On one architecture I'm aware of, it's more convenient for "0" to mean
locked and "1" to mean unlocked (PA-RISC, which does have MP systems;
also, some people have expressed interest in a port to the PA in the
past).
- Bill