diff options
Diffstat (limited to 'sys/arch/i386')
-rw-r--r-- | sys/arch/i386/i386/machdep.c | 28 | ||||
-rw-r--r-- | sys/arch/i386/include/cpu.h | 6 |
2 files changed, 21 insertions, 13 deletions
diff --git a/sys/arch/i386/i386/machdep.c b/sys/arch/i386/i386/machdep.c index 673299a6e6f..45ae08f2b63 100644 --- a/sys/arch/i386/i386/machdep.c +++ b/sys/arch/i386/i386/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.438 2008/11/14 20:43:54 weingart Exp $ */ +/* $OpenBSD: machdep.c,v 1.439 2008/11/22 18:12:32 art Exp $ */ /* $NetBSD: machdep.c,v 1.214 1996/11/10 03:16:17 thorpej Exp $ */ /*- @@ -2340,11 +2340,17 @@ void signotify(struct proc *p) { aston(p); + cpu_unidle(p->p_cpu); +} + #ifdef MULTIPROCESSOR - if (p->p_cpu != curcpu() && p->p_cpu != NULL) - i386_send_ipi(p->p_cpu, I386_IPI_NOP); -#endif +void +cpu_unidle(struct cpu_info *ci) +{ + if (ci != curcpu()) + i386_send_ipi(ci, I386_IPI_NOP); } +#endif int waittime = -1; struct pcb dumppcb; @@ -3243,16 +3249,14 @@ cpu_initclocks(void) void need_resched(struct cpu_info *ci) { - struct proc *p; - ci->ci_want_resched = 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); + /* There's a risk we'll be called before the idle threads start */ + if (ci->ci_curproc) { + aston(ci->ci_curproc); + if (ci != curcpu()) + cpu_unidle(ci); + } } /* Allocate an IDT vector slot within the given range. diff --git a/sys/arch/i386/include/cpu.h b/sys/arch/i386/include/cpu.h index 48fd4f35843..56e1263eb20 100644 --- a/sys/arch/i386/include/cpu.h +++ b/sys/arch/i386/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.105 2008/10/15 23:23:47 deraadt Exp $ */ +/* $OpenBSD: cpu.h,v 1.106 2008/11/22 18:12:32 art Exp $ */ /* $NetBSD: cpu.h,v 1.35 1996/05/05 19:29:26 christos Exp $ */ /*- @@ -205,6 +205,8 @@ extern struct cpu_info *cpu_info[MAXCPUS]; extern void cpu_boot_secondary_processors(void); extern void cpu_init_idle_pcbs(void); +void cpu_unidle(struct cpu_info *); + #else /* MULTIPROCESSOR */ #define MAXCPUS 1 @@ -214,6 +216,8 @@ extern void cpu_init_idle_pcbs(void); #define CPU_IS_PRIMARY(ci) 1 +#define cpu_unidle(ci) + #endif #define aston(p) ((p)->p_md.md_astpending = 1) |