17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate * CDDL HEADER START
37c478bd9Sstevel@tonic-gate *
47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the
5ad4023c4Sdp * Common Development and Distribution License (the "License").
6ad4023c4Sdp * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate *
87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate * and limitations under the License.
127c478bd9Sstevel@tonic-gate *
137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate *
197c478bd9Sstevel@tonic-gate * CDDL HEADER END
207c478bd9Sstevel@tonic-gate */
217c478bd9Sstevel@tonic-gate /*
22*b9e93c10SJonathan Haslam * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
237c478bd9Sstevel@tonic-gate * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate */
257c478bd9Sstevel@tonic-gate
267c478bd9Sstevel@tonic-gate
277c478bd9Sstevel@tonic-gate #include <sys/types.h>
287c478bd9Sstevel@tonic-gate #include <sys/param.h>
297c478bd9Sstevel@tonic-gate #include <sys/stat.h>
307c478bd9Sstevel@tonic-gate #include <sys/open.h>
317c478bd9Sstevel@tonic-gate #include <sys/file.h>
327c478bd9Sstevel@tonic-gate #include <sys/conf.h>
337c478bd9Sstevel@tonic-gate #include <sys/modctl.h>
347c478bd9Sstevel@tonic-gate #include <sys/cmn_err.h>
357c478bd9Sstevel@tonic-gate #include <sys/bitmap.h>
367c478bd9Sstevel@tonic-gate #include <sys/debug.h>
377c478bd9Sstevel@tonic-gate #include <sys/kmem.h>
387c478bd9Sstevel@tonic-gate #include <sys/errno.h>
397c478bd9Sstevel@tonic-gate #include <sys/sysmacros.h>
407c478bd9Sstevel@tonic-gate #include <sys/lockstat.h>
417c478bd9Sstevel@tonic-gate #include <sys/atomic.h>
427c478bd9Sstevel@tonic-gate #include <sys/dtrace.h>
437c478bd9Sstevel@tonic-gate
447c478bd9Sstevel@tonic-gate #include <sys/ddi.h>
457c478bd9Sstevel@tonic-gate #include <sys/sunddi.h>
467c478bd9Sstevel@tonic-gate
477c478bd9Sstevel@tonic-gate typedef struct lockstat_probe {
487c478bd9Sstevel@tonic-gate const char *lsp_func;
497c478bd9Sstevel@tonic-gate const char *lsp_name;
507c478bd9Sstevel@tonic-gate int lsp_probe;
517c478bd9Sstevel@tonic-gate dtrace_id_t lsp_id;
527c478bd9Sstevel@tonic-gate } lockstat_probe_t;
537c478bd9Sstevel@tonic-gate
547c478bd9Sstevel@tonic-gate lockstat_probe_t lockstat_probes[] =
557c478bd9Sstevel@tonic-gate {
567c478bd9Sstevel@tonic-gate { LS_MUTEX_ENTER, LSA_ACQUIRE, LS_MUTEX_ENTER_ACQUIRE },
577c478bd9Sstevel@tonic-gate { LS_MUTEX_ENTER, LSA_BLOCK, LS_MUTEX_ENTER_BLOCK },
587c478bd9Sstevel@tonic-gate { LS_MUTEX_ENTER, LSA_SPIN, LS_MUTEX_ENTER_SPIN },
597c478bd9Sstevel@tonic-gate { LS_MUTEX_EXIT, LSA_RELEASE, LS_MUTEX_EXIT_RELEASE },
607c478bd9Sstevel@tonic-gate { LS_MUTEX_DESTROY, LSA_RELEASE, LS_MUTEX_DESTROY_RELEASE },
617c478bd9Sstevel@tonic-gate { LS_MUTEX_TRYENTER, LSA_ACQUIRE, LS_MUTEX_TRYENTER_ACQUIRE },
627c478bd9Sstevel@tonic-gate { LS_LOCK_SET, LSS_ACQUIRE, LS_LOCK_SET_ACQUIRE },
637c478bd9Sstevel@tonic-gate { LS_LOCK_SET, LSS_SPIN, LS_LOCK_SET_SPIN },
647c478bd9Sstevel@tonic-gate { LS_LOCK_SET_SPL, LSS_ACQUIRE, LS_LOCK_SET_SPL_ACQUIRE },
657c478bd9Sstevel@tonic-gate { LS_LOCK_SET_SPL, LSS_SPIN, LS_LOCK_SET_SPL_SPIN },
667c478bd9Sstevel@tonic-gate { LS_LOCK_TRY, LSS_ACQUIRE, LS_LOCK_TRY_ACQUIRE },
677c478bd9Sstevel@tonic-gate { LS_LOCK_CLEAR, LSS_RELEASE, LS_LOCK_CLEAR_RELEASE },
687c478bd9Sstevel@tonic-gate { LS_LOCK_CLEAR_SPLX, LSS_RELEASE, LS_LOCK_CLEAR_SPLX_RELEASE },
697c478bd9Sstevel@tonic-gate { LS_CLOCK_UNLOCK, LSS_RELEASE, LS_CLOCK_UNLOCK_RELEASE },
707c478bd9Sstevel@tonic-gate { LS_RW_ENTER, LSR_ACQUIRE, LS_RW_ENTER_ACQUIRE },
717c478bd9Sstevel@tonic-gate { LS_RW_ENTER, LSR_BLOCK, LS_RW_ENTER_BLOCK },
727c478bd9Sstevel@tonic-gate { LS_RW_EXIT, LSR_RELEASE, LS_RW_EXIT_RELEASE },
737c478bd9Sstevel@tonic-gate { LS_RW_TRYENTER, LSR_ACQUIRE, LS_RW_TRYENTER_ACQUIRE },
747c478bd9Sstevel@tonic-gate { LS_RW_TRYUPGRADE, LSR_UPGRADE, LS_RW_TRYUPGRADE_UPGRADE },
757c478bd9Sstevel@tonic-gate { LS_RW_DOWNGRADE, LSR_DOWNGRADE, LS_RW_DOWNGRADE_DOWNGRADE },
767c478bd9Sstevel@tonic-gate { LS_THREAD_LOCK, LST_SPIN, LS_THREAD_LOCK_SPIN },
777c478bd9Sstevel@tonic-gate { LS_THREAD_LOCK_HIGH, LST_SPIN, LS_THREAD_LOCK_HIGH_SPIN },
787c478bd9Sstevel@tonic-gate { NULL }
797c478bd9Sstevel@tonic-gate };
807c478bd9Sstevel@tonic-gate
817c478bd9Sstevel@tonic-gate static dev_info_t *lockstat_devi; /* saved in xxattach() for xxinfo() */
827c478bd9Sstevel@tonic-gate static kmutex_t lockstat_test; /* for testing purposes only */
837c478bd9Sstevel@tonic-gate static dtrace_provider_id_t lockstat_id;
847c478bd9Sstevel@tonic-gate
857c478bd9Sstevel@tonic-gate /*ARGSUSED*/
86*b9e93c10SJonathan Haslam static int
lockstat_enable(void * arg,dtrace_id_t id,void * parg)877c478bd9Sstevel@tonic-gate lockstat_enable(void *arg, dtrace_id_t id, void *parg)
887c478bd9Sstevel@tonic-gate {
897c478bd9Sstevel@tonic-gate lockstat_probe_t *probe = parg;
907c478bd9Sstevel@tonic-gate
917c478bd9Sstevel@tonic-gate ASSERT(!lockstat_probemap[probe->lsp_probe]);
927c478bd9Sstevel@tonic-gate
937c478bd9Sstevel@tonic-gate lockstat_probemap[probe->lsp_probe] = id;
947c478bd9Sstevel@tonic-gate membar_producer();
957c478bd9Sstevel@tonic-gate
967c478bd9Sstevel@tonic-gate lockstat_hot_patch();
977c478bd9Sstevel@tonic-gate membar_producer();
987c478bd9Sstevel@tonic-gate
997c478bd9Sstevel@tonic-gate /*
1007c478bd9Sstevel@tonic-gate * Immediately generate a record for the lockstat_test mutex
1017c478bd9Sstevel@tonic-gate * to verify that the mutex hot-patch code worked as expected.
1027c478bd9Sstevel@tonic-gate */
1037c478bd9Sstevel@tonic-gate mutex_enter(&lockstat_test);
1047c478bd9Sstevel@tonic-gate mutex_exit(&lockstat_test);
105*b9e93c10SJonathan Haslam return (0);
1067c478bd9Sstevel@tonic-gate }
1077c478bd9Sstevel@tonic-gate
1087c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1097c478bd9Sstevel@tonic-gate static void
lockstat_disable(void * arg,dtrace_id_t id,void * parg)1107c478bd9Sstevel@tonic-gate lockstat_disable(void *arg, dtrace_id_t id, void *parg)
1117c478bd9Sstevel@tonic-gate {
1127c478bd9Sstevel@tonic-gate lockstat_probe_t *probe = parg;
1137c478bd9Sstevel@tonic-gate int i;
1147c478bd9Sstevel@tonic-gate
1157c478bd9Sstevel@tonic-gate ASSERT(lockstat_probemap[probe->lsp_probe]);
1167c478bd9Sstevel@tonic-gate
1177c478bd9Sstevel@tonic-gate lockstat_probemap[probe->lsp_probe] = 0;
1187c478bd9Sstevel@tonic-gate lockstat_hot_patch();
1197c478bd9Sstevel@tonic-gate membar_producer();
1207c478bd9Sstevel@tonic-gate
1217c478bd9Sstevel@tonic-gate /*
1227c478bd9Sstevel@tonic-gate * See if we have any probes left enabled.
1237c478bd9Sstevel@tonic-gate */
1247c478bd9Sstevel@tonic-gate for (i = 0; i < LS_NPROBES; i++) {
1257c478bd9Sstevel@tonic-gate if (lockstat_probemap[i]) {
1267c478bd9Sstevel@tonic-gate /*
1277c478bd9Sstevel@tonic-gate * This probe is still enabled. We don't need to deal
1287c478bd9Sstevel@tonic-gate * with waiting for all threads to be out of the
1297c478bd9Sstevel@tonic-gate * lockstat critical sections; just return.
1307c478bd9Sstevel@tonic-gate */
1317c478bd9Sstevel@tonic-gate return;
1327c478bd9Sstevel@tonic-gate }
1337c478bd9Sstevel@tonic-gate }
1347c478bd9Sstevel@tonic-gate
1357c478bd9Sstevel@tonic-gate /*
1367c478bd9Sstevel@tonic-gate * The delay() here isn't as cheesy as you might think. We don't
1377c478bd9Sstevel@tonic-gate * want to busy-loop in the kernel, so we have to give up the
1387c478bd9Sstevel@tonic-gate * CPU between calls to lockstat_active_threads(); that much is
1397c478bd9Sstevel@tonic-gate * obvious. But the reason it's a do..while loop rather than a
1407c478bd9Sstevel@tonic-gate * while loop is subtle. The memory barrier above guarantees that
1417c478bd9Sstevel@tonic-gate * no threads will enter the lockstat code from this point forward.
1427c478bd9Sstevel@tonic-gate * However, another thread could already be executing lockstat code
1437c478bd9Sstevel@tonic-gate * without our knowledge if the update to its t_lockstat field hasn't
1447c478bd9Sstevel@tonic-gate * cleared its CPU's store buffer. Delaying for one clock tick
1457c478bd9Sstevel@tonic-gate * guarantees that either (1) the thread will have *ample* time to
1467c478bd9Sstevel@tonic-gate * complete its work, or (2) the thread will be preempted, in which
1477c478bd9Sstevel@tonic-gate * case it will have to grab and release a dispatcher lock, which
1487c478bd9Sstevel@tonic-gate * will flush that CPU's store buffer. Either way we're covered.
1497c478bd9Sstevel@tonic-gate */
1507c478bd9Sstevel@tonic-gate do {
1517c478bd9Sstevel@tonic-gate delay(1);
1527c478bd9Sstevel@tonic-gate } while (lockstat_active_threads());
1537c478bd9Sstevel@tonic-gate }
1547c478bd9Sstevel@tonic-gate
1557c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1567c478bd9Sstevel@tonic-gate static int
lockstat_open(dev_t * devp,int flag,int otyp,cred_t * cred_p)1577c478bd9Sstevel@tonic-gate lockstat_open(dev_t *devp, int flag, int otyp, cred_t *cred_p)
1587c478bd9Sstevel@tonic-gate {
1597c478bd9Sstevel@tonic-gate return (0);
1607c478bd9Sstevel@tonic-gate }
1617c478bd9Sstevel@tonic-gate
1627c478bd9Sstevel@tonic-gate /* ARGSUSED */
1637c478bd9Sstevel@tonic-gate static int
lockstat_info(dev_info_t * dip,ddi_info_cmd_t infocmd,void * arg,void ** result)1647c478bd9Sstevel@tonic-gate lockstat_info(dev_info_t *dip, ddi_info_cmd_t infocmd, void *arg, void **result)
1657c478bd9Sstevel@tonic-gate {
1667c478bd9Sstevel@tonic-gate int error;
1677c478bd9Sstevel@tonic-gate
1687c478bd9Sstevel@tonic-gate switch (infocmd) {
1697c478bd9Sstevel@tonic-gate case DDI_INFO_DEVT2DEVINFO:
1707c478bd9Sstevel@tonic-gate *result = (void *) lockstat_devi;
1717c478bd9Sstevel@tonic-gate error = DDI_SUCCESS;
1727c478bd9Sstevel@tonic-gate break;
1737c478bd9Sstevel@tonic-gate case DDI_INFO_DEVT2INSTANCE:
1747c478bd9Sstevel@tonic-gate *result = (void *)0;
1757c478bd9Sstevel@tonic-gate error = DDI_SUCCESS;
1767c478bd9Sstevel@tonic-gate break;
1777c478bd9Sstevel@tonic-gate default:
1787c478bd9Sstevel@tonic-gate error = DDI_FAILURE;
1797c478bd9Sstevel@tonic-gate }
1807c478bd9Sstevel@tonic-gate return (error);
1817c478bd9Sstevel@tonic-gate }
1827c478bd9Sstevel@tonic-gate
1837c478bd9Sstevel@tonic-gate /*ARGSUSED*/
1847c478bd9Sstevel@tonic-gate static void
lockstat_provide(void * arg,const dtrace_probedesc_t * desc)1857c478bd9Sstevel@tonic-gate lockstat_provide(void *arg, const dtrace_probedesc_t *desc)
1867c478bd9Sstevel@tonic-gate {
1877c478bd9Sstevel@tonic-gate int i = 0;
1887c478bd9Sstevel@tonic-gate
1897c478bd9Sstevel@tonic-gate for (i = 0; lockstat_probes[i].lsp_func != NULL; i++) {
1907c478bd9Sstevel@tonic-gate lockstat_probe_t *probe = &lockstat_probes[i];
1917c478bd9Sstevel@tonic-gate
1927c478bd9Sstevel@tonic-gate if (dtrace_probe_lookup(lockstat_id, "genunix",
1937c478bd9Sstevel@tonic-gate probe->lsp_func, probe->lsp_name) != 0)
1947c478bd9Sstevel@tonic-gate continue;
1957c478bd9Sstevel@tonic-gate
1967c478bd9Sstevel@tonic-gate ASSERT(!probe->lsp_id);
1977c478bd9Sstevel@tonic-gate probe->lsp_id = dtrace_probe_create(lockstat_id,
1987c478bd9Sstevel@tonic-gate "genunix", probe->lsp_func, probe->lsp_name,
1997c478bd9Sstevel@tonic-gate 1, probe);
2007c478bd9Sstevel@tonic-gate }
2017c478bd9Sstevel@tonic-gate }
2027c478bd9Sstevel@tonic-gate
2037c478bd9Sstevel@tonic-gate /*ARGSUSED*/
2047c478bd9Sstevel@tonic-gate static void
lockstat_destroy(void * arg,dtrace_id_t id,void * parg)2057c478bd9Sstevel@tonic-gate lockstat_destroy(void *arg, dtrace_id_t id, void *parg)
2067c478bd9Sstevel@tonic-gate {
2077c478bd9Sstevel@tonic-gate lockstat_probe_t *probe = parg;
2087c478bd9Sstevel@tonic-gate
2097c478bd9Sstevel@tonic-gate ASSERT(!lockstat_probemap[probe->lsp_probe]);
2107c478bd9Sstevel@tonic-gate probe->lsp_id = 0;
2117c478bd9Sstevel@tonic-gate }
2127c478bd9Sstevel@tonic-gate
2137c478bd9Sstevel@tonic-gate static dtrace_pattr_t lockstat_attr = {
2147c478bd9Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
2157c478bd9Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
2167c478bd9Sstevel@tonic-gate { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
2177c478bd9Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
2187c478bd9Sstevel@tonic-gate { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
2197c478bd9Sstevel@tonic-gate };
2207c478bd9Sstevel@tonic-gate
2217c478bd9Sstevel@tonic-gate static dtrace_pops_t lockstat_pops = {
2227c478bd9Sstevel@tonic-gate lockstat_provide,
2237c478bd9Sstevel@tonic-gate NULL,
2247c478bd9Sstevel@tonic-gate lockstat_enable,
2257c478bd9Sstevel@tonic-gate lockstat_disable,
2267c478bd9Sstevel@tonic-gate NULL,
2277c478bd9Sstevel@tonic-gate NULL,
2287c478bd9Sstevel@tonic-gate NULL,
2297c478bd9Sstevel@tonic-gate NULL,
2307c478bd9Sstevel@tonic-gate NULL,
2317c478bd9Sstevel@tonic-gate lockstat_destroy
2327c478bd9Sstevel@tonic-gate };
2337c478bd9Sstevel@tonic-gate
2347c478bd9Sstevel@tonic-gate static int
lockstat_attach(dev_info_t * devi,ddi_attach_cmd_t cmd)2357c478bd9Sstevel@tonic-gate lockstat_attach(dev_info_t *devi, ddi_attach_cmd_t cmd)
2367c478bd9Sstevel@tonic-gate {
2377c478bd9Sstevel@tonic-gate switch (cmd) {
2387c478bd9Sstevel@tonic-gate case DDI_ATTACH:
2397c478bd9Sstevel@tonic-gate break;
2407c478bd9Sstevel@tonic-gate case DDI_RESUME:
2417c478bd9Sstevel@tonic-gate return (DDI_SUCCESS);
2427c478bd9Sstevel@tonic-gate default:
2437c478bd9Sstevel@tonic-gate return (DDI_FAILURE);
2447c478bd9Sstevel@tonic-gate }
2457c478bd9Sstevel@tonic-gate
2467c478bd9Sstevel@tonic-gate if (ddi_create_minor_node(devi, "lockstat", S_IFCHR, 0,
2477c478bd9Sstevel@tonic-gate DDI_PSEUDO, 0) == DDI_FAILURE ||
248ad4023c4Sdp dtrace_register("lockstat", &lockstat_attr, DTRACE_PRIV_KERNEL,
249ad4023c4Sdp NULL, &lockstat_pops, NULL, &lockstat_id) != 0) {
2507c478bd9Sstevel@tonic-gate ddi_remove_minor_node(devi, NULL);
2517c478bd9Sstevel@tonic-gate return (DDI_FAILURE);
2527c478bd9Sstevel@tonic-gate }
2537c478bd9Sstevel@tonic-gate
254aaa19a19Sjhaslam lockstat_probe = dtrace_probe;
255aaa19a19Sjhaslam membar_producer();
256aaa19a19Sjhaslam
2577c478bd9Sstevel@tonic-gate ddi_report_dev(devi);
2587c478bd9Sstevel@tonic-gate lockstat_devi = devi;
2597c478bd9Sstevel@tonic-gate return (DDI_SUCCESS);
2607c478bd9Sstevel@tonic-gate }
2617c478bd9Sstevel@tonic-gate
2627c478bd9Sstevel@tonic-gate static int
lockstat_detach(dev_info_t * devi,ddi_detach_cmd_t cmd)2637c478bd9Sstevel@tonic-gate lockstat_detach(dev_info_t *devi, ddi_detach_cmd_t cmd)
2647c478bd9Sstevel@tonic-gate {
2657c478bd9Sstevel@tonic-gate switch (cmd) {
2667c478bd9Sstevel@tonic-gate case DDI_DETACH:
2677c478bd9Sstevel@tonic-gate break;
2687c478bd9Sstevel@tonic-gate case DDI_SUSPEND:
2697c478bd9Sstevel@tonic-gate return (DDI_SUCCESS);
2707c478bd9Sstevel@tonic-gate default:
2717c478bd9Sstevel@tonic-gate return (DDI_FAILURE);
2727c478bd9Sstevel@tonic-gate }
2737c478bd9Sstevel@tonic-gate
2747c478bd9Sstevel@tonic-gate if (dtrace_unregister(lockstat_id) != 0)
2757c478bd9Sstevel@tonic-gate return (DDI_FAILURE);
2767c478bd9Sstevel@tonic-gate
2777c478bd9Sstevel@tonic-gate ddi_remove_minor_node(devi, NULL);
2787c478bd9Sstevel@tonic-gate return (DDI_SUCCESS);
2797c478bd9Sstevel@tonic-gate }
2807c478bd9Sstevel@tonic-gate
2817c478bd9Sstevel@tonic-gate /*
2827c478bd9Sstevel@tonic-gate * Configuration data structures
2837c478bd9Sstevel@tonic-gate */
2847c478bd9Sstevel@tonic-gate static struct cb_ops lockstat_cb_ops = {
2857c478bd9Sstevel@tonic-gate lockstat_open, /* open */
2867c478bd9Sstevel@tonic-gate nodev, /* close */
2877c478bd9Sstevel@tonic-gate nulldev, /* strategy */
2887c478bd9Sstevel@tonic-gate nulldev, /* print */
2897c478bd9Sstevel@tonic-gate nodev, /* dump */
2907c478bd9Sstevel@tonic-gate nodev, /* read */
2917c478bd9Sstevel@tonic-gate nodev, /* write */
2927c478bd9Sstevel@tonic-gate nodev, /* ioctl */
2937c478bd9Sstevel@tonic-gate nodev, /* devmap */
2947c478bd9Sstevel@tonic-gate nodev, /* mmap */
2957c478bd9Sstevel@tonic-gate nodev, /* segmap */
2967c478bd9Sstevel@tonic-gate nochpoll, /* poll */
2977c478bd9Sstevel@tonic-gate ddi_prop_op, /* cb_prop_op */
2987c478bd9Sstevel@tonic-gate 0, /* streamtab */
2997c478bd9Sstevel@tonic-gate D_MP | D_NEW /* Driver compatibility flag */
3007c478bd9Sstevel@tonic-gate };
3017c478bd9Sstevel@tonic-gate
3027c478bd9Sstevel@tonic-gate static struct dev_ops lockstat_ops = {
3037c478bd9Sstevel@tonic-gate DEVO_REV, /* devo_rev, */
3047c478bd9Sstevel@tonic-gate 0, /* refcnt */
3057c478bd9Sstevel@tonic-gate lockstat_info, /* getinfo */
3067c478bd9Sstevel@tonic-gate nulldev, /* identify */
3077c478bd9Sstevel@tonic-gate nulldev, /* probe */
3087c478bd9Sstevel@tonic-gate lockstat_attach, /* attach */
3097c478bd9Sstevel@tonic-gate lockstat_detach, /* detach */
3107c478bd9Sstevel@tonic-gate nulldev, /* reset */
3117c478bd9Sstevel@tonic-gate &lockstat_cb_ops, /* cb_ops */
3127c478bd9Sstevel@tonic-gate NULL, /* bus_ops */
31319397407SSherry Moore NULL, /* power */
31419397407SSherry Moore ddi_quiesce_not_needed, /* quiesce */
3157c478bd9Sstevel@tonic-gate };
3167c478bd9Sstevel@tonic-gate
3177c478bd9Sstevel@tonic-gate static struct modldrv modldrv = {
3187c478bd9Sstevel@tonic-gate &mod_driverops, /* Type of module. This one is a driver */
31919397407SSherry Moore "Lock Statistics", /* name of module */
3207c478bd9Sstevel@tonic-gate &lockstat_ops, /* driver ops */
3217c478bd9Sstevel@tonic-gate };
3227c478bd9Sstevel@tonic-gate
3237c478bd9Sstevel@tonic-gate static struct modlinkage modlinkage = {
3247c478bd9Sstevel@tonic-gate MODREV_1, (void *)&modldrv, NULL
3257c478bd9Sstevel@tonic-gate };
3267c478bd9Sstevel@tonic-gate
3277c478bd9Sstevel@tonic-gate int
_init(void)3287c478bd9Sstevel@tonic-gate _init(void)
3297c478bd9Sstevel@tonic-gate {
3307c478bd9Sstevel@tonic-gate return (mod_install(&modlinkage));
3317c478bd9Sstevel@tonic-gate }
3327c478bd9Sstevel@tonic-gate
3337c478bd9Sstevel@tonic-gate int
_fini(void)3347c478bd9Sstevel@tonic-gate _fini(void)
3357c478bd9Sstevel@tonic-gate {
3367c478bd9Sstevel@tonic-gate return (mod_remove(&modlinkage));
3377c478bd9Sstevel@tonic-gate }
3387c478bd9Sstevel@tonic-gate
3397c478bd9Sstevel@tonic-gate int
_info(struct modinfo * modinfop)3407c478bd9Sstevel@tonic-gate _info(struct modinfo *modinfop)
3417c478bd9Sstevel@tonic-gate {
3427c478bd9Sstevel@tonic-gate return (mod_info(&modlinkage, modinfop));
3437c478bd9Sstevel@tonic-gate }
344