]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/cddl/dev/profile/profile.c
Merge ^/vendor/llvm-openmp/dist up to its last change, and resolve conflicts.
[FreeBSD/FreeBSD.git] / sys / cddl / dev / profile / profile.c
1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  *
21  * Portions Copyright 2006-2008 John Birrell jb@freebsd.org
22  *
23  * $FreeBSD$
24  *
25  */
26
27 /*
28  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
29  * Use is subject to license terms.
30  */
31
32 #include <sys/cdefs.h>
33 #include <sys/param.h>
34 #include <sys/systm.h>
35 #include <sys/conf.h>
36 #include <sys/cpuvar.h>
37 #include <sys/fcntl.h>
38 #include <sys/filio.h>
39 #include <sys/kdb.h>
40 #include <sys/kernel.h>
41 #include <sys/kmem.h>
42 #include <sys/kthread.h>
43 #include <sys/limits.h>
44 #include <sys/linker.h>
45 #include <sys/lock.h>
46 #include <sys/malloc.h>
47 #include <sys/module.h>
48 #include <sys/mutex.h>
49 #include <sys/poll.h>
50 #include <sys/proc.h>
51 #include <sys/selinfo.h>
52 #include <sys/smp.h>
53 #include <sys/sysctl.h>
54 #include <sys/uio.h>
55 #include <sys/unistd.h>
56 #include <machine/cpu.h>
57 #include <machine/stdarg.h>
58
59 #include <sys/dtrace.h>
60 #include <sys/dtrace_bsd.h>
61
62 #define PROF_NAMELEN            15
63
64 #define PROF_PROFILE            0
65 #define PROF_TICK               1
66 #define PROF_PREFIX_PROFILE     "profile-"
67 #define PROF_PREFIX_TICK        "tick-"
68
69 /*
70  * Regardless of platform, there are five artificial frames in the case of the
71  * profile provider:
72  *
73  *      profile_fire
74  *      cyclic_expire
75  *      cyclic_fire
76  *      [ cbe ]
77  *      [ locore ]
78  *
79  * On amd64, there are two frames associated with locore:  one in locore, and
80  * another in common interrupt dispatch code.  (i386 has not been modified to
81  * use this common layer.)  Further, on i386, the interrupted instruction
82  * appears as its own stack frame.  All of this means that we need to add one
83  * frame for amd64, and then take one away for both amd64 and i386.
84  *
85  * On SPARC, the picture is further complicated because the compiler
86  * optimizes away tail-calls -- so the following frames are optimized away:
87  *
88  *      profile_fire
89  *      cyclic_expire
90  *
91  * This gives three frames.  However, on DEBUG kernels, the cyclic_expire
92  * frame cannot be tail-call eliminated, yielding four frames in this case.
93  *
94  * All of the above constraints lead to the mess below.  Yes, the profile
95  * provider should ideally figure this out on-the-fly by hiting one of its own
96  * probes and then walking its own stack trace.  This is complicated, however,
97  * and the static definition doesn't seem to be overly brittle.  Still, we
98  * allow for a manual override in case we get it completely wrong.
99  */
100 #ifdef __amd64
101 #define PROF_ARTIFICIAL_FRAMES  10
102 #else
103 #ifdef __i386
104 #define PROF_ARTIFICIAL_FRAMES  6
105 #else
106 #ifdef __sparc
107 #ifdef DEBUG
108 #define PROF_ARTIFICIAL_FRAMES  4
109 #else
110 #define PROF_ARTIFICIAL_FRAMES  3
111 #endif
112 #endif
113 #endif
114 #endif
115
116 #ifdef __mips
117 /*
118  * This value is bogus just to make module compilable on mips
119  */
120 #define PROF_ARTIFICIAL_FRAMES  3
121 #endif
122
123 #ifdef __powerpc__
124 /*
125  * This value is bogus just to make module compilable on powerpc
126  */
127 #define PROF_ARTIFICIAL_FRAMES  3
128 #endif
129
130 struct profile_probe_percpu;
131
132 #ifdef __mips
133 /* bogus */
134 #define PROF_ARTIFICIAL_FRAMES  3
135 #endif
136
137 #ifdef __arm__
138 #define PROF_ARTIFICIAL_FRAMES  3
139 #endif
140
141 #ifdef __aarch64__
142 /* TODO: verify */
143 #define PROF_ARTIFICIAL_FRAMES  10
144 #endif
145
146 #ifdef __riscv
147 /* TODO: verify */
148 #define PROF_ARTIFICIAL_FRAMES  10
149 #endif
150
151 typedef struct profile_probe {
152         char            prof_name[PROF_NAMELEN];
153         dtrace_id_t     prof_id;
154         int             prof_kind;
155 #ifdef illumos
156         hrtime_t        prof_interval;
157         cyclic_id_t     prof_cyclic;
158 #else
159         sbintime_t      prof_interval;
160         struct callout  prof_cyclic;
161         sbintime_t      prof_expected;
162         struct profile_probe_percpu **prof_pcpus;
163 #endif
164 } profile_probe_t;
165
166 typedef struct profile_probe_percpu {
167         hrtime_t        profc_expected;
168         hrtime_t        profc_interval;
169         profile_probe_t *profc_probe;
170 #ifdef __FreeBSD__
171         struct callout  profc_cyclic;
172 #endif
173 } profile_probe_percpu_t;
174
175 static d_open_t profile_open;
176 static int      profile_unload(void);
177 static void     profile_create(hrtime_t, char *, int);
178 static void     profile_destroy(void *, dtrace_id_t, void *);
179 static void     profile_enable(void *, dtrace_id_t, void *);
180 static void     profile_disable(void *, dtrace_id_t, void *);
181 static void     profile_load(void *);
182 static void     profile_provide(void *, dtrace_probedesc_t *);
183
184 static int profile_rates[] = {
185     97, 199, 499, 997, 1999,
186     4001, 4999, 0, 0, 0,
187     0, 0, 0, 0, 0,
188     0, 0, 0, 0, 0
189 };
190
191 static int profile_ticks[] = {
192     1, 10, 100, 500, 1000,
193     5000, 0, 0, 0, 0,
194     0, 0, 0, 0, 0
195 };
196
197 /*
198  * profile_max defines the upper bound on the number of profile probes that
199  * can exist (this is to prevent malicious or clumsy users from exhausing
200  * system resources by creating a slew of profile probes). At mod load time,
201  * this gets its value from PROFILE_MAX_DEFAULT or profile-max-probes if it's
202  * present in the profile.conf file.
203  */
204 #define PROFILE_MAX_DEFAULT     1000    /* default max. number of probes */
205 static uint32_t profile_max = PROFILE_MAX_DEFAULT;
206                                         /* maximum number of profile probes */
207 static uint32_t profile_total;          /* current number of profile probes */
208
209 static struct cdevsw profile_cdevsw = {
210         .d_version      = D_VERSION,
211         .d_open         = profile_open,
212         .d_name         = "profile",
213 };
214
215 static dtrace_pattr_t profile_attr = {
216 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
217 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN },
218 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
219 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON },
220 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA },
221 };
222
223 static dtrace_pops_t profile_pops = {
224         .dtps_provide =         profile_provide,
225         .dtps_provide_module =  NULL,
226         .dtps_enable =          profile_enable,
227         .dtps_disable =         profile_disable,
228         .dtps_suspend =         NULL,
229         .dtps_resume =          NULL,
230         .dtps_getargdesc =      NULL,
231         .dtps_getargval =       NULL,
232         .dtps_usermode =        NULL,
233         .dtps_destroy =         profile_destroy
234 };
235
236 static struct cdev              *profile_cdev;
237 static dtrace_provider_id_t     profile_id;
238 static hrtime_t                 profile_interval_min = NANOSEC / 5000;  /* 5000 hz */
239 static int                      profile_aframes = PROF_ARTIFICIAL_FRAMES;
240
241 SYSCTL_DECL(_kern_dtrace);
242 SYSCTL_NODE(_kern_dtrace, OID_AUTO, profile, CTLFLAG_RD, 0, "DTrace profile parameters");
243 SYSCTL_INT(_kern_dtrace_profile, OID_AUTO, aframes, CTLFLAG_RW, &profile_aframes,
244     0, "Skipped frames for profile provider");
245
246 static sbintime_t
247 nsec_to_sbt(hrtime_t nsec)
248 {
249         time_t sec;
250
251         /*
252          * We need to calculate nsec * 2^32 / 10^9
253          * Seconds and nanoseconds are split to avoid overflow.
254          */
255         sec = nsec / NANOSEC;
256         nsec = nsec % NANOSEC;
257         return (((sbintime_t)sec << 32) | ((sbintime_t)nsec << 32) / NANOSEC);
258 }
259
260 static hrtime_t
261 sbt_to_nsec(sbintime_t sbt)
262 {
263
264         return ((sbt >> 32) * NANOSEC +
265             (((uint32_t)sbt * (hrtime_t)NANOSEC) >> 32));
266 }
267
268 static void
269 profile_probe(profile_probe_t *prof, hrtime_t late)
270 {
271         struct thread *td;
272         struct trapframe *frame;
273         uintfptr_t pc, upc;
274
275         td = curthread;
276         pc = upc = 0;
277
278         /*
279          * td_intr_frame can be unset if this is a catch-up event upon waking up
280          * from idle sleep. This can only happen on a CPU idle thread. Use a
281          * representative arg0 value in this case so that one of the probe
282          * arguments is non-zero.
283          */
284         frame = td->td_intr_frame;
285         if (frame != NULL) {
286                 if (TRAPF_USERMODE(frame))
287                         upc = TRAPF_PC(frame);
288                 else
289                         pc = TRAPF_PC(frame);
290         } else if (TD_IS_IDLETHREAD(td))
291                 pc = (uintfptr_t)&cpu_idle;
292
293         dtrace_probe(prof->prof_id, pc, upc, late, 0, 0);
294 }
295
296 static void
297 profile_fire(void *arg)
298 {
299         profile_probe_percpu_t *pcpu = arg;
300         profile_probe_t *prof = pcpu->profc_probe;
301         hrtime_t late;
302
303         late = sbt_to_nsec(sbinuptime() - pcpu->profc_expected);
304
305         profile_probe(prof, late);
306         pcpu->profc_expected += pcpu->profc_interval;
307         callout_schedule_sbt_curcpu(&pcpu->profc_cyclic,
308             pcpu->profc_expected, 0, C_DIRECT_EXEC | C_ABSOLUTE);
309 }
310
311 static void
312 profile_tick(void *arg)
313 {
314         profile_probe_t *prof = arg;
315
316         profile_probe(prof, 0);
317         prof->prof_expected += prof->prof_interval;
318         callout_schedule_sbt(&prof->prof_cyclic,
319             prof->prof_expected, 0, C_DIRECT_EXEC | C_ABSOLUTE);
320 }
321
322 static void
323 profile_create(hrtime_t interval, char *name, int kind)
324 {
325         profile_probe_t *prof;
326
327         if (interval < profile_interval_min)
328                 return;
329
330         if (dtrace_probe_lookup(profile_id, NULL, NULL, name) != 0)
331                 return;
332
333         atomic_add_32(&profile_total, 1);
334         if (profile_total > profile_max) {
335                 atomic_add_32(&profile_total, -1);
336                 return;
337         }
338
339         prof = kmem_zalloc(sizeof (profile_probe_t), KM_SLEEP);
340         (void) strcpy(prof->prof_name, name);
341 #ifdef illumos
342         prof->prof_interval = interval;
343         prof->prof_cyclic = CYCLIC_NONE;
344 #else
345         prof->prof_interval = nsec_to_sbt(interval);
346         callout_init(&prof->prof_cyclic, 1);
347 #endif
348         prof->prof_kind = kind;
349         prof->prof_id = dtrace_probe_create(profile_id,
350             NULL, NULL, name,
351             profile_aframes, prof);
352 }
353
354 /*ARGSUSED*/
355 static void
356 profile_provide(void *arg, dtrace_probedesc_t *desc)
357 {
358         int i, j, rate, kind;
359         hrtime_t val = 0, mult = 1, len = 0;
360         char *name, *suffix = NULL;
361
362         const struct {
363                 char *prefix;
364                 int kind;
365         } types[] = {
366                 { PROF_PREFIX_PROFILE, PROF_PROFILE },
367                 { PROF_PREFIX_TICK, PROF_TICK },
368                 { 0, 0 }
369         };
370
371         const struct {
372                 char *name;
373                 hrtime_t mult;
374         } suffixes[] = {
375                 { "ns",         NANOSEC / NANOSEC },
376                 { "nsec",       NANOSEC / NANOSEC },
377                 { "us",         NANOSEC / MICROSEC },
378                 { "usec",       NANOSEC / MICROSEC },
379                 { "ms",         NANOSEC / MILLISEC },
380                 { "msec",       NANOSEC / MILLISEC },
381                 { "s",          NANOSEC / SEC },
382                 { "sec",        NANOSEC / SEC },
383                 { "m",          NANOSEC * (hrtime_t)60 },
384                 { "min",        NANOSEC * (hrtime_t)60 },
385                 { "h",          NANOSEC * (hrtime_t)(60 * 60) },
386                 { "hour",       NANOSEC * (hrtime_t)(60 * 60) },
387                 { "d",          NANOSEC * (hrtime_t)(24 * 60 * 60) },
388                 { "day",        NANOSEC * (hrtime_t)(24 * 60 * 60) },
389                 { "hz",         0 },
390                 { NULL }
391         };
392
393         if (desc == NULL) {
394                 char n[PROF_NAMELEN];
395
396                 /*
397                  * If no description was provided, provide all of our probes.
398                  */
399                 for (i = 0; i < sizeof (profile_rates) / sizeof (int); i++) {
400                         if ((rate = profile_rates[i]) == 0)
401                                 continue;
402
403                         (void) snprintf(n, PROF_NAMELEN, "%s%d",
404                             PROF_PREFIX_PROFILE, rate);
405                         profile_create(NANOSEC / rate, n, PROF_PROFILE);
406                 }
407
408                 for (i = 0; i < sizeof (profile_ticks) / sizeof (int); i++) {
409                         if ((rate = profile_ticks[i]) == 0)
410                                 continue;
411
412                         (void) snprintf(n, PROF_NAMELEN, "%s%d",
413                             PROF_PREFIX_TICK, rate);
414                         profile_create(NANOSEC / rate, n, PROF_TICK);
415                 }
416
417                 return;
418         }
419
420         name = desc->dtpd_name;
421
422         for (i = 0; types[i].prefix != NULL; i++) {
423                 len = strlen(types[i].prefix);
424
425                 if (strncmp(name, types[i].prefix, len) != 0)
426                         continue;
427                 break;
428         }
429
430         if (types[i].prefix == NULL)
431                 return;
432
433         kind = types[i].kind;
434         j = strlen(name) - len;
435
436         /*
437          * We need to start before any time suffix.
438          */
439         for (j = strlen(name); j >= len; j--) {
440                 if (name[j] >= '0' && name[j] <= '9')
441                         break;
442                 suffix = &name[j];
443         }
444
445         ASSERT(suffix != NULL);
446
447         /*
448          * Now determine the numerical value present in the probe name.
449          */
450         for (; j >= len; j--) {
451                 if (name[j] < '0' || name[j] > '9')
452                         return;
453
454                 val += (name[j] - '0') * mult;
455                 mult *= (hrtime_t)10;
456         }
457
458         if (val == 0)
459                 return;
460
461         /*
462          * Look-up the suffix to determine the multiplier.
463          */
464         for (i = 0, mult = 0; suffixes[i].name != NULL; i++) {
465                 if (strcasecmp(suffixes[i].name, suffix) == 0) {
466                         mult = suffixes[i].mult;
467                         break;
468                 }
469         }
470
471         if (suffixes[i].name == NULL && *suffix != '\0')
472                 return;
473
474         if (mult == 0) {
475                 /*
476                  * The default is frequency-per-second.
477                  */
478                 val = NANOSEC / val;
479         } else {
480                 val *= mult;
481         }
482
483         profile_create(val, name, kind);
484 }
485
486 /* ARGSUSED */
487 static void
488 profile_destroy(void *arg, dtrace_id_t id, void *parg)
489 {
490         profile_probe_t *prof = parg;
491
492 #ifdef illumos
493         ASSERT(prof->prof_cyclic == CYCLIC_NONE);
494 #else
495         ASSERT(!callout_active(&prof->prof_cyclic) && prof->prof_pcpus == NULL);
496 #endif
497         kmem_free(prof, sizeof (profile_probe_t));
498
499         ASSERT(profile_total >= 1);
500         atomic_add_32(&profile_total, -1);
501 }
502
503 #ifdef illumos
504 /*ARGSUSED*/
505 static void
506 profile_online(void *arg, cpu_t *cpu, cyc_handler_t *hdlr, cyc_time_t *when)
507 {
508         profile_probe_t *prof = arg;
509         profile_probe_percpu_t *pcpu;
510
511         pcpu = kmem_zalloc(sizeof (profile_probe_percpu_t), KM_SLEEP);
512         pcpu->profc_probe = prof;
513
514         hdlr->cyh_func = profile_fire;
515         hdlr->cyh_arg = pcpu;
516
517         when->cyt_interval = prof->prof_interval;
518         when->cyt_when = gethrtime() + when->cyt_interval;
519
520         pcpu->profc_expected = when->cyt_when;
521         pcpu->profc_interval = when->cyt_interval;
522 }
523
524 /*ARGSUSED*/
525 static void
526 profile_offline(void *arg, cpu_t *cpu, void *oarg)
527 {
528         profile_probe_percpu_t *pcpu = oarg;
529
530         ASSERT(pcpu->profc_probe == arg);
531         kmem_free(pcpu, sizeof (profile_probe_percpu_t));
532 }
533
534 /* ARGSUSED */
535 static void
536 profile_enable(void *arg, dtrace_id_t id, void *parg)
537 {
538         profile_probe_t *prof = parg;
539         cyc_omni_handler_t omni;
540         cyc_handler_t hdlr;
541         cyc_time_t when;
542
543         ASSERT(prof->prof_interval != 0);
544         ASSERT(MUTEX_HELD(&cpu_lock));
545
546         if (prof->prof_kind == PROF_TICK) {
547                 hdlr.cyh_func = profile_tick;
548                 hdlr.cyh_arg = prof;
549
550                 when.cyt_interval = prof->prof_interval;
551                 when.cyt_when = gethrtime() + when.cyt_interval;
552         } else {
553                 ASSERT(prof->prof_kind == PROF_PROFILE);
554                 omni.cyo_online = profile_online;
555                 omni.cyo_offline = profile_offline;
556                 omni.cyo_arg = prof;
557         }
558
559         if (prof->prof_kind == PROF_TICK) {
560                 prof->prof_cyclic = cyclic_add(&hdlr, &when);
561         } else {
562                 prof->prof_cyclic = cyclic_add_omni(&omni);
563         }
564 }
565
566 /* ARGSUSED */
567 static void
568 profile_disable(void *arg, dtrace_id_t id, void *parg)
569 {
570         profile_probe_t *prof = parg;
571
572         ASSERT(prof->prof_cyclic != CYCLIC_NONE);
573         ASSERT(MUTEX_HELD(&cpu_lock));
574
575         cyclic_remove(prof->prof_cyclic);
576         prof->prof_cyclic = CYCLIC_NONE;
577 }
578
579 #else
580
581 static void
582 profile_enable_omni(profile_probe_t *prof)
583 {
584         profile_probe_percpu_t *pcpu;
585         int cpu;
586
587         prof->prof_pcpus = kmem_zalloc((mp_maxid + 1) * sizeof(pcpu), KM_SLEEP);
588         CPU_FOREACH(cpu) {
589                 pcpu = kmem_zalloc(sizeof(profile_probe_percpu_t), KM_SLEEP);
590                 prof->prof_pcpus[cpu] = pcpu;
591                 pcpu->profc_probe = prof;
592                 pcpu->profc_expected = sbinuptime() + prof->prof_interval;
593                 pcpu->profc_interval = prof->prof_interval;
594                 callout_init(&pcpu->profc_cyclic, 1);
595                 callout_reset_sbt_on(&pcpu->profc_cyclic,
596                     pcpu->profc_expected, 0, profile_fire, pcpu,
597                     cpu, C_DIRECT_EXEC | C_ABSOLUTE);
598         }
599 }
600
601 static void
602 profile_disable_omni(profile_probe_t *prof)
603 {
604         profile_probe_percpu_t *pcpu;
605         int cpu;
606
607         ASSERT(prof->prof_pcpus != NULL);
608         CPU_FOREACH(cpu) {
609                 pcpu = prof->prof_pcpus[cpu];
610                 ASSERT(pcpu->profc_probe == prof);
611                 ASSERT(callout_active(&pcpu->profc_cyclic));
612                 callout_stop(&pcpu->profc_cyclic);
613                 callout_drain(&pcpu->profc_cyclic);
614                 kmem_free(pcpu, sizeof(profile_probe_percpu_t));
615         }
616         kmem_free(prof->prof_pcpus, (mp_maxid + 1) * sizeof(pcpu));
617         prof->prof_pcpus = NULL;
618 }
619
620 /* ARGSUSED */
621 static void
622 profile_enable(void *arg, dtrace_id_t id, void *parg)
623 {
624         profile_probe_t *prof = parg;
625
626         if (prof->prof_kind == PROF_TICK) {
627                 prof->prof_expected = sbinuptime() + prof->prof_interval;
628                 callout_reset_sbt(&prof->prof_cyclic,
629                     prof->prof_expected, 0, profile_tick, prof,
630                     C_DIRECT_EXEC | C_ABSOLUTE);
631         } else {
632                 ASSERT(prof->prof_kind == PROF_PROFILE);
633                 profile_enable_omni(prof);
634         }
635 }
636
637 /* ARGSUSED */
638 static void
639 profile_disable(void *arg, dtrace_id_t id, void *parg)
640 {
641         profile_probe_t *prof = parg;
642
643         if (prof->prof_kind == PROF_TICK) {
644                 ASSERT(callout_active(&prof->prof_cyclic));
645                 callout_stop(&prof->prof_cyclic);
646                 callout_drain(&prof->prof_cyclic);
647         } else {
648                 ASSERT(prof->prof_kind == PROF_PROFILE);
649                 profile_disable_omni(prof);
650         }
651 }
652 #endif
653
654 static void
655 profile_load(void *dummy)
656 {
657         /* Create the /dev/dtrace/profile entry. */
658         profile_cdev = make_dev(&profile_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600,
659             "dtrace/profile");
660
661         if (dtrace_register("profile", &profile_attr, DTRACE_PRIV_USER,
662             NULL, &profile_pops, NULL, &profile_id) != 0)
663                 return;
664 }
665
666
667 static int
668 profile_unload()
669 {
670         int error = 0;
671
672         if ((error = dtrace_unregister(profile_id)) != 0)
673                 return (error);
674
675         destroy_dev(profile_cdev);
676
677         return (error);
678 }
679
680 /* ARGSUSED */
681 static int
682 profile_modevent(module_t mod __unused, int type, void *data __unused)
683 {
684         int error = 0;
685
686         switch (type) {
687         case MOD_LOAD:
688                 break;
689
690         case MOD_UNLOAD:
691                 break;
692
693         case MOD_SHUTDOWN:
694                 break;
695
696         default:
697                 error = EOPNOTSUPP;
698                 break;
699
700         }
701         return (error);
702 }
703
704 /* ARGSUSED */
705 static int
706 profile_open(struct cdev *dev __unused, int oflags __unused, int devtype __unused, struct thread *td __unused)
707 {
708         return (0);
709 }
710
711 SYSINIT(profile_load, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, profile_load, NULL);
712 SYSUNINIT(profile_unload, SI_SUB_DTRACE_PROVIDER, SI_ORDER_ANY, profile_unload, NULL);
713
714 DEV_MODULE(profile, profile_modevent, NULL);
715 MODULE_VERSION(profile, 1);
716 MODULE_DEPEND(profile, dtrace, 1, 1, 1);
717 MODULE_DEPEND(profile, opensolaris, 1, 1, 1);