kernel/spinlock: Add a description to struct spinlock.
authorSascha Wildner <saw@online.de>
Sun, 24 Aug 2014 21:54:16 +0000 (23:54 +0200)
committerSascha Wildner <saw@online.de>
Sun, 24 Aug 2014 21:54:16 +0000 (23:54 +0200)
And add it to spin_init() and SPINLOCK_INITIALIZER().

Submitted-by: dclink (see <http://bugs.dragonflybsd.org/issues/2714>)
OK'd-by:      dillon

79 files changed:
share/man/man9/spinlock.9
sys/bus/cam/cam_sim.c
sys/bus/cam/cam_xpt.c
sys/bus/pci/i386/pci_cfgreg.c
sys/bus/pci/x86_64/pci_cfgreg.c
sys/dev/acpica/Osd/OsdSynch.c
sys/dev/crypto/aesni/aesni.c
sys/dev/crypto/glxsb/glxsb.c
sys/dev/crypto/padlock/padlock.c
sys/dev/disk/nata/ata-all.c
sys/dev/disk/nata/ata-chipset.c
sys/dev/disk/nata/ata-queue.c
sys/dev/disk/nata/ata-raid.c
sys/dev/disk/nata/ata-usb.c
sys/dev/disk/nata/atapi-cam.c
sys/dev/drm/drm_dma.c
sys/dev/drm/drm_mm.c
sys/dev/drm/i915/i915_dma.c
sys/dev/drm/include/linux/wait.h
sys/dev/drm/radeon/radeon_device.c
sys/dev/drm/ttm/ttm_memory.c
sys/dev/misc/putter/putter.c
sys/dev/netif/ath/ath_hal/ah_osdep.c
sys/dev/raid/mrsas/mrsas.c
sys/dev/raid/twa/tw_osl_freebsd.c
sys/dev/raid/twa/tw_osl_inline.h
sys/emulation/linux/linux_futex.c
sys/kern/init_main.c
sys/kern/kern_condvar.c
sys/kern/kern_descrip.c
sys/kern/kern_environment.c
sys/kern/kern_fork.c
sys/kern/kern_ktr.c
sys/kern/kern_nrandom.c
sys/kern/kern_objcache.c
sys/kern/kern_plimit.c
sys/kern/kern_resource.c
sys/kern/kern_sensors.c
sys/kern/kern_spinlock.c
sys/kern/kern_sysref.c
sys/kern/kern_wdog.c
sys/kern/lwkt_msgport.c
sys/kern/lwkt_token.c
sys/kern/subr_csprng.c
sys/kern/subr_prf.c
sys/kern/subr_taskqueue.c
sys/kern/uipc_mbuf.c
sys/kern/uipc_socket.c
sys/kern/uipc_usrreq.c
sys/kern/usched_bsd4.c
sys/kern/usched_dfly.c
sys/kern/usched_dummy.c
sys/kern/vfs_bio.c
sys/kern/vfs_cache.c
sys/kern/vfs_lock.c
sys/kern/vfs_quota.c
sys/net/netmap/netmap_mbq.c
sys/net/pf/pf.c
sys/netproto/smb/smb_subr.h
sys/opencrypto/cryptosoft.c
sys/platform/pc32/i386/busdma_machdep.c
sys/platform/pc32/i386/pmap.c
sys/platform/pc64/x86_64/busdma_machdep.c
sys/platform/pc64/x86_64/pmap.c
sys/platform/vkernel/platform/busdma_machdep.c
sys/platform/vkernel/platform/pmap.c
sys/platform/vkernel64/platform/busdma_machdep.c
sys/platform/vkernel64/platform/pmap.c
sys/sys/spinlock.h
sys/sys/spinlock2.h
sys/sys/tree.h
sys/vfs/hammer2/hammer2_ccms.c
sys/vfs/hammer2/hammer2_vfsops.c
sys/vfs/ntfs/ntfs_subr.c
sys/vfs/ufs/ffs_softdep.c
sys/vm/swap_pager.c
sys/vm/vm_page.c
sys/vm/vm_pager.c
sys/vm/vm_zone.c

index 2c2a115..2e1f3ee 100644 (file)
@@ -28,7 +28,7 @@
 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd January 15, 2014
+.Dd August 24, 2014
 .Dt SPINLOCK 9
 .Os
 .Sh NAME
@@ -46,7 +46,7 @@
 .In sys/spinlock.h
 .In sys/spinlock2.h
 .Ft void
-.Fn spin_init "struct spinlock *mtx"
+.Fn spin_init "struct spinlock *mtx" "const char *descr"
 .Ft void
 .Fn spin_uninit "struct spinlock *mtx"
 .Ft void
@@ -73,6 +73,10 @@ The
 function initializes a new
 .Fa spinlock
 structure for use.
+An initializer macro,
+.Dv SPINLOCK_INITIALIZER ,
+is provided as well, taking the same arguments as
+.Fn spin_init .
 The structure is cleaned up with
 .Fn spin_uninit
 when it is no longer needed.
index 85c7dba..26ba50e 100644 (file)
@@ -26,7 +26,6 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/cam/cam_sim.c,v 1.3 1999/08/28 00:40:42 peter Exp $
- * $DragonFly: src/sys/bus/cam/cam_sim.c,v 1.13 2008/07/18 00:07:21 dillon Exp $
  */
 
 #include <sys/param.h>
@@ -211,7 +210,7 @@ cam_sim_alloc(sim_action_func sim_action, sim_poll_func sim_poll,
 
        SLIST_INIT(&sim->ccb_freeq);
        TAILQ_INIT(&sim->sim_doneq);
-       spin_init(&sim->sim_spin);
+       spin_init(&sim->sim_spin, "cam_sim_alloc");
 
        return (sim);
 }
index fc0f2f9..075113c 100644 (file)
@@ -1452,13 +1452,13 @@ xpt_init(void *dummy)
        STAILQ_INIT(&xsoftc.highpowerq);
        xsoftc.num_highpower = CAM_MAX_HIGHPOWER;
 
-       spin_init(&cam_simq_spin);
+       spin_init(&cam_simq_spin, "cam_simq_spin");
        lockinit(&xsoftc.xpt_lock, "XPT lock", 0, LK_CANRECURSE);
        lockinit(&xsoftc.xpt_topo_lock, "XPT topology lock", 0, LK_CANRECURSE);
 
        SLIST_INIT(&cam_dead_sim.ccb_freeq);
        TAILQ_INIT(&cam_dead_sim.sim_doneq);
-       spin_init(&cam_dead_sim.sim_spin);
+       spin_init(&cam_dead_sim.sim_spin, "cam_dead_sim");
        cam_dead_sim.sim_action = dead_sim_action;
        cam_dead_sim.sim_poll = dead_sim_poll;
        cam_dead_sim.sim_name = "dead_sim";
index 2d7c903..3d2b1ba 100644 (file)
@@ -149,7 +149,7 @@ pci_cfgregopen(void)
        if (v > 0)
                PRVERB(("pcibios: BIOS version %x.%02x\n", (v & 0xff00) >> 8,
                    v & 0xff));
-       spin_init(&pcicfg_spin);
+       spin_init(&pcicfg_spin, "pcicfg");
        opened = 1;
 
        /* $PIR requires PCI BIOS 2.10 or greater. */
index 0d12a73..9da2043 100644 (file)
@@ -89,7 +89,7 @@ pci_cfgregopen(void)
 
        if (!inited) {
                inited = 1;
-               spin_init(&pcicfg_spin);
+               spin_init(&pcicfg_spin, "pcicfg");
        }
 
        if (cfgmech != CFGMECH_NONE)
index 863536a..2912004 100644 (file)
@@ -95,7 +95,7 @@ AcpiOsCreateSemaphore(UINT32 MaxUnits, UINT32 InitialUnits,
 
     as = kmalloc(sizeof(*as), M_ACPISEM, M_INTWAIT | M_ZERO);
 
-    spin_init(&as->as_spin);
+    spin_init(&as->as_spin, "AcpiOsSem");
     as->as_units = InitialUnits;
     as->as_maxunits = MaxUnits;
     as->as_pendings = as->as_resetting = as->as_timeouts = 0;
@@ -345,7 +345,7 @@ AcpiOsCreateLock(ACPI_SPINLOCK *OutHandle)
     if (OutHandle == NULL)
        return (AE_BAD_PARAMETER);
     spin = kmalloc(sizeof(*spin), M_ACPISEM, M_INTWAIT|M_ZERO);
-    spin_init(&spin->lock);
+    spin_init(&spin->lock, "AcpiOsLock");
 #ifdef ACPI_DEBUG_LOCKS
     spin->owner = NULL;
     spin->func = "";
index a4919d5..3c4b7d2 100644 (file)
@@ -92,7 +92,7 @@ aesni_attach(device_t dev)
                return (ENOMEM);
        }
 
-       spin_init(&sc->lock);
+       spin_init(&sc->lock, "aesniattach");
        crypto_register(sc->cid, CRYPTO_AES_CBC, 0, 0);
        crypto_register(sc->cid, CRYPTO_AES_XTS, 0, 0);
        return (0);
index 17f15d7..40f012f 100644 (file)
@@ -508,8 +508,8 @@ glxsb_crypto_setup(struct glxsb_softc *sc)
 
        TAILQ_INIT(&sc->sc_sessions);
        sc->sc_sid = 1;
-       spin_init(&sc->sc_sessions_lock);
-       spin_init(&sc->sc_task_mtx);
+       spin_init(&sc->sc_sessions_lock, "glxsb_sessions");
+       spin_init(&sc->sc_task_mtx, "glxsb_task");
 
        if (crypto_register(sc->sc_cid, CRYPTO_AES_CBC, 0, 0) != 0)
                goto crypto_fail;
index 96e663e..b203cf2 100644 (file)
@@ -126,7 +126,7 @@ padlock_attach(device_t dev)
                return (ENOMEM);
        }
 
-       spin_init(&sc->sc_sessions_lock);
+       spin_init(&sc->sc_sessions_lock, "padlock");
        crypto_register(sc->sc_cid, CRYPTO_AES_CBC, 0, 0);
        crypto_register(sc->sc_cid, CRYPTO_MD5_HMAC, 0, 0);
        crypto_register(sc->sc_cid, CRYPTO_SHA1_HMAC, 0, 0);
index 5a84352..51bba4a 100644 (file)
@@ -24,7 +24,6 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/ata/ata-all.c,v 1.279 2007/02/23 16:25:08 jhb Exp $
- * $DragonFly: src/sys/dev/disk/nata/ata-all.c,v 1.14 2008/03/24 06:41:56 dillon Exp $
  */
 
 #include "opt_ata.h"
@@ -122,8 +121,8 @@ ata_attach(device_t dev)
     /* initialize the softc basics */
     ch->dev = dev;
     ch->state = ATA_IDLE;
-    spin_init(&ch->state_mtx);
-    spin_init(&ch->queue_mtx);
+    spin_init(&ch->state_mtx, "ataattach_state");
+    spin_init(&ch->queue_mtx, "ataattach_queue");
     ata_queue_init(ch);
 
     /* reset the controller HW, the channel and device(s) */
index 287ab1e..ee675a2 100644 (file)
@@ -24,7 +24,6 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/ata/ata-chipset.c,v 1.196 2007/04/08 19:18:51 sos Exp $
- * $DragonFly: src/sys/dev/disk/nata/ata-chipset.c,v 1.15 2008/07/12 16:38:10 mneumann Exp $
  */
 
 #include "opt_ata.h"
@@ -3548,7 +3547,7 @@ ata_promise_chipinit(device_t dev)
            /* setup host packet controls */
            hpkt = kmalloc(sizeof(struct ata_promise_sx4),
                          M_TEMP, M_INTWAIT | M_ZERO);
-           spin_init(&hpkt->mtx);
+           spin_init(&hpkt->mtx, "chipinit");
            TAILQ_INIT(&hpkt->queue);
            hpkt->busy = 0;
            device_set_ivars(dev, hpkt);
@@ -5815,7 +5814,7 @@ ata_serialize(device_t dev, int flags)
     if (!inited) {
        serial = kmalloc(sizeof(struct ata_serialize),
                              M_TEMP, M_INTWAIT | M_ZERO);
-       spin_init(&serial->locked_mtx);
+       spin_init(&serial->locked_mtx, "ataserialize");
        serial->locked_ch = -1;
        serial->restart_ch = -1;
        device_set_ivars(ctlr->dev, serial);
index ff7fda3..1ddb90a 100644 (file)
@@ -24,7 +24,6 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/dev/ata/ata-queue.c,v 1.67 2007/01/27 21:15:58 remko Exp $
- * $DragonFly: src/sys/dev/disk/nata/ata-queue.c,v 1.11 2008/09/23 17:43:41 dillon Exp $
  */
 
 #include "opt_ata.h"
@@ -92,7 +91,7 @@ ata_queue_request(struct ata_request *request)
     ch = device_get_softc(request->parent);
     callout_init_mp(&request->callout);        /* serialization done via state_mtx */
     if (!request->callback && !(request->flags & ATA_R_REQUEUE))
-       spin_init(&request->done);
+       spin_init(&request->done, "ataqueuerqdone");
 
     /* in ATA_STALL_QUEUE state we call HW directly */
     if ((ch->state & ATA_STALL_QUEUE) && (request->flags & ATA_R_CONTROL)) {
index c32111f..ff4d909 100644 (file)
@@ -138,7 +138,7 @@ ata_raid_attach(struct ar_softc *rdp, int writeback)
     char buffer[32];
     int disk;
 
-    spin_init(&rdp->lock);
+    spin_init(&rdp->lock, "ataraidattach");
     ata_raid_config_changed(rdp, writeback);
 
     /* sanitize arrays total_size % (width * interleave) == 0 */
@@ -498,7 +498,7 @@ ata_raid_strategy(struct dev_strategy_args *ap)
                                rebuild->dev = rdp->disks[this].dev;
                                rebuild->flags &= ~ATA_R_READ;
                                rebuild->flags |= ATA_R_WRITE;
-                               spin_init(&composite->lock);
+                               spin_init(&composite->lock, "ardfspare");
                                composite->residual = request->bytecount;
                                composite->rd_needed |= (1 << drv);
                                composite->wr_depend |= (1 << drv);
@@ -557,7 +557,7 @@ ata_raid_strategy(struct dev_strategy_args *ap)
                                      sizeof(struct ata_request));
                                mirror->this = this;
                                mirror->dev = rdp->disks[this].dev;
-                               spin_init(&composite->lock);
+                               spin_init(&composite->lock, "ardfonline");
                                composite->residual = request->bytecount;
                                composite->wr_needed |= (1 << drv);
                                composite->wr_needed |= (1 << this);
index 478a536..e645c7c 100644 (file)
@@ -223,7 +223,7 @@ atausb_attach(device_t dev)
     sc->timeout = 5000;
     sc->locked_ch = NULL;
     sc->restart_ch = NULL;
-    spin_init(&sc->locked_mtx); 
+    spin_init(&sc->locked_mtx, "atausbattach");
 
     id = usbd_get_interface_descriptor(sc->iface);
     switch (id->bInterfaceProtocol) {
@@ -880,8 +880,8 @@ ata_usbchannel_attach(device_t dev)
     ch->hw.end_transaction = ata_usbchannel_end_transaction;
     ch->hw.status = NULL;
     ch->hw.command = NULL;
-    spin_init(&ch->state_mtx);
-    spin_init(&ch->queue_mtx);
+    spin_init(&ch->state_mtx, "usbattach_state");
+    spin_init(&ch->queue_mtx, "usbattach_queue");
     ata_queue_init(ch);
 
     /* XXX SOS reset the controller HW, the channel and device(s) */
index 8fadcfa..d522f22 100644 (file)
@@ -195,7 +195,7 @@ atapi_cam_attach(device_t dev)
        return ENOMEM;
     }
 
-    spin_init(&scp->state_lock);
+    spin_init(&scp->state_lock, "atapicamattach");
 
     scp->dev = dev;
     scp->parent = device_get_parent(dev);
index 75c528a..651c15f 100644 (file)
@@ -46,7 +46,7 @@ int drm_dma_setup(struct drm_device *dev)
        if (dev->dma == NULL)
                return ENOMEM;
 
-       spin_init(&dev->dma_lock);
+       spin_init(&dev->dma_lock, "drmdma_lock");
 
        return 0;
 }
index 26fd87f..7dcdf90 100644 (file)
@@ -643,7 +643,7 @@ int drm_mm_init(struct drm_mm * mm, unsigned long start, unsigned long size)
        INIT_LIST_HEAD(&mm->unused_nodes);
        mm->num_unused = 0;
        mm->scanned_blocks = 0;
-       spin_init(&mm->unused_lock);
+       spin_init(&mm->unused_lock, "drmmminit");
 
        /* Clever trick to avoid a special case in the free hole tracking. */
        INIT_LIST_HEAD(&mm->head_node.node_list);
index 9b21b64..2d64843 100644 (file)
@@ -1438,8 +1438,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
 
        lockinit(&dev_priv->irq_lock, "userirq", 0, LK_CANRECURSE);
        lockinit(&dev_priv->error_lock, "915err", 0, LK_CANRECURSE);
-       spin_init(&dev_priv->rps.lock);
-       spin_init(&dev_priv->dpio_lock);
+       spin_init(&dev_priv->rps.lock, "i915initrps");
+       spin_init(&dev_priv->dpio_lock, "i915initdpio");
 
        lockinit(&dev_priv->rps.hw_lock, "i915 rps.hw_lock", 0, LK_CANRECURSE);
 
@@ -1565,7 +1565,7 @@ i915_driver_open(struct drm_device *dev, struct drm_file *file_priv)
        i915_file_priv = kmalloc(sizeof(*i915_file_priv), DRM_MEM_FILES,
            M_WAITOK | M_ZERO);
 
-       spin_init(&i915_file_priv->mm.lock);
+       spin_init(&i915_file_priv->mm.lock, "i915priv");
        INIT_LIST_HEAD(&i915_file_priv->mm.request_list);
        file_priv->driver_priv = i915_file_priv;
 
index 886fa8f..b974077 100644 (file)
@@ -37,7 +37,7 @@ typedef struct {
 static inline void
 init_waitqueue_head(wait_queue_head_t *eq)
 {
-       spin_init(&eq->lock);
+       spin_init(&eq->lock, "linux_waitqueue");
 }
 
 #define wake_up(eq)            wakeup_one(eq)
index 6663847..4514025 100644 (file)
@@ -1031,10 +1031,10 @@ int radeon_device_init(struct radeon_device *rdev,
        lockinit(&rdev->dc_hw_i2c_mutex,
                 "drm__radeon_device__dc_hw_i2c_mutex", 0, LK_CANRECURSE);
        atomic_set(&rdev->ih.lock, 0);
-       spin_init(&rdev->gem.mutex);
+       spin_init(&rdev->gem.mutex, "radeon_gemmtx");
        lockinit(&rdev->pm.mutex, "drm__radeon_device__pm__mutex", 0,
                 LK_CANRECURSE);
-       spin_init(&rdev->gpu_clock_mutex);
+       spin_init(&rdev->gpu_clock_mutex, "radeon_clockmtx");
        lockinit(&rdev->pm.mclk_lock, "drm__radeon_device__pm__mclk_lock", 0,
                 LK_CANRECURSE);
        lockinit(&rdev->exclusive_lock, "drm__radeon_device__exclusive_lock",
@@ -1101,7 +1101,7 @@ int radeon_device_init(struct radeon_device *rdev,
 
        /* Registers mapping */
        /* TODO: block userspace mapping of io register */
-       spin_init(&rdev->mmio_idx_lock);
+       spin_init(&rdev->mmio_idx_lock, "radeon_mpio");
        rdev->rmmio_rid = PCIR_BAR(2);
        rdev->rmmio = bus_alloc_resource_any(rdev->dev, SYS_RES_MEMORY,
            &rdev->rmmio_rid, RF_ACTIVE | RF_SHAREABLE);
index bb7c37a..3b48ee1 100644 (file)
@@ -253,7 +253,7 @@ int ttm_mem_global_init(struct ttm_mem_global *glob)
        int i;
        struct ttm_mem_zone *zone;
 
-       spin_init(&glob->spin);
+       spin_init(&glob->spin, "ttmemglob");
        glob->swap_queue = taskqueue_create("ttm_swap", M_WAITOK,
            taskqueue_thread_enqueue, &glob->swap_queue);
        taskqueue_start_threads(&glob->swap_queue, 1, 0, -1, "ttm swap");
index 868115c..53d3ddb 100644 (file)
@@ -170,7 +170,7 @@ int putterdebug = 0;
  */
 
 /* protects both the list and the contents of the list elements */
-static struct spinlock pi_mtx = SPINLOCK_INITIALIZER(&pi_mtx);
+static struct spinlock pi_mtx = SPINLOCK_INITIALIZER(&pi_mtx, "pi_mtx");
 
 /*
  * fd routines, for cloner
index e5b27dd..a681b49 100644 (file)
@@ -78,7 +78,7 @@
  * XXX This is a global lock for now; it should be pushed to
  * a per-device lock in some platform-independent fashion.
  */
-struct spinlock ah_regser_spin = SPINLOCK_INITIALIZER(ah_regser_spin);
+struct spinlock ah_regser_spin = SPINLOCK_INITIALIZER(ah_regser_spin, "ah_regser_spin");
 
 extern void ath_hal_printf(struct ath_hal *, const char*, ...)
                __printflike(2,3);
index a26d9da..1c6051a 100644 (file)
@@ -776,7 +776,7 @@ static int mrsas_attach(device_t dev)
     lockinit(&sc->pci_lock,  "mrsas_pci_lock", 0, LK_CANRECURSE);
     lockinit(&sc->io_lock,  "mrsas_io_lock", 0, LK_CANRECURSE);
     lockinit(&sc->aen_lock,  "mrsas_aen_lock", 0, LK_CANRECURSE);
-    spin_init(&sc->ioctl_lock);
+    spin_init(&sc->ioctl_lock, "mrsasioctl");
     lockinit(&sc->mpt_cmd_pool_lock, "mrsas_mpt_cmd_pool_lock", 0,
        LK_CANRECURSE);
     lockinit(&sc->mfi_cmd_pool_lock, "mrsas_mfi_cmd_pool_lock", 0,
index 679fc3a..4c5f1ab 100644 (file)
@@ -306,9 +306,9 @@ twa_attach(device_t dev)
 
        /* Initialize the mutexes right here. */
        sc->io_lock = &(sc->io_lock_handle);
-       spin_init(sc->io_lock);
+       spin_init(sc->io_lock, "twa_iolock");
        sc->q_lock = &(sc->q_lock_handle);
-       spin_init(sc->q_lock);
+       spin_init(sc->q_lock, "twa_qlock");
        sc->sim_lock = &(sc->sim_lock_handle);
        lockinit(sc->sim_lock, "tw_osl_sim_lock", 0, LK_CANRECURSE);
 
index 5a2d2e1..1fb926f 100644 (file)
@@ -60,7 +60,7 @@
  * Return value:       None
  */
 #define tw_osl_init_lock(ctlr_handle, lock_name, lock) \
-       spin_init(lock)
+       spin_init(lock, lock_name)
 
 
 
index 93f7140..fd693f7 100644 (file)
@@ -89,7 +89,7 @@ struct futex_list futex_list;
 #if 0
 #define FUTEX_LOCK(f)          spin_lock(&(f)->f_lck)
 #define FUTEX_UNLOCK(f)                spin_unlock(&(f)->f_lck)
-#define FUTEX_INIT(f)          spin_init(&(f)->f_lck)
+#define FUTEX_INIT(f)          spin_init(&(f)->f_lck, "futex")
 #define        FUTEX_SLEEP(f, id, flag, wm, timo)      ssleep((id), &(f)->f_lck, (flag), (wm), (timo))
 #endif
 
index 742c391..b1c20a3 100644 (file)
@@ -164,7 +164,7 @@ mi_proc0init(struct globaldata *gd, struct user *proc0paddr)
        lwkt_init_thread(&thread0, proc0paddr, LWKT_THREAD_STACK, 0, gd);
        lwkt_set_comm(&thread0, "thread0");
        RB_INIT(&proc0.p_lwp_tree);
-       spin_init(&proc0.p_spin);
+       spin_init(&proc0.p_spin, "iproc_proc0");
        lwkt_token_init(&proc0.p_token, "iproc");
        proc0.p_lasttid = 0;    /* +1 = next TID */
        lwp_rb_tree_RB_INSERT(&proc0.p_lwp_tree, &lwp0);
@@ -173,7 +173,7 @@ mi_proc0init(struct globaldata *gd, struct user *proc0paddr)
        proc0.p_usched = usched_init();
        CPUMASK_ASSALLONES(lwp0.lwp_cpumask);
        lwkt_token_init(&lwp0.lwp_token, "lwp_token");
-       spin_init(&lwp0.lwp_spin);
+       spin_init(&lwp0.lwp_spin, "iproc_lwp0");
        varsymset_init(&proc0.p_varsymset, NULL);
        thread0.td_flags |= TDF_RUNNING;
        thread0.td_proc = &proc0;
index 8ec0c3e..a01344d 100644 (file)
@@ -8,7 +8,7 @@ cv_init(struct cv *c, const char *desc)
 {
        c->cv_desc = desc;
        c->cv_waiters = 0;
-       spin_init(&c->cv_lock);
+       spin_init(&c->cv_lock, "cvinit");
 }
 
 void
index 1990665..9649d93 100644 (file)
@@ -126,7 +126,7 @@ static struct dev_ops fildesc_ops = {
  * Descriptor management.
  */
 static struct filelist filehead = LIST_HEAD_INITIALIZER(&filehead);
-static struct spinlock filehead_spin = SPINLOCK_INITIALIZER(&filehead_spin);
+static struct spinlock filehead_spin = SPINLOCK_INITIALIZER(&filehead_spin, "filehead_spin");
 static int nfiles;             /* actual number of open files */
 extern int cmask;      
 
@@ -1559,7 +1559,7 @@ falloc(struct lwp *lp, struct file **resultfp, int *resultfd)
         * Allocate a new file descriptor.
         */
        fp = kmalloc(sizeof(struct file), M_FILE, M_WAITOK | M_ZERO);
-       spin_init(&fp->f_spin);
+       spin_init(&fp->f_spin, "falloc");
        SLIST_INIT(&fp->f_klist);
        fp->f_count = 1;
        fp->f_ops = &badfileops;
@@ -1782,7 +1782,7 @@ fdinit_bootstrap(struct proc *p0, struct filedesc *fdp0, int cmask)
        fdp0->fd_files = fdp0->fd_builtin_files;
        fdp0->fd_nfiles = NDFILE;
        fdp0->fd_lastfile = -1;
-       spin_init(&fdp0->fd_spin);
+       spin_init(&fdp0->fd_spin, "fdinitbootstrap");
 }
 
 /*
@@ -1826,7 +1826,7 @@ fdinit(struct proc *p)
        newfdp->fd_files = newfdp->fd_builtin_files;
        newfdp->fd_nfiles = NDFILE;
        newfdp->fd_lastfile = -1;
-       spin_init(&newfdp->fd_spin);
+       spin_init(&newfdp->fd_spin, "fdinit");
 
        return (newfdp);
 }
@@ -1942,7 +1942,7 @@ again:
        newfdp->fd_lastfile = fdp->fd_lastfile;
        newfdp->fd_freefile = fdp->fd_freefile;
        newfdp->fd_cmask = fdp->fd_cmask;
-       spin_init(&newfdp->fd_spin);
+       spin_init(&newfdp->fd_spin, "fdcopy");
 
        /*
         * Copy the descriptor table through (i).  This also copies the
index abda37d..094e19d 100644 (file)
@@ -479,7 +479,7 @@ kenv_init(void *dummy)
        }
        kenv_dynp[i] = NULL;
        
-       spin_init(&kenv_dynlock);
+       spin_init(&kenv_dynlock, "kenvdynlock");
        kenv_isdynamic = 1;
 }
 SYSINIT(kenv, SI_BOOT1_POST, SI_ORDER_ANY, kenv_init, NULL);
index 8065ccf..b5fbc4b 100644 (file)
@@ -383,7 +383,7 @@ fork1(struct lwp *lp1, int flags, struct proc **procp)
        p2->p_stat = SIDL;
 
        RB_INIT(&p2->p_lwp_tree);
-       spin_init(&p2->p_spin);
+       spin_init(&p2->p_spin, "procfork1");
        lwkt_token_init(&p2->p_token, "proc");
        lwkt_gettoken(&p2->p_token);
 
@@ -652,7 +652,7 @@ lwp_fork(struct lwp *origlp, struct proc *destproc, int flags)
        crit_exit();
        CPUMASK_ANDMASK(lp->lwp_cpumask, usched_mastermask);
        lwkt_token_init(&lp->lwp_token, "lwp_token");
-       spin_init(&lp->lwp_spin);
+       spin_init(&lp->lwp_spin, "lwptoken");
 
        /*
         * Assign the thread to the current cpu to begin with so we
index 5cc1e79..21c144f 100644 (file)
@@ -274,7 +274,7 @@ ktr_resync_callback(void *dummy __unused)
        if (ktr_testspincnt) {
                struct spinlock spin;
 
-               spin_init(&spin);
+               spin_init(&spin, "ktrresync");
                spin_lock(&spin);
                spin_unlock(&spin);
                logtest_noargs(spin_beg);
index 944b5f7..0b1408f 100644 (file)
@@ -468,7 +468,7 @@ rand_initialize(void)
 #endif
 
 
-       spin_init(&rand_spin);
+       spin_init(&rand_spin, "randinit");
 
        /* Initialize IBAA. */
        IBAA_Init();
index a678cb2..c0df062 100644 (file)
@@ -28,8 +28,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- *
- * $DragonFly: src/sys/kern/kern_objcache.c,v 1.23 2008/10/26 04:29:19 sephe Exp $
  */
 
 #include <sys/param.h>
@@ -226,7 +224,7 @@ objcache_create(const char *name, int cluster_limit, int nom_cache,
         */
        depot = &oc->depot[0];
 
-       spin_init(&depot->spin);
+       spin_init(&depot->spin, "objcachedepot");
        SLIST_INIT(&depot->fullmagazines);
        SLIST_INIT(&depot->emptymagazines);
 
@@ -989,7 +987,7 @@ objcache_timer(void *dummy)
 static void
 objcache_init(void)
 {
-       spin_init(&objcachelist_spin);
+       spin_init(&objcachelist_spin, "objcachelist");
 
        magazine_capmin = mag_capacity_align(MAGAZINE_CAPACITY_MIN);
        magazine_capmax = mag_capacity_align(MAGAZINE_CAPACITY_MAX);
index 4bcc2db..f5d38a5 100644 (file)
@@ -66,7 +66,6 @@
  *
  *     @(#)kern_resource.c     8.5 (Berkeley) 1/21/94
  * $FreeBSD: src/sys/kern/kern_resource.c,v 1.55.2.5 2001/11/03 01:41:08 ps Exp $
- * $DragonFly: src/sys/kern/kern_plimit.c,v 1.3 2008/05/08 01:26:00 dillon Exp $
  */
 
 #include <sys/resource.h>
@@ -111,7 +110,7 @@ plimit_init0(struct plimit *limit)
        limit->pl_rlimit[RLIMIT_MEMLOCK].rlim_cur = lim / 3;
        limit->p_cpulimit = RLIM_INFINITY;
        limit->p_refcnt = 1;
-       spin_init(&limit->p_spin);
+       spin_init(&limit->p_spin, "plimitinit");
 }
 
 /*
@@ -515,7 +514,7 @@ plimit_copy(struct plimit *olimit, struct plimit *nlimit)
 {
        *nlimit = *olimit;
 
-       spin_init(&nlimit->p_spin);
+       spin_init(&nlimit->p_spin, "plimitcopy");
        nlimit->p_refcnt = 1;
        nlimit->p_exclusive = 0;
 }
index 0d90ef0..19d3e68 100644 (file)
@@ -915,7 +915,7 @@ ruadd(struct rusage *ru, struct rusage *ru2)
 void
 uihashinit(void)
 {
-       spin_init(&uihash_lock);
+       spin_init(&uihash_lock, "uihashinit");
        uihashtbl = hashinit(maxproc / 16, M_UIDINFO, &uihash);
 }
 
@@ -957,7 +957,7 @@ uicreate(uid_t uid)
        /*
         * Initialize structure and enter it into the hash table
         */
-       spin_init(&uip->ui_lock);
+       spin_init(&uip->ui_lock, "uicreate");
        uip->ui_uid = uid;
        uip->ui_ref = 1;        /* we're returning a ref */
        varsymset_init(&uip->ui_varsymset, NULL);
index 7d29e81..c15e63c 100644 (file)
@@ -38,7 +38,7 @@
 
 static int             sensor_task_lock_inited = 0;
 static struct lock     sensor_task_lock;
-static struct spinlock sensor_dev_lock = SPINLOCK_INITIALIZER(sensor_dev_lock);
+static struct spinlock sensor_dev_lock = SPINLOCK_INITIALIZER(sensor_dev_lock, "sensor_dev_lock");
 
 int                    sensordev_count = 0;
 SLIST_HEAD(, ksensordev) sensordev_list = SLIST_HEAD_INITIALIZER(sensordev_list);
index a2764d8..aabe5ea 100644 (file)
@@ -70,7 +70,7 @@
 #include <pthread.h>
 #endif
 
-struct spinlock pmap_spin = SPINLOCK_INITIALIZER(pmap_spin);
+struct spinlock pmap_spin = SPINLOCK_INITIALIZER(pmap_spin, "pmap_spin");
 
 struct indefinite_info {
        sysclock_t      base;
@@ -433,7 +433,7 @@ sysctl_spin_lock_test(SYSCTL_HANDLER_ARGS)
         * Indefinite wait test
         */
        if (value == 1) {
-               spin_init(&spin);
+               spin_init(&spin, "sysctllock");
                spin_lock(&spin);       /* force an indefinite wait */
                spin_lock_test_mode = 1;
                spin_lock(&spin);
@@ -448,7 +448,7 @@ sysctl_spin_lock_test(SYSCTL_HANDLER_ARGS)
        if (value == 2) {
                globaldata_t gd = mycpu;
 
-               spin_init(&spin);
+               spin_init(&spin, "sysctllocktest");
                for (i = spin_test_count; i > 0; --i) {
                    _spin_lock_quick(gd, &spin, "test");
                    spin_unlock_quick(gd, &spin);
index 97aed42..3b9e54e 100644 (file)
@@ -30,8 +30,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- * 
- * $DragonFly: src/sys/kern/kern_sysref.c,v 1.7 2008/10/26 04:29:19 sephe Exp $
  */
 /*
  * System resource control module for all cluster-addressable system resource
@@ -80,7 +78,7 @@ sysrefbootinit(void *dummy __unused)
 
        for (i = 0; i < ncpus; ++i) {
                sa = &sysref_array[i];
-               spin_init(&sa->spin);
+               spin_init(&sa->spin, "sysrefbootinit");
                RB_INIT(&sa->rbtree);
        }
 }
index 129407f..ef3f4c6 100644 (file)
@@ -207,7 +207,7 @@ static struct dev_ops wdog_ops = {
 static void
 wdog_init(void)
 {
-       spin_init(&wdogmtx);
+       spin_init(&wdogmtx, "wdog");
        make_dev(&wdog_ops, 0,
            UID_ROOT, GID_WHEEL, 0600, "wdog");
        callout_init_mp(&wdog_callout);
index 36c08a7..48943f3 100644 (file)
@@ -370,7 +370,7 @@ lwkt_initport_spin(lwkt_port_t port, thread_t td, boolean_t fixed_cpuid)
                   lwkt_spin_replyport,
                   dmsgfn,
                   pportfn_oncpu);
-    spin_init(&port->mpu_spin);
+    spin_init(&port->mpu_spin, "lwktinitport");
     port->mpu_td = td;
     if (fixed_cpuid)
        port->mp_cpuid = td->td_gd->gd_cpuid;
index fdec0d0..af1e3d7 100644 (file)
@@ -87,7 +87,7 @@ extern int lwkt_sched_debug;
 #endif
 
 static lwkt_token      pool_tokens[LWKT_NUM_POOL_TOKENS];
-struct spinlock                tok_debug_spin = SPINLOCK_INITIALIZER(&tok_debug_spin);
+struct spinlock                tok_debug_spin = SPINLOCK_INITIALIZER(&tok_debug_spin, "tok_debug_spin");
 
 #define TOKEN_STRING   "REF=%p TOK=%p TD=%p"
 #define TOKEN_ARGS     lwkt_tokref_t ref, lwkt_token_t tok, struct thread *td
index 0af44e3..8d4e36e 100644 (file)
@@ -52,7 +52,7 @@
 
 /* Lock macros */
 #define POOL_LOCK_INIT(pool) \
-    spin_init(&(pool)->lock)
+    spin_init(&(pool)->lock, "csprng_poollock")
 
 #define POOL_LOCK(pool)      \
     spin_lock(&pool->lock)
@@ -65,7 +65,7 @@
 
 
 #define STATE_LOCK_INIT(state)  \
-    spin_init(&state->lock)
+    spin_init(&state->lock, "csprng_statelock")
 
 #define STATE_LOCK(state)      \
     spin_lock(&state->lock)
index f1a5570..c59c26e 100644 (file)
@@ -103,7 +103,7 @@ static void  snprintf_func (int ch, void *arg);
 
 static int consintr = 1;               /* Ok to handle console interrupts? */
 static int msgbufmapped;               /* Set when safe to use msgbuf */
-static struct spinlock cons_spin = SPINLOCK_INITIALIZER(cons_spin);
+static struct spinlock cons_spin = SPINLOCK_INITIALIZER(cons_spin, "cons_spin");
 static thread_t constty_td = NULL;
 
 int msgbuftrigger;
@@ -892,7 +892,7 @@ done:
 void
 kvcreinitspin(void)
 {
-       spin_init(&cons_spin);
+       spin_init(&cons_spin, "kvcre");
        atomic_clear_long(&mycpu->gd_flags, GDF_KPRINTF);
 }
 
index 31e60e3..2b99148 100644 (file)
@@ -84,7 +84,7 @@ static void taskqueue_run(struct taskqueue *queue, int lock_held);
 static __inline void
 TQ_LOCK_INIT(struct taskqueue *tq)
 {
-       spin_init(&tq->tq_lock);
+       spin_init(&tq->tq_lock, "tqlock");
 }
 
 static __inline void
index 18ce8bd..a4bc987 100644 (file)
@@ -134,7 +134,7 @@ mbtrack_cmp(struct mbtrack *mb1, struct mbtrack *mb2)
 RB_GENERATE2(mbuf_rb_tree, mbtrack, rb_node, mbtrack_cmp, struct mbuf *, m);
 
 struct mbuf_rb_tree    mbuf_track_root;
-static struct spinlock mbuf_track_spin = SPINLOCK_INITIALIZER(mbuf_track_spin);
+static struct spinlock mbuf_track_spin = SPINLOCK_INITIALIZER(mbuf_track_spin, "mbuf_track_spin");
 
 static void
 mbuftrack(struct mbuf *m)
index e277295..3e56b35 100644 (file)
@@ -180,7 +180,7 @@ soalloc(int waitok, struct protosw *pr)
                TAILQ_INIT(&so->so_snd.ssb_kq.ki_mlist);
                lwkt_token_init(&so->so_rcv.ssb_token, "rcvtok");
                lwkt_token_init(&so->so_snd.ssb_token, "sndtok");
-               spin_init(&so->so_rcvd_spin);
+               spin_init(&so->so_rcvd_spin, "soalloc");
                netmsg_init(&so->so_rcvd_msg.base, so, &netisr_adone_rport,
                    MSGF_DROPABLE | MSGF_PRIORITY,
                    so->so_proto->pr_usrreqs->pru_rcvd);
index 1129791..c3b9278 100644 (file)
@@ -83,7 +83,7 @@ static unp_defdiscard_t unp_defdiscard_base;
  */
 static struct  sockaddr sun_noname = { sizeof(sun_noname), AF_LOCAL };
 static ino_t   unp_ino = 1;            /* prototype for fake inode numbers */
-static struct spinlock unp_ino_spin = SPINLOCK_INITIALIZER(&unp_ino_spin);
+static struct spinlock unp_ino_spin = SPINLOCK_INITIALIZER(&unp_ino_spin, "unp_ino_spin");
 
 static int     unp_attach (struct socket *, struct pru_attach_info *);
 static void    unp_detach (struct unpcb *);
@@ -787,7 +787,7 @@ static u_long       unpdg_sendspace = 2*1024;       /* really max datagram size */
 static u_long  unpdg_recvspace = 4*1024;
 
 static int     unp_rights;                     /* file descriptors in flight */
-static struct spinlock unp_spin = SPINLOCK_INITIALIZER(&unp_spin);
+static struct spinlock unp_spin = SPINLOCK_INITIALIZER(&unp_spin, "unp_spin");
 
 SYSCTL_DECL(_net_local_seqpacket);
 SYSCTL_DECL(_net_local_stream);
@@ -1413,7 +1413,7 @@ unp_init(void)
 {
        LIST_INIT(&unp_dhead);
        LIST_INIT(&unp_shead);
-       spin_init(&unp_spin);
+       spin_init(&unp_spin, "unpinit");
 }
 
 static int
index 5856e42..b63574d 100644 (file)
@@ -298,7 +298,7 @@ bsd4_rqinit(void *dummy)
 {
        int i;
 
-       spin_init(&bsd4_spin);
+       spin_init(&bsd4_spin, "bsd4rq");
        for (i = 0; i < NQS; i++) {
                TAILQ_INIT(&bsd4_queues[i]);
                TAILQ_INIT(&bsd4_rtqueues[i]);
index 2b03f56..ed99a8d 100644 (file)
@@ -2160,7 +2160,7 @@ usched_dfly_cpu_init(void)
                if (CPUMASK_TESTMASK(mask, smp_active_mask) == 0)
                    continue;
 
-               spin_init(&dd->spin);
+               spin_init(&dd->spin, "uschedcpuinit");
                dd->cpunode = get_cpu_node_by_cpuid(i);
                dd->cpuid = i;
                CPUMASK_ASSBIT(dd->cpumask, i);
index e747c8f..cb40224 100644 (file)
@@ -120,7 +120,7 @@ static void
 dummyinit(void *dummy)
 {
        TAILQ_INIT(&dummy_runq);
-       spin_init(&dummy_spin);
+       spin_init(&dummy_spin, "uscheddummy");
        ATOMIC_CPUMASK_NANDBIT(dummy_curprocmask, 0);
 }
 SYSINIT(runqueue, SI_BOOT2_USCHED, SI_ORDER_FIRST, dummyinit, NULL)
index cb0f6f9..45ef3db 100644 (file)
@@ -635,7 +635,7 @@ bufinit(void *dummy __unused)
        /* next, make a null set of free lists */
        for (i = 0; i < ncpus; ++i) {
                pcpu = &bufpcpu[i];
-               spin_init(&pcpu->spin);
+               spin_init(&pcpu->spin, "bufinit");
                for (j = 0; j < BUFFER_QUEUES; j++)
                        TAILQ_INIT(&pcpu->bufqueues[j]);
        }
index bc4c00b..bb5fa7f 100644 (file)
@@ -3627,16 +3627,16 @@ nchinit(void)
                gd->gd_nchstats = &nchstats[i];
        }
        TAILQ_INIT(&ncneglist);
-       spin_init(&ncspin);
+       spin_init(&ncspin, "nchinit");
        nchashtbl = hashinit_ext(desiredvnodes / 2,
                                 sizeof(struct nchash_head),
                                 M_VFSCACHE, &nchash);
        for (i = 0; i <= (int)nchash; ++i) {
                LIST_INIT(&nchashtbl[i].list);
-               spin_init(&nchashtbl[i].spin);
+               spin_init(&nchashtbl[i].spin, "nchinit_hash");
        }
        for (i = 0; i < NCMOUNT_NUMCACHE; ++i)
-               spin_init(&ncmount_cache[i].spin);
+               spin_init(&ncmount_cache[i].spin, "nchinit_cache");
        nclockwarn = 5 * hz;
 }
 
index 95f1e05..b6b90a9 100644 (file)
@@ -86,7 +86,7 @@ TAILQ_HEAD(freelst, vnode);
 static struct freelst  vnode_active_list;
 static struct freelst  vnode_inactive_list;
 static struct vnode    vnode_active_rover;
-static struct spinlock vfs_spin = SPINLOCK_INITIALIZER(vfs_spin);
+static struct spinlock vfs_spin = SPINLOCK_INITIALIZER(vfs_spin, "vfs_spin");
 
 int  activevnodes = 0;
 SYSCTL_INT(_debug, OID_AUTO, activevnodes, CTLFLAG_RD,
@@ -115,7 +115,7 @@ vfs_lock_init(void)
        TAILQ_INIT(&vnode_inactive_list);
        TAILQ_INIT(&vnode_active_list);
        TAILQ_INSERT_TAIL(&vnode_active_list, &vnode_active_rover, v_list);
-       spin_init(&vfs_spin);
+       spin_init(&vfs_spin, "vfslock");
        kmalloc_raise_limit(M_VNODE, 0);        /* unlimited */
 }
 
@@ -875,7 +875,7 @@ allocvnode(int lktimeout, int lkflags)
        RB_INIT(&vp->v_rbclean_tree);
        RB_INIT(&vp->v_rbdirty_tree);
        RB_INIT(&vp->v_rbhash_tree);
-       spin_init(&vp->v_spin);
+       spin_init(&vp->v_spin, "allocvnode");
 
        lockmgr(&vp->v_lock, LK_EXCLUSIVE);
        atomic_add_int(&numvnodes, 1);
index 1467944..a5fadbe 100644 (file)
@@ -125,7 +125,7 @@ vq_init(struct mount *mp)
        /* initialize the rb trees */
        RB_INIT(&mp->mnt_acct.ac_uroot);
        RB_INIT(&mp->mnt_acct.ac_groot);
-       spin_init(&mp->mnt_acct.ac_spin);
+       spin_init(&mp->mnt_acct.ac_spin, "vqinit");
 
        mp->mnt_acct.ac_bytes = 0;
 
index 62abe4d..88de31d 100644 (file)
@@ -40,7 +40,7 @@ static inline void __mbq_init(struct mbq *q)
 
 void mbq_safe_init(struct mbq *q)
 {
-    spin_init(&q->lock);
+    spin_init(&q->lock, "mbq");
     __mbq_init(q);
 }
 
index b49cf47..de30f63 100644 (file)
@@ -117,7 +117,7 @@ extern int debug_pfugidhack;
 struct lwkt_token pf_token = LWKT_TOKEN_INITIALIZER(pf_token);
 struct lwkt_token pf_gtoken = LWKT_TOKEN_INITIALIZER(pf_gtoken);
 #if __SIZEOF_LONG__ != 8
-struct spinlock pf_spin = SPINLOCK_INITIALIZER(pf_spin);
+struct spinlock pf_spin = SPINLOCK_INITIALIZER(pf_spin, "pf_spin");
 #endif
 
 #define DPFPRINTF(n, x)        if (pf_status.debug >= (n)) kprintf x
index 5f0cbc7..145bb70 100644 (file)
@@ -30,7 +30,6 @@
  * SUCH DAMAGE.
  *
  * $FreeBSD: src/sys/netsmb/smb_subr.h,v 1.1.2.1 2001/05/22 08:32:34 bp Exp $
- * $DragonFly: src/sys/netproto/smb/smb_subr.h,v 1.15 2006/12/22 23:57:54 swildner Exp $
  */
 #ifndef _NETSMB_SMB_SUBR_H_
 #define _NETSMB_SMB_SUBR_H_
@@ -82,7 +81,7 @@ void m_dumpm(struct mbuf *m);
 
 #define        lockdestroy(lock)
 #define        smb_slock                       spinlock
-#define        smb_sl_init(sl, desc)           spin_init(sl)
+#define        smb_sl_init(sl, desc)           spin_init(sl, desc)
 #define        smb_sl_destroy(sl)
 #define        smb_sl_lock(sl)                 spin_lock(sl)
 #define        smb_sl_unlock(sl)               spin_unlock(sl)
index 23623a7..01eefd6 100644 (file)
@@ -58,7 +58,7 @@ static        struct swcr_data **swcr_sessions = NULL;
 static u_int32_t swcr_sesnum;
 static u_int32_t swcr_minsesnum = 1;
 
-static struct spinlock swcr_spin = SPINLOCK_INITIALIZER(swcr_spin);
+static struct spinlock swcr_spin = SPINLOCK_INITIALIZER(swcr_spin, "swcr_spin");
 
 u_int8_t hmac_ipad_buffer[HMAC_MAX_BLOCK_LEN];
 u_int8_t hmac_opad_buffer[HMAC_MAX_BLOCK_LEN];
index 2d7290f..0ee9722 100644 (file)
@@ -154,7 +154,7 @@ struct bus_dmamap {
 static STAILQ_HEAD(, bus_dmamap) bounce_map_callbacklist =
        STAILQ_HEAD_INITIALIZER(bounce_map_callbacklist);
 static struct spinlock bounce_map_list_spin =
-       SPINLOCK_INITIALIZER(&bounce_map_list_spin);
+       SPINLOCK_INITIALIZER(&bounce_map_list_spin, "bounce_map_list_spin");
 
 static struct bus_dmamap nobounce_dmamap;
 
@@ -258,7 +258,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
 
        newtag = kmalloc(sizeof(*newtag), M_DEVBUF, M_INTWAIT | M_ZERO);
 
-       spin_init(&newtag->spin);
+       spin_init(&newtag->spin, "busdmacreate");
        newtag->parent = parent;
        newtag->alignment = alignment;
        newtag->boundary = boundary;
@@ -1095,7 +1095,7 @@ alloc_bounce_zone(bus_dma_tag_t dmat)
        }
        bz = new_bz;
 
-       spin_init(&bz->spin);
+       spin_init(&bz->spin, "allocbouncezone");
        STAILQ_INIT(&bz->bounce_page_list);
        STAILQ_INIT(&bz->bounce_map_waitinglist);
        bz->free_bpages = 0;
index bee854a..cad74b2 100644 (file)
@@ -417,7 +417,7 @@ pmap_bootstrap(vm_paddr_t firstaddr, vm_paddr_t loadaddr)
        kernel_pmap.pm_pteobj = NULL;   /* see pmap_init */
        TAILQ_INIT(&kernel_pmap.pm_pvlist);
        TAILQ_INIT(&kernel_pmap.pm_pvlist_free);
-       spin_init(&kernel_pmap.pm_spin);
+       spin_init(&kernel_pmap.pm_spin, "pmapbootstrap");
        lwkt_token_init(&kernel_pmap.pm_token, "kpmap_tok");
        nkpt = NKPT;
 
@@ -1301,7 +1301,7 @@ pmap_pinit0(struct pmap *pmap)
        pmap->pm_ptphint = NULL;
        TAILQ_INIT(&pmap->pm_pvlist);
        TAILQ_INIT(&pmap->pm_pvlist_free);
-       spin_init(&pmap->pm_spin);
+       spin_init(&pmap->pm_spin, "pmapinit0");
        lwkt_token_init(&pmap->pm_token, "pmap_tok");
        bzero(&pmap->pm_stats, sizeof pmap->pm_stats);
 }
@@ -1360,7 +1360,7 @@ pmap_pinit(struct pmap *pmap)
        pmap->pm_ptphint = NULL;
        TAILQ_INIT(&pmap->pm_pvlist);
        TAILQ_INIT(&pmap->pm_pvlist_free);
-       spin_init(&pmap->pm_spin);
+       spin_init(&pmap->pm_spin, "pmapinit");
        lwkt_token_init(&pmap->pm_token, "pmap_tok");
        bzero(&pmap->pm_stats, sizeof pmap->pm_stats);
        pmap->pm_stats.resident_count = 1;
index 97808dc..418e668 100644 (file)
@@ -154,7 +154,7 @@ struct bus_dmamap {
 static STAILQ_HEAD(, bus_dmamap) bounce_map_callbacklist =
        STAILQ_HEAD_INITIALIZER(bounce_map_callbacklist);
 static struct spinlock bounce_map_list_spin =
-       SPINLOCK_INITIALIZER(&bounce_map_list_spin);
+       SPINLOCK_INITIALIZER(&bounce_map_list_spin, "bounce_map_list_spin");
 
 static struct bus_dmamap nobounce_dmamap;
 
@@ -258,7 +258,7 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t alignment,
 
        newtag = kmalloc(sizeof(*newtag), M_DEVBUF, M_INTWAIT | M_ZERO);
 
-       spin_init(&newtag->spin);
+       spin_init(&newtag->spin, "busdmacreate");
        newtag->parent = parent;
        newtag->alignment = alignment;
        newtag->boundary = boundary;
@@ -1108,7 +1108,7 @@ alloc_bounce_zone(bus_dma_tag_t dmat)
        }
        bz = new_bz;
 
-       spin_init(&bz->spin);
+       spin_init(&bz->spin, "allocbouncezone");
        STAILQ_INIT(&bz->bounce_page_list);
        STAILQ_INIT(&bz->bounce_map_waitinglist);
        bz->free_bpages = 0;
index 45b3a29..3af4f30 100644 (file)
@@ -912,7 +912,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
        kernel_pmap.pm_count = 1;
        CPUMASK_ASSALLONES(kernel_pmap.pm_active);
        RB_INIT(&kernel_pmap.pm_pvroot);
-       spin_init(&kernel_pmap.pm_spin);
+       spin_init(&kernel_pmap.pm_spin, "pmapbootstrap");
        lwkt_token_init(&kernel_pmap.pm_token, "kpmap_tok");
 
        /*
@@ -1626,7 +1626,7 @@ pmap_pinit0(struct pmap *pmap)
        CPUMASK_ASSZERO(pmap->pm_active);
        pmap->pm_pvhint = NULL;
        RB_INIT(&pmap->pm_pvroot);
-       spin_init(&pmap->pm_spin);
+       spin_init(&pmap->pm_spin, "pmapinit0");
        lwkt_token_init(&pmap->pm_token, "pmap_tok");
        bzero(&pmap->pm_stats, sizeof pmap->pm_stats);
        pmap_pinit_defaults(pmap);
@@ -1656,7 +1656,7 @@ pmap_pinit_simple(struct pmap *pmap)
        if (pmap->pm_pmlpv == NULL) {
                RB_INIT(&pmap->pm_pvroot);
                bzero(&pmap->pm_stats, sizeof pmap->pm_stats);
-               spin_init(&pmap->pm_spin);
+               spin_init(&pmap->pm_spin, "pmapinitsimple");
                lwkt_token_init(&pmap->pm_token, "pmap_tok");
        }
 }
index d39594b..8212bfc 100644 (file)
@@ -1006,7 +1006,7 @@ alloc_bounce_zone(bus_dma_tag_t dmat)
        }
        bz = new_bz;
 
-       spin_init(&bz->spin);
+       spin_init(&bz->spin, "allocbouncezone");
        STAILQ_INIT(&bz->bounce_page_list);
        STAILQ_INIT(&bz->bounce_map_waitinglist);
        bz->free_bpages = 0;
index cc85121..5dfa8cc 100644 (file)
@@ -182,7 +182,7 @@ pmap_bootstrap(void)
        kernel_pmap.pm_pteobj = NULL;   /* see pmap_init */
        TAILQ_INIT(&kernel_pmap.pm_pvlist);
        TAILQ_INIT(&kernel_pmap.pm_pvlist_free);
-       spin_init(&kernel_pmap.pm_spin);
+       spin_init(&kernel_pmap.pm_spin, "pmapbootstrap");
        lwkt_token_init(&kernel_pmap.pm_token, "kpmap_tok");
        i386_protection_init();
 }
@@ -253,7 +253,7 @@ pmap_pinit(struct pmap *pmap)
        pmap->pm_cpucachemask = 0;
        TAILQ_INIT(&pmap->pm_pvlist);
        TAILQ_INIT(&pmap->pm_pvlist_free);
-       spin_init(&pmap->pm_spin);
+       spin_init(&pmap->pm_spin, "pmapinit");
        lwkt_token_init(&pmap->pm_token, "pmap_tok");
        bzero(&pmap->pm_stats, sizeof pmap->pm_stats);
        pmap->pm_stats.resident_count = 1;
index 12a568e..d27be7c 100644 (file)
@@ -1002,7 +1002,7 @@ alloc_bounce_zone(bus_dma_tag_t dmat)
        }
        bz = new_bz;
 
-       spin_init(&bz->spin);
+       spin_init(&bz->spin, "allocbouncezone");
        STAILQ_INIT(&bz->bounce_page_list);
        STAILQ_INIT(&bz->bounce_map_waitinglist);
        bz->free_bpages = 0;
index 3b9493f..5e0c929 100644 (file)
@@ -569,7 +569,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr, int64_t ptov_offset)
        TAILQ_INIT(&kernel_pmap.pm_pvlist);
        TAILQ_INIT(&kernel_pmap.pm_pvlist_free);
        lwkt_token_init(&kernel_pmap.pm_token, "kpmap_tok");
-       spin_init(&kernel_pmap.pm_spin);
+       spin_init(&kernel_pmap.pm_spin, "pmapbootstrap");
 
        /*
         * Reserve some special page table entries/VA space for temporary
@@ -1180,7 +1180,7 @@ pmap_pinit(struct pmap *pmap)
        pmap->pm_ptphint = NULL;
        TAILQ_INIT(&pmap->pm_pvlist);
        TAILQ_INIT(&pmap->pm_pvlist_free);
-       spin_init(&pmap->pm_spin);
+       spin_init(&pmap->pm_spin, "pmapinit");
        lwkt_token_init(&pmap->pm_token, "pmap_tok");
        bzero(&pmap->pm_stats, sizeof pmap->pm_stats);
        pmap->pm_stats.resident_count = 1;
index 2da0267..ecaba2e 100644 (file)
@@ -28,8 +28,6 @@
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
- *
- * $DragonFly: src/sys/sys/spinlock.h,v 1.5 2006/05/26 02:26:26 dillon Exp $
  */
 
 #ifndef _SYS_SPINLOCK_H_
 struct spinlock {
        int counta;
        int countb;
+       const char *descr;
 };
 
-#define SPINLOCK_INITIALIZER(head)     { 0, 0 }
+#define SPINLOCK_INITIALIZER(head, d)  { 0, 0, #d }
 
 #define SPINLOCK_SHARED                        0x80000000
 #define SPINLOCK_EXCLWAIT              0x00100000 /* high bits counter */
index e08da39..3f7ebf0 100644 (file)
@@ -263,10 +263,11 @@ spin_pool_unlock(void *chan)
 }
 
 static __inline void
-spin_init(struct spinlock *spin)
+spin_init(struct spinlock *spin, const char *descr)
 {
-        spin->counta = 0;
-        spin->countb = 0;
+       spin->counta = 0;
+       spin->countb = 0;
+       spin->descr  = descr;
 }
 
 static __inline void
index 5a9bb77..bf05c78 100644 (file)
@@ -313,7 +313,7 @@ struct name {                                                               \
 }
 
 #define RB_INITIALIZER(root)                                           \
-       { NULL, NULL, SPINLOCK_INITIALIZER(root.spin) }
+       { NULL, NULL, SPINLOCK_INITIALIZER(root.spin, "root.spin") }
 
 #define RB_INIT(root) do {                                             \
        (root)->rbh_root = NULL;                                        \
index ccd861c..d4f8101 100644 (file)
@@ -74,7 +74,7 @@ void
 ccms_cst_init(ccms_cst_t *cst, void *handle)
 {
        bzero(cst, sizeof(*cst));
-       spin_init(&cst->spin);
+       spin_init(&cst->spin, "ccmscst");
        cst->handle = handle;
 }
 
index 2eeb318..ec998f4 100644 (file)
@@ -334,10 +334,10 @@ hammer2_pfsalloc(const hammer2_inode_data_t *ipdata, hammer2_tid_t alloc_tid)
        kmalloc_create(&pmp->minode, "HAMMER2-inodes");
        kmalloc_create(&pmp->mmsg, "HAMMER2-pfsmsg");
        lockinit(&pmp->lock, "pfslk", 0, 0);
-       spin_init(&pmp->inum_spin);
+       spin_init(&pmp->inum_spin, "hm2pfsalloc_inum");
        RB_INIT(&pmp->inum_tree);
        TAILQ_INIT(&pmp->unlinkq);
-       spin_init(&pmp->list_spin);
+       spin_init(&pmp->list_spin, "hm2pfsalloc_list");
 
        pmp->alloc_tid = alloc_tid + 1;   /* our first media transaction id */
        pmp->flush_tid = pmp->alloc_tid;
@@ -528,8 +528,8 @@ hammer2_vfs_mount(struct mount *mp, char *path, caddr_t data,
                kmalloc_create(&hmp->mchain, "HAMMER2-chains");
                TAILQ_INSERT_TAIL(&hammer2_mntlist, hmp, mntentry);
                RB_INIT(&hmp->iotree);
-               spin_init(&hmp->io_spin);
-               spin_init(&hmp->list_spin);
+               spin_init(&hmp->io_spin, "hm2mount_io");
+               spin_init(&hmp->list_spin, "hm2mount_list");
                TAILQ_INIT(&hmp->flushq);
 
                lockinit(&hmp->vollk, "h2vol", 0, 0);
index 82af7be..d46015c 100644 (file)
@@ -388,7 +388,7 @@ ntfs_ntlookup(struct ntfsmount *ntmp, ino_t ino, struct ntnode **ipp)
 
        /* init lock and lock the newborn ntnode */
        lockinit(&ip->i_lock, "ntnode", 0, LK_EXCLUSIVE);
-       spin_init(&ip->i_interlock);
+       spin_init(&ip->i_interlock, "ntfsntlookup");
        ntfs_ntget(ip);
 
        ntfs_nthashins(ip);
index 7be0069..d574761 100644 (file)
@@ -275,7 +275,7 @@ sema_init(struct sema *semap, char *name, int timo)
        semap->value = 0;
        semap->name = name;
        semap->timo = timo;
-       spin_init(&semap->spin);
+       spin_init(&semap->spin, "ufssema");
 }
 
 /*
index a96cde4..3181c89 100644 (file)
@@ -168,7 +168,7 @@ static int swap_async_max = 4;      /* maximum in-progress async I/O's      */
 static int swap_burst_read = 0;        /* allow burst reading */
 static swblk_t swapiterator;   /* linearize allocations */
 
-static struct spinlock swapbp_spin = SPINLOCK_INITIALIZER(&swapbp_spin);
+static struct spinlock swapbp_spin = SPINLOCK_INITIALIZER(&swapbp_spin, "swapbp_spin");
 
 /* from vm_swap.c */
 extern struct vnode *swapdev_vp;
index da6ea3d..467b8e2 100644 (file)
@@ -116,7 +116,7 @@ static volatile int vm_pages_waiting;
 
 static struct alist vm_contig_alist;
 static struct almeta vm_contig_ameta[ALIST_RECORDS_65536];
-static struct spinlock vm_contig_spin = SPINLOCK_INITIALIZER(&vm_contig_spin);
+static struct spinlock vm_contig_spin = SPINLOCK_INITIALIZER(&vm_contig_spin, "vm_contig_spin");
 
 static u_long vm_dma_reserved = 0;
 TUNABLE_ULONG("vm.dma_reserved", &vm_dma_reserved);
@@ -150,7 +150,7 @@ vm_page_queue_init(void)
 
        for (i = 0; i < PQ_COUNT; i++) {
                TAILQ_INIT(&vm_page_queues[i].pl);
-               spin_init(&vm_page_queues[i].spin);
+               spin_init(&vm_page_queues[i].spin, "vm_page_queue_init");
        }
 
        for (i = 0; i < VMACTION_HSIZE; i++)
index 003165d..85ef704 100644 (file)
@@ -184,7 +184,7 @@ static struct buf *swbuf_raw;
 static vm_offset_t swapbkva;           /* swap buffers kva */
 static struct swqueue bswlist_raw;     /* without kva */
 static struct swqueue bswlist_kva;     /* with kva */
-static struct spinlock bswspin = SPINLOCK_INITIALIZER(&bswspin);
+static struct spinlock bswspin = SPINLOCK_INITIALIZER(&bswspin, "bswspin");
 static int pbuf_raw_count;
 static int pbuf_kva_count;
 
index 4e61113..caac30e 100644 (file)
@@ -237,7 +237,7 @@ zinitna(vm_zone_t z, vm_object_t obj, char *name, int size,
         */
        if ((z->zflags & ZONE_BOOT) == 0) {
                z->zsize = (size + ZONE_ROUNDING - 1) & ~(ZONE_ROUNDING - 1);
-               spin_init(&z->zlock);
+               spin_init(&z->zlock, "zinitna");
                z->zfreecnt = 0;
                z->ztotal = 0;
                z->zmax = 0;
@@ -371,7 +371,7 @@ zbootinit(vm_zone_t z, char *name, int size, void *item, int nitems)
        z->zpagecount = 0;
        z->zalloc = 0;
        z->znalloc = 0;
-       spin_init(&z->zlock);
+       spin_init(&z->zlock, "zbootinit");
 
        bzero(item, (size_t)nitems * z->zsize);
        z->zitems = NULL;