diff options
author | Mark Kettenis <kettenis@cvs.openbsd.org> | 2012-08-30 20:57:01 +0000 |
---|---|---|
committer | Mark Kettenis <kettenis@cvs.openbsd.org> | 2012-08-30 20:57:01 +0000 |
commit | f3345e1919c23eb94f6bdef92f1745f2743438e7 (patch) | |
tree | 7686e0fe72435a209164222cfc2efafe82b663c5 /sys/arch/sparc64 | |
parent | b2771f92dab5427a6f633e3a766f0f67fe096ac0 (diff) |
On SPARC64 VI/VII CPUs, use the sleep instruction while spinning to force a
thread switch in the hope the other thread can do some useful work.
Diffstat (limited to 'sys/arch/sparc64')
-rw-r--r-- | sys/arch/sparc64/sparc64/lock_machdep.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/arch/sparc64/sparc64/lock_machdep.c b/sys/arch/sparc64/sparc64/lock_machdep.c index 7577eda10c1..08b07682b3e 100644 --- a/sys/arch/sparc64/sparc64/lock_machdep.c +++ b/sys/arch/sparc64/sparc64/lock_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lock_machdep.c,v 1.1 2007/11/27 23:29:57 kettenis Exp $ */ +/* $OpenBSD: lock_machdep.c,v 1.2 2012/08/30 20:57:00 kettenis Exp $ */ /* * Copyright (c) 2007 Artur Grabowski <art@openbsd.org> @@ -43,7 +43,19 @@ __mp_lock_init(struct __mp_lock *lock) extern int __mp_lock_spinout; #endif -#define SPINLOCK_SPIN_HOOK /**/ +static __inline void +__mp_lock_spin_hook(void) +{ + __asm __volatile( + "999: nop \n" + " .section .sun4u_mtp_patch, \"ax\" \n" + " .word 999b \n" + " .word 0x81b01060 ! sleep \n" + " .previous \n" + : : : "memory"); +} + +#define SPINLOCK_SPIN_HOOK __mp_lock_spin_hook() static __inline void __mp_lock_spin(struct __mp_lock *mpl) |