summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiod Vallat <miod@cvs.openbsd.org>2007-10-29 19:57:49 +0000
committerMiod Vallat <miod@cvs.openbsd.org>2007-10-29 19:57:49 +0000
commit620a052131b46dc5d8fcb9070b1bb7d96e610850 (patch)
treef91df96ffa1b5e752efcfe36843a2b6812285509
parent40bcb62b105c1d656ffb72880e71291f8f1e0321 (diff)
When a secondary cpu gets its interrupt pin stuck, be sure to savectx
and put the process it was running back on the run queue (unless this was the idle proc).
-rw-r--r--sys/arch/m88k/include/cpu.h3
-rw-r--r--sys/arch/m88k/m88k/m88k_machdep.c43
-rw-r--r--sys/arch/mvme88k/mvme88k/m188_machdep.c6
3 files changed, 47 insertions, 5 deletions
diff --git a/sys/arch/m88k/include/cpu.h b/sys/arch/m88k/include/cpu.h
index a3aa4f9e2b2..2b3e95e81a2 100644
--- a/sys/arch/m88k/include/cpu.h
+++ b/sys/arch/m88k/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.26 2007/10/24 20:53:59 miod Exp $ */
+/* $OpenBSD: cpu.h,v 1.27 2007/10/29 19:57:46 miod Exp $ */
/*
* Copyright (c) 1996 Nivas Madhur
* Copyright (c) 1992, 1993
@@ -137,6 +137,7 @@ curcpu(void)
#define CPU_IS_PRIMARY(ci) ((ci)->ci_primary != 0)
void cpu_boot_secondary_processors(void);
+__dead void cpu_emergency_disable(void);
void m88k_send_ipi(int, cpuid_t);
void m88k_broadcast_ipi(int);
diff --git a/sys/arch/m88k/m88k/m88k_machdep.c b/sys/arch/m88k/m88k/m88k_machdep.c
index 8e3c7a0bcd5..a6a90aec410 100644
--- a/sys/arch/m88k/m88k/m88k_machdep.c
+++ b/sys/arch/m88k/m88k/m88k_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m88k_machdep.c,v 1.24 2007/10/28 19:42:11 miod Exp $ */
+/* $OpenBSD: m88k_machdep.c,v 1.25 2007/10/29 19:57:48 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -442,3 +442,44 @@ vector_init(m88k_exception_vector_area *vbr, u_int32_t *vector_init_list)
/* GCC will by default produce explicit trap 503 for division by zero */
SET_VECTOR(503, vector_init_list[8]);
}
+
+#ifdef MULTIPROCESSOR
+
+/*
+ * This function is invoked when it turns out one secondary processor is
+ * not usable.
+ * Be sure to put the process currently running on it in the run queues,
+ * so that another processor can take care of it.
+ */
+__dead void
+cpu_emergency_disable()
+{
+ struct cpu_info *ci = curcpu();
+ struct schedstate_percpu *spc = &ci->ci_schedstate;
+ struct proc *p = curproc;
+ int s;
+ extern void savectx(struct pcb *);
+
+ if (p != NULL && p != spc->spc_idleproc) {
+ savectx(curpcb);
+
+ /*
+ * The following is an inline yield(), without the call
+ * to mi_switch().
+ */
+ SCHED_LOCK(s);
+ p->p_priority = p->p_usrpri;
+ p->p_stat = SRUN;
+ setrunqueue(p);
+ p->p_stats->p_ru.ru_nvcsw++;
+ SCHED_UNLOCK(s);
+ }
+
+ set_psr(get_psr() | PSR_IND);
+ splhigh();
+
+ for (;;) ;
+ /* NOTREACHED */
+}
+
+#endif /* MULTIPROCESSOR */
diff --git a/sys/arch/mvme88k/mvme88k/m188_machdep.c b/sys/arch/mvme88k/mvme88k/m188_machdep.c
index 82b7512ea45..f43f09077b2 100644
--- a/sys/arch/mvme88k/mvme88k/m188_machdep.c
+++ b/sys/arch/mvme88k/mvme88k/m188_machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: m188_machdep.c,v 1.32 2007/05/19 20:50:06 miod Exp $ */
+/* $OpenBSD: m188_machdep.c,v 1.33 2007/10/29 19:57:48 miod Exp $ */
/*
* Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr.
* Copyright (c) 1996 Nivas Madhur
@@ -484,8 +484,8 @@ m188_ext_int(u_int v, struct trapframe *eframe)
if (++problems >= 10) {
printf("cpu%d: interrupt pin won't clear, "
"disabling processor\n", cpu);
- set_psr(get_psr() | PSR_IND);
- for (;;) ;
+ cpu_emergency_disable();
+ /* NOTREACHED */
}
}
#endif