Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2]: src/sys/arch/alpha Pull up following revision(s) (requested b...
details: https://anonhg.NetBSD.org/src/rev/0d71d0cd33fb
branches: netbsd-2
changeset: 564016:0d71d0cd33fb
user: tron <tron%NetBSD.org@localhost>
date: Mon Aug 29 00:57:12 2005 +0000
description:
Pull up following revision(s) (requested by riz in ticket #5623):
sys/arch/alpha/alpha/machdep.c: revision 1.287
sys/arch/alpha/alpha/trap.c: revision 1.98
sys/arch/alpha/include/pcb.h: revision 1.13
- Change FPCPU_LOCK() such that the caller is responsible for blocking
IPIs in the MULTIPROCESSOR case. Adjust all callers.
- In fpusave_cpu(), block IPIs for the entire duration (while we have
CPUF_FPUSAVE set in ci_flags) to fix the deadlock that leads to
"panic: fpsave ipi didn't", as described in PR port-alpha/26383.
Many thanks to Michael Hitch for the analysis and initial patch which
this one is derived from.
diffstat:
sys/arch/alpha/alpha/machdep.c | 27 ++++++++++++++++++---------
sys/arch/alpha/alpha/trap.c | 14 ++++++++++----
sys/arch/alpha/include/pcb.h | 24 ++++++------------------
3 files changed, 34 insertions(+), 31 deletions(-)
diffs (171 lines):
diff -r 1550b1b07dc4 -r 0d71d0cd33fb sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c Mon Aug 29 00:55:51 2005 +0000
+++ b/sys/arch/alpha/alpha/machdep.c Mon Aug 29 00:57:12 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.282.2.1 2004/07/10 13:07:56 tron Exp $ */
+/* $NetBSD: machdep.c,v 1.282.2.1.2.1 2005/08/29 00:57:12 tron Exp $ */
/*-
* Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.282.2.1 2004/07/10 13:07:56 tron Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.282.2.1.2.1 2005/08/29 00:57:12 tron Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1706,6 +1706,7 @@
KDASSERT(ci == curcpu());
#if defined(MULTIPROCESSOR)
+ s = splhigh(); /* block IPIs for the duration */
atomic_setbits_ulong(&ci->ci_flags, CPUF_FPUSAVE);
#endif
@@ -1720,16 +1721,17 @@
alpha_pal_wrfen(0);
- FPCPU_LOCK(&l->l_addr->u_pcb, s);
+ FPCPU_LOCK(&l->l_addr->u_pcb);
l->l_addr->u_pcb.pcb_fpcpu = NULL;
ci->ci_fpcurlwp = NULL;
- FPCPU_UNLOCK(&l->l_addr->u_pcb, s);
+ FPCPU_UNLOCK(&l->l_addr->u_pcb);
out:
#if defined(MULTIPROCESSOR)
atomic_clearbits_ulong(&ci->ci_flags, CPUF_FPUSAVE);
+ splx(s);
#endif
return;
}
@@ -1749,25 +1751,32 @@
KDASSERT(l->l_addr != NULL);
- FPCPU_LOCK(&l->l_addr->u_pcb, s);
+#if defined(MULTIPROCESSOR)
+ s = splhigh(); /* block IPIs for the duration */
+#endif
+ FPCPU_LOCK(&l->l_addr->u_pcb);
oci = l->l_addr->u_pcb.pcb_fpcpu;
if (oci == NULL) {
- FPCPU_UNLOCK(&l->l_addr->u_pcb, s);
+ FPCPU_UNLOCK(&l->l_addr->u_pcb);
+#if defined(MULTIPROCESSOR)
+ splx(s);
+#endif
return;
}
#if defined(MULTIPROCESSOR)
if (oci == ci) {
KASSERT(ci->ci_fpcurlwp == l);
- FPCPU_UNLOCK(&l->l_addr->u_pcb, s);
+ FPCPU_UNLOCK(&l->l_addr->u_pcb);
+ splx(s);
fpusave_cpu(ci, save);
return;
}
KASSERT(oci->ci_fpcurlwp == l);
alpha_send_ipi(oci->ci_cpuid, ipi);
- FPCPU_UNLOCK(&l->l_addr->u_pcb, s);
+ FPCPU_UNLOCK(&l->l_addr->u_pcb);
spincount = 0;
while (l->l_addr->u_pcb.pcb_fpcpu != NULL) {
@@ -1778,7 +1787,7 @@
}
#else
KASSERT(ci->ci_fpcurlwp == l);
- FPCPU_UNLOCK(&l->l_addr->u_pcb, s);
+ FPCPU_UNLOCK(&l->l_addr->u_pcb);
fpusave_cpu(ci, save);
#endif /* MULTIPROCESSOR */
}
diff -r 1550b1b07dc4 -r 0d71d0cd33fb sys/arch/alpha/alpha/trap.c
--- a/sys/arch/alpha/alpha/trap.c Mon Aug 29 00:55:51 2005 +0000
+++ b/sys/arch/alpha/alpha/trap.c Mon Aug 29 00:57:12 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: trap.c,v 1.92.2.2 2004/07/17 16:46:13 he Exp $ */
+/* $NetBSD: trap.c,v 1.92.2.2.2.1 2005/08/29 00:57:12 tron Exp $ */
/*-
* Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.92.2.2 2004/07/17 16:46:13 he Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.92.2.2.2.1 2005/08/29 00:57:12 tron Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -638,12 +638,18 @@
KDASSERT(l->l_addr->u_pcb.pcb_fpcpu == NULL);
#endif
- FPCPU_LOCK(&l->l_addr->u_pcb, s);
+#if defined(MULTIPROCESSOR)
+ s = splhigh(); /* block IPIs */
+#endif
+ FPCPU_LOCK(&l->l_addr->u_pcb);
l->l_addr->u_pcb.pcb_fpcpu = ci;
ci->ci_fpcurlwp = l;
- FPCPU_UNLOCK(&l->l_addr->u_pcb, s);
+ FPCPU_UNLOCK(&l->l_addr->u_pcb);
+#if defined(MULTIPROCESSOR)
+ splx(s);
+#endif
/*
* Instrument FP usage -- if a process had not previously
diff -r 1550b1b07dc4 -r 0d71d0cd33fb sys/arch/alpha/include/pcb.h
--- a/sys/arch/alpha/include/pcb.h Mon Aug 29 00:55:51 2005 +0000
+++ b/sys/arch/alpha/include/pcb.h Mon Aug 29 00:57:12 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcb.h,v 1.12 2003/06/29 22:28:05 fvdl Exp $ */
+/* $NetBSD: pcb.h,v 1.12.8.1 2005/08/29 00:57:12 tron Exp $ */
/*
* Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -64,25 +64,13 @@
struct simplelock pcb_fpcpu_slock; /* simple lock on fpcpu [SW] */
};
-#if defined(MULTIPROCESSOR)
/*
- * Need to block IPIs while holding the fpcpu_slock.
+ * MULTIPROCESSOR:
+ * Need to block IPIs while holding the fpcpu_slock. That is the
+ * responsibility of the CALLER!
*/
-#define FPCPU_LOCK(pcb, s) \
-do { \
- (s) = splhigh(); \
- simple_lock(&(pcb)->pcb_fpcpu_slock); \
-} while (/*CONSTCOND*/0)
-
-#define FPCPU_UNLOCK(pcb, s) \
-do { \
- simple_unlock(&(pcb)->pcb_fpcpu_slock); \
- splx((s)); \
-} while (/*CONSTCOND*/0)
-#else
-#define FPCPU_LOCK(pcb, s) simple_lock(&(pcb)->pcb_fpcpu_slock)
-#define FPCPU_UNLOCK(pcb, s) simple_unlock(&(pcb)->pcb_fpcpu_slock)
-#endif /* MULTIPROCESSOR */
+#define FPCPU_LOCK(pcb) simple_lock(&(pcb)->pcb_fpcpu_slock)
+#define FPCPU_UNLOCK(pcb) simple_unlock(&(pcb)->pcb_fpcpu_slock)
/*
* The pcb is augmented with machine-dependent additional data for
Home |
Main Index |
Thread Index |
Old Index