diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2006-12-24 20:29:20 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2006-12-24 20:29:20 +0000 |
commit | 0330d467c5d5654526bf0e8d6141cf8d59a148ed (patch) | |
tree | 9f13e3cb00acf1e51b34160c6fcf200312939bf8 | |
parent | 0ece0a5e4e73b44f42815ab3f5f0bc9f7e3bb7c8 (diff) |
Check for want_resched when processing AST and nowhere else. But then, when
doing so, do not check for signals - userret() will do this.
-rw-r--r-- | sys/arch/hppa/hppa/trap.c | 12 | ||||
-rw-r--r-- | sys/arch/i386/i386/trap.c | 4 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/trap.c | 6 | ||||
-rw-r--r-- | sys/arch/powerpc/powerpc/trap.c | 23 | ||||
-rw-r--r-- | sys/arch/solbourne/solbourne/trap.c | 11 | ||||
-rw-r--r-- | sys/arch/sparc/sparc/trap.c | 11 | ||||
-rw-r--r-- | sys/arch/sparc64/sparc64/trap.c | 11 | ||||
-rw-r--r-- | sys/arch/vax/vax/trap.c | 8 |
8 files changed, 53 insertions, 33 deletions
diff --git a/sys/arch/hppa/hppa/trap.c b/sys/arch/hppa/hppa/trap.c index f54757ea251..783c12cd628 100644 --- a/sys/arch/hppa/hppa/trap.c +++ b/sys/arch/hppa/hppa/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.93 2005/12/12 18:59:02 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.94 2006/12/24 20:29:17 miod Exp $ */ /* * Copyright (c) 1998-2004 Michael Shalayeff @@ -146,14 +146,8 @@ userret(struct proc *p, register_t pc, u_quad_t oticks) p->p_flag &= ~P_OWEUPC; ADDUPROF(p); } - } - if (want_resched) { - /* - * We're being preempted. - */ - preempt(NULL); - while ((sig = CURSIG(p)) != 0) - postsig(sig); + if (want_resched) + preempt(NULL); } /* diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index 7392782d26a..1a293e75e86 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.78 2006/09/19 11:06:33 jsg Exp $ */ +/* $OpenBSD: trap.c,v 1.79 2006/12/24 20:29:19 miod Exp $ */ /* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */ /*- @@ -409,6 +409,8 @@ trap(struct trapframe frame) ADDUPROF(p); KERNEL_PROC_UNLOCK(p); } + if (want_resched) + preempt(NULL); goto out; case T_DNA|T_USER: { diff --git a/sys/arch/m88k/m88k/trap.c b/sys/arch/m88k/m88k/trap.c index cf2ae59f5a9..1eaf55d0c88 100644 --- a/sys/arch/m88k/m88k/trap.c +++ b/sys/arch/m88k/m88k/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.35 2006/11/20 21:48:31 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.36 2006/12/24 20:29:19 miod Exp $ */ /* * Copyright (c) 2004, Miodrag Vallat. * Copyright (c) 1998 Steve Murphree, Jr. @@ -565,6 +565,8 @@ user_fault: ADDUPROF(p); KERNEL_PROC_UNLOCK(p); } + if (curcpu()->ci_want_resched) + preempt(NULL); break; } @@ -1082,6 +1084,8 @@ m88110_user_fault: ADDUPROF(p); KERNEL_PROC_UNLOCK(p); } + if (curcpu()->ci_want_resched) + preempt(NULL); break; } diff --git a/sys/arch/powerpc/powerpc/trap.c b/sys/arch/powerpc/powerpc/trap.c index 8c7c3513eca..a5548f62226 100644 --- a/sys/arch/powerpc/powerpc/trap.c +++ b/sys/arch/powerpc/powerpc/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.72 2005/12/17 07:31:27 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.73 2006/12/24 20:29:19 miod Exp $ */ /* $NetBSD: trap.c,v 1.3 1996/10/13 03:31:37 christos Exp $ */ /* @@ -251,12 +251,6 @@ userret(struct proc *p, int pc, u_quad_t oticks) while ((sig = CURSIG(p)) != 0) postsig(sig); p->p_priority = p->p_usrpri; - if (want_resched) { - /* We're being preempted. */ - preempt(NULL); - while ((sig = CURSIG(p))) - postsig(sig); - } /* * If profiling, charge recent system time to the trapped pc. @@ -648,17 +642,16 @@ for (i = 0; i < errnum; i++) { case EXC_AST|EXC_USER: uvmexp.softs++; - /* This is just here that we trap */ + astpending = 0; /* we are about to do it */ + if (p->p_flag & P_OWEUPC) { + p->p_flag &= ~P_OWEUPC; + ADDUPROF(p); + } + if (want_resched) + preempt(NULL); break; } - astpending = 0; /* we are about to do it */ - - if (p->p_flag & P_OWEUPC) { - p->p_flag &= ~P_OWEUPC; - ADDUPROF(p); - } - userret(p, frame->srr0, sticks); /* diff --git a/sys/arch/solbourne/solbourne/trap.c b/sys/arch/solbourne/solbourne/trap.c index 9ea3d9eb6a1..61ff9bb4643 100644 --- a/sys/arch/solbourne/solbourne/trap.c +++ b/sys/arch/solbourne/solbourne/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.6 2006/01/30 21:26:19 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.7 2006/12/24 20:29:19 miod Exp $ */ /* OpenBSD: trap.c,v 1.42 2004/12/06 20:12:25 miod Exp */ /* @@ -376,7 +376,14 @@ badtrap: #endif case T_AST: - break; /* the work is all in userret() */ + want_ast = 0; + if (p->p_flag & P_OWEUPC) { + p->p_flag &= ~P_OWEUPC; + ADDUPROF(p); + } + if (want_resched) + preempt(NULL); + break; case T_ILLINST: if ((n = emulinstr(pc, tf)) == 0) { diff --git a/sys/arch/sparc/sparc/trap.c b/sys/arch/sparc/sparc/trap.c index e97adcdcfa3..6799a7a6bd7 100644 --- a/sys/arch/sparc/sparc/trap.c +++ b/sys/arch/sparc/sparc/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.48 2006/06/09 06:41:44 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.49 2006/12/24 20:29:19 miod Exp $ */ /* $NetBSD: trap.c,v 1.58 1997/09/12 08:55:01 pk Exp $ */ /* @@ -369,7 +369,14 @@ badtrap: #endif case T_AST: - break; /* the work is all in userret() */ + want_ast = 0; + if (p->p_flag & P_OWEUPC) { + p->p_flag &= ~P_OWEUPC; + ADDUPROF(p); + } + if (want_resched) + preempt(NULL); + break; case T_ILLINST: if ((n = emulinstr(pc, tf)) == 0) { diff --git a/sys/arch/sparc64/sparc64/trap.c b/sys/arch/sparc64/sparc64/trap.c index 6b2b67ffb50..57820d5d2b2 100644 --- a/sys/arch/sparc64/sparc64/trap.c +++ b/sys/arch/sparc64/sparc64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.43 2006/07/01 16:24:17 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.44 2006/12/24 20:29:19 miod Exp $ */ /* $NetBSD: trap.c,v 1.73 2001/08/09 01:03:01 eeh Exp $ */ /* @@ -526,7 +526,14 @@ badtrap: #endif case T_AST: - break; /* the work is all in userret() */ + want_ast = 0; + if (p->p_flag & P_OWEUPC) { + p->p_flag &= ~P_OWEUPC; + ADDUPROF(p); + } + if (want_resched) + preempt(NULL); + break; case T_ILLINST: { diff --git a/sys/arch/vax/vax/trap.c b/sys/arch/vax/vax/trap.c index 2f164d1c27c..857143ae859 100644 --- a/sys/arch/vax/vax/trap.c +++ b/sys/arch/vax/vax/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.34 2006/01/30 21:26:19 miod Exp $ */ +/* $OpenBSD: trap.c,v 1.35 2006/12/24 20:29:19 miod Exp $ */ /* $NetBSD: trap.c,v 1.47 1999/08/21 19:26:20 matt Exp $ */ /* * Copyright (c) 1994 Ludd, University of Lule}, Sweden. @@ -311,6 +311,12 @@ if(faultdebug)printf("trap accflt type %lx, code %lx, pc %lx, psl %lx\n", case T_ASTFLT|T_USER: mtpr(AST_NO,PR_ASTLVL); trapsig = 0; + if (p->p_flag & P_OWEUPC) { + p->p_flag &= ~P_OWEUPC; + ADDUPROF(p); + } + if (want_resched) + preempt(NULL); break; #ifdef DDB |