diff options
Diffstat (limited to 'sys/alpha')
-rw-r--r-- | sys/alpha/alpha/exception.s | 13 | ||||
-rw-r--r-- | sys/alpha/alpha/genassym.c | 1 | ||||
-rw-r--r-- | sys/alpha/alpha/trap.c | 31 | ||||
-rw-r--r-- | sys/alpha/include/cpu.h | 42 | ||||
-rw-r--r-- | sys/alpha/include/globaldata.h | 1 | ||||
-rw-r--r-- | sys/alpha/include/pcpu.h | 1 |
6 files changed, 31 insertions, 58 deletions
diff --git a/sys/alpha/alpha/exception.s b/sys/alpha/alpha/exception.s index afeccb8..f2febd0 100644 --- a/sys/alpha/alpha/exception.s +++ b/sys/alpha/alpha/exception.s @@ -135,14 +135,10 @@ XentSys1: LDGP(pv) and t1, FRAME_FLAGS_SYSCALL beq t1, exception_return - ldl t2, GD_ASTPENDING(globalp) /* AST pending? */ - beq t2, 2f /* no: return */ - - /* We've got an AST. Handle it. */ + /* Handle any AST's. */ mov sp, a0 /* only arg is frame */ CALL(ast) -2: /* set the hae register if this process has specified a value */ ldq t0, GD_CURPROC(globalp) beq t0, 3f @@ -264,12 +260,7 @@ Ler1: LDGP(pv) and s1, ALPHA_PSL_USERMODE, t0 /* are we returning to user? */ beq t0, Lrestoreregs /* no: just return */ - ldl t2, GD_ASTPENDING(globalp) /* AST pending? */ - beq t2, Lrestoreregs /* no: return */ - - /* We've got an AST. Handle it. */ - ldiq a0, ALPHA_PSL_IPL_0 /* drop IPL to zero */ - call_pal PAL_OSF1_swpipl + /* Handle any AST's or resched's. */ mov sp, a0 /* only arg is frame */ CALL(ast) diff --git a/sys/alpha/alpha/genassym.c b/sys/alpha/alpha/genassym.c index 10bac57..1417c90 100644 --- a/sys/alpha/alpha/genassym.c +++ b/sys/alpha/alpha/genassym.c @@ -73,7 +73,6 @@ ASSYM(GD_CURPCB, offsetof(struct globaldata, gd_curpcb)); ASSYM(GD_SWITCHTIME, offsetof(struct globaldata, gd_switchtime)); ASSYM(GD_CPUID, offsetof(struct globaldata, gd_cpuid)); ASSYM(GD_IDLEPCBPHYS, offsetof(struct globaldata, gd_idlepcbphys)); -ASSYM(GD_ASTPENDING, offsetof(struct globaldata, gd_astpending)); ASSYM(MTX_LOCK, offsetof(struct mtx, mtx_lock)); ASSYM(MTX_RECURSE, offsetof(struct mtx, mtx_recurse)); diff --git a/sys/alpha/alpha/trap.c b/sys/alpha/alpha/trap.c index eada017..523c79c 100644 --- a/sys/alpha/alpha/trap.c +++ b/sys/alpha/alpha/trap.c @@ -70,8 +70,6 @@ #include <ddb/ddb.h> #endif -u_int32_t want_resched; - unsigned long Sfloat_to_reg __P((unsigned int)); unsigned int reg_to_Sfloat __P((unsigned long)); unsigned long Tfloat_reg_cvt __P((unsigned long)); @@ -101,7 +99,7 @@ userret(p, frame, oticks) struct trapframe *frame; u_quad_t oticks; { - int sig, s; + int sig; /* take pending signals */ while ((sig = CURSIG(p)) != 0) { @@ -111,7 +109,7 @@ userret(p, frame, oticks) } mtx_lock_spin(&sched_lock); p->p_priority = p->p_usrpri; - if (want_resched) { + if (resched_wanted()) { /* * Since we are curproc, a clock interrupt could * change our priority without changing run queues @@ -120,14 +118,12 @@ userret(p, frame, oticks) * before we switch()'ed, we might not be on the queue * indicated by our priority. */ - s = splstatclock(); DROP_GIANT_NOSWITCH(); setrunqueue(p); p->p_stats->p_ru.ru_nivcsw++; mi_switch(); mtx_unlock_spin(&sched_lock); PICKUP_GIANT(); - splx(s); while ((sig = CURSIG(p)) != 0) { if (!mtx_owned(&Giant)) mtx_lock(&Giant); @@ -759,22 +755,27 @@ void ast(framep) struct trapframe *framep; { - register struct proc *p; + struct proc *p = CURPROC; u_quad_t sticks; - p = curproc; + KASSERT(TRAPF_USERMODE(framep), ("ast in kernel mode")); + + /* + * We check for a pending AST here rather than in the assembly as + * acquiring and releasing mutexes in assembly is not fun. + */ mtx_lock_spin(&sched_lock); + if (!(astpending() || resched_wanted())) { + mtx_unlock_spin(&sched_lock); + return; + } + sticks = p->p_sticks; - mtx_unlock_spin(&sched_lock); p->p_md.md_tf = framep; - if ((framep->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) == 0) - panic("ast and not user"); - + astoff(); cnt.v_soft++; - - PCPU_SET(astpending, 0); - mtx_lock_spin(&sched_lock); + mtx_intr_enable(&sched_lock); if (p->p_sflag & PS_OWEUPC) { p->p_sflag &= ~PS_OWEUPC; mtx_unlock_spin(&sched_lock); diff --git a/sys/alpha/include/cpu.h b/sys/alpha/include/cpu.h index 8ecaaf3..3e0696f 100644 --- a/sys/alpha/include/cpu.h +++ b/sys/alpha/include/cpu.h @@ -62,45 +62,29 @@ struct clockframe { struct trapframe cf_tf; }; -#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) (curproc->p_intr_nesting_level >= 2) - -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define need_resched() do { want_resched = 1; aston(); } while (0) +#define TRAPF_USERMODE(framep) \ + (((framep)->tf_regs[FRAME_PS] & ALPHA_PSL_USERMODE) != 0) +#define TRAPF_PC(framep) ((framep)->tf_regs[FRAME_PC]) -#define resched_wanted() want_resched +#define CLKF_USERMODE(framep) TRAPF_USERMODE(&(framep)->cf_tf) +#define CLKF_PC(framep) TRAPF_PC(&(framep)->cf_tf) +#define CLKF_INTR(framep) (curproc->p_intr_nesting_level >= 2) /* - * Give a profiling tick to the current process when the user profiling - * buffer pages are invalid. On the hp300, request an ast to send us - * through trap, marking the proc as needing a profiling tick. + * Arrange to handle pending profiling ticks before returning to user mode. + * + * XXX this is now poorly named and implemented. It used to handle only a + * single tick and the PS_OWEUPC flag served as a counter. Now there is a + * counter in the proc table and flag isn't really necessary. */ #define need_proftick(p) do { \ - mtx_lock_spin(&sched_lock); \ + mtx_lock_spin(&sched_lock); \ (p)->p_sflag |= PS_OWEUPC; \ - mtx_unlock_spin(&sched_lock); \ aston(); \ + mtx_unlock_spin(&sched_lock); \ } while (0) /* - * Notify the current process (p) that it has a signal pending, - * process as soon as possible. - */ -#define signotify(p) aston() - -#define aston() PCPU_SET(astpending, 1) - -#ifdef _KERNEL -extern u_int32_t want_resched; /* resched() was called */ -#endif - - -/* * CTL_MACHDEP definitions. */ #define CPU_CONSDEV 1 /* dev_t: console terminal device */ diff --git a/sys/alpha/include/globaldata.h b/sys/alpha/include/globaldata.h index 84dbf34..8e6cfbe 100644 --- a/sys/alpha/include/globaldata.h +++ b/sys/alpha/include/globaldata.h @@ -57,7 +57,6 @@ struct globaldata { u_int32_t gd_next_asn; /* next ASN to allocate */ u_int32_t gd_current_asngen; /* ASN rollover check */ - u_int gd_astpending; SLIST_ENTRY(globaldata) gd_allcpu; int gd_witness_spin_check; #ifdef KTR_PERCPU diff --git a/sys/alpha/include/pcpu.h b/sys/alpha/include/pcpu.h index 84dbf34..8e6cfbe 100644 --- a/sys/alpha/include/pcpu.h +++ b/sys/alpha/include/pcpu.h @@ -57,7 +57,6 @@ struct globaldata { u_int32_t gd_next_asn; /* next ASN to allocate */ u_int32_t gd_current_asngen; /* ASN rollover check */ - u_int gd_astpending; SLIST_ENTRY(globaldata) gd_allcpu; int gd_witness_spin_check; #ifdef KTR_PERCPU |