Subject: Re: Support for atomic locks in lock.h
To: Jason R Thorpe <thorpej@wasabisystems.com>
From: Wayne Knowles <wdk@netbsd.org>
List: port-mips
Date: 11/25/2001 18:37:07
On Sat, 24 Nov 2001, Jason R Thorpe wrote:

> Not really.  Here's what I would suggest:
>
> 	* Put an #ifdef _KERNEL / #else / #endif in each function
> 	  in <machine/lock.h>.  Make the kernel versions panic for
> 	  now (they're not needed unless you support MULTIPROCESSOR,
> 	  which the MIPS ports currently do not).  We can deal with
> 	  the kernel later.

Probably better not to define the functions for #ifdef KERNEL
and let the linker pick the problem up. (This is the current case)


> 	* For the !_KERNEL version, I suggest adding a sysctl that
> 	  has a some processor capabilities flags that you can cache.
> 	  Add a flag that indicates presence of LL/SC.

It sounds to me like the problem needs to be solved 2 ways:

R4000:
	- sysctl in __cpu_simple_lock_init to determine processor
	  capabilities
	- use LL/SC along with .set mips2 as suggested by Jason

R3000:
	- Implement restartable atomic sequences as suggested by Nathan
	- syscall to send details into kernel
	- look at using Hash techniques to improve scalability??

Given the development is occuring on a R4000 processor at present, I will
start with the LL/SC approach and come back to restartable atomic
sequences after I have completed the SA and LWP functionality.

-- 
Wayne Knowles			NetBSD/mipsco port maintainer
wdk@netbsd.org			http://www.netbsd.org