Lines Matching defs:provider
60 * The fasttrap provider allows DTrace consumers to instrument any user-level
109 * framework -- is a little tricky and bears some explanation. Each provider
112 * (ftp_ccount) and USDT consumers (ftp_mcount); all three prevent a provider
113 * from being freed. A provider is looked up by taking the bucket lock for the
114 * provider hash table, and is returned with its lock held. The provider lock
120 * not be taken when holding the provider lock as that would create a cyclic
121 * lock ordering. In situations where one would naturally take the provider
123 * the provider from disappearing, drop the provider lock, and acquire the
127 * bucket lock before provider lock
128 * DTrace before provider lock
130 * never hold the provider lock and creation lock simultaneously
147 * When the fasttrap provider is loaded, fasttrap_max is set to either
345 * ones. If a provider is marked but not retired, we just
363 * If this provider has consumers actively
365 * provider (ftp_mcount), we can't unregister
382 * provider we can remove it from the hash
385 * provider, increment our flag to try again
417 * If we were unable to remove a retired provider, try again after
517 * is set on the proc structure to indicate that there is a pid provider
541 * We clean up the pid provider for this process here; user-land
542 * static probes are handled by the meta-provider remove entry point.
548 * XXX optimization: track which provider types are instantiated
748 fasttrap_provider_t *provider = probe->ftp_prov;
770 tp->ftt_proc == provider->ftp_proc)
864 * live or we hold the provider lock on the process if it's dead and
982 * Increment the count of enabled probes on this probe's provider;
983 * the provider can't go away while the probe still exists. We
992 * If this probe's provider is retired (meaning it was valid in a
994 * provider can't go away while we're in this code path.
1037 * Solaris uses its ulwp_t struct for scratch space to support the pid provider.
1106 fasttrap_provider_t *provider = probe->ftp_prov;
1115 * provider lock as a point of mutual exclusion to prevent other
1123 lck_mtx_lock(&provider->ftp_mtx);
1134 ASSERT(provider->ftp_rcount > 0);
1135 provider->ftp_rcount--;
1140 * mark this retired provider to get a chance to remove some
1143 if (provider->ftp_retired && !provider->ftp_marked)
1144 whack = provider->ftp_marked = 1;
1145 lck_mtx_unlock(&provider->ftp_mtx);
1154 if (provider->ftp_rcount == 0 && !provider->ftp_marked)
1155 whack = provider->ftp_marked = 1;
1156 lck_mtx_unlock(&provider->ftp_mtx);
1404 * Lookup a fasttrap-managed provider based on its name and associated pid.
1405 * If the pattr argument is non-NULL, this function instantiates the provider
1406 * if it doesn't exist otherwise it returns NULL. The provider is returned
1466 * when we're done with this provider.
1509 * Take another lap through the list to make sure a provider hasn't
1526 * Fail and return NULL if either the provider name is too long
1527 * or we fail to register this new provider with the DTrace
1529 * the full provider name -- we keep it in pieces in the provider
1555 fasttrap_provider_free(fasttrap_provider_t *provider)
1557 pid_t pid = provider->ftp_pid;
1562 * creating probes, and no meta providers referencing this provider.
1564 ASSERT(provider->ftp_rcount == 0);
1565 ASSERT(provider->ftp_ccount == 0);
1566 ASSERT(provider->ftp_mcount == 0);
1568 fasttrap_proc_release(provider->ftp_proc);
1575 lck_mtx_destroy(&provider->ftp_mtx, fasttrap_lck_grp);
1576 lck_mtx_destroy(&provider->ftp_cmtx, fasttrap_lck_grp);
1579 kmem_free(provider, sizeof (fasttrap_provider_t));
1582 * Decrement p_dtrace_probes on the process whose provider we're
1585 * corresponds to this process's hash chain in the provider hash
1631 * Mark the provider to be removed in our post-processing step,
1633 * already be marked defunct by another provider that shares the
1636 * provider; setting the proc to be defunct indicates that all
1639 * We obviously need to take the bucket lock before the provider lock
1640 * to perform the lookup, but we need to drop the provider lock
1642 * provider lock in callbacks invoked from the DTrace framework. The
1643 * bucket lock therefore protects the integrity of the provider hash
1653 * We don't have to worry about invalidating the same provider twice
1654 * since fasttrap_provider_lookup() will ignore provider that have
1667 fasttrap_provider_t *provider;
1708 if ((provider = fasttrap_provider_lookup(pdata->ftps_pid, pdata->ftps_provider_type,
1715 * actively adding a new probe associated with this provider. This
1716 * prevents the provider from being deleted -- we'll need to check
1719 provider->ftp_ccount++;
1720 lck_mtx_unlock(&provider->ftp_mtx);
1725 * other threads creating probes. We must drop the provider lock
1729 lck_mtx_lock(&provider->ftp_cmtx);
1738 if (dtrace_probe_lookup(provider->ftp_provid,
1757 pp->ftp_prov = provider;
1770 tp->ftt_proc = provider->ftp_proc;
1780 pp->ftp_id = dtrace_probe_create(provider->ftp_provid,
1785 } else if (dtrace_probe_lookup(provider->ftp_provid, pdata->ftps_mod,
1808 pp->ftp_prov = provider;
1822 tp->ftt_proc = provider->ftp_proc;
1833 pp->ftp_id = dtrace_probe_create(provider->ftp_provid,
1837 lck_mtx_unlock(&provider->ftp_cmtx);
1840 * We know that the provider is still valid since we incremented the
1841 * creation reference count. If someone tried to clean up this provider
1845 lck_mtx_lock(&provider->ftp_mtx);
1846 provider->ftp_ccount--;
1847 whack = provider->ftp_retired;
1848 lck_mtx_unlock(&provider->ftp_mtx);
1858 * this provider to free some up. This is to cover the case where
1862 lck_mtx_unlock(&provider->ftp_cmtx);
1863 lck_mtx_lock(&provider->ftp_mtx);
1864 provider->ftp_ccount--;
1865 provider->ftp_marked = 1;
1866 lck_mtx_unlock(&provider->ftp_mtx);
1878 fasttrap_provider_t *provider;
1883 * have enough space for the provider name.
1886 sizeof (provider->ftp_name)) {
1887 cmn_err(CE_WARN, "failed to instantiate provider %s: "
1893 * Don't let folks spoof the true pid provider.
1896 cmn_err(CE_WARN, "failed to instantiate provider %s: "
1903 * We also need to check the other pid provider types
1906 cmn_err(CE_WARN, "failed to instantiate provider %s: "
1912 cmn_err(CE_WARN, "failed to instantiate provider %s: "
1921 * the stability of the new provider accordingly.
1935 if ((provider = fasttrap_provider_lookup(pid, DTFTP_PROVIDER_USDT, dhpv->dthpv_provname,
1937 cmn_err(CE_WARN, "failed to instantiate provider %s for "
1951 * probes to an existing provider. If the provider already exists, BZZT!
1958 if (provider->ftp_mcount != 0) {
1959 /* This is the duplicate provider case. */
1960 lck_mtx_unlock(&provider->ftp_mtx);
1966 * Up the meta provider count so this provider isn't removed until
1967 * the meta provider has been told to remove it.
1969 provider->ftp_mcount++;
1971 lck_mtx_unlock(&provider->ftp_mtx);
1973 return (provider);
1982 fasttrap_provider_t *provider = parg;
1989 * Since the meta provider count is non-zero we don't have to worry
1990 * about this provider disappearing.
1992 ASSERT(provider->ftp_mcount > 0);
1999 lck_mtx_lock(&provider->ftp_cmtx);
2007 if (dtrace_probe_lookup(provider->ftp_provid, dhpb->dthpb_mod,
2009 lck_mtx_unlock(&provider->ftp_cmtx);
2021 lck_mtx_unlock(&provider->ftp_cmtx);
2037 pp->ftp_prov = provider;
2038 pp->ftp_pid = provider->ftp_pid;
2055 tp->ftt_proc = provider->ftp_proc;
2077 tp->ftt_pid = provider->ftp_pid;
2099 tp->ftt_proc = provider->ftp_proc;
2121 tp->ftt_pid = provider->ftp_pid;
2143 pp->ftp_id = dtrace_probe_create(provider->ftp_provid, dhpb->dthpb_mod,
2146 lck_mtx_unlock(&provider->ftp_cmtx);
2155 * Clean up the USDT provider. There may be active consumers of the
2156 * provider busy adding probes, no damage will actually befall the
2157 * provider until that count has dropped to zero. This just puts
2158 * the provider on death row.