aboutsummaryrefslogtreecommitdiff
path: root/sys/sys/sdt.h
Commit message (Collapse)AuthorAgeFilesLines
* Provide SDT_PROBES_ENABLED for kernels without KDTRACE.Mateusz Guzik2018-12-191-0/+1
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=342262
* Provide SDT_PROBES_ENABLED macro.Mateusz Guzik2018-12-081-1/+3
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=341720
* sys/sys: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326256
* sdt: make all sdt probe sites test one variableMateusz Guzik2017-10-221-1/+5
| | | | | | | | | | | This saves on cache misses at the expense of a slight grow of .text. Note this is a bandaid for lack of hotpatching. Discussed with: markj Notes: svn path=/head/; revision=324869
* sdt: whack unused SDT_PROBE_ENABLEDMateusz Guzik2017-10-221-4/+0
| | | | Notes: svn path=/head/; revision=324867
* Implement LOCKSTAT_OOL_PROFILE_ENABLEDMateusz Guzik2017-02-081-0/+1
| | | | | | | | For use in uninlined locking primitives to decide whether lockstat or profiling needs to be taken care of. Notes: svn path=/head/; revision=313453
* mtx: move lockstat handling out of inline primitivesMateusz Guzik2017-02-051-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Lockstat requires checking if it is enabled and if so, calling a 6 argument function. Further, determining whether to call it on unlock requires pre-reading the lock value. This is problematic in at least 3 ways: - more branches in the hot path than necessary - additional cacheline ping pong under contention - bigger code Instead, check first if lockstat handling is necessary and if so, just fall back to regular locking routines. For this purpose a new macro is introduced (LOCKSTAT_PROFILE_ENABLED). LOCK_PROFILING uninlines all primitives. Fold in the current inline lock variant into the _mtx_lock_flags to retain the support. With this change the inline variants are not used when LOCK_PROFILING is defined and thus can ignore its existence. This results in: text data bss dec hex filename 22259667 1303208 4994976 28557851 1b3c21b kernel.orig 21797315 1303208 4994976 28095499 1acb40b kernel.patched i.e. about 3% reduction in text size. A remaining action is to remove spurious arguments for internal kernel consumers. Notes: svn path=/head/; revision=313275
* sdt: annotate the probe test as likely to failMateusz Guzik2016-06-151-1/+1
| | | | | | | | | | This saves a jump in plenty of cases. Approved by: re (kib) MFC after: 1 week Notes: svn path=/head/; revision=301922
* sdt.h: no need for argtype_list_headAndriy Gapon2015-09-291-1/+1
| | | | | | | MFC after: 12 days Notes: svn path=/head/; revision=288366
* Define _DTRACE_VERSION in sdt.h rather than setting it manually. This isMark Johnston2014-09-021-0/+2
| | | | | | | | similar to what illumos does, and makes it easier to enable USDT probes in third-party software that doesn't make use of the system makefiles. Notes: svn path=/head/; revision=270990
* Remove _DTRACE_VERSION from sdt.h. It will now come from the command lineRui Paulo2014-07-121-2/+0
| | | | | | | | | (bsd.dep.mk). MFC after: 3 weeks Notes: svn path=/head/; revision=268542
* sdt: add support for solaris/illumos style DTRACE_PROBE macrosAndriy Gapon2013-11-261-0/+55
| | | | | | | | | | | | | | | | | | | | The new macros are implemented in terms of SDT_PROBE_DEFINE and SDT_PROBE. Probes defined in this way will appear under SDT provider named "sdt". Parameter types are exposed via SDT_PROBE_ARGTYPE. This is something that illumos does not have by default. This kind of SDT probes is already present in ZFS code, so those probes will now be available if KDTRACE_HOOKS options is enabled. A potential future illumos compatibility enhancement is to encode a provider name as a prefix in a probe name. Reviewed by: markj MFC after: 3 weeks X-MFC after: r258622 Notes: svn path=/head/; revision=258625
* dtrace sdt: remove the ugly sname parameter of SDT_PROBE_DEFINEAndriy Gapon2013-11-261-51/+51
| | | | | | | | | | | In its stead use the Solaris / illumos approach of emulating '-' (dash) in probe names with '__' (two consecutive underscores). Reviewed by: markj MFC after: 3 weeks Notes: svn path=/head/; revision=258622
* Do some cleanup of the SDT code. In particular,Mark Johnston2013-10-261-2/+1
| | | | | | | | | | | | * Remove the unused sdt cdev. * Don't bother keeping a list of probes in struct sdt_prov; it's not needed. * Invoke sdt_load and sdt_unload from the module handler instead of registering separate SYSINITs. * Keep to within 80 columns. * Check for errors from dtrace_unregister(). Notes: svn path=/head/; revision=257152
* Give argtype struct names a different prefix than probe struct names.Mark Johnston2013-09-211-2/+2
| | | | | | | | | | | Otherwise it's possible to declare SDT probes in such a way that a name collision occurs, causing an unexpected compilation error. Approved by: re (gjb) MFC after: 1 week Notes: svn path=/head/; revision=255776
* Add a "translated type" argument to SDT_PROBE_ARGTYPE() and add some macrosMark Johnston2013-08-171-35/+110
| | | | | | | | | | | | | | which allow one to define SDT probes that specify translated types. The idea is to make it easy to write SDT probe definitions that can work across multiple operating systems. In particular, this makes it possible to port illumos SDT probes to FreeBSD without changing their argument types, so long as the appropriate translators are defined. Then DTrace scripts written for Solaris/illumos will work on FreeBSD without any changes. MFC after: 1 week Notes: svn path=/head/; revision=254468
* FreeBSD's DTrace implementation has a few problems with respect to handlingMark Johnston2013-08-131-94/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | probes declared in a kernel module when that module is unloaded. In particular, * Unloading a module with active SDT probes will cause a panic. [1] * A module's (FBT/SDT) probes aren't destroyed when the module is unloaded; trying to use them after the fact will generally cause a panic. This change fixes both problems by porting the DTrace module load/unload handlers from illumos and registering them with the corresponding EVENTHANDLER(9) handlers. This allows the DTrace framework to destroy all probes defined in a module when that module is unloaded, and to prevent a module unload from proceeding if some of its probes are active. The latter problem has already been fixed for FBT probes by checking lf->nenabled in kern_kldunload(), but moving the check into the DTrace framework generalizes it to all kernel providers and also fixes a race in the current implementation (since a probe may be activated between the check and the call to linker_file_unload()). Additionally, the SDT implementation has been reworked to define SDT providers/probes/argtypes in linker sets rather than using SYSINIT/SYSUNINIT to create and destroy SDT probes when a module is loaded or unloaded. This simplifies things quite a bit since it means that pretty much all of the SDT code can live in sdt.ko, and since it becomes easier to integrate SDT with the DTrace framework. Furthermore, this allows FreeBSD to be quite flexible in that SDT providers spanning multiple modules can be created on the fly when a module is loaded; at the moment it looks like illumos' SDT implementation requires all SDT probes to be statically defined in a single kernel table. PR: 166927, 166926, 166928 Reported by: davide [1] Reviewed by: avg, trociny (earlier version) MFC after: 1 month Notes: svn path=/head/; revision=254268
* Also define SDT_PROBE_DEFINE0 for the !KDTRACE_HOOKS case.Mark Johnston2013-07-081-0/+1
| | | | Notes: svn path=/head/; revision=253022
* Add SDT_PROBE_DEFINE0 for consistency with SDT_PROBE0.Mark Johnston2013-07-061-0/+3
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=252894
* Add macros which allow one to define SDT probes with six or seven arguments;Mark Johnston2013-05-301-0/+49
| | | | | | | | | | | | | | | they are needed when porting some of the Solaris providers (ip, iscsi, and tcp in particular). dtrace_probe() only takes five arguments from the probe site, so we need to add the appropriate cast to allow for more than five arguments. The extra arguments are later copied out of dtrace_probe()'s stack frame by dtrace_getarg() (or the provider-specific getarg method) as needed. MFC after: 1 week Notes: svn path=/head/; revision=251166
* Protect SDT_PROBE() with do { } while (0) loop.Pawel Jakub Dawidek2013-05-191-2/+3
| | | | Notes: svn path=/head/; revision=250816
* Implement the DTrace sched provider. This implementation aims to beRyan Stone2012-05-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | compatible with the sched provider implemented by Solaris and its open- source derivatives. Full documentation of the sched provider can be found on Oracle's DTrace wiki pages. Note that for compatibility with scripts originally written for Solaris, serveral probes are defined that will never fire. These probes are defined to fire when Solaris-specific features perform certain actions. As these features are not present in FreeBSD, the probes can never fire. Also, I have added a two probes that are not defined in Solaris, lend-pri and load-change. These probes have been added to make it possible to collect schedgraph data with DTrace. Finally, a few probes are defined in Solaris to take a cpuinfo_t * argument. As it was not immediately clear to me how to translate that to FreeBSD, currently those probes are passed NULL in place of a cpuinfo_t *. Sponsored by: Sandvine Incorporated MFC after: 2 weeks Notes: svn path=/head/; revision=235459
* Instead of only iterating over the set of known SDT probes when sdt.ko isRyan Stone2012-03-271-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* SDT's struct sdt_argtype can be marked static everywhere.Ed Schouten2011-11-071-1/+1
| | | | | | | It is only passed to SYSINIT/SYSUNINIT. Notes: svn path=/head/; revision=227294
* Add an extra comment to the SDT probes definition. This allows us to getRui Paulo2010-08-221-28/+61
| | | | | | | | | | | | use '-' in probe names, matching the probe names in Solaris.[1] Add userland SDT probes definitions to sys/sdt.h. Sponsored by: The FreeBSD Foundation Discussed with: rwaston [1] Notes: svn path=/head/; revision=211616
* Add SDT_PROBE[1-5] in the same way we have SDT_PROBE_DEFINE[1-5] toBjoern A. Zeeb2009-11-281-0/+17
| | | | | | | | | avoid having to add all the unused trailing arguments as zeros. MFC after: 6 days Notes: svn path=/head/; revision=199883
* Adding missing ";"'s required by some SDT_PROBE_DEFINEx() macros.Robert Watson2009-03-031-10/+10
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=189314
* Reduce the verbosity of SDT trace points for DTrace by defining severalRobert Watson2009-03-031-0/+36
| | | | | | | | | | | | | | wrapper macros that allow trace points and arguments to be declared using a single macro rather than several. This means a lot less repetition and vertical space for each trace point. Use these macros when defining privilege and MAC Framework trace points. Reviewed by: jb MFC after: 1 week Notes: svn path=/head/; revision=189311
* Add the statically defined tracing header.John Birrell2008-05-171-0/+179
Note that this implementation differs from the one in OpenSolaris, so it is BSD licensed and can be included anywhere. The kernel definitions defined here are dependent on the kernel option KDTRACE_HOOKS so that macros added to the sources are pre-processed out completely when the DTrace kernel hooks aren't compiled in. Notes: svn path=/head/; revision=179063