Add stoppcbs[] arrays on Alpha and sparc64 and have each CPU save its

current context in the IPI_STOP handler so that we can get accurate stack
traces of threads on other CPUs on these two archs like we do now on i386
and amd64.

Tested on:	alpha, sparc64
This commit is contained in:
John Baldwin 2005-11-03 21:08:20 +00:00
parent 55de4dcab6
commit 091e8307d0
5 changed files with 13 additions and 5 deletions

View File

@ -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;
}
}

View File

@ -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);

View File

@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$");
#include <machine/pcb.h>
#ifdef SMP
#if defined (__i386__) || defined(__amd64__)
#if defined (__i386__) || defined(__amd64__) || defined(__sparc64__) || defined(__alpha__)
#define HAVE_STOPPEDPCBS
#include <machine/smp.h>
#endif

View File

@ -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);

View File

@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$");
#include <machine/md_var.h>
#include <machine/metadata.h>
#include <machine/ofw_machdep.h>
#include <machine/pcb.h>
#include <machine/smp.h>
#include <machine/tick.h>
#include <machine/tlb.h>
@ -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) {