diff options
author | jake <jake@FreeBSD.org> | 2001-01-21 19:25:07 +0000 |
---|---|---|
committer | jake <jake@FreeBSD.org> | 2001-01-21 19:25:07 +0000 |
commit | 937122ae6dc02a639d13dd06132201548bd7364f (patch) | |
tree | 75b59a2832d9f622680ddf91bb405ee9b1f761d4 /sys/alpha | |
parent | d326c51b74ea24afabc190774a1b7721c3e6d1e8 (diff) | |
download | FreeBSD-src-937122ae6dc02a639d13dd06132201548bd7364f.zip FreeBSD-src-937122ae6dc02a639d13dd06132201548bd7364f.tar.gz |
Make intr_nesting_level per-process, rather than per-cpu. Setup
interrupt threads to run with it always >= 1, so that malloc can
detect M_WAITOK from "interrupt" context. This is also necessary
in order to context switch from sched_ithd() directly.
Reviewed By: peter
Diffstat (limited to 'sys/alpha')
-rw-r--r-- | sys/alpha/alpha/interrupt.c | 12 | ||||
-rw-r--r-- | sys/alpha/alpha/mp_machdep.c | 2 | ||||
-rw-r--r-- | sys/alpha/include/cpu.h | 4 | ||||
-rw-r--r-- | sys/alpha/include/globaldata.h | 1 | ||||
-rw-r--r-- | sys/alpha/include/pcpu.h | 1 |
5 files changed, 8 insertions, 12 deletions
diff --git a/sys/alpha/alpha/interrupt.c b/sys/alpha/alpha/interrupt.c index 6311937..c11de3a 100644 --- a/sys/alpha/alpha/interrupt.c +++ b/sys/alpha/alpha/interrupt.c @@ -89,15 +89,15 @@ interrupt(a0, a1, a2, framep) unsigned long a0, a1, a2; struct trapframe *framep; { + struct proc *p; + /* * Find our per-cpu globals. */ globalp = (struct globaldata *) alpha_pal_rdval(); - - atomic_add_int(PCPU_PTR(intr_nesting_level), 1); + p = curproc; + atomic_add_int(&p->p_intr_nesting_level, 1); { - struct proc *p = curproc; - if (!p) p = &proc0; if ((caddr_t) framep < (caddr_t) p->p_addr + 1024) { panic("possible stack overflow\n"); } @@ -116,7 +116,7 @@ interrupt(a0, a1, a2, framep) CTR0(KTR_INTR, "clock interrupt"); if (PCPU_GET(cpuno) != hwrpb->rpb_primary_cpu_id) { CTR0(KTR_INTR, "ignoring clock on secondary"); - atomic_subtract_int(PCPU_PTR(intr_nesting_level), 1); + atomic_subtract_int(&p->p_intr_nesting_level, 1); return; } @@ -152,7 +152,7 @@ interrupt(a0, a1, a2, framep) a0, a1, a2); /* NOTREACHED */ } - atomic_subtract_int(PCPU_PTR(intr_nesting_level), 1); + atomic_subtract_int(&p->p_intr_nesting_level, 1); } void diff --git a/sys/alpha/alpha/mp_machdep.c b/sys/alpha/alpha/mp_machdep.c index 2ece633..e2a2be5 100644 --- a/sys/alpha/alpha/mp_machdep.c +++ b/sys/alpha/alpha/mp_machdep.c @@ -1053,7 +1053,7 @@ smp_handle_ipi(struct trapframe *frame) CTR0(KTR_SMP, "IPI_CHECKSTATE"); if (frame->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) checkstate_cpustate[cpuno] = CHECKSTATE_USER; - else if (PCPU_GET(intr_nesting_level) == 1) + else if (curproc->p_intr_nesting_level == 1) checkstate_cpustate[cpuno] = CHECKSTATE_SYS; else checkstate_cpustate[cpuno] = CHECKSTATE_INTR; diff --git a/sys/alpha/include/cpu.h b/sys/alpha/include/cpu.h index 3da213f..0edb2fc 100644 --- a/sys/alpha/include/cpu.h +++ b/sys/alpha/include/cpu.h @@ -65,7 +65,7 @@ struct clockframe { #define CLKF_USERMODE(framep) \ (((framep)->cf_tf.tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) != 0) #define CLKF_PC(framep) ((framep)->cf_tf.tf_regs[FRAME_PC]) -#define CLKF_INTR(framep) (PCPU_GET(intr_nesting_level) >= 2) +#define CLKF_INTR(framep) (curproc->p_intr_nesting_level >= 2) /* * Preempt the current process if in interrupt from user mode, @@ -92,8 +92,6 @@ struct clockframe { #define aston() PCPU_SET(astpending, 1) #ifdef _KERNEL -extern u_int astpending; -extern u_int32_t intr_nesting_level; /* bookeeping only; counts sw intrs */ extern u_int32_t want_resched; /* resched() was called */ #endif diff --git a/sys/alpha/include/globaldata.h b/sys/alpha/include/globaldata.h index 127dd09..d99c5a9 100644 --- a/sys/alpha/include/globaldata.h +++ b/sys/alpha/include/globaldata.h @@ -56,7 +56,6 @@ struct globaldata { u_int64_t gd_pending_ipis; /* pending IPI events */ u_int32_t gd_next_asn; /* next ASN to allocate */ u_int32_t gd_current_asngen; /* ASN rollover check */ - u_int32_t gd_intr_nesting_level; /* interrupt recursion */ u_int gd_astpending; SLIST_ENTRY(globaldata) gd_allcpu; diff --git a/sys/alpha/include/pcpu.h b/sys/alpha/include/pcpu.h index 127dd09..d99c5a9 100644 --- a/sys/alpha/include/pcpu.h +++ b/sys/alpha/include/pcpu.h @@ -56,7 +56,6 @@ struct globaldata { u_int64_t gd_pending_ipis; /* pending IPI events */ u_int32_t gd_next_asn; /* next ASN to allocate */ u_int32_t gd_current_asngen; /* ASN rollover check */ - u_int32_t gd_intr_nesting_level; /* interrupt recursion */ u_int gd_astpending; SLIST_ENTRY(globaldata) gd_allcpu; |