4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
25 static int dtrace_verbose_ioctl;
26 SYSCTL_INT(_debug_dtrace, OID_AUTO, verbose_ioctl, CTLFLAG_RW, &dtrace_verbose_ioctl, 0, "");
28 #define DTRACE_IOCTL_PRINTF(fmt, ...) if (dtrace_verbose_ioctl) printf(fmt, ## __VA_ARGS__ )
32 dtrace_ioctl(struct cdev *dev, u_long cmd, caddr_t addr,
33 int flags __unused, struct thread *td)
35 #if __FreeBSD_version < 800039
36 dtrace_state_t *state = dev->si_drv1;
38 dtrace_state_t *state;
39 devfs_get_cdevpriv((void **) &state);
45 if (state->dts_anon) {
46 ASSERT(dtrace_anon.dta_state == NULL);
47 state = state->dts_anon;
51 case DTRACEIOC_AGGDESC: {
52 dtrace_aggdesc_t **paggdesc = (dtrace_aggdesc_t **) addr;
53 dtrace_aggdesc_t aggdesc;
55 dtrace_aggregation_t *agg;
58 dtrace_recdesc_t *lrec;
63 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_AGGDESC\n",__func__,__LINE__);
65 if (copyin((void *) *paggdesc, &aggdesc, sizeof (aggdesc)) != 0)
68 mutex_enter(&dtrace_lock);
70 if ((agg = dtrace_aggid2agg(state, aggdesc.dtagd_id)) == NULL) {
71 mutex_exit(&dtrace_lock);
75 aggdesc.dtagd_epid = agg->dtag_ecb->dte_epid;
77 nrecs = aggdesc.dtagd_nrecs;
78 aggdesc.dtagd_nrecs = 0;
80 offs = agg->dtag_base;
81 lrec = &agg->dtag_action.dta_rec;
82 aggdesc.dtagd_size = lrec->dtrd_offset + lrec->dtrd_size - offs;
84 for (act = agg->dtag_first; ; act = act->dta_next) {
85 ASSERT(act->dta_intuple ||
86 DTRACEACT_ISAGG(act->dta_kind));
89 * If this action has a record size of zero, it
90 * denotes an argument to the aggregating action.
91 * Because the presence of this record doesn't (or
92 * shouldn't) affect the way the data is interpreted,
93 * we don't copy it out to save user-level the
94 * confusion of dealing with a zero-length record.
96 if (act->dta_rec.dtrd_size == 0) {
97 ASSERT(agg->dtag_hasarg);
101 aggdesc.dtagd_nrecs++;
103 if (act == &agg->dtag_action)
108 * Now that we have the size, we need to allocate a temporary
109 * buffer in which to store the complete description. We need
110 * the temporary buffer to be able to drop dtrace_lock()
111 * across the copyout(), below.
113 size = sizeof (dtrace_aggdesc_t) +
114 (aggdesc.dtagd_nrecs * sizeof (dtrace_recdesc_t));
116 buf = kmem_alloc(size, KM_SLEEP);
117 dest = (uintptr_t)buf;
119 bcopy(&aggdesc, (void *)dest, sizeof (aggdesc));
120 dest += offsetof(dtrace_aggdesc_t, dtagd_rec[0]);
122 for (act = agg->dtag_first; ; act = act->dta_next) {
123 dtrace_recdesc_t rec = act->dta_rec;
126 * See the comment in the above loop for why we pass
127 * over zero-length records.
129 if (rec.dtrd_size == 0) {
130 ASSERT(agg->dtag_hasarg);
137 rec.dtrd_offset -= offs;
138 bcopy(&rec, (void *)dest, sizeof (rec));
139 dest += sizeof (dtrace_recdesc_t);
141 if (act == &agg->dtag_action)
145 mutex_exit(&dtrace_lock);
147 if (copyout(buf, (void *) *paggdesc, dest - (uintptr_t)buf) != 0) {
148 kmem_free(buf, size);
152 kmem_free(buf, size);
155 case DTRACEIOC_AGGSNAP:
156 case DTRACEIOC_BUFSNAP: {
157 dtrace_bufdesc_t **pdesc = (dtrace_bufdesc_t **) addr;
158 dtrace_bufdesc_t desc;
160 dtrace_buffer_t *buf;
162 dtrace_debug_output();
164 if (copyin((void *) *pdesc, &desc, sizeof (desc)) != 0)
167 DTRACE_IOCTL_PRINTF("%s(%d): %s curcpu %d cpu %d\n",
169 cmd == DTRACEIOC_AGGSNAP ?
170 "DTRACEIOC_AGGSNAP":"DTRACEIOC_BUFSNAP",
171 curcpu, desc.dtbd_cpu);
173 if (desc.dtbd_cpu < 0 || desc.dtbd_cpu >= NCPU)
175 if (pcpu_find(desc.dtbd_cpu) == NULL)
178 mutex_enter(&dtrace_lock);
180 if (cmd == DTRACEIOC_BUFSNAP) {
181 buf = &state->dts_buffer[desc.dtbd_cpu];
183 buf = &state->dts_aggbuffer[desc.dtbd_cpu];
186 if (buf->dtb_flags & (DTRACEBUF_RING | DTRACEBUF_FILL)) {
187 size_t sz = buf->dtb_offset;
189 if (state->dts_activity != DTRACE_ACTIVITY_STOPPED) {
190 mutex_exit(&dtrace_lock);
195 * If this buffer has already been consumed, we're
196 * going to indicate that there's nothing left here
199 if (buf->dtb_flags & DTRACEBUF_CONSUMED) {
200 mutex_exit(&dtrace_lock);
204 desc.dtbd_errors = 0;
205 desc.dtbd_oldest = 0;
208 if (copyout(&desc, (void *) *pdesc, sz) != 0)
215 * If this is a ring buffer that has wrapped, we want
216 * to copy the whole thing out.
218 if (buf->dtb_flags & DTRACEBUF_WRAPPED) {
219 dtrace_buffer_polish(buf);
223 if (copyout(buf->dtb_tomax, desc.dtbd_data, sz) != 0) {
224 mutex_exit(&dtrace_lock);
229 desc.dtbd_drops = buf->dtb_drops;
230 desc.dtbd_errors = buf->dtb_errors;
231 desc.dtbd_oldest = buf->dtb_xamot_offset;
233 mutex_exit(&dtrace_lock);
235 if (copyout(&desc, (void *) *pdesc, sizeof (desc)) != 0)
238 buf->dtb_flags |= DTRACEBUF_CONSUMED;
243 if (buf->dtb_tomax == NULL) {
244 ASSERT(buf->dtb_xamot == NULL);
245 mutex_exit(&dtrace_lock);
249 cached = buf->dtb_tomax;
250 ASSERT(!(buf->dtb_flags & DTRACEBUF_NOSWITCH));
252 dtrace_xcall(desc.dtbd_cpu,
253 (dtrace_xcall_t)dtrace_buffer_switch, buf);
255 state->dts_errors += buf->dtb_xamot_errors;
258 * If the buffers did not actually switch, then the cross call
259 * did not take place -- presumably because the given CPU is
260 * not in the ready set. If this is the case, we'll return
263 if (buf->dtb_tomax == cached) {
264 ASSERT(buf->dtb_xamot != cached);
265 mutex_exit(&dtrace_lock);
269 ASSERT(cached == buf->dtb_xamot);
271 DTRACE_IOCTL_PRINTF("%s(%d): copyout the buffer snapshot\n",__func__,__LINE__);
274 * We have our snapshot; now copy it out.
276 if (copyout(buf->dtb_xamot, desc.dtbd_data,
277 buf->dtb_xamot_offset) != 0) {
278 mutex_exit(&dtrace_lock);
282 desc.dtbd_size = buf->dtb_xamot_offset;
283 desc.dtbd_drops = buf->dtb_xamot_drops;
284 desc.dtbd_errors = buf->dtb_xamot_errors;
285 desc.dtbd_oldest = 0;
287 mutex_exit(&dtrace_lock);
289 DTRACE_IOCTL_PRINTF("%s(%d): copyout buffer desc: size %zd drops %lu errors %lu\n",__func__,__LINE__,(size_t) desc.dtbd_size,(u_long) desc.dtbd_drops,(u_long) desc.dtbd_errors);
292 * Finally, copy out the buffer description.
294 if (copyout(&desc, (void *) *pdesc, sizeof (desc)) != 0)
299 case DTRACEIOC_CONF: {
302 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_CONF\n",__func__,__LINE__);
304 bzero(&conf, sizeof (conf));
305 conf.dtc_difversion = DIF_VERSION;
306 conf.dtc_difintregs = DIF_DIR_NREGS;
307 conf.dtc_diftupregs = DIF_DTR_NREGS;
308 conf.dtc_ctfmodel = CTF_MODEL_NATIVE;
310 *((dtrace_conf_t *) addr) = conf;
314 case DTRACEIOC_DOFGET: {
315 dof_hdr_t **pdof = (dof_hdr_t **) addr;
316 dof_hdr_t hdr, *dof = *pdof;
320 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_DOFGET\n",__func__,__LINE__);
322 if (copyin((void *)dof, &hdr, sizeof (hdr)) != 0)
325 mutex_enter(&dtrace_lock);
326 dof = dtrace_dof_create(state);
327 mutex_exit(&dtrace_lock);
329 len = MIN(hdr.dofh_loadsz, dof->dofh_loadsz);
330 rval = copyout(dof, (void *) *pdof, len);
331 dtrace_dof_destroy(dof);
333 return (rval == 0 ? 0 : EFAULT);
335 case DTRACEIOC_ENABLE: {
336 dof_hdr_t *dof = NULL;
337 dtrace_enabling_t *enab = NULL;
338 dtrace_vstate_t *vstate;
341 dtrace_enable_io_t *p = (dtrace_enable_io_t *) addr;
343 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_ENABLE\n",__func__,__LINE__);
346 * If a NULL argument has been passed, we take this as our
347 * cue to reevaluate our enablings.
349 if (p->dof == NULL) {
350 dtrace_enabling_matchall();
355 if ((dof = dtrace_dof_copyin((uintptr_t) p->dof, &rval)) == NULL)
358 mutex_enter(&cpu_lock);
359 mutex_enter(&dtrace_lock);
360 vstate = &state->dts_vstate;
362 if (state->dts_activity != DTRACE_ACTIVITY_INACTIVE) {
363 mutex_exit(&dtrace_lock);
364 mutex_exit(&cpu_lock);
365 dtrace_dof_destroy(dof);
369 if (dtrace_dof_slurp(dof, vstate, td->td_ucred, &enab, 0, B_TRUE) != 0) {
370 mutex_exit(&dtrace_lock);
371 mutex_exit(&cpu_lock);
372 dtrace_dof_destroy(dof);
376 if ((rval = dtrace_dof_options(dof, state)) != 0) {
377 dtrace_enabling_destroy(enab);
378 mutex_exit(&dtrace_lock);
379 mutex_exit(&cpu_lock);
380 dtrace_dof_destroy(dof);
384 if ((err = dtrace_enabling_match(enab, &p->n_matched)) == 0) {
385 err = dtrace_enabling_retain(enab);
387 dtrace_enabling_destroy(enab);
390 mutex_exit(&cpu_lock);
391 mutex_exit(&dtrace_lock);
392 dtrace_dof_destroy(dof);
396 case DTRACEIOC_EPROBE: {
397 dtrace_eprobedesc_t **pepdesc = (dtrace_eprobedesc_t **) addr;
398 dtrace_eprobedesc_t epdesc;
400 dtrace_action_t *act;
406 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_EPROBE\n",__func__,__LINE__);
408 if (copyin((void *)*pepdesc, &epdesc, sizeof (epdesc)) != 0)
411 mutex_enter(&dtrace_lock);
413 if ((ecb = dtrace_epid2ecb(state, epdesc.dtepd_epid)) == NULL) {
414 mutex_exit(&dtrace_lock);
418 if (ecb->dte_probe == NULL) {
419 mutex_exit(&dtrace_lock);
423 epdesc.dtepd_probeid = ecb->dte_probe->dtpr_id;
424 epdesc.dtepd_uarg = ecb->dte_uarg;
425 epdesc.dtepd_size = ecb->dte_size;
427 nrecs = epdesc.dtepd_nrecs;
428 epdesc.dtepd_nrecs = 0;
429 for (act = ecb->dte_action; act != NULL; act = act->dta_next) {
430 if (DTRACEACT_ISAGG(act->dta_kind) || act->dta_intuple)
433 epdesc.dtepd_nrecs++;
437 * Now that we have the size, we need to allocate a temporary
438 * buffer in which to store the complete description. We need
439 * the temporary buffer to be able to drop dtrace_lock()
440 * across the copyout(), below.
442 size = sizeof (dtrace_eprobedesc_t) +
443 (epdesc.dtepd_nrecs * sizeof (dtrace_recdesc_t));
445 buf = kmem_alloc(size, KM_SLEEP);
446 dest = (uintptr_t)buf;
448 bcopy(&epdesc, (void *)dest, sizeof (epdesc));
449 dest += offsetof(dtrace_eprobedesc_t, dtepd_rec[0]);
451 for (act = ecb->dte_action; act != NULL; act = act->dta_next) {
452 if (DTRACEACT_ISAGG(act->dta_kind) || act->dta_intuple)
458 bcopy(&act->dta_rec, (void *)dest,
459 sizeof (dtrace_recdesc_t));
460 dest += sizeof (dtrace_recdesc_t);
463 mutex_exit(&dtrace_lock);
465 if (copyout(buf, (void *) *pepdesc, dest - (uintptr_t)buf) != 0) {
466 kmem_free(buf, size);
470 kmem_free(buf, size);
473 case DTRACEIOC_FORMAT: {
474 dtrace_fmtdesc_t *fmt = (dtrace_fmtdesc_t *) addr;
478 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_FORMAT\n",__func__,__LINE__);
480 mutex_enter(&dtrace_lock);
482 if (fmt->dtfd_format == 0 ||
483 fmt->dtfd_format > state->dts_nformats) {
484 mutex_exit(&dtrace_lock);
489 * Format strings are allocated contiguously and they are
490 * never freed; if a format index is less than the number
491 * of formats, we can assert that the format map is non-NULL
492 * and that the format for the specified index is non-NULL.
494 ASSERT(state->dts_formats != NULL);
495 str = state->dts_formats[fmt->dtfd_format - 1];
498 len = strlen(str) + 1;
500 if (len > fmt->dtfd_length) {
501 fmt->dtfd_length = len;
503 if (copyout(str, fmt->dtfd_string, len) != 0) {
504 mutex_exit(&dtrace_lock);
509 mutex_exit(&dtrace_lock);
514 processorid_t *cpuid = (processorid_t *) addr;
516 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_GO\n",__func__,__LINE__);
518 rval = dtrace_state_go(state, cpuid);
522 case DTRACEIOC_PROBEARG: {
523 dtrace_argdesc_t *desc = (dtrace_argdesc_t *) addr;
524 dtrace_probe_t *probe;
525 dtrace_provider_t *prov;
527 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_PROBEARG\n",__func__,__LINE__);
529 if (desc->dtargd_id == DTRACE_IDNONE)
532 if (desc->dtargd_ndx == DTRACE_ARGNONE)
535 mutex_enter(&dtrace_provider_lock);
536 mutex_enter(&mod_lock);
537 mutex_enter(&dtrace_lock);
539 if (desc->dtargd_id > dtrace_nprobes) {
540 mutex_exit(&dtrace_lock);
541 mutex_exit(&mod_lock);
542 mutex_exit(&dtrace_provider_lock);
546 if ((probe = dtrace_probes[desc->dtargd_id - 1]) == NULL) {
547 mutex_exit(&dtrace_lock);
548 mutex_exit(&mod_lock);
549 mutex_exit(&dtrace_provider_lock);
553 mutex_exit(&dtrace_lock);
555 prov = probe->dtpr_provider;
557 if (prov->dtpv_pops.dtps_getargdesc == NULL) {
559 * There isn't any typed information for this probe.
560 * Set the argument number to DTRACE_ARGNONE.
562 desc->dtargd_ndx = DTRACE_ARGNONE;
564 desc->dtargd_native[0] = '\0';
565 desc->dtargd_xlate[0] = '\0';
566 desc->dtargd_mapping = desc->dtargd_ndx;
568 prov->dtpv_pops.dtps_getargdesc(prov->dtpv_arg,
569 probe->dtpr_id, probe->dtpr_arg, desc);
572 mutex_exit(&mod_lock);
573 mutex_exit(&dtrace_provider_lock);
577 case DTRACEIOC_PROBEMATCH:
578 case DTRACEIOC_PROBES: {
579 dtrace_probedesc_t *p_desc = (dtrace_probedesc_t *) addr;
580 dtrace_probe_t *probe = NULL;
581 dtrace_probekey_t pkey;
588 DTRACE_IOCTL_PRINTF("%s(%d): %s\n",__func__,__LINE__,
589 cmd == DTRACEIOC_PROBEMATCH ?
590 "DTRACEIOC_PROBEMATCH":"DTRACEIOC_PROBES");
592 p_desc->dtpd_provider[DTRACE_PROVNAMELEN - 1] = '\0';
593 p_desc->dtpd_mod[DTRACE_MODNAMELEN - 1] = '\0';
594 p_desc->dtpd_func[DTRACE_FUNCNAMELEN - 1] = '\0';
595 p_desc->dtpd_name[DTRACE_NAMELEN - 1] = '\0';
598 * Before we attempt to match this probe, we want to give
599 * all providers the opportunity to provide it.
601 if (p_desc->dtpd_id == DTRACE_IDNONE) {
602 mutex_enter(&dtrace_provider_lock);
603 dtrace_probe_provide(p_desc, NULL);
604 mutex_exit(&dtrace_provider_lock);
608 if (cmd == DTRACEIOC_PROBEMATCH) {
609 dtrace_probekey(p_desc, &pkey);
610 pkey.dtpk_id = DTRACE_IDNONE;
613 dtrace_cred2priv(td->td_ucred, &priv, &uid, &zoneid);
615 mutex_enter(&dtrace_lock);
617 if (cmd == DTRACEIOC_PROBEMATCH) {
618 for (i = p_desc->dtpd_id; i <= dtrace_nprobes; i++) {
619 if ((probe = dtrace_probes[i - 1]) != NULL &&
620 (m = dtrace_match_probe(probe, &pkey,
621 priv, uid, zoneid)) != 0)
626 mutex_exit(&dtrace_lock);
631 for (i = p_desc->dtpd_id; i <= dtrace_nprobes; i++) {
632 if ((probe = dtrace_probes[i - 1]) != NULL &&
633 dtrace_match_priv(probe, priv, uid, zoneid))
639 mutex_exit(&dtrace_lock);
643 dtrace_probe_description(probe, p_desc);
644 mutex_exit(&dtrace_lock);
648 case DTRACEIOC_PROVIDER: {
649 dtrace_providerdesc_t *pvd = (dtrace_providerdesc_t *) addr;
650 dtrace_provider_t *pvp;
652 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_PROVIDER\n",__func__,__LINE__);
654 pvd->dtvd_name[DTRACE_PROVNAMELEN - 1] = '\0';
655 mutex_enter(&dtrace_provider_lock);
657 for (pvp = dtrace_provider; pvp != NULL; pvp = pvp->dtpv_next) {
658 if (strcmp(pvp->dtpv_name, pvd->dtvd_name) == 0)
662 mutex_exit(&dtrace_provider_lock);
667 bcopy(&pvp->dtpv_priv, &pvd->dtvd_priv, sizeof (dtrace_ppriv_t));
668 bcopy(&pvp->dtpv_attr, &pvd->dtvd_attr, sizeof (dtrace_pattr_t));
672 case DTRACEIOC_REPLICATE: {
673 dtrace_repldesc_t *desc = (dtrace_repldesc_t *) addr;
674 dtrace_probedesc_t *match = &desc->dtrpd_match;
675 dtrace_probedesc_t *create = &desc->dtrpd_create;
678 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_REPLICATE\n",__func__,__LINE__);
680 match->dtpd_provider[DTRACE_PROVNAMELEN - 1] = '\0';
681 match->dtpd_mod[DTRACE_MODNAMELEN - 1] = '\0';
682 match->dtpd_func[DTRACE_FUNCNAMELEN - 1] = '\0';
683 match->dtpd_name[DTRACE_NAMELEN - 1] = '\0';
685 create->dtpd_provider[DTRACE_PROVNAMELEN - 1] = '\0';
686 create->dtpd_mod[DTRACE_MODNAMELEN - 1] = '\0';
687 create->dtpd_func[DTRACE_FUNCNAMELEN - 1] = '\0';
688 create->dtpd_name[DTRACE_NAMELEN - 1] = '\0';
690 mutex_enter(&dtrace_lock);
691 err = dtrace_enabling_replicate(state, match, create);
692 mutex_exit(&dtrace_lock);
696 case DTRACEIOC_STATUS: {
697 dtrace_status_t *stat = (dtrace_status_t *) addr;
698 dtrace_dstate_t *dstate;
702 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_STATUS\n",__func__,__LINE__);
705 * See the comment in dtrace_state_deadman() for the reason
706 * for setting dts_laststatus to INT64_MAX before setting
707 * it to the correct value.
709 state->dts_laststatus = INT64_MAX;
710 dtrace_membar_producer();
711 state->dts_laststatus = dtrace_gethrtime();
713 bzero(stat, sizeof (*stat));
715 mutex_enter(&dtrace_lock);
717 if (state->dts_activity == DTRACE_ACTIVITY_INACTIVE) {
718 mutex_exit(&dtrace_lock);
722 if (state->dts_activity == DTRACE_ACTIVITY_DRAINING)
723 stat->dtst_exiting = 1;
725 nerrs = state->dts_errors;
726 dstate = &state->dts_vstate.dtvs_dynvars;
728 for (i = 0; i < NCPU; i++) {
730 if (pcpu_find(i) == NULL)
733 dtrace_dstate_percpu_t *dcpu = &dstate->dtds_percpu[i];
735 stat->dtst_dyndrops += dcpu->dtdsc_drops;
736 stat->dtst_dyndrops_dirty += dcpu->dtdsc_dirty_drops;
737 stat->dtst_dyndrops_rinsing += dcpu->dtdsc_rinsing_drops;
739 if (state->dts_buffer[i].dtb_flags & DTRACEBUF_FULL)
742 nerrs += state->dts_buffer[i].dtb_errors;
744 for (j = 0; j < state->dts_nspeculations; j++) {
745 dtrace_speculation_t *spec;
746 dtrace_buffer_t *buf;
748 spec = &state->dts_speculations[j];
749 buf = &spec->dtsp_buffer[i];
750 stat->dtst_specdrops += buf->dtb_xamot_drops;
754 stat->dtst_specdrops_busy = state->dts_speculations_busy;
755 stat->dtst_specdrops_unavail = state->dts_speculations_unavail;
756 stat->dtst_stkstroverflows = state->dts_stkstroverflows;
757 stat->dtst_dblerrors = state->dts_dblerrors;
759 (state->dts_activity == DTRACE_ACTIVITY_KILLED);
760 stat->dtst_errors = nerrs;
762 mutex_exit(&dtrace_lock);
766 case DTRACEIOC_STOP: {
768 processorid_t *cpuid = (processorid_t *) addr;
770 DTRACE_IOCTL_PRINTF("%s(%d): DTRACEIOC_STOP\n",__func__,__LINE__);
772 mutex_enter(&dtrace_lock);
773 rval = dtrace_state_stop(state, cpuid);
774 mutex_exit(&dtrace_lock);