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 /* 22 * Copyright 2007 Sun Microsystems, Inc. All rights reserved. 23 * Use is subject to license terms. 24 */ 25 26 #pragma ident "%Z%%M% %I% %E% SMI" 27 28 #include <sys/sdt_impl.h> 29 30 static dtrace_pattr_t vtrace_attr = { 31 { DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_ISA }, 32 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 33 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 34 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 35 { DTRACE_STABILITY_UNSTABLE, DTRACE_STABILITY_UNSTABLE, DTRACE_CLASS_ISA }, 36 }; 37 38 static dtrace_pattr_t info_attr = { 39 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 40 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 41 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 42 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 43 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 44 }; 45 46 static dtrace_pattr_t fpu_attr = { 47 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 48 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 49 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 50 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_CPU }, 51 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 52 }; 53 54 static dtrace_pattr_t fsinfo_attr = { 55 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 56 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 57 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 58 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 59 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 60 }; 61 62 static dtrace_pattr_t stab_attr = { 63 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 64 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 65 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 66 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 67 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 68 }; 69 70 static dtrace_pattr_t sdt_attr = { 71 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_ISA }, 72 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 73 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 74 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 75 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_ISA }, 76 }; 77 78 static dtrace_pattr_t xpv_attr = { 79 { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_PLATFORM }, 80 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 81 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, 82 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_PLATFORM }, 83 { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_PLATFORM }, 84 }; 85 86 sdt_provider_t sdt_providers[] = { 87 { "vtrace", "__vtrace_", &vtrace_attr, 0 }, 88 { "sysinfo", "__cpu_sysinfo_", &info_attr, 0 }, 89 { "vminfo", "__cpu_vminfo_", &info_attr, 0 }, 90 { "fpuinfo", "__fpuinfo_", &fpu_attr, 0 }, 91 { "sched", "__sched_", &stab_attr, 0 }, 92 { "proc", "__proc_", &stab_attr, 0 }, 93 { "io", "__io_", &stab_attr, 0 }, 94 { "mib", "__mib_", &stab_attr, 0 }, 95 { "fsinfo", "__fsinfo_", &fsinfo_attr, 0 }, 96 { "xpv", "__xpv_", &xpv_attr, 0 }, 97 { "sysevent", "__sysevent_", &stab_attr, 0 }, 98 { "sdt", NULL, &sdt_attr, 0 }, 99 { NULL } 100 }; 101 102 sdt_argdesc_t sdt_args[] = { 103 { "sched", "wakeup", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 104 { "sched", "wakeup", 1, 0, "kthread_t *", "psinfo_t *" }, 105 { "sched", "dequeue", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 106 { "sched", "dequeue", 1, 0, "kthread_t *", "psinfo_t *" }, 107 { "sched", "dequeue", 2, 1, "disp_t *", "cpuinfo_t *" }, 108 { "sched", "enqueue", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 109 { "sched", "enqueue", 1, 0, "kthread_t *", "psinfo_t *" }, 110 { "sched", "enqueue", 2, 1, "disp_t *", "cpuinfo_t *" }, 111 { "sched", "enqueue", 3, 2, "int" }, 112 { "sched", "off-cpu", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 113 { "sched", "off-cpu", 1, 0, "kthread_t *", "psinfo_t *" }, 114 { "sched", "tick", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 115 { "sched", "tick", 1, 0, "kthread_t *", "psinfo_t *" }, 116 { "sched", "change-pri", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 117 { "sched", "change-pri", 1, 0, "kthread_t *", "psinfo_t *" }, 118 { "sched", "change-pri", 2, 1, "pri_t" }, 119 { "sched", "schedctl-nopreempt", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 120 { "sched", "schedctl-nopreempt", 1, 0, "kthread_t *", "psinfo_t *" }, 121 { "sched", "schedctl-nopreempt", 2, 1, "int" }, 122 { "sched", "schedctl-preempt", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 123 { "sched", "schedctl-preempt", 1, 0, "kthread_t *", "psinfo_t *" }, 124 { "sched", "schedctl-yield", 0, 0, "int" }, 125 { "sched", "surrender", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 126 { "sched", "surrender", 1, 0, "kthread_t *", "psinfo_t *" }, 127 { "sched", "cpucaps-sleep", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 128 { "sched", "cpucaps-sleep", 1, 0, "kthread_t *", "psinfo_t *" }, 129 { "sched", "cpucaps-wakeup", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 130 { "sched", "cpucaps-wakeup", 1, 0, "kthread_t *", "psinfo_t *" }, 131 { "proc", "create", 0, 0, "proc_t *", "psinfo_t *" }, 132 { "proc", "exec", 0, 0, "string" }, 133 { "proc", "exec-failure", 0, 0, "int" }, 134 { "proc", "exit", 0, 0, "int" }, 135 { "proc", "fault", 0, 0, "int" }, 136 { "proc", "fault", 1, 1, "siginfo_t *" }, 137 { "proc", "lwp-create", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 138 { "proc", "lwp-create", 1, 0, "kthread_t *", "psinfo_t *" }, 139 { "proc", "signal-clear", 0, 0, "int" }, 140 { "proc", "signal-clear", 1, 1, "siginfo_t *" }, 141 { "proc", "signal-discard", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 142 { "proc", "signal-discard", 1, 1, "proc_t *", "psinfo_t *" }, 143 { "proc", "signal-discard", 2, 2, "int" }, 144 { "proc", "signal-handle", 0, 0, "int" }, 145 { "proc", "signal-handle", 1, 1, "siginfo_t *" }, 146 { "proc", "signal-handle", 2, 2, "void (*)(void)" }, 147 { "proc", "signal-send", 0, 0, "kthread_t *", "lwpsinfo_t *" }, 148 { "proc", "signal-send", 1, 0, "kthread_t *", "psinfo_t *" }, 149 { "proc", "signal-send", 2, 1, "int" }, 150 { "io", "start", 0, 0, "buf_t *", "bufinfo_t *" }, 151 { "io", "start", 1, 0, "buf_t *", "devinfo_t *" }, 152 { "io", "start", 2, 0, "buf_t *", "fileinfo_t *" }, 153 { "io", "done", 0, 0, "buf_t *", "bufinfo_t *" }, 154 { "io", "done", 1, 0, "buf_t *", "devinfo_t *" }, 155 { "io", "done", 2, 0, "buf_t *", "fileinfo_t *" }, 156 { "io", "wait-start", 0, 0, "buf_t *", "bufinfo_t *" }, 157 { "io", "wait-start", 1, 0, "buf_t *", "devinfo_t *" }, 158 { "io", "wait-start", 2, 0, "buf_t *", "fileinfo_t *" }, 159 { "io", "wait-done", 0, 0, "buf_t *", "bufinfo_t *" }, 160 { "io", "wait-done", 1, 0, "buf_t *", "devinfo_t *" }, 161 { "io", "wait-done", 2, 0, "buf_t *", "fileinfo_t *" }, 162 { "mib", NULL, 0, 0, "int" }, 163 { "fsinfo", NULL, 0, 0, "vnode_t *", "fileinfo_t *" }, 164 { "fsinfo", NULL, 1, 1, "int", "int" }, 165 { "sysevent", "post", 0, 0, "evch_bind_t *", "syseventchaninfo_t *" }, 166 { "sysevent", "post", 1, 1, "sysevent_impl_t *", "syseventinfo_t *" }, 167 { "xpv", "add-to-physmap-end", 0, 0, "int" }, 168 { "xpv", "add-to-physmap-start", 0, 0, "domid_t" }, 169 { "xpv", "add-to-physmap-start", 1, 1, "uint_t" }, 170 { "xpv", "add-to-physmap-start", 2, 2, "ulong_t" }, 171 { "xpv", "add-to-physmap-start", 3, 3, "ulong_t" }, 172 { "xpv", "decrease-reservation-end", 0, 0, "int" }, 173 { "xpv", "decrease-reservation-start", 0, 0, "domid_t" }, 174 { "xpv", "decrease-reservation-start", 1, 1, "ulong_t" }, 175 { "xpv", "decrease-reservation-start", 2, 2, "uint_t" }, 176 { "xpv", "decrease-reservation-start", 3, 3, "ulong_t *" }, 177 { "xpv", "dom-create-start", 0, 0, "xen_domctl_t *" }, 178 { "xpv", "dom-destroy-start", 0, 0, "domid_t" }, 179 { "xpv", "dom-pause-start", 0, 0, "domid_t" }, 180 { "xpv", "dom-unpause-start", 0, 0, "domid_t" }, 181 { "xpv", "dom-create-end", 0, 0, "int" }, 182 { "xpv", "dom-destroy-end", 0, 0, "int" }, 183 { "xpv", "dom-pause-end", 0, 0, "int" }, 184 { "xpv", "dom-unpause-end", 0, 0, "int" }, 185 { "xpv", "evtchn-op-end", 0, 0, "int" }, 186 { "xpv", "evtchn-op-start", 0, 0, "int" }, 187 { "xpv", "evtchn-op-start", 1, 1, "void *" }, 188 { "xpv", "increase-reservation-end", 0, 0, "int" }, 189 { "xpv", "increase-reservation-start", 0, 0, "domid_t" }, 190 { "xpv", "increase-reservation-start", 1, 1, "ulong_t" }, 191 { "xpv", "increase-reservation-start", 2, 2, "uint_t" }, 192 { "xpv", "increase-reservation-start", 3, 3, "ulong_t *" }, 193 { "xpv", "mmap-end", 0, 0, "int" }, 194 { "xpv", "mmap-entry", 0, 0, "ulong_t" }, 195 { "xpv", "mmap-entry", 1, 1, "ulong_t" }, 196 { "xpv", "mmap-entry", 2, 2, "ulong_t" }, 197 { "xpv", "mmap-start", 0, 0, "domid_t" }, 198 { "xpv", "mmap-start", 1, 1, "int" }, 199 { "xpv", "mmap-start", 2, 2, "privcmd_mmap_entry_t *" }, 200 { "xpv", "mmapbatch-end", 0, 0, "int" }, 201 { "xpv", "mmapbatch-end", 1, 1, "struct seg *" }, 202 { "xpv", "mmapbatch-end", 2, 2, "caddr_t" }, 203 { "xpv", "mmapbatch-start", 0, 0, "domid_t" }, 204 { "xpv", "mmapbatch-start", 1, 1, "int" }, 205 { "xpv", "mmapbatch-start", 2, 2, "caddr_t" }, 206 { "xpv", "mmu-ext-op-end", 0, 0, "int" }, 207 { "xpv", "mmu-ext-op-start", 0, 0, "int" }, 208 { "xpv", "mmu-ext-op-start", 1, 1, "struct mmuext_op *" }, 209 { "xpv", "mmu-update-start", 0, 0, "int" }, 210 { "xpv", "mmu-update-start", 1, 1, "int" }, 211 { "xpv", "mmu-update-start", 2, 2, "mmu_update_t *" }, 212 { "xpv", "mmu-update-end", 0, 0, "int" }, 213 { "xpv", "populate-physmap-end", 0, 0, "int" }, 214 { "xpv", "populate-physmap-start", 0, 0, "domid_t" }, 215 { "xpv", "populate-physmap-start", 1, 1, "ulong_t" }, 216 { "xpv", "populate-physmap-start", 2, 2, "ulong_t *" }, 217 { "xpv", "set-memory-map-end", 0, 0, "int" }, 218 { "xpv", "set-memory-map-start", 0, 0, "domid_t" }, 219 { "xpv", "set-memory-map-start", 1, 1, "int" }, 220 { "xpv", "set-memory-map-start", 2, 2, "struct xen_memory_map *" }, 221 { "xpv", "setvcpucontext-end", 0, 0, "int" }, 222 { "xpv", "setvcpucontext-start", 0, 0, "domid_t" }, 223 { "xpv", "setvcpucontext-start", 1, 1, "vcpu_guest_context_t *" }, 224 { NULL } 225 }; 226 227 /*ARGSUSED*/ 228 void 229 sdt_getargdesc(void *arg, dtrace_id_t id, void *parg, dtrace_argdesc_t *desc) 230 { 231 sdt_probe_t *sdp = parg; 232 int i; 233 234 desc->dtargd_native[0] = '\0'; 235 desc->dtargd_xlate[0] = '\0'; 236 237 for (i = 0; sdt_args[i].sda_provider != NULL; i++) { 238 sdt_argdesc_t *a = &sdt_args[i]; 239 240 if (strcmp(sdp->sdp_provider->sdtp_name, a->sda_provider) != 0) 241 continue; 242 243 if (a->sda_name != NULL && 244 strcmp(sdp->sdp_name, a->sda_name) != 0) 245 continue; 246 247 if (desc->dtargd_ndx != a->sda_ndx) 248 continue; 249 250 if (a->sda_native != NULL) 251 (void) strcpy(desc->dtargd_native, a->sda_native); 252 253 if (a->sda_xlate != NULL) 254 (void) strcpy(desc->dtargd_xlate, a->sda_xlate); 255 256 desc->dtargd_mapping = a->sda_mapping; 257 return; 258 } 259 260 desc->dtargd_ndx = DTRACE_ARGNONE; 261 } 262