Lines Matching defs:provider

54  * The fasttrap provider allows DTrace consumers to instrument any user-level
103 * framework -- is a little tricky and bears some explanation. Each provider
106 * (ftp_ccount) and USDT consumers (ftp_mcount); all three prevent a provider
107 * from being freed. A provider is looked up by taking the bucket lock for the
108 * provider hash table, and is returned with its lock held. The provider lock
114 * not be taken when holding the provider lock as that would create a cyclic
115 * lock ordering. In situations where one would naturally take the provider
117 * the provider from disappearing, drop the provider lock, and acquire the
121 * bucket lock before provider lock
122 * DTrace before provider lock
124 * never hold the provider lock and creation lock simultaneously
140 * When the fasttrap provider is loaded, fasttrap_max is set to either
291 * ones. If a provider is marked but not retired, we just
309 * If this provider has consumers actively
311 * provider (ftp_mcount), we can't unregister
328 * provider we can remove it from the hash
331 * provider, increment our flag to try again
357 * If we were unable to remove a retired provider, try again after
443 * exit, and removal of a meta provider so it
459 * is set on the proc structure to indicate that there is a pid provider
471 * We clean up the pid provider for this process here; user-land
472 * static probes are handled by the meta-provider remove entry point.
531 * provider (this one) will still be around throughout this
666 fasttrap_provider_t *provider = probe->ftp_prov;
688 tp->ftt_proc == provider->ftp_proc)
781 * live or we hold the provider lock on the process if it's dead and
891 * Increment the count of enabled probes on this probe's provider;
892 * the provider can't go away while the probe still exists. We
901 * If this probe's provider is retired (meaning it was valid in a
903 * provider can't go away while we're in this code path.
993 fasttrap_provider_t *provider = probe->ftp_prov;
1002 * provider lock as a point of mutual exclusion to prevent other
1010 mutex_enter(&provider->ftp_mtx);
1021 ASSERT(provider->ftp_rcount > 0);
1022 provider->ftp_rcount--;
1027 * mark this retired provider to get a chance to remove some
1030 if (provider->ftp_retired && !provider->ftp_marked)
1031 whack = provider->ftp_marked = 1;
1032 mutex_exit(&provider->ftp_mtx);
1041 if (provider->ftp_rcount == 0 && !provider->ftp_marked)
1042 whack = provider->ftp_marked = 1;
1043 mutex_exit(&provider->ftp_mtx);
1271 * Lookup a fasttrap-managed provider based on its name and associated pid.
1272 * If the pattr argument is non-NULL, this function instantiates the provider
1273 * if it doesn't exist otherwise it returns NULL. The provider is returned
1329 * when we're done with this provider.
1352 * Take another lap through the list to make sure a provider hasn't
1369 * Fail and return NULL if either the provider name is too long
1370 * or we fail to register this new provider with the DTrace
1372 * the full provider name -- we keep it in pieces in the provider
1398 fasttrap_provider_free(fasttrap_provider_t *provider)
1400 pid_t pid = provider->ftp_pid;
1405 * creating probes, and no meta providers referencing this provider.
1407 ASSERT(provider->ftp_rcount == 0);
1408 ASSERT(provider->ftp_ccount == 0);
1409 ASSERT(provider->ftp_mcount == 0);
1412 * If this provider hasn't been retired, we need to explicitly drop the
1415 if (!provider->ftp_retired) {
1416 atomic_add_64(&provider->ftp_proc->ftpc_acount, -1);
1417 ASSERT(provider->ftp_proc->ftpc_acount <
1418 provider->ftp_proc->ftpc_rcount);
1421 fasttrap_proc_release(provider->ftp_proc);
1423 kmem_free(provider, sizeof (fasttrap_provider_t));
1426 * Decrement p_dtrace_probes on the process whose provider we're
1429 * corresponds to this process's hash chain in the provider hash
1477 * Mark the provider to be removed in our post-processing step, mark it
1480 * that we're done with this provider; dropping the active the proc
1484 * We obviously need to take the bucket lock before the provider lock
1485 * to perform the lookup, but we need to drop the provider lock
1487 * provider lock in callbacks invoked from the DTrace framework. The
1488 * bucket lock therefore protects the integrity of the provider hash
1500 * We don't have to worry about invalidating the same provider twice
1501 * since fasttrap_provider_lookup() will ignore provider that have
1526 fasttrap_provider_t *provider;
1554 if ((provider = fasttrap_provider_lookup(pdata->ftps_pid,
1560 * actively adding a new probe associated with this provider. This
1561 * prevents the provider from being deleted -- we'll need to check
1564 provider->ftp_ccount++;
1565 mutex_exit(&provider->ftp_mtx);
1570 * other threads creating probes. We must drop the provider lock
1574 mutex_enter(&provider->ftp_cmtx);
1583 if (dtrace_probe_lookup(provider->ftp_provid,
1596 pp->ftp_prov = provider;
1605 tp->ftt_proc = provider->ftp_proc;
1613 pp->ftp_id = dtrace_probe_create(provider->ftp_provid,
1618 } else if (dtrace_probe_lookup(provider->ftp_provid, pdata->ftps_mod,
1646 pp->ftp_prov = provider;
1656 tp->ftt_proc = provider->ftp_proc;
1665 pp->ftp_id = dtrace_probe_create(provider->ftp_provid,
1669 mutex_exit(&provider->ftp_cmtx);
1672 * We know that the provider is still valid since we incremented the
1673 * creation reference count. If someone tried to clean up this provider
1677 mutex_enter(&provider->ftp_mtx);
1678 provider->ftp_ccount--;
1679 whack = provider->ftp_retired;
1680 mutex_exit(&provider->ftp_mtx);
1690 * this provider to free some up. This is to cover the case where
1694 mutex_exit(&provider->ftp_cmtx);
1695 mutex_enter(&provider->ftp_mtx);
1696 provider->ftp_ccount--;
1697 provider->ftp_marked = 1;
1698 mutex_exit(&provider->ftp_mtx);
1709 fasttrap_provider_t *provider;
1714 * have enough space for the provider name.
1717 sizeof (provider->ftp_name)) {
1718 cmn_err(CE_WARN, "failed to instantiate provider %s: "
1724 * Don't let folks spoof the true pid provider.
1727 cmn_err(CE_WARN, "failed to instantiate provider %s: "
1735 * the stability of the new provider accordingly.
1748 if ((provider = fasttrap_provider_lookup(pid, dhpv->dthpv_provname,
1750 cmn_err(CE_WARN, "failed to instantiate provider %s for "
1756 * Up the meta provider count so this provider isn't removed until
1757 * the meta provider has been told to remove it.
1759 provider->ftp_mcount++;
1761 mutex_exit(&provider->ftp_mtx);
1763 return (provider);
1771 fasttrap_provider_t *provider = parg;
1778 * Since the meta provider count is non-zero we don't have to worry
1779 * about this provider disappearing.
1781 ASSERT(provider->ftp_mcount > 0);
1807 mutex_enter(&provider->ftp_cmtx);
1809 if (dtrace_probe_lookup(provider->ftp_provid, dhpb->dthpb_mod,
1811 mutex_exit(&provider->ftp_cmtx);
1822 mutex_exit(&provider->ftp_cmtx);
1828 pp->ftp_prov = provider;
1829 pp->ftp_pid = provider->ftp_pid;
1841 tp->ftt_proc = provider->ftp_proc;
1843 tp->ftt_pid = provider->ftp_pid;
1860 tp->ftt_proc = provider->ftp_proc;
1862 tp->ftt_pid = provider->ftp_pid;
1884 pp->ftp_id = dtrace_probe_create(provider->ftp_provid, dhpb->dthpb_mod,
1887 mutex_exit(&provider->ftp_cmtx);
1895 * Clean up the USDT provider. There may be active consumers of the
1896 * provider busy adding probes, no damage will actually befall the
1897 * provider until that count has dropped to zero. This just puts
1898 * the provider on death row.
2208 * Unregister the meta-provider to make sure no new fasttrap-
2211 * meta-provider. We can fail to unregister as a meta-provider
2253 * this provider. A thread must first acquire the
2255 * blocking on the provider's lock.