diff options
author | Simon Marchi <simon.marchi@polymtl.ca> | 2013-01-21 19:54:57 -0500 |
---|---|---|
committer | Chris Metcalf <cmetcalf@tilera.com> | 2013-03-22 15:46:18 -0400 |
commit | ef567f25d5d9d803b89bc2aec6bb71fe8b4bebd9 (patch) | |
tree | e17d273b2a98d2cdd94eef15eb4cf41c376248b3 /arch/tile | |
parent | 6e4a2f7f94cbac4e1f111f604ccf57dcbdef0a81 (diff) |
tile: support TIF_SYSCALL_TRACEPOINT; select HAVE_SYSCALL_TRACEPOINTS
This patch adds support for the TIF_SYSCALL_TRACEPOINT on the tile
architecture. Basically, it calls the appropriate tracepoints on syscall
entry and exit.
Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Diffstat (limited to 'arch/tile')
-rw-r--r-- | arch/tile/Kconfig | 1 | ||||
-rw-r--r-- | arch/tile/include/asm/thread_info.h | 8 | ||||
-rw-r--r-- | arch/tile/kernel/intvec_64.S | 14 | ||||
-rw-r--r-- | arch/tile/kernel/ptrace.c | 17 |
4 files changed, 33 insertions, 7 deletions
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig index e911ef638b77..0e500d90c2a0 100644 --- a/arch/tile/Kconfig +++ b/arch/tile/Kconfig | |||
@@ -23,6 +23,7 @@ config TILE | |||
23 | select GENERIC_CLOCKEVENTS | 23 | select GENERIC_CLOCKEVENTS |
24 | select MODULES_USE_ELF_RELA | 24 | select MODULES_USE_ELF_RELA |
25 | select HAVE_ARCH_TRACEHOOK | 25 | select HAVE_ARCH_TRACEHOOK |
26 | select HAVE_SYSCALL_TRACEPOINTS | ||
26 | 27 | ||
27 | # FIXME: investigate whether we need/want these options. | 28 | # FIXME: investigate whether we need/want these options. |
28 | # select HAVE_IOREMAP_PROT | 29 | # select HAVE_IOREMAP_PROT |
diff --git a/arch/tile/include/asm/thread_info.h b/arch/tile/include/asm/thread_info.h index e9c670d7a7fe..c96331eb5771 100644 --- a/arch/tile/include/asm/thread_info.h +++ b/arch/tile/include/asm/thread_info.h | |||
@@ -124,6 +124,7 @@ extern void _cpu_idle(void); | |||
124 | #define TIF_SECCOMP 6 /* secure computing */ | 124 | #define TIF_SECCOMP 6 /* secure computing */ |
125 | #define TIF_MEMDIE 7 /* OOM killer at work */ | 125 | #define TIF_MEMDIE 7 /* OOM killer at work */ |
126 | #define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ | 126 | #define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ |
127 | #define TIF_SYSCALL_TRACEPOINT 9 /* syscall tracepoint instrumentation */ | ||
127 | 128 | ||
128 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) | 129 | #define _TIF_SIGPENDING (1<<TIF_SIGPENDING) |
129 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) | 130 | #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED) |
@@ -134,12 +135,19 @@ extern void _cpu_idle(void); | |||
134 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) | 135 | #define _TIF_SECCOMP (1<<TIF_SECCOMP) |
135 | #define _TIF_MEMDIE (1<<TIF_MEMDIE) | 136 | #define _TIF_MEMDIE (1<<TIF_MEMDIE) |
136 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) | 137 | #define _TIF_NOTIFY_RESUME (1<<TIF_NOTIFY_RESUME) |
138 | #define _TIF_SYSCALL_TRACEPOINT (1<<TIF_SYSCALL_TRACEPOINT) | ||
137 | 139 | ||
138 | /* Work to do on any return to user space. */ | 140 | /* Work to do on any return to user space. */ |
139 | #define _TIF_ALLWORK_MASK \ | 141 | #define _TIF_ALLWORK_MASK \ |
140 | (_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SINGLESTEP|\ | 142 | (_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SINGLESTEP|\ |
141 | _TIF_ASYNC_TLB|_TIF_NOTIFY_RESUME) | 143 | _TIF_ASYNC_TLB|_TIF_NOTIFY_RESUME) |
142 | 144 | ||
145 | /* Work to do at syscall entry. */ | ||
146 | #define _TIF_SYSCALL_ENTRY_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_TRACEPOINT) | ||
147 | |||
148 | /* Work to do at syscall exit. */ | ||
149 | #define _TIF_SYSCALL_EXIT_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_TRACEPOINT) | ||
150 | |||
143 | /* | 151 | /* |
144 | * Thread-synchronous status. | 152 | * Thread-synchronous status. |
145 | * | 153 | * |
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S index 21991f72eba3..85d483957027 100644 --- a/arch/tile/kernel/intvec_64.S +++ b/arch/tile/kernel/intvec_64.S | |||
@@ -1000,8 +1000,11 @@ handle_syscall: | |||
1000 | 1000 | ||
1001 | /* Trace syscalls, if requested. */ | 1001 | /* Trace syscalls, if requested. */ |
1002 | addi r31, r31, THREAD_INFO_FLAGS_OFFSET | 1002 | addi r31, r31, THREAD_INFO_FLAGS_OFFSET |
1003 | ld r30, r31 | 1003 | { |
1004 | andi r30, r30, _TIF_SYSCALL_TRACE | 1004 | ld r30, r31 |
1005 | moveli r32, _TIF_SYSCALL_ENTRY_WORK | ||
1006 | } | ||
1007 | and r30, r30, r32 | ||
1005 | { | 1008 | { |
1006 | addi r30, r31, THREAD_INFO_STATUS_OFFSET - THREAD_INFO_FLAGS_OFFSET | 1009 | addi r30, r31, THREAD_INFO_STATUS_OFFSET - THREAD_INFO_FLAGS_OFFSET |
1007 | beqzt r30, .Lrestore_syscall_regs | 1010 | beqzt r30, .Lrestore_syscall_regs |
@@ -1074,8 +1077,11 @@ handle_syscall: | |||
1074 | FEEDBACK_REENTER(handle_syscall) | 1077 | FEEDBACK_REENTER(handle_syscall) |
1075 | 1078 | ||
1076 | /* Do syscall trace again, if requested. */ | 1079 | /* Do syscall trace again, if requested. */ |
1077 | ld r30, r31 | 1080 | { |
1078 | andi r0, r30, _TIF_SYSCALL_TRACE | 1081 | ld r30, r31 |
1082 | moveli r32, _TIF_SYSCALL_EXIT_WORK | ||
1083 | } | ||
1084 | and r0, r30, r32 | ||
1079 | { | 1085 | { |
1080 | andi r0, r30, _TIF_SINGLESTEP | 1086 | andi r0, r30, _TIF_SINGLESTEP |
1081 | beqzt r0, 1f | 1087 | beqzt r0, 1f |
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c index 0ab8b76baddc..363b2dd20f99 100644 --- a/arch/tile/kernel/ptrace.c +++ b/arch/tile/kernel/ptrace.c | |||
@@ -25,6 +25,9 @@ | |||
25 | #include <asm/traps.h> | 25 | #include <asm/traps.h> |
26 | #include <arch/chip.h> | 26 | #include <arch/chip.h> |
27 | 27 | ||
28 | #define CREATE_TRACE_POINTS | ||
29 | #include <trace/events/syscalls.h> | ||
30 | |||
28 | void user_enable_single_step(struct task_struct *child) | 31 | void user_enable_single_step(struct task_struct *child) |
29 | { | 32 | { |
30 | set_tsk_thread_flag(child, TIF_SINGLESTEP); | 33 | set_tsk_thread_flag(child, TIF_SINGLESTEP); |
@@ -249,16 +252,24 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request, | |||
249 | 252 | ||
250 | int do_syscall_trace_enter(struct pt_regs *regs) | 253 | int do_syscall_trace_enter(struct pt_regs *regs) |
251 | { | 254 | { |
252 | if (tracehook_report_syscall_entry(regs)) { | 255 | if (test_thread_flag(TIF_SYSCALL_TRACE)) { |
253 | regs->regs[TREG_SYSCALL_NR] = -1; | 256 | if (tracehook_report_syscall_entry(regs)) |
257 | regs->regs[TREG_SYSCALL_NR] = -1; | ||
254 | } | 258 | } |
255 | 259 | ||
260 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) | ||
261 | trace_sys_enter(regs, regs->regs[TREG_SYSCALL_NR]); | ||
262 | |||
256 | return regs->regs[TREG_SYSCALL_NR]; | 263 | return regs->regs[TREG_SYSCALL_NR]; |
257 | } | 264 | } |
258 | 265 | ||
259 | void do_syscall_trace_exit(struct pt_regs *regs) | 266 | void do_syscall_trace_exit(struct pt_regs *regs) |
260 | { | 267 | { |
261 | tracehook_report_syscall_exit(regs, 0); | 268 | if (test_thread_flag(TIF_SYSCALL_TRACE)) |
269 | tracehook_report_syscall_exit(regs, 0); | ||
270 | |||
271 | if (test_thread_flag(TIF_SYSCALL_TRACEPOINT)) | ||
272 | trace_sys_exit(regs, regs->regs[TREG_SYSCALL_NR]); | ||
262 | } | 273 | } |
263 | 274 | ||
264 | void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code) | 275 | void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code) |