Deleted Added
full compact
kern_condvar.c (73925) kern_condvar.c (74912)
1/*-
2 * Copyright (c) 2000 Jake Burkholder <jake@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 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
1/*-
2 * Copyright (c) 2000 Jake Burkholder <jake@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 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD: head/sys/kern/kern_condvar.c 73925 2001-03-07 03:26:39Z jhb $
26 * $FreeBSD: head/sys/kern/kern_condvar.c 74912 2001-03-28 09:03:24Z jhb $
27 */
28
29#include "opt_ktrace.h"
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/proc.h>
34#include <sys/kernel.h>

--- 157 unchanged lines hidden (view full) ---

192
193 p = CURPROC;
194#ifdef KTRACE
195 if (p && KTRPOINT(p, KTR_CSW))
196 ktrcsw(p->p_tracep, 1, 0);
197#endif
198 CV_ASSERT(cvp, mp, p);
199 WITNESS_SLEEP(0, mp);
27 */
28
29#include "opt_ktrace.h"
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/proc.h>
34#include <sys/kernel.h>

--- 157 unchanged lines hidden (view full) ---

192
193 p = CURPROC;
194#ifdef KTRACE
195 if (p && KTRPOINT(p, KTR_CSW))
196 ktrcsw(p->p_tracep, 1, 0);
197#endif
198 CV_ASSERT(cvp, mp, p);
199 WITNESS_SLEEP(0, mp);
200 WITNESS_SAVE(mp, mp);
200 WITNESS_SAVE(&mp->mtx_object, mp);
201
202 mtx_lock_spin(&sched_lock);
203 if (cold || panicstr) {
204 /*
205 * After a panic, or during autoconfiguration, just give
206 * interrupts a chance, then just return; don't run any other
207 * procs or panic below, in case this is the idle process and
208 * already asleep.

--- 11 unchanged lines hidden (view full) ---

220
221 mtx_unlock_spin(&sched_lock);
222#ifdef KTRACE
223 if (KTRPOINT(p, KTR_CSW))
224 ktrcsw(p->p_tracep, 0, 0);
225#endif
226 PICKUP_GIANT();
227 mtx_lock(mp);
201
202 mtx_lock_spin(&sched_lock);
203 if (cold || panicstr) {
204 /*
205 * After a panic, or during autoconfiguration, just give
206 * interrupts a chance, then just return; don't run any other
207 * procs or panic below, in case this is the idle process and
208 * already asleep.

--- 11 unchanged lines hidden (view full) ---

220
221 mtx_unlock_spin(&sched_lock);
222#ifdef KTRACE
223 if (KTRPOINT(p, KTR_CSW))
224 ktrcsw(p->p_tracep, 0, 0);
225#endif
226 PICKUP_GIANT();
227 mtx_lock(mp);
228 WITNESS_RESTORE(mp, mp);
228 WITNESS_RESTORE(&mp->mtx_object, mp);
229}
230
231/*
232 * Wait on a condition variable, allowing interruption by signals. Return 0 if
233 * the process was resumed with cv_signal or cv_broadcast, EINTR or ERESTART if
234 * a signal was caught. If ERESTART is returned the system call should be
235 * restarted if possible.
236 */

--- 8 unchanged lines hidden (view full) ---

245 p = CURPROC;
246 rval = 0;
247#ifdef KTRACE
248 if (p && KTRPOINT(p, KTR_CSW))
249 ktrcsw(p->p_tracep, 1, 0);
250#endif
251 CV_ASSERT(cvp, mp, p);
252 WITNESS_SLEEP(0, mp);
229}
230
231/*
232 * Wait on a condition variable, allowing interruption by signals. Return 0 if
233 * the process was resumed with cv_signal or cv_broadcast, EINTR or ERESTART if
234 * a signal was caught. If ERESTART is returned the system call should be
235 * restarted if possible.
236 */

--- 8 unchanged lines hidden (view full) ---

245 p = CURPROC;
246 rval = 0;
247#ifdef KTRACE
248 if (p && KTRPOINT(p, KTR_CSW))
249 ktrcsw(p->p_tracep, 1, 0);
250#endif
251 CV_ASSERT(cvp, mp, p);
252 WITNESS_SLEEP(0, mp);
253 WITNESS_SAVE(mp, mp);
253 WITNESS_SAVE(&mp->mtx_object, mp);
254
255 mtx_lock_spin(&sched_lock);
256 if (cold || panicstr) {
257 /*
258 * After a panic, or during autoconfiguration, just give
259 * interrupts a chance, then just return; don't run any other
260 * procs or panic below, in case this is the idle process and
261 * already asleep.

--- 23 unchanged lines hidden (view full) ---

285 PROC_UNLOCK(p);
286 }
287
288#ifdef KTRACE
289 if (KTRPOINT(p, KTR_CSW))
290 ktrcsw(p->p_tracep, 0, 0);
291#endif
292 mtx_lock(mp);
254
255 mtx_lock_spin(&sched_lock);
256 if (cold || panicstr) {
257 /*
258 * After a panic, or during autoconfiguration, just give
259 * interrupts a chance, then just return; don't run any other
260 * procs or panic below, in case this is the idle process and
261 * already asleep.

--- 23 unchanged lines hidden (view full) ---

285 PROC_UNLOCK(p);
286 }
287
288#ifdef KTRACE
289 if (KTRPOINT(p, KTR_CSW))
290 ktrcsw(p->p_tracep, 0, 0);
291#endif
292 mtx_lock(mp);
293 WITNESS_RESTORE(mp, mp);
293 WITNESS_RESTORE(&mp->mtx_object, mp);
294
295 return (rval);
296}
297
298/*
299 * Wait on a condition variable for at most timo/hz seconds. Returns 0 if the
300 * process was resumed by cv_signal or cv_broadcast, EWOULDBLOCK if the timeout
301 * expires.

--- 8 unchanged lines hidden (view full) ---

310 p = CURPROC;
311 rval = 0;
312#ifdef KTRACE
313 if (p && KTRPOINT(p, KTR_CSW))
314 ktrcsw(p->p_tracep, 1, 0);
315#endif
316 CV_ASSERT(cvp, mp, p);
317 WITNESS_SLEEP(0, mp);
294
295 return (rval);
296}
297
298/*
299 * Wait on a condition variable for at most timo/hz seconds. Returns 0 if the
300 * process was resumed by cv_signal or cv_broadcast, EWOULDBLOCK if the timeout
301 * expires.

--- 8 unchanged lines hidden (view full) ---

310 p = CURPROC;
311 rval = 0;
312#ifdef KTRACE
313 if (p && KTRPOINT(p, KTR_CSW))
314 ktrcsw(p->p_tracep, 1, 0);
315#endif
316 CV_ASSERT(cvp, mp, p);
317 WITNESS_SLEEP(0, mp);
318 WITNESS_SAVE(mp, mp);
318 WITNESS_SAVE(&mp->mtx_object, mp);
319
320 mtx_lock_spin(&sched_lock);
321 if (cold || panicstr) {
322 /*
323 * After a panic, or during autoconfiguration, just give
324 * interrupts a chance, then just return; don't run any other
325 * procs or panic below, in case this is the idle process and
326 * already asleep.

--- 18 unchanged lines hidden (view full) ---

345
346 mtx_unlock_spin(&sched_lock);
347#ifdef KTRACE
348 if (KTRPOINT(p, KTR_CSW))
349 ktrcsw(p->p_tracep, 0, 0);
350#endif
351 PICKUP_GIANT();
352 mtx_lock(mp);
319
320 mtx_lock_spin(&sched_lock);
321 if (cold || panicstr) {
322 /*
323 * After a panic, or during autoconfiguration, just give
324 * interrupts a chance, then just return; don't run any other
325 * procs or panic below, in case this is the idle process and
326 * already asleep.

--- 18 unchanged lines hidden (view full) ---

345
346 mtx_unlock_spin(&sched_lock);
347#ifdef KTRACE
348 if (KTRPOINT(p, KTR_CSW))
349 ktrcsw(p->p_tracep, 0, 0);
350#endif
351 PICKUP_GIANT();
352 mtx_lock(mp);
353 WITNESS_RESTORE(mp, mp);
353 WITNESS_RESTORE(&mp->mtx_object, mp);
354
355 return (rval);
356}
357
358/*
359 * Wait on a condition variable for at most timo/hz seconds, allowing
360 * interruption by signals. Returns 0 if the process was resumed by cv_signal
361 * or cv_broadcast, EWOULDBLOCK if the timeout expires, and EINTR or ERESTART if

--- 10 unchanged lines hidden (view full) ---

372 p = CURPROC;
373 rval = 0;
374#ifdef KTRACE
375 if (p && KTRPOINT(p, KTR_CSW))
376 ktrcsw(p->p_tracep, 1, 0);
377#endif
378 CV_ASSERT(cvp, mp, p);
379 WITNESS_SLEEP(0, mp);
354
355 return (rval);
356}
357
358/*
359 * Wait on a condition variable for at most timo/hz seconds, allowing
360 * interruption by signals. Returns 0 if the process was resumed by cv_signal
361 * or cv_broadcast, EWOULDBLOCK if the timeout expires, and EINTR or ERESTART if

--- 10 unchanged lines hidden (view full) ---

372 p = CURPROC;
373 rval = 0;
374#ifdef KTRACE
375 if (p && KTRPOINT(p, KTR_CSW))
376 ktrcsw(p->p_tracep, 1, 0);
377#endif
378 CV_ASSERT(cvp, mp, p);
379 WITNESS_SLEEP(0, mp);
380 WITNESS_SAVE(mp, mp);
380 WITNESS_SAVE(&mp->mtx_object, mp);
381
382 mtx_lock_spin(&sched_lock);
383 if (cold || panicstr) {
384 /*
385 * After a panic, or during autoconfiguration, just give
386 * interrupts a chance, then just return; don't run any other
387 * procs or panic below, in case this is the idle process and
388 * already asleep.

--- 30 unchanged lines hidden (view full) ---

419 PROC_UNLOCK(p);
420 }
421
422#ifdef KTRACE
423 if (KTRPOINT(p, KTR_CSW))
424 ktrcsw(p->p_tracep, 0, 0);
425#endif
426 mtx_lock(mp);
381
382 mtx_lock_spin(&sched_lock);
383 if (cold || panicstr) {
384 /*
385 * After a panic, or during autoconfiguration, just give
386 * interrupts a chance, then just return; don't run any other
387 * procs or panic below, in case this is the idle process and
388 * already asleep.

--- 30 unchanged lines hidden (view full) ---

419 PROC_UNLOCK(p);
420 }
421
422#ifdef KTRACE
423 if (KTRPOINT(p, KTR_CSW))
424 ktrcsw(p->p_tracep, 0, 0);
425#endif
426 mtx_lock(mp);
427 WITNESS_RESTORE(mp, mp);
427 WITNESS_RESTORE(&mp->mtx_object, mp);
428
429 return (rval);
430}
431
432/*
433 * Common code for signal and broadcast. Assumes waitq is not empty. Must be
434 * called with sched_lock held.
435 */

--- 107 unchanged lines hidden ---
428
429 return (rval);
430}
431
432/*
433 * Common code for signal and broadcast. Assumes waitq is not empty. Must be
434 * called with sched_lock held.
435 */

--- 107 unchanged lines hidden ---