aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/tile/Kconfig17
-rw-r--r--arch/tile/include/asm/atomic.h21
-rw-r--r--arch/tile/include/asm/ptrace.h3
-rw-r--r--arch/tile/include/asm/syscall.h6
-rw-r--r--arch/tile/include/asm/syscalls.h6
-rw-r--r--arch/tile/include/asm/thread_info.h8
-rw-r--r--arch/tile/include/uapi/asm/unistd.h2
-rw-r--r--arch/tile/kernel/intvec_32.S10
-rw-r--r--arch/tile/kernel/intvec_64.S24
-rw-r--r--arch/tile/kernel/ptrace.c39
-rw-r--r--arch/tile/kernel/time.c6
11 files changed, 93 insertions, 49 deletions
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index 0e5343902363..5b6a40dd5556 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -22,6 +22,9 @@ config TILE
22 select ARCH_HAVE_NMI_SAFE_CMPXCHG 22 select ARCH_HAVE_NMI_SAFE_CMPXCHG
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
26 select HAVE_SYSCALL_TRACEPOINTS
27 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
25 28
26# FIXME: investigate whether we need/want these options. 29# FIXME: investigate whether we need/want these options.
27# select HAVE_IOREMAP_PROT 30# select HAVE_IOREMAP_PROT
@@ -40,9 +43,6 @@ config MMU
40config GENERIC_CSUM 43config GENERIC_CSUM
41 def_bool y 44 def_bool y
42 45
43config SEMAPHORE_SLEEPERS
44 def_bool y
45
46config HAVE_ARCH_ALLOC_REMAP 46config HAVE_ARCH_ALLOC_REMAP
47 def_bool y 47 def_bool y
48 48
@@ -67,12 +67,6 @@ config HUGETLB_SUPER_PAGES
67config RWSEM_GENERIC_SPINLOCK 67config RWSEM_GENERIC_SPINLOCK
68 def_bool y 68 def_bool y
69 69
70# We have a very flat architecture from a migration point of view,
71# so save boot time by presetting this (particularly useful on tile-sim).
72config DEFAULT_MIGRATION_COST
73 int
74 default "10000000"
75
76# We only support gcc 4.4 and above, so this should work. 70# We only support gcc 4.4 and above, so this should work.
77config ARCH_SUPPORTS_OPTIMIZED_INLINING 71config ARCH_SUPPORTS_OPTIMIZED_INLINING
78 def_bool y 72 def_bool y
@@ -413,11 +407,6 @@ endmenu
413 407
414menu "Executable file formats" 408menu "Executable file formats"
415 409
416# only elf supported
417config KCORE_ELF
418 def_bool y
419 depends on PROC_FS
420
421source "fs/Kconfig.binfmt" 410source "fs/Kconfig.binfmt"
422 411
423endmenu 412endmenu
diff --git a/arch/tile/include/asm/atomic.h b/arch/tile/include/asm/atomic.h
index f2461429a4a4..e71387ab20ca 100644
--- a/arch/tile/include/asm/atomic.h
+++ b/arch/tile/include/asm/atomic.h
@@ -131,4 +131,25 @@ static inline int atomic_read(const atomic_t *v)
131#include <asm/atomic_64.h> 131#include <asm/atomic_64.h>
132#endif 132#endif
133 133
134#ifndef __ASSEMBLY__
135
136static inline long long atomic64_dec_if_positive(atomic64_t *v)
137{
138 long long c, old, dec;
139
140 c = atomic64_read(v);
141 for (;;) {
142 dec = c - 1;
143 if (unlikely(dec < 0))
144 break;
145 old = atomic64_cmpxchg((v), c, dec);
146 if (likely(old == c))
147 break;
148 c = old;
149 }
150 return dec;
151}
152
153#endif /* __ASSEMBLY__ */
154
134#endif /* _ASM_TILE_ATOMIC_H */ 155#endif /* _ASM_TILE_ATOMIC_H */
diff --git a/arch/tile/include/asm/ptrace.h b/arch/tile/include/asm/ptrace.h
index 2e83fc1b9467..fd412260aff7 100644
--- a/arch/tile/include/asm/ptrace.h
+++ b/arch/tile/include/asm/ptrace.h
@@ -44,7 +44,8 @@ typedef unsigned long pt_reg_t;
44struct pt_regs *get_pt_regs(struct pt_regs *); 44struct pt_regs *get_pt_regs(struct pt_regs *);
45 45
46/* Trace the current syscall. */ 46/* Trace the current syscall. */
47extern void do_syscall_trace(void); 47extern int do_syscall_trace_enter(struct pt_regs *regs);
48extern void do_syscall_trace_exit(struct pt_regs *regs);
48 49
49#define arch_has_single_step() (1) 50#define arch_has_single_step() (1)
50 51
diff --git a/arch/tile/include/asm/syscall.h b/arch/tile/include/asm/syscall.h
index d35e0dcb67b1..9644b88f133d 100644
--- a/arch/tile/include/asm/syscall.h
+++ b/arch/tile/include/asm/syscall.h
@@ -22,6 +22,12 @@
22#include <linux/err.h> 22#include <linux/err.h>
23#include <arch/abi.h> 23#include <arch/abi.h>
24 24
25/* The array of function pointers for syscalls. */
26extern void *sys_call_table[];
27#ifdef CONFIG_COMPAT
28extern void *compat_sys_call_table[];
29#endif
30
25/* 31/*
26 * Only the low 32 bits of orig_r0 are meaningful, so we return int. 32 * Only the low 32 bits of orig_r0 are meaningful, so we return int.
27 * This importantly ignores the high bits on 64-bit, so comparisons 33 * This importantly ignores the high bits on 64-bit, so comparisons
diff --git a/arch/tile/include/asm/syscalls.h b/arch/tile/include/asm/syscalls.h
index 78886e2417a6..07b298450ef2 100644
--- a/arch/tile/include/asm/syscalls.h
+++ b/arch/tile/include/asm/syscalls.h
@@ -24,12 +24,6 @@
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/compat.h> 25#include <linux/compat.h>
26 26
27/* The array of function pointers for syscalls. */
28extern void *sys_call_table[];
29#ifdef CONFIG_COMPAT
30extern void *compat_sys_call_table[];
31#endif
32
33/* 27/*
34 * Note that by convention, any syscall which requires the current 28 * Note that by convention, any syscall which requires the current
35 * register set takes an additional "struct pt_regs *" pointer; a 29 * register set takes an additional "struct pt_regs *" pointer; a
diff --git a/arch/tile/include/asm/thread_info.h b/arch/tile/include/asm/thread_info.h
index ccc8ef37235c..d1733dee98a2 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/include/uapi/asm/unistd.h b/arch/tile/include/uapi/asm/unistd.h
index cd7b6dd9d471..3866397aaf5a 100644
--- a/arch/tile/include/uapi/asm/unistd.h
+++ b/arch/tile/include/uapi/asm/unistd.h
@@ -20,6 +20,8 @@
20/* Use the standard ABI for syscalls. */ 20/* Use the standard ABI for syscalls. */
21#include <asm-generic/unistd.h> 21#include <asm-generic/unistd.h>
22 22
23#define NR_syscalls __NR_syscalls
24
23/* Additional Tilera-specific syscalls. */ 25/* Additional Tilera-specific syscalls. */
24#define __NR_cacheflush (__NR_arch_specific_syscall + 1) 26#define __NR_cacheflush (__NR_arch_specific_syscall + 1)
25__SYSCALL(__NR_cacheflush, sys_cacheflush) 27__SYSCALL(__NR_cacheflush, sys_cacheflush)
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S
index f212bf7cea86..cb52d66343ed 100644
--- a/arch/tile/kernel/intvec_32.S
+++ b/arch/tile/kernel/intvec_32.S
@@ -1201,7 +1201,10 @@ handle_syscall:
1201 lw r30, r31 1201 lw r30, r31
1202 andi r30, r30, _TIF_SYSCALL_TRACE 1202 andi r30, r30, _TIF_SYSCALL_TRACE
1203 bzt r30, .Lrestore_syscall_regs 1203 bzt r30, .Lrestore_syscall_regs
1204 jal do_syscall_trace 1204 {
1205 PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
1206 jal do_syscall_trace_enter
1207 }
1205 FEEDBACK_REENTER(handle_syscall) 1208 FEEDBACK_REENTER(handle_syscall)
1206 1209
1207 /* 1210 /*
@@ -1252,7 +1255,10 @@ handle_syscall:
1252 lw r30, r31 1255 lw r30, r31
1253 andi r30, r30, _TIF_SYSCALL_TRACE 1256 andi r30, r30, _TIF_SYSCALL_TRACE
1254 bzt r30, 1f 1257 bzt r30, 1f
1255 jal do_syscall_trace 1258 {
1259 PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
1260 jal do_syscall_trace_exit
1261 }
1256 FEEDBACK_REENTER(handle_syscall) 1262 FEEDBACK_REENTER(handle_syscall)
12571: { 12631: {
1258 movei r30, 0 /* not an NMI */ 1264 movei r30, 0 /* not an NMI */
diff --git a/arch/tile/kernel/intvec_64.S b/arch/tile/kernel/intvec_64.S
index 4ea080902654..85d483957027 100644
--- a/arch/tile/kernel/intvec_64.S
+++ b/arch/tile/kernel/intvec_64.S
@@ -1000,13 +1000,19 @@ 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
1008 } 1011 }
1009 jal do_syscall_trace 1012 {
1013 PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
1014 jal do_syscall_trace_enter
1015 }
1010 FEEDBACK_REENTER(handle_syscall) 1016 FEEDBACK_REENTER(handle_syscall)
1011 1017
1012 /* 1018 /*
@@ -1071,13 +1077,19 @@ handle_syscall:
1071 FEEDBACK_REENTER(handle_syscall) 1077 FEEDBACK_REENTER(handle_syscall)
1072 1078
1073 /* Do syscall trace again, if requested. */ 1079 /* Do syscall trace again, if requested. */
1074 ld r30, r31 1080 {
1075 andi r0, r30, _TIF_SYSCALL_TRACE 1081 ld r30, r31
1082 moveli r32, _TIF_SYSCALL_EXIT_WORK
1083 }
1084 and r0, r30, r32
1076 { 1085 {
1077 andi r0, r30, _TIF_SINGLESTEP 1086 andi r0, r30, _TIF_SINGLESTEP
1078 beqzt r0, 1f 1087 beqzt r0, 1f
1079 } 1088 }
1080 jal do_syscall_trace 1089 {
1090 PTREGS_PTR(r0, PTREGS_OFFSET_BASE)
1091 jal do_syscall_trace_exit
1092 }
1081 FEEDBACK_REENTER(handle_syscall) 1093 FEEDBACK_REENTER(handle_syscall)
1082 andi r0, r30, _TIF_SINGLESTEP 1094 andi r0, r30, _TIF_SINGLESTEP
1083 1095
diff --git a/arch/tile/kernel/ptrace.c b/arch/tile/kernel/ptrace.c
index 9835312d5a91..0f83ed4602b2 100644
--- a/arch/tile/kernel/ptrace.c
+++ b/arch/tile/kernel/ptrace.c
@@ -21,9 +21,13 @@
21#include <linux/uaccess.h> 21#include <linux/uaccess.h>
22#include <linux/regset.h> 22#include <linux/regset.h>
23#include <linux/elf.h> 23#include <linux/elf.h>
24#include <linux/tracehook.h>
24#include <asm/traps.h> 25#include <asm/traps.h>
25#include <arch/chip.h> 26#include <arch/chip.h>
26 27
28#define CREATE_TRACE_POINTS
29#include <trace/events/syscalls.h>
30
27void user_enable_single_step(struct task_struct *child) 31void user_enable_single_step(struct task_struct *child)
28{ 32{
29 set_tsk_thread_flag(child, TIF_SINGLESTEP); 33 set_tsk_thread_flag(child, TIF_SINGLESTEP);
@@ -246,29 +250,26 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
246} 250}
247#endif 251#endif
248 252
249void do_syscall_trace(void) 253int do_syscall_trace_enter(struct pt_regs *regs)
250{ 254{
251 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 255 if (test_thread_flag(TIF_SYSCALL_TRACE)) {
252 return; 256 if (tracehook_report_syscall_entry(regs))
257 regs->regs[TREG_SYSCALL_NR] = -1;
258 }
253 259
254 if (!(current->ptrace & PT_PTRACED)) 260 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
255 return; 261 trace_sys_enter(regs, regs->regs[TREG_SYSCALL_NR]);
256 262
257 /* 263 return regs->regs[TREG_SYSCALL_NR];
258 * The 0x80 provides a way for the tracing parent to distinguish 264}
259 * between a syscall stop and SIGTRAP delivery
260 */
261 ptrace_notify(SIGTRAP|((current->ptrace & PT_TRACESYSGOOD) ? 0x80 : 0));
262 265
263 /* 266void do_syscall_trace_exit(struct pt_regs *regs)
264 * this isn't the same as continuing with a signal, but it will do 267{
265 * for normal use. strace only continues with a signal if the 268 if (test_thread_flag(TIF_SYSCALL_TRACE))
266 * stopping signal is not SIGTRAP. -brl 269 tracehook_report_syscall_exit(regs, 0);
267 */ 270
268 if (current->exit_code) { 271 if (test_thread_flag(TIF_SYSCALL_TRACEPOINT))
269 send_sig(current->exit_code, current, 1); 272 trace_sys_exit(regs, regs->regs[0]);
270 current->exit_code = 0;
271 }
272} 273}
273 274
274void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code) 275void send_sigtrap(struct task_struct *tsk, struct pt_regs *regs, int error_code)
diff --git a/arch/tile/kernel/time.c b/arch/tile/kernel/time.c
index f6f50f2a5e37..5ac397ec6986 100644
--- a/arch/tile/kernel/time.c
+++ b/arch/tile/kernel/time.c
@@ -230,6 +230,10 @@ int setup_profiling_timer(unsigned int multiplier)
230 */ 230 */
231cycles_t ns2cycles(unsigned long nsecs) 231cycles_t ns2cycles(unsigned long nsecs)
232{ 232{
233 struct clock_event_device *dev = &__get_cpu_var(tile_timer); 233 /*
234 * We do not have to disable preemption here as each core has the same
235 * clock frequency.
236 */
237 struct clock_event_device *dev = &__raw_get_cpu_var(tile_timer);
234 return ((u64)nsecs * dev->mult) >> dev->shift; 238 return ((u64)nsecs * dev->mult) >> dev->shift;
235} 239}