From ef18272453c97238fc9a89211d4c609ef9c760dc Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 22 Dec 2012 00:21:10 -0500 Subject: arch/tile: Call tracehook_report_syscall_{entry,exit} in syscall trace Call tracehook functions for syscall tracing. The check for TIF_SYSCALL_TRACE was removed, because the same check is done right before in the assembly file. Signed-off-by: Simon Marchi Signed-off-by: Chris Metcalf [with ptrace.h fixup] --- arch/tile/include/asm/ptrace.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'arch/tile/include/asm') 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; struct pt_regs *get_pt_regs(struct pt_regs *); /* Trace the current syscall. */ -extern void do_syscall_trace(void); +extern int do_syscall_trace_enter(struct pt_regs *regs); +extern void do_syscall_trace_exit(struct pt_regs *regs); #define arch_has_single_step() (1) -- cgit v1.2.3 From e2ed522aaad79db339cecbbc4ae2a0d422ee4c4f Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 21 Jan 2013 19:54:55 -0500 Subject: tile: move declaration of sys_call_table to When activating syscall tracing, kernel/trace/trace_syscalls.c doesn't find sys_call_table because it includes , not . Also, looking at the other architectures, that is probably where it should be. Signed-off-by: Simon Marchi Signed-off-by: Chris Metcalf --- arch/tile/include/asm/syscall.h | 6 ++++++ arch/tile/include/asm/syscalls.h | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'arch/tile/include/asm') 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 @@ #include #include +/* The array of function pointers for syscalls. */ +extern void *sys_call_table[]; +#ifdef CONFIG_COMPAT +extern void *compat_sys_call_table[]; +#endif + /* * Only the low 32 bits of orig_r0 are meaningful, so we return int. * 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 @@ #include #include -/* The array of function pointers for syscalls. */ -extern void *sys_call_table[]; -#ifdef CONFIG_COMPAT -extern void *compat_sys_call_table[]; -#endif - /* * Note that by convention, any syscall which requires the current * register set takes an additional "struct pt_regs *" pointer; a -- cgit v1.2.3 From ef567f25d5d9d803b89bc2aec6bb71fe8b4bebd9 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 21 Jan 2013 19:54:57 -0500 Subject: 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 Signed-off-by: Chris Metcalf --- arch/tile/include/asm/thread_info.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'arch/tile/include/asm') 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); #define TIF_SECCOMP 6 /* secure computing */ #define TIF_MEMDIE 7 /* OOM killer at work */ #define TIF_NOTIFY_RESUME 8 /* callback before returning to user */ +#define TIF_SYSCALL_TRACEPOINT 9 /* syscall tracepoint instrumentation */ #define _TIF_SIGPENDING (1< Date: Fri, 1 Feb 2013 12:37:48 -0500 Subject: tile: support atomic64_dec_if_positive() Use the normal cmpxchg() idiom to implement this functionality. Signed-off-by: Chris Metcalf --- arch/tile/include/asm/atomic.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'arch/tile/include/asm') 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) #include #endif +#ifndef __ASSEMBLY__ + +static inline long long atomic64_dec_if_positive(atomic64_t *v) +{ + long long c, old, dec; + + c = atomic64_read(v); + for (;;) { + dec = c - 1; + if (unlikely(dec < 0)) + break; + old = atomic64_cmpxchg((v), c, dec); + if (likely(old == c)) + break; + c = old; + } + return dec; +} + +#endif /* __ASSEMBLY__ */ + #endif /* _ASM_TILE_ATOMIC_H */ -- cgit v1.2.3 From ffae3d0e3606b2e274c9ec1b969342d630b2ecae Mon Sep 17 00:00:00 2001 From: Chris Metcalf Date: Tue, 9 Apr 2013 12:33:07 -0400 Subject: tile: comment assumption about __insn_mtspr for The arch_local_irq_save(), etc., routines are required to function as compiler barriers. They do, but it's subtle and requires knowing that the gcc builtin __insn_mtspr() is marked as a memory clobber. Provide a comment explaining the assumption. Signed-off-by: Chris Metcalf --- arch/tile/include/asm/irqflags.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'arch/tile/include/asm') diff --git a/arch/tile/include/asm/irqflags.h b/arch/tile/include/asm/irqflags.h index 241c0bb60b12..c96f9bbb760d 100644 --- a/arch/tile/include/asm/irqflags.h +++ b/arch/tile/include/asm/irqflags.h @@ -40,7 +40,15 @@ #include #include -/* Set and clear kernel interrupt masks. */ +/* + * Set and clear kernel interrupt masks. + * + * NOTE: __insn_mtspr() is a compiler builtin marked as a memory + * clobber. We rely on it being equivalent to a compiler barrier in + * this code since arch_local_irq_save() and friends must act as + * compiler barriers. This compiler semantic is baked into enough + * places that the compiler will maintain it going forward. + */ #if CHIP_HAS_SPLIT_INTR_MASK() #if INT_PERF_COUNT < 32 || INT_AUX_PERF_COUNT < 32 || INT_MEM_ERROR >= 32 # error Fix assumptions about which word various interrupts are in -- cgit v1.2.3