diff options
Diffstat (limited to 'sys/arch')
-rw-r--r-- | sys/arch/amd64/amd64/ioapic.c | 8 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/locore.S | 5 | ||||
-rw-r--r-- | sys/arch/amd64/amd64/trap.c | 6 | ||||
-rw-r--r-- | sys/arch/amd64/include/pic.h | 4 | ||||
-rw-r--r-- | sys/arch/hppa64/include/cpu.h | 4 | ||||
-rw-r--r-- | sys/arch/i386/i386/locore.s | 3 | ||||
-rw-r--r-- | sys/arch/i386/i386/trap.c | 11 | ||||
-rw-r--r-- | sys/arch/i386/include/intrdefs.h | 4 | ||||
-rw-r--r-- | sys/arch/mips64/mips64/interrupt.c | 17 | ||||
-rw-r--r-- | sys/arch/sparc64/include/psl.h | 4 |
10 files changed, 46 insertions, 20 deletions
diff --git a/sys/arch/amd64/amd64/ioapic.c b/sys/arch/amd64/amd64/ioapic.c index 21c4b38ddab..6ee5bf11a1b 100644 --- a/sys/arch/amd64/amd64/ioapic.c +++ b/sys/arch/amd64/amd64/ioapic.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ioapic.c,v 1.4 2005/05/25 23:17:47 niklas Exp $ */ +/* $OpenBSD: ioapic.c,v 1.5 2005/05/29 03:20:36 deraadt Exp $ */ /* $NetBSD: ioapic.c,v 1.6 2003/05/15 13:30:31 fvdl Exp $ */ /*- @@ -127,14 +127,14 @@ ioapic_lock(struct ioapic_softc *sc) flags = read_psl(); disable_intr(); - mtx_enter(&sc->sc_pic.pic_mutex); + SIMPLE_LOCK(&sc->sc_pic.pic_lock); return flags; } static __inline void ioapic_unlock(struct ioapic_softc *sc, u_long flags) { - mtx_leave(&sc->sc_pic.pic_mutex); + SIMPLE_UNLOCK(&sc->sc_pic.pic_lock); write_psl(flags); } @@ -294,7 +294,7 @@ ioapic_attach(struct device *parent, struct device *self, void *aux) sc->sc_data = (volatile u_int32_t *)(bh + IOAPIC_DATA); sc->sc_pic.pic_type = PIC_IOAPIC; - mtx_init(&sc->sc_pic.pic_mutex, IPL_NONE); + SIMPLE_LOCK_INIT(&sc->sc_pic.pic_lock); sc->sc_pic.pic_hwmask = ioapic_hwmask; sc->sc_pic.pic_hwunmask = ioapic_hwunmask; sc->sc_pic.pic_addroute = ioapic_addroute; diff --git a/sys/arch/amd64/amd64/locore.S b/sys/arch/amd64/amd64/locore.S index a73047353d6..46583605655 100644 --- a/sys/arch/amd64/amd64/locore.S +++ b/sys/arch/amd64/amd64/locore.S @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.S,v 1.18 2005/05/27 19:32:39 art Exp $ */ +/* $OpenBSD: locore.S,v 1.19 2005/05/29 03:20:36 deraadt Exp $ */ /* $NetBSD: locore.S,v 1.13 2004/03/25 18:33:17 drochner Exp $ */ /* @@ -846,8 +846,9 @@ idle_start: cmpl $0,_C_LABEL(whichqs)(%rip) jz idle_loop idle_exit: + movl $IPL_HIGH,CPUVAR(ILEVEL) sti -#if defined(MULTIPROCESSOR) +#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG) call _C_LABEL(sched_lock_idle) #endif switch_search: diff --git a/sys/arch/amd64/amd64/trap.c b/sys/arch/amd64/amd64/trap.c index 0bc830b1c7b..05289bfe2ed 100644 --- a/sys/arch/amd64/amd64/trap.c +++ b/sys/arch/amd64/amd64/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.5 2005/05/25 23:17:47 niklas Exp $ */ +/* $OpenBSD: trap.c,v 1.6 2005/05/29 03:20:36 deraadt Exp $ */ /* $NetBSD: trap.c,v 1.2 2003/05/04 23:51:56 fvdl Exp $ */ /*- @@ -386,6 +386,10 @@ copyfault: case T_PAGEFLT: /* allow page faults in kernel mode */ if (p == NULL) goto we_re_toast; +#ifdef LOCKDEBUG + if (simple_lock_held(&sched_lock)) + goto we_re_toast; +#endif #ifdef MULTIPROCESSOR if ((p->p_flag & P_BIGLOCK) == 0) goto we_re_toast; diff --git a/sys/arch/amd64/include/pic.h b/sys/arch/amd64/include/pic.h index 0ef3a8fa4ca..0859288542f 100644 --- a/sys/arch/amd64/include/pic.h +++ b/sys/arch/amd64/include/pic.h @@ -1,4 +1,4 @@ -/* $OpenBSD: pic.h,v 1.3 2005/05/25 23:17:47 niklas Exp $ */ +/* $OpenBSD: pic.h,v 1.4 2005/05/29 03:20:36 deraadt Exp $ */ /* $NetBSD: pic.h,v 1.1 2003/02/26 21:26:11 fvdl Exp $ */ #ifndef _X86_PIC_H @@ -20,7 +20,7 @@ struct pic { struct device pic_dev; int pic_type; #ifdef MULTIPROCESSOR - struct mutex pic_mutex; + struct SIMPLE_LOCK pic_lock; #endif void (*pic_hwmask)(struct pic *, int); void (*pic_hwunmask)(struct pic *, int); diff --git a/sys/arch/hppa64/include/cpu.h b/sys/arch/hppa64/include/cpu.h index e4054861dab..11f8d9e16ae 100644 --- a/sys/arch/hppa64/include/cpu.h +++ b/sys/arch/hppa64/include/cpu.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cpu.h,v 1.3 2005/05/25 23:17:47 niklas Exp $ */ +/* $OpenBSD: cpu.h,v 1.4 2005/05/29 03:20:37 deraadt Exp $ */ /* * Copyright (c) 2005 Michael Shalayeff @@ -83,8 +83,8 @@ #define IPL_VM 7 #define IPL_AUDIO 8 #define IPL_CLOCK 9 +#define IPL_SCHED 9 #define IPL_STATCLOCK 10 -#define IPL_SCHED IPL_STATCLOCK #define IPL_HIGH 11 #define NIPL 12 diff --git a/sys/arch/i386/i386/locore.s b/sys/arch/i386/i386/locore.s index f27a00a8c3a..724f4325bdb 100644 --- a/sys/arch/i386/i386/locore.s +++ b/sys/arch/i386/i386/locore.s @@ -1,4 +1,4 @@ -/* $OpenBSD: locore.s,v 1.89 2005/05/26 04:29:06 mickey Exp $ */ +/* $OpenBSD: locore.s,v 1.90 2005/05/29 03:20:38 deraadt Exp $ */ /* $NetBSD: locore.s,v 1.145 1996/05/03 19:41:19 christos Exp $ */ /*- @@ -1617,6 +1617,7 @@ ENTRY(idle_start) jz _C_LABEL(idle_loop) ENTRY(idle_exit) + movl $IPL_HIGH,CPL # splhigh sti #if defined(MULTIPROCESSOR) || defined(LOCKDEBUG) call _C_LABEL(sched_lock_idle) diff --git a/sys/arch/i386/i386/trap.c b/sys/arch/i386/i386/trap.c index 98d21021725..960753234ab 100644 --- a/sys/arch/i386/i386/trap.c +++ b/sys/arch/i386/i386/trap.c @@ -1,4 +1,4 @@ -/* $OpenBSD: trap.c,v 1.68 2005/05/25 23:17:47 niklas Exp $ */ +/* $OpenBSD: trap.c,v 1.69 2005/05/29 03:20:38 deraadt Exp $ */ /* $NetBSD: trap.c,v 1.95 1996/05/05 06:50:02 mycroft Exp $ */ /*- @@ -451,6 +451,15 @@ trap(frame) case T_PAGEFLT: /* allow page faults in kernel mode */ if (p == 0 || p->p_addr == 0) goto we_re_toast; +#ifdef LOCKDEBUG + /* If we page-fault while in scheduler, we're doomed. */ +#ifdef notyet + if (simple_lock_held(&sched_lock)) +#else + if (__mp_lock_held(&sched_lock)) +#endif + goto we_re_toast; +#endif pcb = &p->p_addr->u_pcb; #if 0 diff --git a/sys/arch/i386/include/intrdefs.h b/sys/arch/i386/include/intrdefs.h index 2cf218fc765..6b7b1762430 100644 --- a/sys/arch/i386/include/intrdefs.h +++ b/sys/arch/i386/include/intrdefs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: intrdefs.h,v 1.3 2005/05/25 23:17:47 niklas Exp $ */ +/* $OpenBSD: intrdefs.h,v 1.4 2005/05/29 03:20:39 deraadt Exp $ */ /* $NetBSD: intrdefs.h,v 1.2 2003/05/04 22:01:56 fvdl Exp $ */ #ifndef _i386_INTRDEFS_H @@ -66,8 +66,8 @@ #define IPL_IMP IPL_VM /* XXX - should not be here. */ #define IPL_AUDIO MAKEIPL(7) /* audio */ #define IPL_CLOCK MAKEIPL(8) /* clock */ +#define IPL_SCHED IPL_CLOCK #define IPL_STATCLOCK MAKEIPL(9) /* statclock */ -#define IPL_SCHED IPL_STATCLOCK #define IPL_HIGH MAKEIPL(9) /* everything */ #define IPL_IPI MAKEIPL(10) /* interprocessor interrupt */ diff --git a/sys/arch/mips64/mips64/interrupt.c b/sys/arch/mips64/mips64/interrupt.c index 95ea6c0ef8f..a8a748fd2de 100644 --- a/sys/arch/mips64/mips64/interrupt.c +++ b/sys/arch/mips64/mips64/interrupt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: interrupt.c,v 1.12 2005/05/25 23:17:47 niklas Exp $ */ +/* $OpenBSD: interrupt.c,v 1.13 2005/05/29 03:20:40 deraadt Exp $ */ /* * Copyright (c) 2001-2004 Opsycon AB (www.opsycon.se / www.opsycon.com) @@ -282,10 +282,21 @@ softintr() ADDUPROF(p); } if (want_resched) { + int s; + /* - * We're being preempted. + * Since we are curproc, clock will normally just change + * our priority without moving us from one queue to another + * (since the running process is not on a queue.) + * If that happened after we put ourselves on the run queue + * but before we switched, we might not be on the queue + * indicated by our priority. */ - preempt(NULL); + s = splstatclock(); + setrunqueue(p); + p->p_stats->p_ru.ru_nivcsw++; + mi_switch(); + splx(s); while ((sig = CURSIG(p)) != 0) postsig(sig); } diff --git a/sys/arch/sparc64/include/psl.h b/sys/arch/sparc64/include/psl.h index 633a97467a9..ef4ef42008f 100644 --- a/sys/arch/sparc64/include/psl.h +++ b/sys/arch/sparc64/include/psl.h @@ -1,4 +1,4 @@ -/* $OpenBSD: psl.h,v 1.14 2005/05/25 23:17:47 niklas Exp $ */ +/* $OpenBSD: psl.h,v 1.15 2005/05/29 03:20:40 deraadt Exp $ */ /* $NetBSD: psl.h,v 1.20 2001/04/13 23:30:05 thorpej Exp $ */ /* @@ -90,7 +90,7 @@ #define PIL_SER 12 #define PIL_STATCLOCK 14 #define PIL_HIGH 15 -#define PIL_SCHED PIL_STATCLOCK +#define PIL_SCHED PIL_CLOCK #define PIL_LOCK PIL_HIGH /* |