]> www.infradead.org Git - users/jedix/linux-maple.git/commit
dtrace: import the sdt type information into per-sdt_probedesc state
authorNick Alcock <nick.alcock@oracle.com>
Wed, 14 Sep 2016 01:16:46 +0000 (02:16 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Fri, 28 Oct 2016 12:45:44 +0000 (13:45 +0100)
commitec8c03da4f00339c460381fe2851e21d9ef85260
tree9bcef3f76176b9bfd9bbcb04bcb810a63fc1b328
parent243433293dc4bda8e67df4eadc9d74f4238ab7a3
dtrace: import the sdt type information into per-sdt_probedesc state

Now we have type and probe names in ELF sections, we have to do something
with them (it's initdata, so in the kernel, if not in modules, it will
be thrown away after initialization.)

We marshal each arg string in turn, without parsing it, into a new field
in the sdt_probedesc_t, the per-probe structure used to communicate
information about SDT probes to the SDT kernel module.  Before now, this
has been a simple task at runtime: the array is constructed by
dtrace_sdt.sh and just needs to be reformulated (for the core kernel) or
dropped unchanged into place (for modules).  But this extra field is
derived from C macro expansion and cannot be determined by
dtrace_sdt.sh: so it leaves it 0 and we fill it in at boot / module load
time.

The fillout process is a little baroque to avoid slowing down the boot
too much, since we have to associate one array with another and want
to avoid linear scans.  We build a hashtable mapping from probe name
to args string (i.e. from _dtrace_sdt_names to _dtrace_sdt_args entry),
in the process verifying that if the probe appears multiple times,
all its arg strings are the same.  We can then easily use this hash
table to point the extra argument types field in the sdt_probedesc_t
array at the args string too.

One inefficiency remains: there can be *lots* of duplicate args strings,
and currently we make no attempt to deduplicate them.  (We discard the
core kernel's array of probe names, but the array of arg strings
obviously must be preserved.  We could deduplicate it, but do not.)

This is probably wasting no more than a few kilobytes at present, so
a deduplicator is not worth writing, but as the number of probes
(particularly perf probes) increases, one may become worth writing.

The new sdpd_args field into which the type info string is dropped is
protected from the ABI checker: the sdt_probedesc_t is internal to the
kernel and the DTrace module, and the usual ABI guarantees do not apply
to it.

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Acked-by: Kris Van Hees <kris.van.hees@oracle.com>
Orabug: 24661801
include/linux/dtrace_sdt.h
include/linux/sdt.h
kernel/dtrace/dtrace_sdt_core.c
kernel/module.c
scripts/dtrace_sdt.sh