Subject: CVS commit: src/sys/arch
To: None <source-changes@NetBSD.org>
From: Jason R Thorpe <thorpej@netbsd.org>
List: source-changes
Date: 03/09/2007 19:21:59
Module Name:	src
Committed By:	thorpej
Date:		Fri Mar  9 19:21:59 UTC 2007

Modified Files:
	src/sys/arch/arm/arm: arm_machdep.c
	src/sys/arch/arm/arm32: genassym.cf irq_dispatch.S
	src/sys/arch/arm/conf: files.arm
	src/sys/arch/arm/include: mutex.h
	src/sys/arch/arm/include/arm32: frame.h
	src/sys/arch/arm/iomd: iomd_irq.S
	src/sys/arch/arm/ofw: ofw_irq.S
	src/sys/arch/arm/sa11x0: sa11x0_irq.S
	src/sys/arch/arm/xscale: i80200_irq.S
	src/sys/arch/shark/isa: isa_irq.S

Log Message:
Rewrite the ARM mutex implementation to be of the simple-mutex variety.
Because pre-v6 ARM lacks support for an atomic compare-and-swap, we
implement _lock_cas() as a restartable atomic squence that is checked
in the IRQ handler right before AST processing.  (This is safe because,
for all practical purposes, there are no SMP pre-v6 ARM systems.)

This can serve as a model for other non-MP platforms that lack the
necessary atomic operations for mutexes (SuperH, for example).

Upshots of this change:
- kmutex_t is now down to 8 bytes on ARM; about as good as we can get.
- ARM2 systems don't have to trap and emulate SWP or SWPB for mutexes.

The acorn26 port is not updated by this commit to do the LOCK_CAS_CHECK.
That is left as an exercise for the port maintainer.

Reviewed and tested by Matt Thomas.


To generate a diff of this commit:
cvs rdiff -r1.13 -r1.14 src/sys/arch/arm/arm/arm_machdep.c
cvs rdiff -r1.31 -r1.32 src/sys/arch/arm/arm32/genassym.cf
cvs rdiff -r1.7 -r1.8 src/sys/arch/arm/arm32/irq_dispatch.S
cvs rdiff -r1.82 -r1.83 src/sys/arch/arm/conf/files.arm
cvs rdiff -r1.6 -r1.7 src/sys/arch/arm/include/mutex.h
cvs rdiff -r1.14 -r1.15 src/sys/arch/arm/include/arm32/frame.h
cvs rdiff -r1.5 -r1.6 src/sys/arch/arm/iomd/iomd_irq.S
cvs rdiff -r1.6 -r1.7 src/sys/arch/arm/ofw/ofw_irq.S
cvs rdiff -r1.9 -r1.10 src/sys/arch/arm/sa11x0/sa11x0_irq.S
cvs rdiff -r1.13 -r1.14 src/sys/arch/arm/xscale/i80200_irq.S
cvs rdiff -r1.6 -r1.7 src/sys/arch/shark/isa/isa_irq.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.