Lines Matching defs:provider
57 * The fasttrap provider allows DTrace consumers to instrument any user-level
106 * framework -- is a little tricky and bears some explanation. Each provider
109 * (ftp_ccount) and USDT consumers (ftp_mcount); all three prevent a provider
110 * from being freed. A provider is looked up by taking the bucket lock for the
111 * provider hash table, and is returned with its lock held. The provider lock
117 * not be taken when holding the provider lock as that would create a cyclic
118 * lock ordering. In situations where one would naturally take the provider
120 * the provider from disappearing, drop the provider lock, and acquire the
124 * bucket lock before provider lock
125 * DTrace before provider lock
127 * never hold the provider lock and creation lock simultaneously
143 * When the fasttrap provider is loaded, fasttrap_max is set to either
294 * ones. If a provider is marked but not retired, we just
312 * If this provider has consumers actively
314 * provider (ftp_mcount), we can't unregister
331 * provider we can remove it from the hash
334 * provider, increment our flag to try again
364 * If we were unable to remove a retired provider, try again after
454 * exit, and removal of a meta provider so it
470 * is set on the proc structure to indicate that there is a pid provider
482 * We clean up the pid provider for this process here; user-land
483 * static probes are handled by the meta-provider remove entry point.
542 * provider (this one) will still be around throughout this
677 fasttrap_provider_t *provider = probe->ftp_prov;
699 tp->ftt_proc == provider->ftp_proc)
792 * live or we hold the provider lock on the process if it's dead and
902 * Increment the count of enabled probes on this probe's provider;
903 * the provider can't go away while the probe still exists. We
912 * If this probe's provider is retired (meaning it was valid in a
914 * provider can't go away while we're in this code path.
1014 fasttrap_provider_t *provider = probe->ftp_prov;
1023 * provider lock as a point of mutual exclusion to prevent other
1031 mutex_enter(&provider->ftp_mtx);
1042 ASSERT(provider->ftp_rcount > 0);
1043 provider->ftp_rcount--;
1048 * mark this retired provider to get a chance to remove some
1051 if (provider->ftp_retired && !provider->ftp_marked)
1052 whack = provider->ftp_marked = 1;
1053 mutex_exit(&provider->ftp_mtx);
1062 if (provider->ftp_rcount == 0 && !provider->ftp_marked)
1063 whack = provider->ftp_marked = 1;
1064 mutex_exit(&provider->ftp_mtx);
1292 * Lookup a fasttrap-managed provider based on its name and associated pid.
1293 * If the pattr argument is non-NULL, this function instantiates the provider
1294 * if it doesn't exist otherwise it returns NULL. The provider is returned
1350 * when we're done with this provider.
1373 * Take another lap through the list to make sure a provider hasn't
1390 * Fail and return NULL if either the provider name is too long
1391 * or we fail to register this new provider with the DTrace
1393 * the full provider name -- we keep it in pieces in the provider
1419 fasttrap_provider_free(fasttrap_provider_t *provider)
1421 pid_t pid = provider->ftp_pid;
1426 * creating probes, and no meta providers referencing this provider.
1428 ASSERT(provider->ftp_rcount == 0);
1429 ASSERT(provider->ftp_ccount == 0);
1430 ASSERT(provider->ftp_mcount == 0);
1433 * If this provider hasn't been retired, we need to explicitly drop the
1436 if (!provider->ftp_retired) {
1437 atomic_dec_64(&provider->ftp_proc->ftpc_acount);
1438 ASSERT(provider->ftp_proc->ftpc_acount <
1439 provider->ftp_proc->ftpc_rcount);
1442 fasttrap_proc_release(provider->ftp_proc);
1444 kmem_free(provider, sizeof (fasttrap_provider_t));
1447 * Decrement p_dtrace_probes on the process whose provider we're
1450 * corresponds to this process's hash chain in the provider hash
1498 * Mark the provider to be removed in our post-processing step, mark it
1501 * that we're done with this provider; dropping the active the proc
1505 * We obviously need to take the bucket lock before the provider lock
1506 * to perform the lookup, but we need to drop the provider lock
1508 * provider lock in callbacks invoked from the DTrace framework. The
1509 * bucket lock therefore protects the integrity of the provider hash
1521 * We don't have to worry about invalidating the same provider twice
1522 * since fasttrap_provider_lookup() will ignore provider that have
1547 fasttrap_provider_t *provider;
1575 if ((provider = fasttrap_provider_lookup(pdata->ftps_pid,
1581 * actively adding a new probe associated with this provider. This
1582 * prevents the provider from being deleted -- we'll need to check
1585 provider->ftp_ccount++;
1586 mutex_exit(&provider->ftp_mtx);
1591 * other threads creating probes. We must drop the provider lock
1595 mutex_enter(&provider->ftp_cmtx);
1604 if (dtrace_probe_lookup(provider->ftp_provid,
1617 pp->ftp_prov = provider;
1626 tp->ftt_proc = provider->ftp_proc;
1634 pp->ftp_id = dtrace_probe_create(provider->ftp_provid,
1639 } else if (dtrace_probe_lookup(provider->ftp_provid, pdata->ftps_mod,
1667 pp->ftp_prov = provider;
1677 tp->ftt_proc = provider->ftp_proc;
1686 pp->ftp_id = dtrace_probe_create(provider->ftp_provid,
1690 mutex_exit(&provider->ftp_cmtx);
1693 * We know that the provider is still valid since we incremented the
1694 * creation reference count. If someone tried to clean up this provider
1698 mutex_enter(&provider->ftp_mtx);
1699 provider->ftp_ccount--;
1700 whack = provider->ftp_retired;
1701 mutex_exit(&provider->ftp_mtx);
1711 * this provider to free some up. This is to cover the case where
1715 mutex_exit(&provider->ftp_cmtx);
1716 mutex_enter(&provider->ftp_mtx);
1717 provider->ftp_ccount--;
1718 provider->ftp_marked = 1;
1719 mutex_exit(&provider->ftp_mtx);
1730 fasttrap_provider_t *provider;
1735 * have enough space for the provider name.
1738 sizeof (provider->ftp_name)) {
1739 cmn_err(CE_WARN, "failed to instantiate provider %s: "
1745 * Don't let folks spoof the true pid provider.
1748 cmn_err(CE_WARN, "failed to instantiate provider %s: "
1756 * the stability of the new provider accordingly.
1769 if ((provider = fasttrap_provider_lookup(pid, dhpv->dthpv_provname,
1771 cmn_err(CE_WARN, "failed to instantiate provider %s for "
1777 * Up the meta provider count so this provider isn't removed until
1778 * the meta provider has been told to remove it.
1780 provider->ftp_mcount++;
1782 mutex_exit(&provider->ftp_mtx);
1784 return (provider);
1791 * single-threaded with respect to the meta provider machinery. Knowing that
1793 * operation on this provider allows us an important optimization: we need not
1797 * module, function and name (DTrace doesn't hash on provider name).
1804 fasttrap_provider_t *provider = parg;
1811 * Since the meta provider count is non-zero we don't have to worry
1812 * about this provider disappearing.
1814 ASSERT(provider->ftp_mcount > 0);
1847 pp->ftp_prov = provider;
1848 pp->ftp_pid = provider->ftp_pid;
1860 tp->ftt_proc = provider->ftp_proc;
1862 tp->ftt_pid = provider->ftp_pid;
1879 tp->ftt_proc = provider->ftp_proc;
1881 tp->ftt_pid = provider->ftp_pid;
1903 pp->ftp_id = dtrace_probe_create(provider->ftp_provid, dhpb->dthpb_mod,
1912 * Clean up the USDT provider. There may be active consumers of the
1913 * provider busy adding probes, no damage will actually befall the
1914 * provider until that count has dropped to zero. This just puts
1915 * the provider on death row.
2222 * Unregister the meta-provider to make sure no new fasttrap-
2225 * meta-provider. We can fail to unregister as a meta-provider
2267 * this provider. A thread must first acquire the
2269 * blocking on the provider's lock.