Lines Matching refs:probe

100  * of tracepoints to enable. If a probe is activated, it adds its ID to
154 * fasttrap.conf file. Each time a probe is created, fasttrap_total is
156 * probe; fasttrap_total is capped at fasttrap_max.
592 fasttrap_tracepoint_enable(proc_t *p, fasttrap_probe_t *probe, uint_t index)
600 ASSERT(index < probe->ftp_ntps);
602 pid = probe->ftp_pid;
603 pc = probe->ftp_tps[index].fit_tp->ftt_pc;
604 id = &probe->ftp_tps[index].fit_id;
606 ASSERT(probe->ftp_tps[index].fit_tp->ftt_pid == pid);
612 * on the generation in which this probe was last modified.
614 fasttrap_mod_barrier(probe->ftp_gen);
648 * This can't be the first interested probe. We don't have
723 * Initialize the tracepoint that's been preallocated with the probe.
725 new_tp = probe->ftp_tps[index].fit_tp;
729 ASSERT(new_tp->ftt_proc == probe->ftp_prov->ftp_proc);
765 fasttrap_tracepoint_disable(proc_t *p, fasttrap_probe_t *probe, uint_t index)
768 fasttrap_provider_t *provider = probe->ftp_prov;
774 ASSERT(index < probe->ftp_ntps);
776 pid = probe->ftp_pid;
777 pc = probe->ftp_tps[index].fit_tp->ftt_pc;
778 id = &probe->ftp_tps[index].fit_id;
780 ASSERT(probe->ftp_tps[index].fit_tp->ftt_pid == pid);
819 while ((*idp)->fti_probe != probe) {
828 ASSERT(id->fti_probe == probe);
832 * all done, but if this was the last probe assocated with this
838 * If the current probe's tracepoint is in use, swap it
841 if (tp == probe->ftp_tps[index].fit_tp) {
859 ASSERT(*tmp_tp != probe->ftp_tps[index].fit_tp);
863 probe->ftp_tps[index].fit_tp = *tmp_tp;
871 * Tag the modified probe with the generation in which it was
874 probe->ftp_gen = fasttrap_mod_gen;
912 * Remove the probe from the hash table of active tracepoints.
928 * Tag the modified probe with the generation in which it was changed.
930 probe->ftp_gen = fasttrap_mod_gen;
971 * on CPU B. A probe fires on A, and is allowed to enter. BOOM!
994 fasttrap_probe_t *probe = parg;
998 ASSERT(probe != NULL);
999 ASSERT(!probe->ftp_enabled);
1000 ASSERT(id == probe->ftp_id);
1004 * Increment the count of enabled probes on this probe's provider;
1005 * the provider can't go away while the probe still exists. We
1007 * this probe.
1009 lck_mtx_lock(&probe->ftp_prov->ftp_mtx);
1010 probe->ftp_prov->ftp_rcount++;
1011 lck_mtx_unlock(&probe->ftp_prov->ftp_mtx);
1014 * If this probe's provider is retired (meaning it was valid in a
1018 if (probe->ftp_prov->ftp_retired)
1026 if ((p = sprlock(probe->ftp_pid)) == PROC_NULL) {
1040 p = prfind(probe->ftp_pid);
1061 * time a probe has been enabled in this process, we need to allocate scratch
1080 * Enable all the tracepoints and add this probe's id to each
1083 for (i = 0; i < (int)probe->ftp_ntps; i++) {
1084 if ((rc = fasttrap_tracepoint_enable(p, probe, i)) != 0) {
1097 * created so far for this probe.
1100 fasttrap_tracepoint_disable(p, probe, i);
1108 * Since we're not actually enabling this probe,
1119 probe->ftp_enabled = 1;
1128 fasttrap_probe_t *probe = parg;
1129 fasttrap_provider_t *provider = probe->ftp_prov;
1133 ASSERT(id == probe->ftp_id);
1139 * DTrace consumers from disabling this probe.
1141 if ((p = sprlock(probe->ftp_pid)) != PROC_NULL) {
1151 if (probe->ftp_enabled) {
1152 for (i = 0; i < (int)probe->ftp_ntps; i++) {
1153 fasttrap_tracepoint_disable(p, probe, i);
1175 * last probe to be disabled to be able to free it.
1185 if (!probe->ftp_enabled)
1188 probe->ftp_enabled = 0;
1200 fasttrap_probe_t *probe = parg;
1207 if (probe->ftp_prov->ftp_retired != 0 ||
1208 desc->dtargd_ndx >= probe->ftp_nargs) {
1213 ndx = (probe->ftp_argmap != NULL) ?
1214 probe->ftp_argmap[desc->dtargd_ndx] : desc->dtargd_ndx;
1216 str = probe->ftp_ntypes;
1223 if (probe->ftp_xtypes == NULL)
1226 str = probe->ftp_xtypes;
1239 fasttrap_probe_t *probe = parg;
1242 ASSERT(probe != NULL);
1243 ASSERT(!probe->ftp_enabled);
1244 ASSERT(fasttrap_total >= probe->ftp_ntps);
1246 atomic_add_32(&fasttrap_total, -probe->ftp_ntps);
1248 size_t size = offsetof(fasttrap_probe_t, ftp_tps[probe->ftp_ntps]);
1251 if (probe->ftp_gen + 1 >= fasttrap_mod_gen)
1252 fasttrap_mod_barrier(probe->ftp_gen);
1254 for (i = 0; i < probe->ftp_ntps; i++) {
1256 kmem_free(probe->ftp_tps[i].fit_tp, sizeof (fasttrap_tracepoint_t));
1258 zfree(fasttrap_tracepoint_t_zone, probe->ftp_tps[i].fit_tp);
1263 kmem_free(probe, size);
1265 if (probe->ftp_ntps < FASTTRAP_PROBE_T_ZONE_MAX_TRACEPOINTS) {
1266 zfree(fasttrap_probe_t_zones[probe->ftp_ntps], probe);
1268 size_t size = offsetof(fasttrap_probe_t, ftp_tps[probe->ftp_ntps]);
1269 kmem_free(probe, size);
1776 * actively adding a new probe associated with this provider. This
1857 * We later assume that each probe has exactly one tracepoint
2025 * each static probe being created. We want to get rid of that check.
2216 * table. Later, when the probe fires, we only remap the arguments
2227 * The probe is fully constructed -- register it with DTrace.
2264 fasttrap_probe_spec_t *probe;
2271 sizeof (probe->ftps_noffs)))
2284 if (noffs > ((1024 * 1024) - sizeof(fasttrap_probe_spec_t)) / sizeof(probe->ftps_offs[0]))
2288 sizeof (probe->ftps_offs[0]) * (noffs - 1);
2290 probe = kmem_alloc(size, KM_SLEEP);
2292 if (copyin(arg, probe, size) != 0 ||
2293 probe->ftps_noffs != noffs) {
2294 kmem_free(probe, size);
2302 for (i = 0, c = &probe->ftps_func[0]; i < sizeof(probe->ftps_func) && *c != '\0'; i++, c++) {
2313 for (i = 0, c = &probe->ftps_mod[0]; i < sizeof(probe->ftps_mod) && *c != '\0'; i++, c++) {
2326 pid_t pid = probe->ftps_pid;
2348 ret = fasttrap_add_probe(probe);
2351 kmem_free(probe, size);