Store in globaldata our CPU ID#. Provide a lock for panics - only one

CPU can panic at a time.
Obtained from:Andrew Gallatin <gallatin@cs.duke.edu>
This commit is contained in:
mjacob 2000-12-09 20:52:42 +00:00
parent 31a5760aa2
commit 036f9ff7a3
6 changed files with 11 additions and 0 deletions

View File

@ -282,6 +282,7 @@ globaldata_init(struct globaldata *globaldata, int cpuno, size_t sz)
globaldata->gd_other_cpus = all_cpus & ~(1 << cpuno); globaldata->gd_other_cpus = all_cpus & ~(1 << cpuno);
globaldata->gd_next_asn = 0; globaldata->gd_next_asn = 0;
globaldata->gd_current_asngen = 1; globaldata->gd_current_asngen = 1;
globaldata->gd_cpuid = cpuno;
cpuno_to_globaldata[cpuno] = globaldata; cpuno_to_globaldata[cpuno] = globaldata;
} }
@ -369,10 +370,14 @@ s_lock_try(struct simplelock *lkp)
/* lock around the MP rendezvous */ /* lock around the MP rendezvous */
static struct simplelock smp_rv_lock; static struct simplelock smp_rv_lock;
/* only 1 CPU can panic at a time :) */
struct simplelock panic_lock;
static void static void
init_locks(void) init_locks(void)
{ {
s_lock_init(&smp_rv_lock); s_lock_init(&smp_rv_lock);
s_lock_init(&panic_lock);
} }
void void

View File

@ -62,6 +62,7 @@ struct globaldata {
u_int gd_astpending; u_int gd_astpending;
SLIST_ENTRY(globaldata) gd_allcpu; SLIST_ENTRY(globaldata) gd_allcpu;
int gd_witness_spin_check; int gd_witness_spin_check;
u_int gd_cpuid;
#ifdef KTR_PERCPU #ifdef KTR_PERCPU
volatile int gd_ktr_idx; /* Index into trace table */ volatile int gd_ktr_idx; /* Index into trace table */
char *gd_ktr_buf; char *gd_ktr_buf;

View File

@ -55,6 +55,8 @@ s_unlock(struct simplelock *lkp)
lkp->lock_data = 0; lkp->lock_data = 0;
} }
extern struct simplelock panic_lock;
#if !defined(SIMPLELOCK_DEBUG) && MAXCPU > 1 #if !defined(SIMPLELOCK_DEBUG) && MAXCPU > 1
/* /*
* This set of defines turns on the real functions in i386/isa/apic_ipl.s. * This set of defines turns on the real functions in i386/isa/apic_ipl.s.

View File

@ -62,6 +62,7 @@ struct globaldata {
u_int gd_astpending; u_int gd_astpending;
SLIST_ENTRY(globaldata) gd_allcpu; SLIST_ENTRY(globaldata) gd_allcpu;
int gd_witness_spin_check; int gd_witness_spin_check;
u_int gd_cpuid;
#ifdef KTR_PERCPU #ifdef KTR_PERCPU
volatile int gd_ktr_idx; /* Index into trace table */ volatile int gd_ktr_idx; /* Index into trace table */
char *gd_ktr_buf; char *gd_ktr_buf;

View File

@ -62,6 +62,7 @@ struct globaldata {
u_int gd_astpending; u_int gd_astpending;
SLIST_ENTRY(globaldata) gd_allcpu; SLIST_ENTRY(globaldata) gd_allcpu;
int gd_witness_spin_check; int gd_witness_spin_check;
u_int gd_cpuid;
#ifdef KTR_PERCPU #ifdef KTR_PERCPU
volatile int gd_ktr_idx; /* Index into trace table */ volatile int gd_ktr_idx; /* Index into trace table */
char *gd_ktr_buf; char *gd_ktr_buf;

View File

@ -62,6 +62,7 @@ struct globaldata {
u_int gd_astpending; u_int gd_astpending;
SLIST_ENTRY(globaldata) gd_allcpu; SLIST_ENTRY(globaldata) gd_allcpu;
int gd_witness_spin_check; int gd_witness_spin_check;
u_int gd_cpuid;
#ifdef KTR_PERCPU #ifdef KTR_PERCPU
volatile int gd_ktr_idx; /* Index into trace table */ volatile int gd_ktr_idx; /* Index into trace table */
char *gd_ktr_buf; char *gd_ktr_buf;