diff options
Diffstat (limited to 'sys/arch/amd64')
-rw-r--r-- | sys/arch/amd64/amd64/machdep.c | 23 | ||||
-rw-r--r-- | sys/arch/amd64/include/cpu.h | 6 |
2 files changed, 22 insertions, 7 deletions
diff --git a/sys/arch/amd64/amd64/machdep.c b/sys/arch/amd64/amd64/machdep.c index 418903872c9..ca00b33cfdc 100644 --- a/sys/arch/amd64/amd64/machdep.c +++ b/sys/arch/amd64/amd64/machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: machdep.c,v 1.84 2008/10/09 19:04:18 kettenis Exp $ */ +/* $OpenBSD: machdep.c,v 1.85 2008/11/22 18:12:32 art Exp $ */ /* $NetBSD: machdep.c,v 1.3 2003/05/07 22:58:18 fvdl Exp $ */ /*- @@ -726,11 +726,17 @@ void signotify(struct proc *p) { aston(p); + cpu_unidle(p->p_cpu); +} + #ifdef MULTIPROCESSOR - if (p->p_cpu != curcpu() && p->p_cpu != NULL) - x86_send_ipi(p->p_cpu, X86_IPI_NOP); -#endif +void +cpu_unidle(struct cpu_info *ci) +{ + if (ci != curcpu()) + x86_send_ipi(ci, X86_IPI_NOP); } +#endif int waittime = -1; struct pcb dumppcb; @@ -1743,8 +1749,13 @@ void need_resched(struct cpu_info *ci) { ci->ci_want_resched = 1; - if ((ci)->ci_curproc != NULL) - aston((ci)->ci_curproc); + + /* 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); + } } /* diff --git a/sys/arch/amd64/include/cpu.h b/sys/arch/amd64/include/cpu.h index 8bbe67e6ebc..2c21acf44d3 100644 --- a/sys/arch/amd64/include/cpu.h +++ b/sys/arch/amd64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.38 2008/10/15 23:23:46 deraadt Exp $ */ +/* $OpenBSD: cpu.h,v 1.39 2008/11/22 18:12:32 art Exp $ */ /* $NetBSD: cpu.h,v 1.1 2003/04/26 18:39:39 fvdl Exp $ */ /*- @@ -184,6 +184,8 @@ extern struct cpu_info *cpu_info[MAXCPUS]; void cpu_boot_secondary_processors(void); void cpu_init_idle_pcbs(void); +void cpu_unidle(struct cpu_info *); + #else /* !MULTIPROCESSOR */ #define MAXCPUS 1 @@ -193,6 +195,8 @@ extern struct cpu_info cpu_info_primary; #define curcpu() (&cpu_info_primary) +#define cpu_unidle(ci) + #endif /* |