diff options
author | Miod Vallat <miod@cvs.openbsd.org> | 2008-12-21 21:43:53 +0000 |
---|---|---|
committer | Miod Vallat <miod@cvs.openbsd.org> | 2008-12-21 21:43:53 +0000 |
commit | e1803070e9f48fc53947cf4737a22e0646685cb4 (patch) | |
tree | 8f6b9d3195fdf453467dd0e456e8579f6bd313d9 /sys/arch/m88k | |
parent | 092ee4c2db0867b4b25eeb81b0c6c7d09da06e83 (diff) |
Proper cpu_unidle() function for MP kernels. ok art@ long ago
Diffstat (limited to 'sys/arch/m88k')
-rw-r--r-- | sys/arch/m88k/include/cpu.h | 16 | ||||
-rw-r--r-- | sys/arch/m88k/m88k/m88k_machdep.c | 29 |
2 files changed, 30 insertions, 15 deletions
diff --git a/sys/arch/m88k/include/cpu.h b/sys/arch/m88k/include/cpu.h index f4de3b9eb8e..7dae95065b7 100644 --- a/sys/arch/m88k/include/cpu.h +++ b/sys/arch/m88k/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.38 2008/10/15 23:23:48 deraadt Exp $ */ +/* $OpenBSD: cpu.h,v 1.39 2008/12/21 21:43:51 miod Exp $ */ /* * Copyright (c) 1996 Nivas Madhur * Copyright (c) 1992, 1993 @@ -138,7 +138,6 @@ extern struct cpu_info m88k_cpus[MAX_CPUS]; if (((ci) = &m88k_cpus[cii])->ci_flags & CIF_ALIVE) #define CPU_INFO_UNIT(ci) ((ci)->ci_cpuid) #define MAXCPUS MAX_CPUS -#define cpu_unidle(ci) #if defined(MULTIPROCESSOR) @@ -155,12 +154,14 @@ curcpu(void) void cpu_boot_secondary_processors(void); __dead void cpu_emergency_disable(void); +void cpu_unidle(struct cpu_info *); void m88k_send_ipi(int, cpuid_t); void m88k_broadcast_ipi(int); #else /* MULTIPROCESSOR */ #define curcpu() (&m88k_cpus[0]) +#define cpu_unidle(ci) do { /* nothing */ } while (0) #define CPU_IS_PRIMARY(ci) 1 #endif /* MULTIPROCESSOR */ @@ -234,16 +235,6 @@ struct clockframe { (regs)->sfip & FIP_ADDR))) #define PROC_PC(p) PC_REGS((struct reg *)((p)->p_md.md_tf)) -/* - * Preempt the current process if in interrupt from user mode, - * or after the current trap/syscall if in system mode. - */ -#define need_resched(ci) \ -do { \ - ci->ci_want_resched = 1; \ - if (ci->ci_curproc != NULL) \ - aston(ci->ci_curproc); \ -} while (0) #define clear_resched(ci) (ci)->ci_want_resched = 0 /* @@ -253,6 +244,7 @@ do { \ */ #define need_proftick(p) aston(p) +void need_resched(struct cpu_info *); void signotify(struct proc *); int badaddr(vaddr_t addr, int size); diff --git a/sys/arch/m88k/m88k/m88k_machdep.c b/sys/arch/m88k/m88k/m88k_machdep.c index be41eeb193a..9976d3be34d 100644 --- a/sys/arch/m88k/m88k/m88k_machdep.c +++ b/sys/arch/m88k/m88k/m88k_machdep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: m88k_machdep.c,v 1.42 2008/11/27 20:46:48 miod Exp $ */ +/* $OpenBSD: m88k_machdep.c,v 1.43 2008/12/21 21:43:52 miod Exp $ */ /* * Copyright (c) 1998, 1999, 2000, 2001 Steve Murphree, Jr. * Copyright (c) 1996 Nivas Madhur @@ -319,10 +319,33 @@ void signotify(struct proc *p) { aston(p); + cpu_unidle(p->p_cpu); +} + #ifdef MULTIPROCESSOR - if (p->p_cpu != curcpu() && p->p_cpu != NULL) - m88k_send_ipi(CI_IPI_NOTIFY, p->p_cpu->ci_cpuid); +void +cpu_unidle(struct cpu_info *ci) +{ + if (ci != curcpu()) + m88k_send_ipi(CI_IPI_NOTIFY, ci->ci_cpuid); +} #endif + +/* + * Preempt the current process if in interrupt from user mode, + * or after the current trap/syscall if in system mode. + */ +void +need_resched(struct cpu_info *ci) +{ + ci->ci_want_resched = 1; + + /* There's a risk we'll be called before the idle threads start */ + if (ci->ci_curproc != NULL) { + aston(ci->ci_curproc); + if (ci != curcpu()) + cpu_unidle(ci); + } } /* |