summaryrefslogtreecommitdiff
path: root/sys/arch/alpha
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-05-29 14:19:51 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-05-29 14:19:51 +0000
commit9fbf631ea4d32275e2a0b73042a7f5c42b84dddf (patch)
tree35a6f3a16e30d51a8bcd59b8df375c0d878e41b0 /sys/arch/alpha
parent3074148f150ad1764336ec65e48c9c96ac9404c9 (diff)
Kill SPINLOCK_SPIN_HOOK, use CPU_BUSY_CYCLE() instead.
ok visa@, kettenis@
Diffstat (limited to 'sys/arch/alpha')
-rw-r--r--sys/arch/alpha/alpha/lock_machdep.c7
-rw-r--r--sys/arch/alpha/alpha/machdep.c7
-rw-r--r--sys/arch/alpha/alpha/mutex.c6
-rw-r--r--sys/arch/alpha/include/cpu.h25
-rw-r--r--sys/arch/alpha/include/lock.h25
5 files changed, 32 insertions, 38 deletions
diff --git a/sys/arch/alpha/alpha/lock_machdep.c b/sys/arch/alpha/alpha/lock_machdep.c
index 21100c8c0ef..f9292e87ca0 100644
--- a/sys/arch/alpha/alpha/lock_machdep.c
+++ b/sys/arch/alpha/alpha/lock_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock_machdep.c,v 1.5 2017/04/30 16:45:45 mpi Exp $ */
+/* $OpenBSD: lock_machdep.c,v 1.6 2017/05/29 14:19:49 mpi Exp $ */
/*
* Copyright (c) 2007 Artur Grabowski <art@openbsd.org>
@@ -22,7 +22,6 @@
#include <machine/atomic.h>
#include <machine/cpu.h>
-#include <machine/lock.h>
#if defined(MP_LOCKDEBUG)
#ifndef DDB
@@ -69,14 +68,14 @@ __mp_lock_spin(struct __mp_lock *mpl)
{
#ifndef MP_LOCKDEBUG
while (mpl->mpl_count != 0)
- SPINLOCK_SPIN_HOOK;
+ CPU_BUSY_CYCLE();
#else
int nticks = __mp_lock_spinout;
if (!CPU_IS_PRIMARY(curcpu()))
nticks += nticks;
while (mpl->mpl_count != 0 && --nticks > 0)
- SPINLOCK_SPIN_HOOK;
+ CPU_BUSY_CYCLE();
if (nticks == 0) {
db_printf("__mp_lock(%p): lock spun out", mpl);
diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c
index 9a0db1004fe..57c7d0f2721 100644
--- a/sys/arch/alpha/alpha/machdep.c
+++ b/sys/arch/alpha/alpha/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.180 2017/04/30 16:45:45 mpi Exp $ */
+/* $OpenBSD: machdep.c,v 1.181 2017/05/29 14:19:49 mpi Exp $ */
/* $NetBSD: machdep.c,v 1.210 2000/06/01 17:12:38 thorpej Exp $ */
/*-
@@ -105,9 +105,6 @@
#ifndef NO_IEEE
#include <machine/ieeefp.h>
#endif
-#ifdef MULTIPROCESSOR
-#include <machine/lock.h>
-#endif
#include <dev/pci/pcivar.h>
@@ -1761,7 +1758,7 @@ fpusave_proc(struct proc *p, int save)
alpha_pal_swpipl(s);
while (p->p_addr->u_pcb.pcb_fpcpu != NULL)
- SPINLOCK_SPIN_HOOK;
+ CPU_BUSY_CYCLE();
#else
KASSERT(ci->ci_fpcurproc == p);
fpusave_cpu(ci, save);
diff --git a/sys/arch/alpha/alpha/mutex.c b/sys/arch/alpha/alpha/mutex.c
index ada28fad1cc..04dbf9cdfd3 100644
--- a/sys/arch/alpha/alpha/mutex.c
+++ b/sys/arch/alpha/alpha/mutex.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mutex.c,v 1.17 2017/04/20 13:57:29 visa Exp $ */
+/* $OpenBSD: mutex.c,v 1.18 2017/05/29 14:19:49 mpi Exp $ */
/*
* Copyright (c) 2004 Artur Grabowski <art@openbsd.org>
@@ -31,7 +31,7 @@
#include <sys/atomic.h>
#include <machine/intr.h>
-#include <machine/lock.h>
+#include <machine/cpu.h>
#include <ddb/db_output.h>
@@ -48,7 +48,7 @@ void
__mtx_enter(struct mutex *mtx)
{
while (__mtx_enter_try(mtx) == 0)
- SPINLOCK_SPIN_HOOK;
+ CPU_BUSY_CYCLE();
}
int
diff --git a/sys/arch/alpha/include/cpu.h b/sys/arch/alpha/include/cpu.h
index fb1dc79e045..bded5b32aa1 100644
--- a/sys/arch/alpha/include/cpu.h
+++ b/sys/arch/alpha/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.57 2016/03/30 15:39:46 afresh1 Exp $ */
+/* $OpenBSD: cpu.h,v 1.58 2017/05/29 14:19:49 mpi Exp $ */
/* $NetBSD: cpu.h,v 1.45 2000/08/21 02:03:12 thorpej Exp $ */
/*-
@@ -246,15 +246,36 @@ void cpu_pause_resume(unsigned long, int);
void cpu_pause_resume_all(int);
void cpu_unidle(struct cpu_info *);
+/*
+ * On the Alpha, interprocessor interrupts come in at device priority
+ * level. This can cause some problems while waiting for r/w spinlocks
+ * from a high'ish priority level: IPIs that come in will not be processed.
+ * This can lead to deadlock.
+ *
+ * This hook allows IPIs to be processed while a spinlock's interlock
+ * is released.
+ */
+#define CPU_BUSY_CYCLE() \
+do { \
+ struct cpu_info *__ci = curcpu(); \
+ int __s; \
+ \
+ if (__ci->ci_ipis != 0) { \
+ __s = splipi(); \
+ alpha_ipi_process_with_frame(__ci); \
+ splx(__s); \
+ } \
+} while (0)
+
#else /* ! MULTIPROCESSOR */
#define curcpu() (&cpu_info_primary)
#define CPU_IS_PRIMARY(ci) 1
#define cpu_unidle(ci) do { /* nothing */ } while (0)
+#define CPU_BUSY_CYCLE() do {} while (0)
#endif /* MULTIPROCESSOR */
-#define CPU_BUSY_CYCLE() do {} while (0)
#define curproc curcpu()->ci_curproc
#define fpcurproc curcpu()->ci_fpcurproc
diff --git a/sys/arch/alpha/include/lock.h b/sys/arch/alpha/include/lock.h
index 3ef8a5cb550..c2214df2f71 100644
--- a/sys/arch/alpha/include/lock.h
+++ b/sys/arch/alpha/include/lock.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: lock.h,v 1.9 2015/02/11 03:56:00 dlg Exp $ */
+/* $OpenBSD: lock.h,v 1.10 2017/05/29 14:19:49 mpi Exp $ */
/* $NetBSD: lock.h,v 1.16 2001/12/17 23:34:57 thorpej Exp $ */
/*-
@@ -38,27 +38,4 @@
#ifndef _MACHINE_LOCK_H_
#define _MACHINE_LOCK_H_
-#if defined(MULTIPROCESSOR)
-/*
- * On the Alpha, interprocessor interrupts come in at device priority
- * level. This can cause some problems while waiting for r/w spinlocks
- * from a high'ish priority level: IPIs that come in will not be processed.
- * This can lead to deadlock.
- *
- * This hook allows IPIs to be processed while a spinlock's interlock
- * is released.
- */
-#define SPINLOCK_SPIN_HOOK \
-do { \
- struct cpu_info *__ci = curcpu(); \
- int __s; \
- \
- if (__ci->ci_ipis != 0) { \
- __s = splipi(); \
- alpha_ipi_process_with_frame(__ci); \
- splx(__s); \
- } \
-} while (0)
-#endif /* MULTIPROCESSOR */
-
#endif /* _MACHINE_LOCK_H_ */