Index: compat/ndis/kern_ndis.c =================================================================== RCS file: /usr/cvs/src/sys/compat/ndis/kern_ndis.c,v retrieving revision 1.93 diff -u -r1.93 kern_ndis.c --- compat/ndis/kern_ndis.c 23 Feb 2007 12:18:28 -0000 1.93 +++ compat/ndis/kern_ndis.c 23 Feb 2007 15:59:19 -0000 @@ -1248,7 +1248,7 @@ * expects them to fire before the halt is called. */ - tsleep(curthread->td_proc, PWAIT, "ndwait", hz); + pause("ndwait", hz); NDIS_LOCK(sc); sc->ndis_block->nmb_devicectx = sc; Index: dev/acpica/Osd/OsdSchedule.c =================================================================== RCS file: /usr/cvs/src/sys/dev/acpica/Osd/OsdSchedule.c,v retrieving revision 1.37 diff -u -r1.37 OsdSchedule.c --- dev/acpica/Osd/OsdSchedule.c 16 May 2006 14:36:22 -0000 1.37 +++ dev/acpica/Osd/OsdSchedule.c 23 Feb 2007 15:59:19 -0000 @@ -132,7 +132,6 @@ AcpiOsSleep(ACPI_INTEGER Milliseconds) { int timo; - static int dummy; ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); @@ -143,7 +142,7 @@ * DELAY instead for better granularity. */ if (timo > 0) - tsleep(&dummy, 0, "acpislp", timo); + pause("acpislp", timo); else DELAY(Milliseconds * 1000); Index: dev/ata/ata-all.c =================================================================== RCS file: /usr/cvs/src/sys/dev/ata/ata-all.c,v retrieving revision 1.278 diff -u -r1.278 ata-all.c --- dev/ata/ata-all.c 23 Feb 2007 12:18:32 -0000 1.278 +++ dev/ata/ata-all.c 23 Feb 2007 15:59:19 -0000 @@ -122,7 +122,7 @@ /* reset the controller HW, the channel and device(s) */ while (ATA_LOCKING(dev, ATA_LF_LOCK) != ch->unit) - tsleep(&error, PRIBIO, "ataatch", 1); + pause("ataatch", 1); ATA_RESET(dev); ATA_LOCKING(dev, ATA_LF_UNLOCK); @@ -196,7 +196,7 @@ /* poll for locking the channel */ while (ATA_LOCKING(dev, ATA_LF_LOCK) != ch->unit) - tsleep(&dev, PRIBIO, "atarini", 1); + pause("atarini", 1); /* catch eventual request in ch->running */ mtx_lock(&ch->state_mtx); @@ -824,7 +824,7 @@ if (1 || interval < (1000000/hz) || ata_delayed_attach) DELAY(interval); else - tsleep(&interval, PRIBIO, "ataslp", interval/(1000000/hz)); + pause("ataslp", interval/(1000000/hz)); } char * Index: dev/ata/atapi-cd.c =================================================================== RCS file: /usr/cvs/src/sys/dev/ata/atapi-cd.c,v retrieving revision 1.192 diff -u -r1.192 atapi-cd.c --- dev/ata/atapi-cd.c 21 Feb 2007 19:07:18 -0000 1.192 +++ dev/ata/atapi-cd.c 23 Feb 2007 15:59:19 -0000 @@ -710,7 +710,7 @@ request->u.atapi.sense.key == 7) && request->u.atapi.sense.asc == 4 && request->u.atapi.sense.ascq == 1) - tsleep(&timeout, PRIBIO, "acdld", hz / 2); + pause("acdld", hz / 2); else break; } @@ -1095,7 +1095,7 @@ /* some drives just return ready, wait for the expected fixate time */ if ((error = acd_test_ready(dev)) != EBUSY) { timeout = timeout / (cdp->cap.cur_write_speed / 177); - tsleep(&error, PRIBIO, "acdfix", timeout * hz / 2); + pause("acdfix", timeout * hz / 2); return acd_test_ready(dev); } @@ -1104,7 +1104,7 @@ return error; if ((error = acd_test_ready(dev)) != EBUSY) return error; - tsleep(&error, PRIBIO, "acdcld", hz / 2); + pause("acdcld", hz / 2); } return EIO; } Index: dev/ata/atapi-tape.c =================================================================== RCS file: /usr/cvs/src/sys/dev/ata/atapi-tape.c,v retrieving revision 1.102 diff -u -r1.102 atapi-tape.c --- dev/ata/atapi-tape.c 21 Feb 2007 19:07:19 -0000 1.102 +++ dev/ata/atapi-tape.c 23 Feb 2007 15:59:19 -0000 @@ -612,7 +612,7 @@ error = ata_atapicmd(dev, ccb, NULL, 0, 0, 10); if (error) return error; - tsleep((caddr_t)&error, PRIBIO, "astlu", 1 * hz); + pause("astlu", 1 * hz); if (function == ATAPI_SS_EJECT) return 0; return ast_wait_dsc(dev, 60*60); @@ -665,7 +665,7 @@ error = ata_atapicmd(dev, ccb, NULL, 0, 0, 0); if (error != EBUSY) break; - tsleep(&error, PRIBIO, "atpwt", hz / 2); + pause("atpwt", hz / 2); timeout -= (hz / 2); } return error; Index: dev/ppc/ppc.c =================================================================== RCS file: /usr/cvs/src/sys/dev/ppc/ppc.c,v retrieving revision 1.53 diff -u -r1.53 ppc.c --- dev/ppc/ppc.c 23 Feb 2007 12:18:50 -0000 1.53 +++ dev/ppc/ppc.c 23 Feb 2007 15:59:19 -0000 @@ -1393,8 +1393,7 @@ case MS_OP_ADELAY: if (mi->arg[0].i) - tsleep(NULL, PPBPRI, "ppbdelay", - mi->arg[0].i * (hz/1000)); + pause("ppbdelay", mi->arg[0].i * (hz/1000)); INCR_PC; break; Index: kern/kern_synch.c =================================================================== RCS file: /usr/cvs/src/sys/kern/kern_synch.c,v retrieving revision 1.287 diff -u -r1.287 kern_synch.c --- kern/kern_synch.c 3 Jan 2007 02:38:41 -0000 1.287 +++ kern/kern_synch.c 23 Feb 2007 15:59:19 -0000 @@ -69,6 +69,7 @@ int hogticks; int lbolt; +static int pause_wchan; static struct callout loadav_callout; static struct callout lbolt_callout; @@ -164,7 +165,10 @@ if (TD_ON_SLEEPQ(td)) sleepq_remove(td, td->td_wchan); - flags = SLEEPQ_MSLEEP; + if (ident == &pause_wchan) + flags = SLEEPQ_PAUSE; + else + flags = SLEEPQ_MSLEEP; if (catch) flags |= SLEEPQ_INTERRUPTIBLE; @@ -308,6 +312,22 @@ } /* + * pause() is like tsleep() except that the intention is to not be + * explicitly woken up by another thread. Instead, the current thread + * simply wishes to sleep until the timeout expires. It is + * implemented using a dummy wait channel. + */ +int +pause(wmesg, timo) + const char *wmesg; + int timo; +{ + + KASSERT(timo != 0, ("pause: timeout required")); + return (tsleep(&pause_wchan, 0, wmesg, timo)); +} + +/* * Make all threads sleeping on the specified identifier runnable. */ void Index: sys/sleepqueue.h =================================================================== RCS file: /usr/cvs/src/sys/sys/sleepqueue.h,v retrieving revision 1.9 diff -u -r1.9 sleepqueue.h --- sys/sleepqueue.h 16 Dec 2006 06:54:09 -0000 1.9 +++ sys/sleepqueue.h 23 Feb 2007 15:59:19 -0000 @@ -84,6 +84,7 @@ #define SLEEPQ_TYPE 0x0ff /* Mask of sleep queue types. */ #define SLEEPQ_MSLEEP 0x00 /* Used by msleep/wakeup. */ #define SLEEPQ_CONDVAR 0x01 /* Used for a cv. */ +#define SLEEPQ_PAUSE 0x02 /* Used by pause. */ #define SLEEPQ_INTERRUPTIBLE 0x100 /* Sleep is interruptible. */ void init_sleepqueues(void); Index: sys/systm.h =================================================================== RCS file: /usr/cvs/src/sys/sys/systm.h,v retrieving revision 1.249 diff -u -r1.249 systm.h --- sys/systm.h 14 Feb 2007 05:21:22 -0000 1.249 +++ sys/systm.h 23 Feb 2007 15:59:19 -0000 @@ -310,6 +310,7 @@ int msleep(void *chan, struct mtx *mtx, int pri, const char *wmesg, int timo); int msleep_spin(void *chan, struct mtx *mtx, const char *wmesg, int timo); +int pause(const char *wmesg, int timo); #define tsleep(chan, pri, wmesg, timo) msleep(chan, NULL, pri, wmesg, timo) void wakeup(void *chan) __nonnull(1); void wakeup_one(void *chan) __nonnull(1);