Lines Matching defs:provider
84 * The fasttrap provider allows DTrace consumers to instrument any user-level
133 * framework -- is a little tricky and bears some explanation. Each provider
136 * (ftp_ccount) and USDT consumers (ftp_mcount); all three prevent a provider
137 * from being freed. A provider is looked up by taking the bucket lock for the
138 * provider hash table, and is returned with its lock held. The provider lock
144 * not be taken when holding the provider lock as that would create a cyclic
145 * lock ordering. In situations where one would naturally take the provider
147 * the provider from disappearing, drop the provider lock, and acquire the
151 * bucket lock before provider lock
152 * DTrace before provider lock
154 * never hold the provider lock and creation lock simultaneously
179 * When the fasttrap provider is loaded, fasttrap_max is set to either
482 * ones. If a provider is marked but not retired, we just
500 * If this provider has consumers actively
502 * provider (ftp_mcount), we can't unregister
519 * provider we can remove it from the hash
522 * provider, increment our flag to try again
548 * If we were unable to retire a provider, try again after a
681 * exit, and removal of a meta provider so it
722 * is set on the proc structure to indicate that there is a pid provider
748 * We clean up the pid provider for this process here; user-land
749 * static probes are handled by the meta-provider remove entry point.
814 * provider (this one) will still be around throughout this
958 fasttrap_provider_t *provider = probe->ftp_prov;
980 tp->ftt_proc == provider->ftp_proc)
1073 * live or we hold the provider lock on the process if it's dead and
1192 * Increment the count of enabled probes on this probe's provider;
1193 * the provider can't go away while the probe still exists. We
1202 * If this probe's provider is retired (meaning it was valid in a
1204 * provider can't go away while we're in this code path.
1315 fasttrap_provider_t *provider = probe->ftp_prov;
1321 mutex_enter(&provider->ftp_mtx);
1326 * provider lock as a point of mutual exclusion to prevent other
1341 ASSERT(provider->ftp_rcount > 0);
1342 provider->ftp_rcount--;
1347 * mark this retired provider to get a chance to remove some
1350 if (provider->ftp_retired && !provider->ftp_marked)
1351 whack = provider->ftp_marked = 1;
1352 mutex_exit(&provider->ftp_mtx);
1358 if (provider->ftp_rcount == 0 && !provider->ftp_marked)
1359 whack = provider->ftp_marked = 1;
1360 mutex_exit(&provider->ftp_mtx);
1630 * Lookup a fasttrap-managed provider based on its name and associated pid.
1631 * If the pattr argument is non-NULL, this function instantiates the provider
1632 * if it doesn't exist otherwise it returns NULL. The provider is returned
1679 * when we're done with this provider.
1696 mutex_init(&new_fp->ftp_mtx, "provider mtx", MUTEX_DEFAULT, NULL);
1705 * Take another lap through the list to make sure a provider hasn't
1722 * Fail and return NULL if either the provider name is too long
1723 * or we fail to register this new provider with the DTrace
1725 * the full provider name -- we keep it in pieces in the provider
1751 fasttrap_provider_free(fasttrap_provider_t *provider)
1753 pid_t pid = provider->ftp_pid;
1758 * creating probes, and no meta providers referencing this provider.
1760 ASSERT(provider->ftp_rcount == 0);
1761 ASSERT(provider->ftp_ccount == 0);
1762 ASSERT(provider->ftp_mcount == 0);
1765 * If this provider hasn't been retired, we need to explicitly drop the
1768 if (!provider->ftp_retired) {
1769 atomic_dec_64(&provider->ftp_proc->ftpc_acount);
1770 ASSERT(provider->ftp_proc->ftpc_acount <
1771 provider->ftp_proc->ftpc_rcount);
1774 fasttrap_proc_release(provider->ftp_proc);
1777 mutex_destroy(&provider->ftp_mtx);
1778 mutex_destroy(&provider->ftp_cmtx);
1780 kmem_free(provider, sizeof (fasttrap_provider_t));
1783 * Decrement p_dtrace_probes on the process whose provider we're
1786 * corresponds to this process's hash chain in the provider hash
1831 * Mark the provider to be removed in our post-processing step, mark it
1834 * that we're done with this provider; dropping the active the proc
1838 * We obviously need to take the bucket lock before the provider lock
1839 * to perform the lookup, but we need to drop the provider lock
1841 * provider lock in callbacks invoked from the DTrace framework. The
1842 * bucket lock therefore protects the integrity of the provider hash
1854 * We don't have to worry about invalidating the same provider twice
1855 * since fasttrap_provider_lookup() will ignore provider that have
1880 fasttrap_provider_t *provider;
1908 if ((provider = fasttrap_provider_lookup(pdata->ftps_pid,
1914 * actively adding a new probe associated with this provider. This
1915 * prevents the provider from being deleted -- we'll need to check
1918 provider->ftp_ccount++;
1919 mutex_exit(&provider->ftp_mtx);
1924 * other threads creating probes. We must drop the provider lock
1928 mutex_enter(&provider->ftp_cmtx);
1937 if (dtrace_probe_lookup(provider->ftp_provid,
1950 pp->ftp_prov = provider;
1959 tp->ftt_proc = provider->ftp_proc;
1967 pp->ftp_id = dtrace_probe_create(provider->ftp_provid,
1972 } else if (dtrace_probe_lookup(provider->ftp_provid, pdata->ftps_mod,
2000 pp->ftp_prov = provider;
2010 tp->ftt_proc = provider->ftp_proc;
2019 pp->ftp_id = dtrace_probe_create(provider->ftp_provid,
2023 mutex_exit(&provider->ftp_cmtx);
2026 * We know that the provider is still valid since we incremented the
2027 * creation reference count. If someone tried to clean up this provider
2031 mutex_enter(&provider->ftp_mtx);
2032 provider->ftp_ccount--;
2033 whack = provider->ftp_retired;
2034 mutex_exit(&provider->ftp_mtx);
2044 * this provider to free some up. This is to cover the case where
2048 mutex_exit(&provider->ftp_cmtx);
2049 mutex_enter(&provider->ftp_mtx);
2050 provider->ftp_ccount--;
2051 provider->ftp_marked = 1;
2052 mutex_exit(&provider->ftp_mtx);
2063 fasttrap_provider_t *provider;
2068 * have enough space for the provider name.
2071 sizeof (provider->ftp_name)) {
2072 printf("failed to instantiate provider %s: "
2078 * Don't let folks spoof the true pid provider.
2081 printf("failed to instantiate provider %s: "
2089 * the stability of the new provider accordingly.
2102 if ((provider = fasttrap_provider_lookup(pid, dhpv->dthpv_provname,
2104 printf("failed to instantiate provider %s for "
2110 * Up the meta provider count so this provider isn't removed until
2111 * the meta provider has been told to remove it.
2113 provider->ftp_mcount++;
2115 mutex_exit(&provider->ftp_mtx);
2117 return (provider);
2124 * single-threaded with respect to the meta provider machinery. Knowing that
2126 * operation on this provider allows us an important optimization: we need not
2130 * module, function and name (DTrace doesn't hash on provider name).
2137 fasttrap_provider_t *provider = parg;
2144 * Since the meta provider count is non-zero we don't have to worry
2145 * about this provider disappearing.
2147 ASSERT(provider->ftp_mcount > 0);
2180 pp->ftp_prov = provider;
2181 pp->ftp_pid = provider->ftp_pid;
2193 tp->ftt_proc = provider->ftp_proc;
2195 tp->ftt_pid = provider->ftp_pid;
2212 tp->ftt_proc = provider->ftp_proc;
2214 tp->ftt_pid = provider->ftp_pid;
2236 pp->ftp_id = dtrace_probe_create(provider->ftp_provid, dhpb->dthpb_mod,
2245 * Clean up the USDT provider. There may be active consumers of the
2246 * provider busy adding probes, no damage will actually befall the
2247 * provider until that count has dropped to zero. This just puts
2248 * the provider on death row.
2606 * Unregister the meta-provider to make sure no new fasttrap-
2609 * meta-provider. We can fail to unregister as a meta-provider
2630 * this provider. A thread must first acquire the
2632 * blocking on the provider's lock.