diff options
author | Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | 2011-03-16 19:05:00 -0400 |
---|---|---|
committer | Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> | 2011-03-16 19:05:00 -0400 |
commit | eedb8dd005de7301c4ebf913edab768c6f5f3c22 (patch) | |
tree | 75b122d1b044b48b208e0a846908228228444937 /arch/sh/kernel | |
parent | b6fe057e20fd792a5a6e16b48451de6cc6938c2b (diff) |
lttng-instrumentation/lttng-instrumentation-sh
LTTng - instrumentation SH
Partial SH64 instrumentation.
Changelog:
- fix do_fork instrumentation
- fix redeclaration of ‘pid’ within process_<32/64>.
- sh: spare fixes for LTTng (includes headers, DEFINE_TRACE)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Diffstat (limited to 'arch/sh/kernel')
-rw-r--r-- | arch/sh/kernel/process_32.c | 5 | ||||
-rw-r--r-- | arch/sh/kernel/process_64.c | 10 | ||||
-rw-r--r-- | arch/sh/kernel/ptrace_32.c | 8 | ||||
-rw-r--r-- | arch/sh/kernel/ptrace_64.c | 4 | ||||
-rw-r--r-- | arch/sh/kernel/sys_sh.c | 3 | ||||
-rw-r--r-- | arch/sh/kernel/traps_32.c | 11 |
6 files changed, 39 insertions, 2 deletions
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c index 762a13984bb..ddffe37d968 100644 --- a/arch/sh/kernel/process_32.c +++ b/arch/sh/kernel/process_32.c @@ -21,12 +21,15 @@ #include <linux/fs.h> #include <linux/ftrace.h> #include <linux/hw_breakpoint.h> +#include <trace/sched.h> #include <asm/uaccess.h> #include <asm/mmu_context.h> #include <asm/system.h> #include <asm/fpu.h> #include <asm/syscalls.h> +DEFINE_TRACE(sched_kthread_create); + void show_regs(struct pt_regs * regs) { printk("\n"); @@ -94,6 +97,8 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) pid = do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0, NULL, NULL); + trace_sched_kthread_create(fn, pid); + return pid; } EXPORT_SYMBOL(kernel_thread); diff --git a/arch/sh/kernel/process_64.c b/arch/sh/kernel/process_64.c index 210c1cabcb7..4b17fd9ed79 100644 --- a/arch/sh/kernel/process_64.c +++ b/arch/sh/kernel/process_64.c @@ -25,12 +25,15 @@ #include <linux/init.h> #include <linux/module.h> #include <linux/io.h> +#include <trace/sched.h> #include <asm/syscalls.h> #include <asm/uaccess.h> #include <asm/pgtable.h> #include <asm/mmu_context.h> #include <asm/fpu.h> +DEFINE_TRACE(sched_kthread_create); + struct task_struct *last_task_used_math = NULL; void show_regs(struct pt_regs *regs) @@ -300,6 +303,7 @@ ATTRIB_NORET void kernel_thread_helper(void *arg, int (*fn)(void *)) */ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) { + int pid; struct pt_regs regs; memset(®s, 0, sizeof(regs)); @@ -310,8 +314,12 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) regs.sr = (1 << 30); /* Ok, create the new process.. */ - return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, + pid = do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, ®s, 0, NULL, NULL); + + trace_sched_kthread_create(fn, pid); + + return pid; } EXPORT_SYMBOL(kernel_thread); diff --git a/arch/sh/kernel/ptrace_32.c b/arch/sh/kernel/ptrace_32.c index 90a15d29fee..df61c55de26 100644 --- a/arch/sh/kernel/ptrace_32.c +++ b/arch/sh/kernel/ptrace_32.c @@ -26,6 +26,7 @@ #include <linux/elf.h> #include <linux/regset.h> #include <linux/hw_breakpoint.h> +#include <trace/syscall.h> #include <asm/uaccess.h> #include <asm/pgtable.h> #include <asm/system.h> @@ -37,6 +38,9 @@ #define CREATE_TRACE_POINTS #include <trace/events/syscalls.h> +DEFINE_TRACE(syscall_entry); +DEFINE_TRACE(syscall_exit); + /* * This routine will get a word off of the process kernel stack. */ @@ -491,6 +495,8 @@ asmlinkage long do_syscall_trace_enter(struct pt_regs *regs) { long ret = 0; + trace_syscall_entry(regs, regs->regs[3]); + secure_computing(regs->regs[0]); if (test_thread_flag(TIF_SYSCALL_TRACE) && @@ -517,6 +523,8 @@ asmlinkage void do_syscall_trace_leave(struct pt_regs *regs) { int step; + trace_syscall_exit(regs->regs[0]); + if (unlikely(current->audit_context)) audit_syscall_exit(AUDITSC_RESULT(regs->regs[0]), regs->regs[0]); diff --git a/arch/sh/kernel/ptrace_64.c b/arch/sh/kernel/ptrace_64.c index 4436eacddb1..c893d20483b 100644 --- a/arch/sh/kernel/ptrace_64.c +++ b/arch/sh/kernel/ptrace_64.c @@ -31,6 +31,7 @@ #include <linux/tracehook.h> #include <linux/elf.h> #include <linux/regset.h> +#include <trace/syscall.h> #include <asm/io.h> #include <asm/uaccess.h> #include <asm/pgtable.h> @@ -43,6 +44,9 @@ #define CREATE_TRACE_POINTS #include <trace/events/syscalls.h> +DEFINE_TRACE(syscall_entry); +DEFINE_TRACE(syscall_exit); + /* This mask defines the bits of the SR which the user is not allowed to change, which are everything except S, Q, M, PR, SZ, FR. */ #define SR_MASK (0xffff8cfd) diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c index 8c6a350df75..b519b22b575 100644 --- a/arch/sh/kernel/sys_sh.c +++ b/arch/sh/kernel/sys_sh.c @@ -27,6 +27,9 @@ #include <asm/unistd.h> #include <asm/cacheflush.h> #include <asm/cachectl.h> +#include <trace/ipc.h> + +DEFINE_TRACE(ipc_call); asmlinkage int old_mmap(unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c index 3484c2f65ab..5abd87752eb 100644 --- a/arch/sh/kernel/traps_32.c +++ b/arch/sh/kernel/traps_32.c @@ -27,6 +27,7 @@ #include <linux/sysfs.h> #include <linux/uaccess.h> #include <linux/perf_event.h> +#include <trace/trap.h> #include <asm/system.h> #include <asm/alignment.h> #include <asm/fpu.h> @@ -47,6 +48,9 @@ #define TRAP_ILLEGAL_SLOT_INST 13 #endif +DEFINE_TRACE(trap_entry); +DEFINE_TRACE(trap_exit); + static void dump_mem(const char *str, unsigned long bottom, unsigned long top) { unsigned long p; @@ -545,6 +549,8 @@ asmlinkage void do_address_error(struct pt_regs *regs, error_code = lookup_exception_vector(); #endif + trace_trap_entry(regs, error_code >> 5); + oldfs = get_fs(); if (user_mode(regs)) { @@ -589,8 +595,10 @@ fixup: address); set_fs(oldfs); - if (tmp == 0) + if (!tmp) { + trace_trap_exit(); return; /* sorted */ + } uspace_segv: printk(KERN_NOTICE "Sending SIGBUS to \"%s\" due to unaligned " "access (PC %lx PR %lx)\n", current->comm, regs->pc, @@ -623,6 +631,7 @@ uspace_segv: 0, address); set_fs(oldfs); } + trace_trap_exit(); } #ifdef CONFIG_SH_DSP |