]> www.infradead.org Git - users/jedix/linux-maple.git/commit
dtrace: restructuring for multi-arch support
authorKris Van Hees <kris.van.hees@oracle.com>
Mon, 22 Dec 2014 21:54:49 +0000 (16:54 -0500)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 21 Jul 2015 14:29:47 +0000 (15:29 +0100)
commit70ed4bc387de012e09134ed06cfc89a4e4d5ae1f
tree7e0ff2d2b4a4ad21f28472e5abd76ede23e22cff
parent4487815dc173016a6aff6c4b6c7475100b396f81
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>
20 files changed:
arch/x86/include/asm/dtrace_cpuinfo.h [new file with mode: 0644]
arch/x86/include/asm/dtrace_sdt.h [new file with mode: 0644]
arch/x86/include/asm/dtrace_syscall.h [new file with mode: 0644]
arch/x86/include/asm/dtrace_util.h [new file with mode: 0644]
arch/x86/kernel/dtrace_sdt.c [new file with mode: 0644]
arch/x86/kernel/dtrace_syscall.c [new file with mode: 0644]
arch/x86/kernel/dtrace_syscall_stubs.S [moved from kernel/dtrace/dtrace_stubs_x86_64.S with 95% similarity]
arch/x86/kernel/dtrace_util.c [new file with mode: 0644]
include/linux/dtrace_cpu.h
include/linux/dtrace_cpu_defines.h
include/linux/dtrace_os.h
include/linux/dtrace_syscall.h [new file with mode: 0644]
include/linux/sdt.h
kernel/dtrace/Kconfig
kernel/dtrace/Makefile
kernel/dtrace/dtrace_cpu.c
kernel/dtrace/dtrace_os.c
kernel/dtrace/dtrace_sdt.c [deleted file]
kernel/dtrace/dtrace_sdt.h [new file with mode: 0644]
kernel/dtrace/dtrace_sdt_core.c [new file with mode: 0644]