From 0be33f66cf897d7227de863f5ce4e19d209da1cd Mon Sep 17 00:00:00 2001 From: skrll Date: Sat, 3 Apr 2010 07:46:01 +0000 Subject: [PATCH] Add md_astpending to struct mdlwp and use it. --- sys/arch/hp700/include/cpu.h | 6 +++--- sys/arch/hp700/include/intr.h | 7 ++----- sys/arch/hppa/hppa/hppa_machdep.c | 11 +++++++---- sys/arch/hppa/hppa/trap.c | 15 +++++++-------- sys/arch/hppa/hppa/vm_machdep.c | 5 +++-- sys/arch/hppa/include/proc.h | 5 +++-- 6 files changed, 25 insertions(+), 24 deletions(-) diff --git a/sys/arch/hp700/include/cpu.h b/sys/arch/hp700/include/cpu.h index b90003c77a82..2fa22f71e4c3 100644 --- a/sys/arch/hp700/include/cpu.h +++ b/sys/arch/hp700/include/cpu.h @@ -1,4 +1,4 @@ -/* $NetBSD: cpu.h,v 1.43 2010/04/02 19:33:16 skrll Exp $ */ +/* $NetBSD: cpu.h,v 1.44 2010/04/03 07:46:01 skrll Exp $ */ /* $OpenBSD: cpu.h,v 1.55 2008/07/23 17:39:35 kettenis Exp $ */ @@ -216,8 +216,8 @@ struct clockframe { #define CLKF_INTR(framep) ((framep)->cf_flags & TFF_INTR) #define CLKF_USERMODE(framep) ((framep)->cf_flags & T_USER) -#define cpu_signotify(l) (setsoftast()) -#define cpu_need_proftick(l) ((l)->l_pflag |= LP_OWEUPC, setsoftast()) +#define cpu_signotify(l) (setsoftast(l)) +#define cpu_need_proftick(l) ((l)->l_pflag |= LP_OWEUPC, setsoftast(l)) #include struct cpu_info { diff --git a/sys/arch/hp700/include/intr.h b/sys/arch/hp700/include/intr.h index cce6902522cc..79ced1d34843 100644 --- a/sys/arch/hp700/include/intr.h +++ b/sys/arch/hp700/include/intr.h @@ -1,4 +1,4 @@ -/* $NetBSD: intr.h,v 1.16 2010/03/31 12:56:14 skrll Exp $ */ +/* $NetBSD: intr.h,v 1.17 2010/04/03 07:46:01 skrll Exp $ */ /* $OpenBSD: intr.h,v 1.26 2009/12/29 13:11:40 jsing Exp $ */ /*- @@ -57,9 +57,6 @@ /* The priority level masks. */ extern int imask[NIPL]; -/* The asynchronous system trap flag. */ -extern volatile int astpending; - /* splraise()/spllower() are in locore.S */ int splraise(int); void spllower(int); @@ -91,7 +88,7 @@ splraiseipl(ipl_cookie_t icookie) #include -#define setsoftast() (astpending = 1) +#define setsoftast(l) ((l)->l_md.md_astpending = 1) #define setsoftnet() hp700_intr_schedule(softnetmask) void hp700_intr_schedule(int); diff --git a/sys/arch/hppa/hppa/hppa_machdep.c b/sys/arch/hppa/hppa/hppa_machdep.c index 852cfb0ea708..c184b7a08ec0 100644 --- a/sys/arch/hppa/hppa/hppa_machdep.c +++ b/sys/arch/hppa/hppa/hppa_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: hppa_machdep.c,v 1.20 2010/03/16 16:20:19 skrll Exp $ */ +/* $NetBSD: hppa_machdep.c,v 1.21 2010/04/03 07:46:02 skrll Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: hppa_machdep.c,v 1.20 2010/03/16 16:20:19 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hppa_machdep.c,v 1.21 2010/04/03 07:46:02 skrll Exp $"); #include #include @@ -351,6 +351,10 @@ hppa_ras(struct lwp *l) } } +/* + * Preempt the current LWP if in interrupt from user mode, + * or after the current trap/syscall if in system mode. + */ void cpu_need_resched(struct cpu_info *ci, int flags) { @@ -359,8 +363,7 @@ cpu_need_resched(struct cpu_info *ci, int flags) if (ci->ci_want_resched && !immed) return; ci->ci_want_resched = 1; - /* setsoftast(ci->ci_data.cpu_onproc); */ - setsoftast(); + setsoftast(ci->ci_data.cpu_onproc); #ifdef MULTIPROCESSOR if (ci->ci_curlwp != ci->ci_data.cpu_idlelwp) { diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c index 280b163240d5..bb7fbb55d8c4 100644 --- a/sys/arch/hppa/hppa/trap.c +++ b/sys/arch/hppa/hppa/trap.c @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.85 2010/03/31 12:56:14 skrll Exp $ */ +/* $NetBSD: trap.c,v 1.86 2010/04/03 07:46:02 skrll Exp $ */ /*- * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc. @@ -58,7 +58,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.85 2010/03/31 12:56:14 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.86 2010/04/03 07:46:02 skrll Exp $"); /* #define INTRDEBUG */ /* #define TRAPDEBUG */ @@ -174,8 +174,6 @@ uint8_t fpopmap[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; -volatile int astpending; - void pmap_hptdump(void); void syscall(struct trapframe *, int *); @@ -205,11 +203,12 @@ userret(struct lwp *l, register_t pc, u_quad_t oticks) { struct proc *p = l->l_proc; - if (astpending) { - astpending = 0; - if (curcpu()->ci_want_resched) { + if (l->l_md.md_astpending) { + l->l_md.md_astpending = 0; + uvmexp.softs++; + + if (curcpu()->ci_want_resched) preempt(); - } } mi_userret(l); diff --git a/sys/arch/hppa/hppa/vm_machdep.c b/sys/arch/hppa/hppa/vm_machdep.c index 50e25c1292cc..6300bd2a8984 100644 --- a/sys/arch/hppa/hppa/vm_machdep.c +++ b/sys/arch/hppa/hppa/vm_machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.43 2010/04/01 12:09:39 skrll Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.44 2010/04/03 07:46:02 skrll Exp $ */ /* $OpenBSD: vm_machdep.c,v 1.64 2008/09/30 18:54:26 miod Exp $ */ @@ -29,7 +29,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.43 2010/04/01 12:09:39 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.44 2010/04/03 07:46:02 skrll Exp $"); #include #include @@ -93,6 +93,7 @@ cpu_lwp_fork(struct lwp *l1, struct lwp *l2, void *stack, size_t stacksize, pcb1 = lwp_getpcb(l1); pcb2 = lwp_getpcb(l2); + l2->l_md.md_astpending = 0; l2->l_md.md_flags = 0; /* Flush the parent LWP out of the FPU. */ diff --git a/sys/arch/hppa/include/proc.h b/sys/arch/hppa/include/proc.h index 599d716d23d7..c80cb0fe1bcd 100644 --- a/sys/arch/hppa/include/proc.h +++ b/sys/arch/hppa/include/proc.h @@ -1,6 +1,6 @@ -/* $NetBSD: proc.h,v 1.9 2010/03/31 06:40:30 skrll Exp $ */ +/* $NetBSD: proc.h,v 1.10 2010/04/03 07:46:02 skrll Exp $ */ -/* $OpenBSD: proc.h,v 1.1 1998/07/07 21:32:44 mickey Exp $ */ +/* $OpenBSD: proc.h,v 1.4 2009/12/29 13:11:40 jsing Exp $ */ /* * Copyright (c) 1992, 1993 @@ -43,6 +43,7 @@ */ struct mdlwp { struct trapframe *md_regs; /* registers on current frame */ + volatile int md_astpending; /* AST pending for this LWP */ int md_flags; /* machine-dependent flags */ vaddr_t md_bpva;