Subject: Re: Support for atomic locks in lock.h
To: Nathan J. Williams <nathanw@wasabisystems.com>
From: Wayne Knowles <wdk@netbsd.org>
List: port-mips
Date: 11/25/2001 16:44:15
On 24 Nov 2001, Nathan J. Williams wrote:

> One thing to wonder about is whether we need to worry about SMP
> systems using the processors without ll/sc (I think that the Tandem
> Integrity S300 is a MP R3000 system, for example). Those systems will
> hurt our heads a lot; I have to imagine that they have some extra
> hardware in the interface between the CPU and the system bus that
> provides locking capabilites.
>
> However, for uniprocessor R3000 systems, we could use "restartable
> sections" for moderately cheap userlevel atomicity, and we don't use
> __cpu_simple_locks in the kernel on uniprocessor systems. SAs and
> restartable sections have some bits in common, and I think they could
> be made to work together.

I assume you are refering to "Optimistic" techniques as outlined in the
paper "Fast Mutual Exclusion for Uniprocessors" available at:

http://www.cs.cmu.edu/afs/cs/project/mach/public/doc/published/Rcs.ps

> I think we'd want to use the ld.so.conf/sysctl trick to select between
> versions of the pthread library based on the presence of ll/sc.

That could work.  We don't inline the __cpu_simple_lock functions and
move them to a seperate library (r3k and r4k versions).

If we could control the address of the test-and-set function we can teach
the kernel to be aware of the restartable section when it sees it in the
PC during a context switch.

--
Wayne