dtrace: restructuring for multi-arch support
1) The cpu_info member of the cpu_core structure is now architecture
dependent through the use of type cpuinfo_arch_t. Architectures must
provide a typedef for this type in asm/dtrace_cpuinfo.h.
2) Wherever an instruction address is used, the type is now sdt_instr_t,
which architectures must define in asm/dtrace_sdt.h.
3) System calls that use an assembly language stub must be defined by
architectures in asm/dtrace_syscall.h using the following syntax:
DTRACE_SYSCALL_STUB(all-caps-name, name)
E.g.
DTRACE_SYSCALL_STUB(CLONE, clone)
4) The x86 architecture uses an InvalidOpcode TRAP as probe firing
mechanism for SDT. This is machinery that is entirely architecture
specific (not just in imolementation) and the function prototypes for
those functions have been moved to asm/dtrace_util.h. The actual SDT
implementation (which aside from the core framework is always going
to be architecture specific) has been moved into the x86 specific
part of the kernel tree. The core framework has been split off into
is own dtrace_sdt_core.c.
5) The system call tracing implementation (and assembly language stubs)
are very architecture specific and have been moved into the x86
specific part of the kernel tree. The sys_call_ptr_t type has been
discontinued because dt_sys_call_t serves the same purpose already.
The syscall tracing specific part of dtrace_os.h has been split out
into its own dtrace_syscall.h.
6) Aside from any architecture-specific support functions (that are not
accessed from arch-independent code), an arch-specific dtrace_util.c
must also implement the following functions:
void dtrace_skip_instruction(struct pt_regs *regs)
Adjust the CPU registers such that upon restoring of the
register set, execution commences with the instruction
AFTER the one currently referenced.
int dtrace_die_notifier(struct notifier_block *nb,
unsigned long val, void *args)
Handle faults that could cause a panic in cases of
invalid memory accesses, and very whether DTrace has
requested that they be rendered non-fatal. This may
also be used for other arch-specific things like the
InvalidOpcode TRAP on x86.
7) Since the linux/percpu.h include file occurs in different include
chains dependent on the architecture, linux/dtrace_cpu_defines.h now
includes it explicitly (as it should have done from the beginning)
because it does depend on per_cpu() and friends.
8) The use of uprobes structures in linux/dtrace_os.h was conditional on
a specific architecture (x86_64). This has been changed to now be
conditional on whether the fasttrap provider is being built. Fasttrap
itself depends on uprobes through the kconfig mechanism.
9) The DTrace facility has been a bool option in Kconfig for a while now,
although some code still refers to the possibilty CONFIG_DTRACE_MODULE
may be defined. That has been changed to always check CONFIG_DTRACE.
10) Some architectures truly need strnlen_user() to be used when there
are userspace addresses involved.
11) While on x86 we were using the dump stack facility to get stacktrace
information, this is not available on other architectures. We're now
using the save_stack_trace(). Sadly, just for x86 we need to adjust
the stack depth value by -1 because the x86 implementation adds a
totally unnecessary sentinel value to the end of the stacktrace (and
includes it in the nr_entries count).
Orabug:
20262965
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Acked-by: Nick Alcock <nick.alcock@oracle.com>