summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2007-10-18 20:44:48 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2007-10-18 20:44:48 +0000
commit6f1c71b9977ec4838e8a0f2afa8e50cb199998ac (patch)
treeca44c19be21547752322695019a186792256a473 /sys
parente67049c7109f02116e7819328dcfd9022c92ae9b (diff)
Don't try to send IPIs to CPUs that aren't running (yet).
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sparc64/include/cpu.h5
-rw-r--r--sys/arch/sparc64/sparc64/cpu.c10
-rw-r--r--sys/arch/sparc64/sparc64/ipifuncs.c12
-rw-r--r--sys/arch/sparc64/sparc64/pmap.c3
4 files changed, 17 insertions, 13 deletions
diff --git a/sys/arch/sparc64/include/cpu.h b/sys/arch/sparc64/include/cpu.h
index b888013280d..dc2f6f8c736 100644
--- a/sys/arch/sparc64/include/cpu.h
+++ b/sys/arch/sparc64/include/cpu.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.h,v 1.48 2007/10/16 19:22:49 kettenis Exp $ */
+/* $OpenBSD: cpu.h,v 1.49 2007/10/18 20:44:47 kettenis Exp $ */
/* $NetBSD: cpu.h,v 1.28 2001/06/14 22:56:58 thorpej Exp $ */
/*
@@ -113,6 +113,7 @@ struct cpu_info {
struct proc *ci_fpproc;
int ci_number;
+ int ci_flags;
int ci_upaid;
int ci_node;
struct schedstate_percpu ci_schedstate; /* scheduler state */
@@ -131,6 +132,8 @@ struct cpu_info {
paddr_t ci_paddr; /* Phys addr of this structure. */
};
+#define CPUF_RUNNING 0x0001 /* CPU is running */
+
extern struct cpu_info *cpus;
#define curpcb curcpu()->ci_cpcb
diff --git a/sys/arch/sparc64/sparc64/cpu.c b/sys/arch/sparc64/sparc64/cpu.c
index a6320524dc6..e308290d961 100644
--- a/sys/arch/sparc64/sparc64/cpu.c
+++ b/sys/arch/sparc64/sparc64/cpu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cpu.c,v 1.24 2007/10/17 21:23:28 kettenis Exp $ */
+/* $OpenBSD: cpu.c,v 1.25 2007/10/18 20:44:47 kettenis Exp $ */
/* $NetBSD: cpu.c,v 1.13 2001/05/26 21:27:15 chs Exp $ */
/*
@@ -383,7 +383,6 @@ struct cfdriver cpu_cd = {
#ifdef MULTIPROCESSOR
void cpu_mp_startup(void);
-volatile int cpu_mp_started;
void
cpu_boot_secondary_processors(void)
@@ -406,13 +405,10 @@ cpu_boot_secondary_processors(void)
for (i = 0; i < 2000; i++) {
sparc_membar(Sync);
- if (cpu_mp_started == 1)
+ if (ci->ci_flags & CPUF_RUNNING)
break;
delay(10000);
}
-
- cpu_mp_started = 0;
- sparc_membar(Sync);
}
}
@@ -424,7 +420,7 @@ cpu_hatch(void)
printf("cpu%d running\n", cpu_number());
cpu_reset_fpustate();
- cpu_mp_started = 1;
+ curcpu()->ci_flags |= CPUF_RUNNING;
sparc_membar(Sync);
s = splhigh();
diff --git a/sys/arch/sparc64/sparc64/ipifuncs.c b/sys/arch/sparc64/sparc64/ipifuncs.c
index 405db9feb83..501569b2e33 100644
--- a/sys/arch/sparc64/sparc64/ipifuncs.c
+++ b/sys/arch/sparc64/sparc64/ipifuncs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipifuncs.c,v 1.2 2007/09/10 21:44:06 kettenis Exp $ */
+/* $OpenBSD: ipifuncs.c,v 1.3 2007/10/18 20:44:47 kettenis Exp $ */
/* $NetBSD: ipifuncs.c,v 1.8 2006/10/07 18:11:36 rjs Exp $ */
/*-
@@ -112,9 +112,13 @@ sparc64_broadcast_ipi(void (*func)(void), u_int64_t arg0, u_int64_t arg1)
{
struct cpu_info *ci;
- for (ci = cpus; ci != NULL; ci = ci->ci_next)
- if (ci->ci_number != cpu_number())
- sparc64_send_ipi(ci->ci_upaid, func, arg0, arg1);
+ for (ci = cpus; ci != NULL; ci = ci->ci_next) {
+ if (ci->ci_number == cpu_number())
+ continue;
+ if ((ci->ci_flags & CPUF_RUNNING) == 0)
+ continue;
+ sparc64_send_ipi(ci->ci_upaid, func, arg0, arg1);
+ }
}
void
diff --git a/sys/arch/sparc64/sparc64/pmap.c b/sys/arch/sparc64/sparc64/pmap.c
index 0c03c10aa44..b58e0f79d28 100644
--- a/sys/arch/sparc64/sparc64/pmap.c
+++ b/sys/arch/sparc64/sparc64/pmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pmap.c,v 1.44 2007/10/17 21:23:28 kettenis Exp $ */
+/* $OpenBSD: pmap.c,v 1.45 2007/10/18 20:44:47 kettenis Exp $ */
/* $NetBSD: pmap.c,v 1.107 2001/08/31 16:47:41 eeh Exp $ */
#undef NO_VCACHE /* Don't forget the locked TLB in dostart */
/*
@@ -1401,6 +1401,7 @@ remap_data:
cpus->ci_cpcb = (struct pcb *)u0[0]; /* Need better source */
cpus->ci_upaid = CPU_UPAID;
cpus->ci_number = 0;
+ cpus->ci_flags = CPUF_RUNNING;
cpus->ci_fpproc = NULL;
cpus->ci_spinup = main; /* Call main when we're running. */
cpus->ci_initstack = (void *)u0[1];