diff options
author | Artur Grabowski <art@cvs.openbsd.org> | 2007-04-03 10:14:48 +0000 |
---|---|---|
committer | Artur Grabowski <art@cvs.openbsd.org> | 2007-04-03 10:14:48 +0000 |
commit | 54694685d91ea2b7c9905c9c9951428dacbc0c83 (patch) | |
tree | 6df5060d9519ba7b2621fb41c6c9feacd808a9f8 /sys | |
parent | 5580441acd58a8850e70767fc09899dacbd178c8 (diff) |
Make the ast on i386 per-process instead of per-cpu. This makes
signal delivery more reliable in some cases when a process switches
cpu.
kettenis@ ok
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/i386/i386/genassym.cf | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/locore.s | 14 | ||||
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 12 | ||||
-rw-r--r-- | sys/arch/i386/include/cpu.h | 10 | ||||
-rw-r--r-- | sys/arch/i386/include/intr.h | 3 | ||||
-rw-r--r-- | sys/arch/i386/include/proc.h | 3 |
6 files changed, 29 insertions, 17 deletions
diff --git a/sys/arch/i386/i386/genassym.cf b/sys/arch/i386/i386/genassym.cf index b47fb186d00..e20ff580910 100644 --- a/sys/arch/i386/i386/genassym.cf +++ b/sys/arch/i386/i386/genassym.cf @@ -1,4 +1,4 @@ -# $OpenBSD: genassym.cf,v 1.25 2007/02/20 21:15:01 tom Exp $ +# $OpenBSD: genassym.cf,v 1.26 2007/04/03 10:14:47 art Exp $ # # Copyright (c) 1982, 1990 The Regents of the University of California. # All rights reserved. @@ -96,6 +96,7 @@ member p_wchan member p_vmspace member p_flag member p_cpu +member P_MD_ASTPENDING p_md.md_astpending export P_SYSTEM @@ -198,7 +199,6 @@ define CPU_INFO_LEVEL offsetof(struct cpu_info, ci_level) define CPU_INFO_VENDOR offsetof(struct cpu_info, ci_vendor[0]) define CPU_INFO_SIGNATURE offsetof(struct cpu_info, ci_signature) define CPU_INFO_RESCHED offsetof(struct cpu_info, ci_want_resched) -define CPU_INFO_ASTPENDING offsetof(struct cpu_info, ci_astpending) define CPU_INFO_GDT offsetof(struct cpu_info, ci_gdt) define CPU_INFO_IPENDING offsetof(struct cpu_info, ci_ipending) define CPU_INFO_IMASK offsetof(struct cpu_info, ci_imask) diff --git a/sys/arch/i386/i386/locore.s b/sys/arch/i386/i386/locore.s index fd5d7bc1ddc..2a1820fed71 100644 --- a/sys/arch/i386/i386/locore.s +++ b/sys/arch/i386/i386/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.106 2007/02/20 21:15:01 tom Exp $ */ +/* $OpenBSD: locore.s,v 1.107 2007/04/03 10:14:47 art Exp $ */ /* $NetBSD: locore.s,v 1.145 1996/05/03 19:41:19 christos Exp $ */ /*- @@ -125,10 +125,14 @@ #define CHECK_ASTPENDING(treg) \ GET_CPUINFO(treg) ; \ - cmpl $0,CPU_INFO_ASTPENDING(treg) - -#define CLEAR_ASTPENDING(cireg) \ - movl $0,CPU_INFO_ASTPENDING(cireg) + movl CPU_INFO_CURPROC(treg), treg ; \ + cmpl $0, treg ; \ + je 1f ; \ + cmpl $0,P_MD_ASTPENDING(treg) ; \ + 1: + +#define CLEAR_ASTPENDING(cpreg) \ + movl $0,P_MD_ASTPENDING(cpreg) /* * These are used on interrupt or trap entry or exit. diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 3343744a8ca..765ed409e9c 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.380 2007/03/19 09:29:33 art Exp $ */ +/* $OpenBSD: machdep.c,v 1.381 2007/04/03 10:14:47 art Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -3300,8 +3300,16 @@ cpu_initclocks(void) void need_resched(struct cpu_info *ci) { + struct proc *p; + ci->ci_want_resched = 1; - ci->ci_astpending = 1; + + /* + * Need to catch the curproc in case it's cleared just + * between the check and the aston(). + */ + if ((p = ci->ci_curproc) != NULL) + aston(p); } #ifdef MULTIPROCESSOR diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h index faebea52539..de3390846aa 100644 --- a/sys/arch/i386/include/cpu.h +++ b/sys/arch/i386/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.89 2007/03/19 09:29:33 art Exp $ */ +/* $OpenBSD: cpu.h,v 1.90 2007/04/03 10:14:47 art Exp $ */ /* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */ /*- @@ -124,7 +124,6 @@ struct cpu_info { void (*cpu_setup)(struct cpu_info *); /* proc-dependant init */ int ci_want_resched; - int ci_astpending; union descriptor *ci_gdt; union descriptor *ci_ldt; /* per-cpu default LDT */ @@ -202,7 +201,6 @@ extern void cpu_init_idle_pcbs(void); #define curpcb curcpu()->ci_curpcb #define want_resched (curcpu()->ci_want_resched) -#define astpending (curcpu()->ci_astpending) /* * Preempt the current process if in interrupt from user mode, @@ -219,18 +217,20 @@ extern void need_resched(struct cpu_info *); */ #define PROC_PC(p) ((p)->p_md.md_regs->tf_eip) +#define aston(p) ((p)->p_md.md_astpending = 1) + /* * Give a profiling tick to the current process when the user profiling * buffer pages are invalid. On the i386, request an ast to send us * through trap(), marking the proc as needing a profiling tick. */ -#define need_proftick(p) setsoftast() +#define need_proftick(p) aston(p) /* * Notify the current process (p) that it has a signal pending, * process as soon as possible. */ -#define signotify(p) setsoftast() +#define signotify(p) aston(p) /* * We need a machine-independent name for this. diff --git a/sys/arch/i386/include/intr.h b/sys/arch/i386/include/intr.h index a78cfcb116f..63f1e93bbc0 100644 --- a/sys/arch/i386/include/intr.h +++ b/sys/arch/i386/include/intr.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intr.h,v 1.28 2007/03/23 16:03:52 art Exp $ */ +/* $OpenBSD: intr.h,v 1.29 2007/04/03 10:14:47 art Exp $ */ /* $NetBSD: intr.h,v 1.5 1996/05/13 06:11:28 mycroft Exp $ */ /* @@ -129,7 +129,6 @@ void splassert_check(int, const char *); #define spllock() splhigh() #define spl0() spllower(IPL_NONE) -#define setsoftast() (astpending = 1) #define setsoftclock() softintr(1 << SIR_CLOCK, IPL_SOFTCLOCK) #define setsoftnet() softintr(1 << SIR_NET, IPL_SOFTNET) #define setsofttty() softintr(1 << SIR_TTY, IPL_SOFTTTY) diff --git a/sys/arch/i386/include/proc.h b/sys/arch/i386/include/proc.h index e5393cd22e4..8027e2f3e27 100644 --- a/sys/arch/i386/include/proc.h +++ b/sys/arch/i386/include/proc.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proc.h,v 1.4 2004/06/13 21:49:16 niklas Exp $ */ +/* $OpenBSD: proc.h,v 1.5 2007/04/03 10:14:47 art Exp $ */ /* $NetBSD: proc.h,v 1.10 1995/08/06 05:33:23 mycroft Exp $ */ /* @@ -39,6 +39,7 @@ struct mdproc { struct trapframe *md_regs; /* registers on current frame */ int md_flags; /* machine-dependent flags */ int md_tss_sel; /* TSS selector */ + int md_astpending; }; /* md_flags */ |