Lines Matching full: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 in fasttrap_pid_cleanup_cb()
312 * If this provider has consumers actively in fasttrap_pid_cleanup_cb()
314 * provider (ftp_mcount), we can't unregister in fasttrap_pid_cleanup_cb()
331 * provider we can remove it from the hash in fasttrap_pid_cleanup_cb()
334 * provider, increment our flag to try again in fasttrap_pid_cleanup_cb()
364 * If we were unable to remove a retired provider, try again after in fasttrap_pid_cleanup_cb()
454 * exit, and removal of a meta provider so it in fasttrap_fork()
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 in fasttrap_exec_exit()
483 * static probes are handled by the meta-provider remove entry point. in fasttrap_exec_exit()
542 * provider (this one) will still be around throughout this in fasttrap_tracepoint_enable()
677 fasttrap_provider_t *provider = probe->ftp_prov; in fasttrap_tracepoint_disable() local
699 tp->ftt_proc == provider->ftp_proc) in fasttrap_tracepoint_disable()
792 * live or we hold the provider lock on the process if it's dead and in fasttrap_tracepoint_disable()
902 * Increment the count of enabled probes on this probe's provider; in fasttrap_pid_enable()
903 * the provider can't go away while the probe still exists. We in fasttrap_pid_enable()
912 * If this probe's provider is retired (meaning it was valid in a in fasttrap_pid_enable()
914 * provider can't go away while we're in this code path. in fasttrap_pid_enable()
1014 fasttrap_provider_t *provider = probe->ftp_prov; in fasttrap_pid_disable() local
1023 * provider lock as a point of mutual exclusion to prevent other in fasttrap_pid_disable()
1031 mutex_enter(&provider->ftp_mtx); in fasttrap_pid_disable()
1042 ASSERT(provider->ftp_rcount > 0); in fasttrap_pid_disable()
1043 provider->ftp_rcount--; in fasttrap_pid_disable()
1048 * mark this retired provider to get a chance to remove some in fasttrap_pid_disable()
1051 if (provider->ftp_retired && !provider->ftp_marked) in fasttrap_pid_disable()
1052 whack = provider->ftp_marked = 1; in fasttrap_pid_disable()
1053 mutex_exit(&provider->ftp_mtx); in fasttrap_pid_disable()
1062 if (provider->ftp_rcount == 0 && !provider->ftp_marked) in fasttrap_pid_disable()
1063 whack = provider->ftp_marked = 1; in fasttrap_pid_disable()
1064 mutex_exit(&provider->ftp_mtx); in fasttrap_pid_disable()
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. in fasttrap_provider_lookup()
1373 * Take another lap through the list to make sure a provider hasn't in fasttrap_provider_lookup()
1390 * Fail and return NULL if either the provider name is too long in fasttrap_provider_lookup()
1391 * or we fail to register this new provider with the DTrace in fasttrap_provider_lookup()
1393 * the full provider name -- we keep it in pieces in the provider in fasttrap_provider_lookup()
1419 fasttrap_provider_free(fasttrap_provider_t *provider) in fasttrap_provider_free() argument
1421 pid_t pid = provider->ftp_pid; in fasttrap_provider_free()
1426 * creating probes, and no meta providers referencing this provider. in fasttrap_provider_free()
1428 ASSERT(provider->ftp_rcount == 0); in fasttrap_provider_free()
1429 ASSERT(provider->ftp_ccount == 0); in fasttrap_provider_free()
1430 ASSERT(provider->ftp_mcount == 0); in fasttrap_provider_free()
1433 * If this provider hasn't been retired, we need to explicitly drop the in fasttrap_provider_free()
1436 if (!provider->ftp_retired) { in fasttrap_provider_free()
1437 atomic_dec_64(&provider->ftp_proc->ftpc_acount); in fasttrap_provider_free()
1438 ASSERT(provider->ftp_proc->ftpc_acount < in fasttrap_provider_free()
1439 provider->ftp_proc->ftpc_rcount); in fasttrap_provider_free()
1442 fasttrap_proc_release(provider->ftp_proc); in fasttrap_provider_free()
1444 kmem_free(provider, sizeof (fasttrap_provider_t)); in fasttrap_provider_free()
1447 * Decrement p_dtrace_probes on the process whose provider we're in fasttrap_provider_free()
1450 * corresponds to this process's hash chain in the provider hash in fasttrap_provider_free()
1498 * Mark the provider to be removed in our post-processing step, mark it in fasttrap_provider_retire()
1501 * that we're done with this provider; dropping the active the proc in fasttrap_provider_retire()
1505 * We obviously need to take the bucket lock before the provider lock in fasttrap_provider_retire()
1506 * to perform the lookup, but we need to drop the provider lock in fasttrap_provider_retire()
1508 * provider lock in callbacks invoked from the DTrace framework. The in fasttrap_provider_retire()
1509 * bucket lock therefore protects the integrity of the provider hash in fasttrap_provider_retire()
1521 * We don't have to worry about invalidating the same provider twice in fasttrap_provider_retire()
1522 * since fasttrap_provider_lookup() will ignore provider that have in fasttrap_provider_retire()
1547 fasttrap_provider_t *provider; in fasttrap_add_probe() local
1575 if ((provider = fasttrap_provider_lookup(pdata->ftps_pid, in fasttrap_add_probe()
1581 * actively adding a new probe associated with this provider. This in fasttrap_add_probe()
1582 * prevents the provider from being deleted -- we'll need to check in fasttrap_add_probe()
1585 provider->ftp_ccount++; in fasttrap_add_probe()
1586 mutex_exit(&provider->ftp_mtx); in fasttrap_add_probe()
1591 * other threads creating probes. We must drop the provider lock in fasttrap_add_probe()
1595 mutex_enter(&provider->ftp_cmtx); in fasttrap_add_probe()
1604 if (dtrace_probe_lookup(provider->ftp_provid, in fasttrap_add_probe()
1617 pp->ftp_prov = provider; in fasttrap_add_probe()
1626 tp->ftt_proc = provider->ftp_proc; in fasttrap_add_probe()
1634 pp->ftp_id = dtrace_probe_create(provider->ftp_provid, in fasttrap_add_probe()
1639 } else if (dtrace_probe_lookup(provider->ftp_provid, pdata->ftps_mod, in fasttrap_add_probe()
1667 pp->ftp_prov = provider; in fasttrap_add_probe()
1677 tp->ftt_proc = provider->ftp_proc; in fasttrap_add_probe()
1686 pp->ftp_id = dtrace_probe_create(provider->ftp_provid, in fasttrap_add_probe()
1690 mutex_exit(&provider->ftp_cmtx); in fasttrap_add_probe()
1693 * We know that the provider is still valid since we incremented the in fasttrap_add_probe()
1694 * creation reference count. If someone tried to clean up this provider in fasttrap_add_probe()
1698 mutex_enter(&provider->ftp_mtx); in fasttrap_add_probe()
1699 provider->ftp_ccount--; in fasttrap_add_probe()
1700 whack = provider->ftp_retired; in fasttrap_add_probe()
1701 mutex_exit(&provider->ftp_mtx); in fasttrap_add_probe()
1711 * this provider to free some up. This is to cover the case where in fasttrap_add_probe()
1715 mutex_exit(&provider->ftp_cmtx); in fasttrap_add_probe()
1716 mutex_enter(&provider->ftp_mtx); in fasttrap_add_probe()
1717 provider->ftp_ccount--; in fasttrap_add_probe()
1718 provider->ftp_marked = 1; in fasttrap_add_probe()
1719 mutex_exit(&provider->ftp_mtx); in fasttrap_add_probe()
1730 fasttrap_provider_t *provider; in fasttrap_meta_provide() local
1735 * have enough space for the provider name. in fasttrap_meta_provide()
1738 sizeof (provider->ftp_name)) { in fasttrap_meta_provide()
1739 cmn_err(CE_WARN, "failed to instantiate provider %s: " in fasttrap_meta_provide()
1745 * Don't let folks spoof the true pid provider. in fasttrap_meta_provide()
1748 cmn_err(CE_WARN, "failed to instantiate provider %s: " in fasttrap_meta_provide()
1756 * the stability of the new provider accordingly. in fasttrap_meta_provide()
1769 if ((provider = fasttrap_provider_lookup(pid, dhpv->dthpv_provname, in fasttrap_meta_provide()
1771 cmn_err(CE_WARN, "failed to instantiate provider %s for " in fasttrap_meta_provide()
1777 * Up the meta provider count so this provider isn't removed until in fasttrap_meta_provide()
1778 * the meta provider has been told to remove it. in fasttrap_meta_provide()
1780 provider->ftp_mcount++; in fasttrap_meta_provide()
1782 mutex_exit(&provider->ftp_mtx); in fasttrap_meta_provide()
1784 return (provider); in fasttrap_meta_provide()
1792 fasttrap_provider_t *provider = parg; in fasttrap_meta_create_probe() local
1799 * Since the meta provider count is non-zero we don't have to worry in fasttrap_meta_create_probe()
1800 * about this provider disappearing. in fasttrap_meta_create_probe()
1802 ASSERT(provider->ftp_mcount > 0); in fasttrap_meta_create_probe()
1828 mutex_enter(&provider->ftp_cmtx); in fasttrap_meta_create_probe()
1830 if (dtrace_probe_lookup(provider->ftp_provid, dhpb->dthpb_mod, in fasttrap_meta_create_probe()
1832 mutex_exit(&provider->ftp_cmtx); in fasttrap_meta_create_probe()
1843 mutex_exit(&provider->ftp_cmtx); in fasttrap_meta_create_probe()
1849 pp->ftp_prov = provider; in fasttrap_meta_create_probe()
1850 pp->ftp_pid = provider->ftp_pid; in fasttrap_meta_create_probe()
1862 tp->ftt_proc = provider->ftp_proc; in fasttrap_meta_create_probe()
1864 tp->ftt_pid = provider->ftp_pid; in fasttrap_meta_create_probe()
1881 tp->ftt_proc = provider->ftp_proc; in fasttrap_meta_create_probe()
1883 tp->ftt_pid = provider->ftp_pid; in fasttrap_meta_create_probe()
1905 pp->ftp_id = dtrace_probe_create(provider->ftp_provid, dhpb->dthpb_mod, in fasttrap_meta_create_probe()
1908 mutex_exit(&provider->ftp_cmtx); in fasttrap_meta_create_probe()
1916 * Clean up the USDT provider. There may be active consumers of the in fasttrap_meta_remove()
1917 * provider busy adding probes, no damage will actually befall the in fasttrap_meta_remove()
1918 * provider until that count has dropped to zero. This just puts in fasttrap_meta_remove()
1919 * the provider on death row. in fasttrap_meta_remove()
2226 * Unregister the meta-provider to make sure no new fasttrap- in fasttrap_detach()
2229 * meta-provider. We can fail to unregister as a meta-provider in fasttrap_detach()
2271 * this provider. A thread must first acquire the in fasttrap_detach()
2273 * blocking on the provider's lock. in fasttrap_detach()