]> www.infradead.org Git - users/jedix/linux-maple.git/commit
dtrace: is-enabled probes for SDT
authorNick Alcock <nick.alcock@oracle.com>
Wed, 23 Nov 2016 17:50:09 +0000 (17:50 +0000)
committerKris Van Hees <kris.van.hees@oracle.com>
Fri, 23 Dec 2016 22:33:01 +0000 (17:33 -0500)
commit560ecfb75f5666af865825dc5b1bf6fbbfdea155
treecc24a1c5a22275811436ef8faa7baa7e1f34ebb6
parent9fe9473d0a8d810063bdfcc891edaef964827645
dtrace: is-enabled probes for SDT

"Is-enabled probes" are a conditional, long supported in userspace
probing, which lets you avoid doing expensive data-collection operations
needed only by DTrace probes unless those probes are active.

e.g. (an example using the core DTRACE_PROBE / DTRACE_IS_ENABLED macros,
rather than the DTRACE_providername macros used in practice, because
no such macros have been added to the kernel yet):

if (DTRACE_IS_ENABLED(__io_wait__start)) {
/* stuff done only when io:::wait-start is enabled */
}

As with normal SDT probes, the DTRACE_IS_ENABLED() macro compiles to a
stub function call (named like __dtrace_isenabled_*()) which is replaced
at bootup/module load time with an architecture-dependent instruction
sequence analogous to a function that always returns false, though no
function call is generated.  At probe enabling time, this is replaced
with a trap into dtrace just like normal dtrace probes, incurring a
performance hit, but only when the probe is active.

The probe name used in the various ELF sections that track SDT
probes begins with a ? character to help the module distinguish
is-enabled probes from normal probes: this is internal to the DTrace
implementation and is otherwise invisible.

(Thanks to Kris Van Hees for initial work on this.)

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Acked-by: Kris Van Hees <kris.van.hees@oracle.com>
Orabug: 25143173
arch/sparc/include/asm/dtrace_sdt_arch.h [new file with mode: 0644]
arch/sparc/kernel/dtrace_sdt.c
arch/x86/include/asm/dtrace_arch.h
arch/x86/include/asm/dtrace_sdt_arch.h [new file with mode: 0644]
arch/x86/kernel/dtrace_sdt.c
include/linux/dtrace_sdt.h
include/linux/sdt.h
kernel/dtrace/dtrace_sdt_core.c
scripts/dtrace_sdt.sh
scripts/mod/modpost.c