dtrace: add support for DTrace on sparc64
This commit adds support for sparc64 to the DTrace modules. It also
includes some changes to the arch-independent code, to account for
some extra support pieces that are necessary for sparc64 without needing
to unnecessarily increase the portion of arch-dependent code.
- Add sparc64 implementations for arch-specific portions of DTrace.
- Add support for a provider API function (dtps_cleanup_module) to be
called for modules when a provider module is being unloaded. When
defined, this function can take care of any final cleanup that may
be necessary. This facility is used by the SDT code on sparc64 to
clean up the trampolines for the SDT probes.
- Add support for the pdata member in the module struct. This member
(generic pointer) can be populated with a pointer to a structure that
holds implementation specific DTrace data for the module. Each arch
must define dtrace_module_t (in include/<arch>/dtrace/mod_arch.h),
containing at a minimum:
size_t sdt_probe_cnt
int sdt_enabled
size_t fbt_probe_cnt
For sparc64 there is also a sdt_instr_t *sdt_tab member that will
hold a memory block for SDT trampolines.
The dtrace_module_t structs are allocated from a kmem cache. For
modules that exist before dtrace is loaded, the pdata member is
populated during the loading of dtrace. Modules loaded after dtrace
get it populated from a module notifier. When modules are unloaded,
the module notifier cleans up the pdata member. When dtrace itself
is unloaded, all remaining modules have their pdata member cleaned
up.
- Provide a generic method for calling a function on every loaded
module in the absence of a kernel facility to allow modules access
to the actual list of loaded modules. This adds an exported function
void dtrace_for_each_module(for_each_module_fn *fn, void *arg)
to be used from module code to call fn(arg, modile) for every module
that is loaded.
Orabug:
19005048
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Acked-by: Nick Alcock <nick.alcock@oracle.com>