kern_intr.c (71240) | kern_intr.c (72200) |
---|---|
1/* 2 * Copyright (c) 1997, Stefan Esser <se@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * | 1/* 2 * Copyright (c) 1997, Stefan Esser <se@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 9 unchanged lines hidden (view full) --- 18 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * |
26 * $FreeBSD: head/sys/kern/kern_intr.c 71240 2001-01-19 09:57:29Z peter $ | 26 * $FreeBSD: head/sys/kern/kern_intr.c 72200 2001-02-09 06:11:45Z bmilekic $ |
27 * 28 */ 29 30 31#include <sys/param.h> 32#include <sys/bus.h> 33#include <sys/rtprio.h> 34#include <sys/systm.h> --- 128 unchanged lines hidden (view full) --- 163 * to done, it will do another go-round. Then get the sched lock 164 * and see if the thread is on whichkqs yet. If not, put it on 165 * there. In any case, kick everyone so that if the new thread 166 * is higher priority than their current thread, it gets run now. 167 */ 168 ih->ih_need = 1; 169 if (!(flag & SWI_DELAY)) { 170 it->it_need = 1; | 27 * 28 */ 29 30 31#include <sys/param.h> 32#include <sys/bus.h> 33#include <sys/rtprio.h> 34#include <sys/systm.h> --- 128 unchanged lines hidden (view full) --- 163 * to done, it will do another go-round. Then get the sched lock 164 * and see if the thread is on whichkqs yet. If not, put it on 165 * there. In any case, kick everyone so that if the new thread 166 * is higher priority than their current thread, it gets run now. 167 */ 168 ih->ih_need = 1; 169 if (!(flag & SWI_DELAY)) { 170 it->it_need = 1; |
171 mtx_enter(&sched_lock, MTX_SPIN); | 171 mtx_lock_spin(&sched_lock); |
172 if (p->p_stat == SWAIT) { /* not on run queue */ 173 CTR1(KTR_INTR, "sched_swi: setrunqueue %d", p->p_pid); 174/* membar_lock(); */ 175 p->p_stat = SRUN; 176 setrunqueue(p); 177 aston(); 178 } 179 else { 180 CTR3(KTR_INTR, "sched_swi %d: it_need %d, state %d", 181 p->p_pid, it->it_need, p->p_stat ); 182 } | 172 if (p->p_stat == SWAIT) { /* not on run queue */ 173 CTR1(KTR_INTR, "sched_swi: setrunqueue %d", p->p_pid); 174/* membar_lock(); */ 175 p->p_stat = SRUN; 176 setrunqueue(p); 177 aston(); 178 } 179 else { 180 CTR3(KTR_INTR, "sched_swi %d: it_need %d, state %d", 181 p->p_pid, it->it_need, p->p_stat ); 182 } |
183 mtx_exit(&sched_lock, MTX_SPIN); | 183 mtx_unlock_spin(&sched_lock); |
184 need_resched(); 185 } 186} 187 188/* 189 * This is the main code for soft interrupt threads. 190 */ 191void --- 26 unchanged lines hidden (view full) --- 218 ih->ih_need = 0; 219 CTR5(KTR_INTR, 220 "sithd_loop pid %d ih=%p: %p(%p) flg=%x", 221 p->p_pid, (void *)ih, 222 (void *)ih->ih_handler, ih->ih_argument, 223 ih->ih_flags); 224 225 if ((ih->ih_flags & INTR_MPSAFE) == 0) | 184 need_resched(); 185 } 186} 187 188/* 189 * This is the main code for soft interrupt threads. 190 */ 191void --- 26 unchanged lines hidden (view full) --- 218 ih->ih_need = 0; 219 CTR5(KTR_INTR, 220 "sithd_loop pid %d ih=%p: %p(%p) flg=%x", 221 p->p_pid, (void *)ih, 222 (void *)ih->ih_handler, ih->ih_argument, 223 ih->ih_flags); 224 225 if ((ih->ih_flags & INTR_MPSAFE) == 0) |
226 mtx_enter(&Giant, MTX_DEF); | 226 mtx_lock(&Giant); |
227 ih->ih_handler(ih->ih_argument); 228 if ((ih->ih_flags & INTR_MPSAFE) == 0) | 227 ih->ih_handler(ih->ih_argument); 228 if ((ih->ih_flags & INTR_MPSAFE) == 0) |
229 mtx_exit(&Giant, MTX_DEF); | 229 mtx_unlock(&Giant); |
230 } 231 } 232 233 /* 234 * Processed all our interrupts. Now get the sched 235 * lock. This may take a while and it_need may get 236 * set again, so we have to check it again. 237 */ 238 mtx_assert(&Giant, MA_NOTOWNED); | 230 } 231 } 232 233 /* 234 * Processed all our interrupts. Now get the sched 235 * lock. This may take a while and it_need may get 236 * set again, so we have to check it again. 237 */ 238 mtx_assert(&Giant, MA_NOTOWNED); |
239 mtx_enter(&sched_lock, MTX_SPIN); | 239 mtx_lock_spin(&sched_lock); |
240 if (!it->it_need) { 241 p->p_stat = SWAIT; /* we're idle */ 242 CTR1(KTR_INTR, "sithd_loop pid %d: done", p->p_pid); 243 mi_switch(); 244 CTR1(KTR_INTR, "sithd_loop pid %d: resumed", p->p_pid); 245 } | 240 if (!it->it_need) { 241 p->p_stat = SWAIT; /* we're idle */ 242 CTR1(KTR_INTR, "sithd_loop pid %d: done", p->p_pid); 243 mi_switch(); 244 CTR1(KTR_INTR, "sithd_loop pid %d: resumed", p->p_pid); 245 } |
246 mtx_exit(&sched_lock, MTX_SPIN); | 246 mtx_unlock_spin(&sched_lock); |
247 } 248} 249 250SYSINIT(start_softintr, SI_SUB_SOFTINTR, SI_ORDER_FIRST, start_softintr, NULL) 251 252/* 253 * Start standard software interrupt threads 254 */ --- 66 unchanged lines hidden --- | 247 } 248} 249 250SYSINIT(start_softintr, SI_SUB_SOFTINTR, SI_ORDER_FIRST, start_softintr, NULL) 251 252/* 253 * Start standard software interrupt threads 254 */ --- 66 unchanged lines hidden --- |