Subject: Re: SMP API things, lock debugging, etc.
To: None <eeh@netbsd.org>
From: Stefan Grefen <Stefan.Grefen@tantau.com>
List: tech-smp
Date: 07/27/1999 19:31:26
"Eduardo E. Horvath" wrote:
>
[...]
> Are all locks spinlocks? What about stealing the adaptive mutex concept
> from Solaris?
They can be build in a MI way using those MD spinlocks. All you need is
a spinlock
(that should block all interrupts on THIS cpu) and you can build those
mutexes.
On this level only a CPU can be owner of a lock. Anything that goes to
sleep
should never hold a spin lock while sleeping.
[..]
> >
> > #if defined(MULTIPROCESSOR)
> > #define curproc cpu_info[cpu_number()].ci_curproc
> > #else
> > extern struct proc *curproc;
> > #endif
> >
>
> Why not just have a function that returns a pointer to the current
> cpu_info structure? Array indexing may require rather expensive
> multiplication if the cpu_info structure is not a power of 2.
I think each CPU should have a private page mapped at the same VA,
containing
the cpu_info struct or at least the pointer to it's curproc.
Alternatively we could make the cpu_info an array of pointers.
I would prefer the private page, because this would be only one instead
of
2 pointer lookups.
Stefan
>
> =========================================================================
> Eduardo Horvath eeh@one-o.com
> "I need to find a pithy new quote." -- me
--
Stefan Grefen Tantau Software
International Inc.
stefan.grefen@tantau.com
--- Hacking's just another word for nothing left to kludge. ---