path: root/sys/sys
diff options
authorRyan Stone <rstone@FreeBSD.org>2012-03-27 15:07:43 +0000
committerRyan Stone <rstone@FreeBSD.org>2012-03-27 15:07:43 +0000
commit974241079704e313fe2424a2c31e7e9342979ca7 (patch)
tree3e88342c0b877113ee02c840d3b675a1e232f253 /sys/sys
parent250a19126063fc5d69757aaa927d6dbf04e91dc9 (diff)
Instead of only iterating over the set of known SDT probes when sdt.ko is
loaded and unloaded, also have sdt.ko register callbacks with kern_sdt.c that will be called when a newly loaded KLD module adds more probes or a module with probes is unloaded. This fixes two issues: first, if a module with SDT probes was loaded after sdt.ko was loaded, those new probes would not be available in DTrace. Second, if a module with SDT probes was unloaded while sdt.ko was loaded, the kernel would panic the next time DTrace had cause to try and do anything with the no-longer-existent probes. This makes it possible to create SDT probes in KLD modules, although there are still two caveats: first, any SDT probes in a KLD module must be part of a DTrace provider that is defined in that module. At present DTrace only destroys probes when the provider is destroyed, so you can still panic the system if a KLD module creates new probes in a provider from a different module(including the kernel) and then unload the the first module. Second, the system will panic if you unload a module containing SDT probes while there is an active D script that has enabled those probes. MFC after: 1 month
Notes: svn path=/head/; revision=233552
Diffstat (limited to 'sys/sys')
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/sys/sdt.h b/sys/sys/sdt.h
index 3ee18a8f672b..90d169906d49 100644
--- a/sys/sys/sdt.h
+++ b/sys/sys/sdt.h
@@ -258,6 +258,10 @@ int sdt_argtype_listall(struct sdt_probe *, sdt_argtype_listall_func_t, void *);
int sdt_probe_listall(struct sdt_provider *, sdt_probe_listall_func_t, void *);
int sdt_provider_listall(sdt_provider_listall_func_t,void *);
+void sdt_register_callbacks(sdt_provider_listall_func_t, void *,
+ sdt_provider_listall_func_t, void *, sdt_probe_listall_func_t, void *);
+void sdt_deregister_callbacks(void);
#endif /* KDTRACE_HOOKS */
#endif /* _KERNEL */