Rename msleep() to ssleep().
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 24 Aug 2009 15:43:19 +0000 (08:43 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 24 Aug 2009 15:43:19 +0000 (08:43 -0700)
* msleep() was taking a spinlock.  Rename to ssleep() as per old request
  from hsu.

* Our mtx functions currently use mtxsleep().  Leave msleep() unassigned
  to make porting easier.

15 files changed:
sys/dev/acpica5/Osd/OsdSynch.c
sys/dev/disk/nata/ata-queue.c
sys/dev/raid/aac/aac.c
sys/dev/sound/pci/hda/hdac.c
sys/kern/kern_ccms.c
sys/kern/kern_descrip.c
sys/kern/kern_lock.c
sys/kern/kern_objcache.c
sys/kern/kern_synch.c
sys/kern/kern_syslink.c
sys/kern/lwkt_msgport.c
sys/kern/sysv_sem.c
sys/kern/vfs_bio.c
sys/sys/systm.h
sys/vm/vm_pager.c

index 78c52cd..c41f7fc 100644 (file)
@@ -50,8 +50,8 @@ ACPI_MODULE_NAME("SYNCH")
 
 MALLOC_DEFINE(M_ACPISEM, "acpisem", "ACPI semaphore");
 
-#define AS_LOCK(as)            spin_lock_wr(&(as)->as_mtx)
-#define AS_UNLOCK(as)          spin_unlock_wr(&(as)->as_mtx)
+#define AS_LOCK(as)            spin_lock_wr(&(as)->as_spin)
+#define AS_UNLOCK(as)          spin_unlock_wr(&(as)->as_spin)
 #define AS_LOCK_DECL
 
 /*
@@ -59,7 +59,7 @@ MALLOC_DEFINE(M_ACPISEM, "acpisem", "ACPI semaphore");
  * in the OSI code to implement a mutex.  Go figure.)
  */
 struct acpi_semaphore {
-    struct     spinlock as_mtx;
+    struct     spinlock as_spin;
     UINT32     as_units;
     UINT32     as_maxunits;
     UINT32     as_pendings;
@@ -94,7 +94,7 @@ AcpiOsCreateSemaphore(UINT32 MaxUnits, UINT32 InitialUnits,
 
     as = kmalloc(sizeof(*as), M_ACPISEM, M_INTWAIT | M_ZERO);
 
-    spin_init(&as->as_mtx);
+    spin_init(&as->as_spin);
     as->as_units = InitialUnits;
     as->as_maxunits = MaxUnits;
     as->as_pendings = as->as_resetting = as->as_timeouts = 0;
@@ -120,7 +120,7 @@ AcpiOsDeleteSemaphore(ACPI_HANDLE Handle)
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
 
     ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "destroyed semaphore %p\n", as));
-    spin_uninit(&as->as_mtx);
+    spin_uninit(&as->as_spin);
     kfree(as, M_ACPISEM);
 #endif /* !ACPI_NO_SEMAPHORES */
 
@@ -208,8 +208,8 @@ AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT16 Timeout)
        }
 
        ACPI_DEBUG_PRINT((ACPI_DB_MUTEX,
-           "semaphore blocked, calling msleep(%p, %p, %d, \"acsem\", %d)\n",
-           as, &as->as_mtx, PCATCH, tmo));
+           "semaphore blocked, calling ssleep(%p, %p, %d, \"acsem\", %d)\n",
+           as, &as->as_spin, PCATCH, tmo));
 
        as->as_pendings++;
 
@@ -218,7 +218,7 @@ AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT16 Timeout)
                __func__, Timeout, as->as_pendings, as, AcpiOsGetThreadId());
        }
 
-       rv = msleep(as, &as->as_mtx, PCATCH, "acsem", tmo);
+       rv = ssleep(as, &as->as_spin, PCATCH, "acsem", tmo);
 
        as->as_pendings--;
 
@@ -233,7 +233,7 @@ AcpiOsWaitSemaphore(ACPI_HANDLE Handle, UINT32 Units, UINT16 Timeout)
        }
 #endif
 
-       ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "msleep(%d) returned %d\n", tmo, rv));
+       ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "ssleep(%d) returned %d\n", tmo, rv));
        if (rv == EWOULDBLOCK) {
            result = AE_TIME;
            break;
index 2c17478..5186c99 100644 (file)
@@ -119,7 +119,7 @@ ata_queue_request(struct ata_request *request)
            spin_lock_wr(&request->done);
            /* check if the request was completed already */
            if (!(request->flags & ATA_R_COMPLETED))
-               msleep(request, &request->done, 0, "ATA request completion "
+               ssleep(request, &request->done, 0, "ATA request completion "
                       "wait", request->timeout * hz * 4);
            spin_unlock_wr(&request->done);
            /* check if the request was completed while sleeping */
index a03e945..f2c0505 100644 (file)
@@ -815,7 +815,7 @@ aac_fast_intr(void *arg)
 
                /*
                 * This might miss doing the actual wakeup.  However, the
-                * msleep that this is waking up has a timeout, so it will
+                * ssleep that this is waking up has a timeout, so it will
                 * wake up eventually.  AIFs and printfs are low enough
                 * priority that they can handle hanging out for a few seconds
                 * if needed.
index 7b273ea..e389883 100644 (file)
@@ -2914,7 +2914,7 @@ hdac_command_sendone_internal(struct hdac_softc *sc, uint32_t verb, nid_t cad)
  * hdac_command_send_internal
  *
  * Send a command list to the codec via the corb. We queue as much verbs as
- * we can and msleep on the codec. When the interrupt get the responses
+ * we can and sleep on the codec. When the interrupt get the responses
  * back from the rirb, it will wake us up so we can queue the remaining verbs
  * if any.
  ****************************************************************************/
index cc73f49..0f70a91 100644 (file)
@@ -198,7 +198,7 @@ ccms_lock_get(ccms_dataspace_t ds, ccms_lock_t lock)
        RB_SCAN(ccms_rb_tree, &ds->tree, ccms_lock_undo_cmp,
                ccms_lock_undo_match, &info);
        info.coll_cst->blocked = 1;
-       msleep(info.coll_cst, &ds->spin, 0,
+       ssleep(info.coll_cst, &ds->spin, 0,
               ((lock->ltype == CCMS_LTYPE_SHARED) ? "rngsh" : "rngex"),
               hz);
        info.coll_cst = NULL;
index 58c7736..caf66c3 100644 (file)
@@ -1869,7 +1869,7 @@ fdfree(struct proc *p, struct filedesc *repl)
                                 * in a shared file descriptor table.
                                 */
                                fdp->fd_holdleaderswakeup = 1;
-                               msleep(&fdp->fd_holdleaderscount, 
+                               ssleep(&fdp->fd_holdleaderscount,
                                       &fdp->fd_spin, 0, "fdlhold", 0);
                                goto retry;
                        }
@@ -1879,7 +1879,7 @@ fdfree(struct proc *p, struct filedesc *repl)
                                 * remains valid in closef().
                                 */
                                fdtol->fdl_wakeup = 1;
-                               msleep(fdtol, &fdp->fd_spin, 0, "fdlhold", 0);
+                               ssleep(fdtol, &fdp->fd_spin, 0, "fdlhold", 0);
                                goto retry;
                        }
                }
index 9ae8167..f205adb 100644 (file)
@@ -129,7 +129,7 @@ acquire(struct lock *lkp, int extflags, int wanted)
                /*
                 * Atomic spinlock release/sleep/reacquire.
                 */
-               error = msleep(lkp, &lkp->lk_spinlock,
+               error = ssleep(lkp, &lkp->lk_spinlock,
                               ((extflags & LK_PCATCH) ? PCATCH : 0),
                               lkp->lk_wmesg, 
                               ((extflags & LK_TIMELOCK) ? lkp->lk_timo : 0));
index 5a4cc7f..291d3ec 100644 (file)
@@ -463,7 +463,7 @@ retry:
        if ((ocflags & (M_WAITOK|M_NULLOK)) == M_WAITOK) {
                ++cpucache->waiting;
                ++depot->waiting;
-               msleep(depot, &depot->spin, 0, "objcache_get", 0);
+               ssleep(depot, &depot->spin, 0, "objcache_get", 0);
                --cpucache->waiting;
                --depot->waiting;
                spin_unlock_wr(&depot->spin);
index db65b14..055c38d 100644 (file)
@@ -688,7 +688,7 @@ resume:
 
 /*
  * Interlocked spinlock sleep.  An exclusively held spinlock must
- * be passed to msleep().  The function will atomically release the
+ * be passed to ssleep().  The function will atomically release the
  * spinlock and tsleep on the ident, then reacquire the spinlock and
  * return.
  *
@@ -696,7 +696,7 @@ resume:
  * heavily.
  */
 int
-msleep(void *ident, struct spinlock *spin, int flags,
+ssleep(void *ident, struct spinlock *spin, int flags,
        const char *wmesg, int timo)
 {
        globaldata_t gd = mycpu;
index b680968..cb4ed44 100644 (file)
@@ -588,7 +588,7 @@ slfileop_read(struct file *fp, struct uio *uio, struct ucred *cred, int flags)
                        goto done1;
                }
                ++sl->rwaiters;
-               error = msleep(&sl->rwaiters, &sl->spin, PCATCH, "slrmsg", 0);
+               error = ssleep(&sl->rwaiters, &sl->spin, PCATCH, "slrmsg", 0);
                --sl->rwaiters;
                if (error)
                        goto done1;
@@ -1231,7 +1231,7 @@ backend_wblocked_user(struct sldesc *sl, int nbio, sl_proto_t proto)
                                break;
                        }
                        ++sl->wblocked;
-                       error = msleep(&sl->wblocked, &sl->spin,
+                       error = ssleep(&sl->wblocked, &sl->spin,
                                       PCATCH, "slwmsg", 0);
                        if (error)
                                break;
@@ -1404,7 +1404,7 @@ syslink_kdomsg(struct sldesc *ksl, struct slmsg *slmsg)
        spin_lock_wr(&ksl->spin);
        if (error == 0) {
                while (slmsg->rep == NULL) {
-                       error = msleep(slmsg, &ksl->spin, 0, "kwtmsg", 0);
+                       error = ssleep(slmsg, &ksl->spin, 0, "kwtmsg", 0);
                        /* XXX ignore error for now */
                }
                if (slmsg->rep == (struct slmsg *)-1) {
@@ -1460,7 +1460,7 @@ syslink_kwaitmsg(struct sldesc *ksl, struct slmsg *slmsg)
 
        spin_lock_wr(&ksl->spin);
        while (slmsg->rep == NULL) {
-               error = msleep(slmsg, &ksl->spin, 0, "kwtmsg", 0);
+               error = ssleep(slmsg, &ksl->spin, 0, "kwtmsg", 0);
                /* XXX ignore error for now */
        }
        if (slmsg->rep == (struct slmsg *)-1) {
index 4431ac1..8b95e6c 100644 (file)
@@ -812,7 +812,7 @@ lwkt_spin_waitmsg(lwkt_msg_t msg, int flags)
             * We must still wait for message completion regardless.
             */
            if ((flags & PCATCH) && sentabort == 0) {
-               error = msleep(won, &port->mpu_spin, PCATCH, "waitmsg", 0);
+               error = ssleep(won, &port->mpu_spin, PCATCH, "waitmsg", 0);
                if (error) {
                    sentabort = error;
                    spin_unlock_wr(&port->mpu_spin);
@@ -820,7 +820,7 @@ lwkt_spin_waitmsg(lwkt_msg_t msg, int flags)
                    spin_lock_wr(&port->mpu_spin);
                }
            } else {
-               error = msleep(won, &port->mpu_spin, 0, "waitmsg", 0);
+               error = ssleep(won, &port->mpu_spin, 0, "waitmsg", 0);
            }
            /* see note at the top on the MSGPORTF_WAITING flag */
        }
@@ -853,7 +853,7 @@ lwkt_spin_waitport(lwkt_port_t port, int flags)
     spin_lock_wr(&port->mpu_spin);
     while ((msg = _lwkt_pollmsg(port)) == NULL) {
        port->mp_flags |= MSGPORTF_WAITING;
-       error = msleep(port, &port->mpu_spin, flags, "waitport", 0);
+       error = ssleep(port, &port->mpu_spin, flags, "waitport", 0);
        /* see note at the top on the MSGPORTF_WAITING flag */
        if (error) {
            spin_unlock_wr(&port->mpu_spin);
index f207bfc..caec18d 100644 (file)
@@ -808,7 +808,7 @@ sys_semop(struct semop_args *uap)
 
                /*
                 * Is it really morning, or was our sleep interrupted?
-                * (Delayed check of msleep() return code because we
+                * (Delayed check of tsleep() return code because we
                 * need to decrement sem[nz]cnt either way.)
                 */
                if (eval != 0)
index 3758510..622a2a2 100644 (file)
@@ -2321,7 +2321,7 @@ buf_daemon(void)
                 */
                spin_lock_wr(&needsbuffer_spin);
                if (bd_request == 0) {
-                       msleep(&bd_request, &needsbuffer_spin, 0,
+                       ssleep(&bd_request, &needsbuffer_spin, 0,
                               "psleep", hz);
                }
                bd_request = 0;
@@ -2381,7 +2381,7 @@ buf_daemon_hw(void)
                 */
                spin_lock_wr(&needsbuffer_spin);
                if (bd_request_hw == 0) {
-                       msleep(&bd_request_hw, &needsbuffer_spin, 0,
+                       ssleep(&bd_request_hw, &needsbuffer_spin, 0,
                               "psleep", hz);
                }
                bd_request_hw = 0;
index 725f4e1..2ca81fd 100644 (file)
@@ -333,7 +333,7 @@ extern watchdog_tickle_fn   wdog_tickler;
  * less often.
  */
 int    tsleep (void *, int, const char *, int);
-int    msleep (void *, struct spinlock *, int, const char *, int);
+int    ssleep (void *, struct spinlock *, int, const char *, int);
 int    mtxsleep (void *, struct mtx *, int, const char *, int);
 int    zsleep(void *, struct lwkt_serialize *, int, const char *, int);
 void   tsleep_interlock (void *, int);
index d64ba6a..388a3c4 100644 (file)
@@ -361,14 +361,14 @@ getpbuf(int *pfreecnt)
        for (;;) {
                if (pfreecnt) {
                        while (*pfreecnt == 0)
-                               msleep(pfreecnt, &bswspin, 0, "wswbuf0", 0);
+                               ssleep(pfreecnt, &bswspin, 0, "wswbuf0", 0);
                }
 
                /* get a bp from the swap buffer header pool */
                if ((bp = TAILQ_FIRST(&bswlist)) != NULL)
                        break;
                bswneeded = 1;
-               msleep(&bswneeded, &bswspin, 0, "wswbuf1", 0);
+               ssleep(&bswneeded, &bswspin, 0, "wswbuf1", 0);
                /* loop in case someone else grabbed one */
        }
        TAILQ_REMOVE(&bswlist, bp, b_freelist);