aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Hilman <khilman@deeprootsystems.com>2013-03-28 17:54:40 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2013-04-03 12:00:01 -0400
commitb00884802043d9102ecc2abfdc37a7b35b30e52a (patch)
tree634138ea0602f55374fb1d4a5fa453cce17c6683
parent4fd75911f6970478444eece952dacb2db9d1e5a5 (diff)
ARM: 7688/1: add support for context tracking subsystem
commit 91d1aa43 (context_tracking: New context tracking susbsystem) generalized parts of the RCU userspace extended quiescent state into the context tracking subsystem. Context tracking is then used to implement adaptive tickless (a.k.a extended nohz) To support the new context tracking subsystem on ARM, the user/kernel boundary transtions need to be instrumented. For exceptions and IRQs in usermode, the existing usr_entry macro is used to instrument the user->kernel transition. For the return to usermode path, the ret_to_user* path is instrumented. Using the usr_entry macro, this covers interrupts in userspace, data abort and prefetch abort exceptions in userspace as well as undefined exceptions in userspace (which is where FP emulation and VFP are handled.) For syscalls, the slow return path is covered by instrumenting the ret_to_user path. In addition, the syscall entry point is instrumented which covers the user->kernel transition for both fast and slow syscalls, and an additional instrumentation point is added for the fast syscall return path (ret_fast_syscall). Cc: Mats Liljegren <mats.liljegren@enea.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Kevin Hilman <khilman@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--arch/arm/Kconfig1
-rw-r--r--arch/arm/include/asm/thread_info.h1
-rw-r--r--arch/arm/kernel/entry-armv.S1
-rw-r--r--arch/arm/kernel/entry-common.S3
-rw-r--r--arch/arm/kernel/entry-header.S28
5 files changed, 34 insertions, 0 deletions
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 5b714695b01b..7dc4cabc34d7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -59,6 +59,7 @@ config ARM
59 select CLONE_BACKWARDS 59 select CLONE_BACKWARDS
60 select OLD_SIGSUSPEND3 60 select OLD_SIGSUSPEND3
61 select OLD_SIGACTION 61 select OLD_SIGACTION
62 select HAVE_CONTEXT_TRACKING
62 help 63 help
63 The ARM series is a line of low-power-consumption RISC chip designs 64 The ARM series is a line of low-power-consumption RISC chip designs
64 licensed by ARM Ltd and targeted at embedded applications and 65 licensed by ARM Ltd and targeted at embedded applications and
diff --git a/arch/arm/include/asm/thread_info.h b/arch/arm/include/asm/thread_info.h
index cddda1f41f0f..1995d1a84060 100644
--- a/arch/arm/include/asm/thread_info.h
+++ b/arch/arm/include/asm/thread_info.h
@@ -152,6 +152,7 @@ extern int vfp_restore_user_hwstate(struct user_vfp __user *,
152#define TIF_SYSCALL_AUDIT 9 152#define TIF_SYSCALL_AUDIT 9
153#define TIF_SYSCALL_TRACEPOINT 10 153#define TIF_SYSCALL_TRACEPOINT 10
154#define TIF_SECCOMP 11 /* seccomp syscall filtering active */ 154#define TIF_SECCOMP 11 /* seccomp syscall filtering active */
155#define TIF_NOHZ 12 /* in adaptive nohz mode */
155#define TIF_USING_IWMMXT 17 156#define TIF_USING_IWMMXT 17
156#define TIF_MEMDIE 18 /* is terminating due to OOM killer */ 157#define TIF_MEMDIE 18 /* is terminating due to OOM killer */
157#define TIF_RESTORE_SIGMASK 20 158#define TIF_RESTORE_SIGMASK 20
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 0f82098c9bfe..2b1de1b2f132 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -396,6 +396,7 @@ ENDPROC(__pabt_svc)
396#ifdef CONFIG_IRQSOFF_TRACER 396#ifdef CONFIG_IRQSOFF_TRACER
397 bl trace_hardirqs_off 397 bl trace_hardirqs_off
398#endif 398#endif
399 ct_user_exit save = 0
399 .endm 400 .endm
400 401
401 .macro kuser_cmpxchg_check 402 .macro kuser_cmpxchg_check
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index 3248cde504ed..469e82b3f757 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -41,6 +41,7 @@ ret_fast_syscall:
41 41
42 /* perform architecture specific actions before user return */ 42 /* perform architecture specific actions before user return */
43 arch_ret_to_user r1, lr 43 arch_ret_to_user r1, lr
44 ct_user_enter
44 45
45 restore_user_regs fast = 1, offset = S_OFF 46 restore_user_regs fast = 1, offset = S_OFF
46 UNWIND(.fnend ) 47 UNWIND(.fnend )
@@ -76,6 +77,7 @@ no_work_pending:
76#endif 77#endif
77 /* perform architecture specific actions before user return */ 78 /* perform architecture specific actions before user return */
78 arch_ret_to_user r1, lr 79 arch_ret_to_user r1, lr
80 ct_user_enter save = 0
79 81
80 restore_user_regs fast = 0, offset = 0 82 restore_user_regs fast = 0, offset = 0
81ENDPROC(ret_to_user_from_irq) 83ENDPROC(ret_to_user_from_irq)
@@ -394,6 +396,7 @@ ENTRY(vector_swi)
394 mcr p15, 0, ip, c1, c0 @ update control register 396 mcr p15, 0, ip, c1, c0 @ update control register
395#endif 397#endif
396 enable_irq 398 enable_irq
399 ct_user_exit
397 400
398 get_thread_info tsk 401 get_thread_info tsk
399 adr tbl, sys_call_table @ load syscall table pointer 402 adr tbl, sys_call_table @ load syscall table pointer
diff --git a/arch/arm/kernel/entry-header.S b/arch/arm/kernel/entry-header.S
index 9a8531eadd3d..782a94956286 100644
--- a/arch/arm/kernel/entry-header.S
+++ b/arch/arm/kernel/entry-header.S
@@ -164,6 +164,34 @@
164#endif /* !CONFIG_THUMB2_KERNEL */ 164#endif /* !CONFIG_THUMB2_KERNEL */
165 165
166/* 166/*
167 * Context tracking subsystem. Used to instrument transitions
168 * between user and kernel mode.
169 */
170 .macro ct_user_exit, save = 1
171#ifdef CONFIG_CONTEXT_TRACKING
172 .if \save
173 stmdb sp!, {r0-r3, ip, lr}
174 bl user_exit
175 ldmia sp!, {r0-r3, ip, lr}
176 .else
177 bl user_exit
178 .endif
179#endif
180 .endm
181
182 .macro ct_user_enter, save = 1
183#ifdef CONFIG_CONTEXT_TRACKING
184 .if \save
185 stmdb sp!, {r0-r3, ip, lr}
186 bl user_enter
187 ldmia sp!, {r0-r3, ip, lr}
188 .else
189 bl user_enter
190 .endif
191#endif
192 .endm
193
194/*
167 * These are the registers used in the syscall handler, and allow us to 195 * These are the registers used in the syscall handler, and allow us to
168 * have in theory up to 7 arguments to a function - r0 to r6. 196 * have in theory up to 7 arguments to a function - r0 to r6.
169 * 197 *