diff --git a/sys/alpha/alpha/mp_machdep.c b/sys/alpha/alpha/mp_machdep.c index c1b9706d8118..e548d4f5d39b 100644 --- a/sys/alpha/alpha/mp_machdep.c +++ b/sys/alpha/alpha/mp_machdep.c @@ -62,6 +62,7 @@ static volatile int aps_ready = 0; static struct mtx ap_boot_mtx; u_int64_t boot_cpu_id; +struct pcb stoppcbs[MAXCPU]; static void release_aps(void *dummy); static int smp_cpu_enabled(struct pcs *pcsp); @@ -543,11 +544,12 @@ smp_handle_ipi(struct trapframe *frame) case IPI_STOP: CTR0(KTR_SMP, "IPI_STOP"); - atomic_set_int(&stopped_cpus, cpumask); + savectx(&stoppcbs[PCPU_GET(cpuid)]); + atomic_set_acq_int(&stopped_cpus, cpumask); while ((started_cpus & cpumask) == 0) - alpha_mb(); - atomic_clear_int(&started_cpus, cpumask); - atomic_clear_int(&stopped_cpus, cpumask); + cpu_spinwait(); + atomic_clear_rel_int(&started_cpus, cpumask); + atomic_clear_rel_int(&stopped_cpus, cpumask); break; } } diff --git a/sys/alpha/include/smp.h b/sys/alpha/include/smp.h index 9660d098ee6b..9bfd0c6eec90 100644 --- a/sys/alpha/include/smp.h +++ b/sys/alpha/include/smp.h @@ -27,6 +27,7 @@ #ifndef LOCORE extern u_int64_t boot_cpu_id; +extern struct pcb stoppcbs[]; void ipi_selected(u_int cpus, u_int64_t ipi); void ipi_all(u_int64_t ipi); diff --git a/sys/kern/subr_kdb.c b/sys/kern/subr_kdb.c index 634343ce553e..2f5d1623d955 100644 --- a/sys/kern/subr_kdb.c +++ b/sys/kern/subr_kdb.c @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include #ifdef SMP -#if defined (__i386__) || defined(__amd64__) +#if defined (__i386__) || defined(__amd64__) || defined(__sparc64__) || defined(__alpha__) #define HAVE_STOPPEDPCBS #include #endif diff --git a/sys/sparc64/include/smp.h b/sys/sparc64/include/smp.h index b51425d07476..09b93d38eced 100644 --- a/sys/sparc64/include/smp.h +++ b/sys/sparc64/include/smp.h @@ -72,6 +72,8 @@ struct ipi_tlb_args { struct pcpu; +extern struct pcb stoppcbs[]; + void cpu_mp_bootstrap(struct pcpu *pc); void cpu_mp_shutdown(void); diff --git a/sys/sparc64/sparc64/mp_machdep.c b/sys/sparc64/sparc64/mp_machdep.c index 140f94416d38..ff2a0d4bd55d 100644 --- a/sys/sparc64/sparc64/mp_machdep.c +++ b/sys/sparc64/sparc64/mp_machdep.c @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -99,6 +100,7 @@ static ih_func_t cpu_ipi_stop; struct cpu_start_args cpu_start_args = { 0, -1, -1, 0, 0 }; struct ipi_cache_args ipi_cache_args; struct ipi_tlb_args ipi_tlb_args; +struct pcb stoppcbs[MAXCPU]; struct mtx ipi_mtx; @@ -395,6 +397,7 @@ cpu_ipi_stop(struct trapframe *tf) { CTR1(KTR_SMP, "cpu_ipi_stop: stopped %d", PCPU_GET(cpuid)); + savectx(&stoppcbs[PCPU_GET(cpuid)]); atomic_set_acq_int(&stopped_cpus, PCPU_GET(cpumask)); while ((started_cpus & PCPU_GET(cpumask)) == 0) { if ((shutdown_cpus & PCPU_GET(cpumask)) != 0) {