Browse Source

ARM: entry: instrument usr exception handlers with irqsoff tracing

As we no longer re-enable interrupts in these exception handlers, add
the irqsoff tracing calls to them so that the kernel tracks the state
more accurately.

Note that these calls are conditional on IRQSOFF_TRACER:

  kernel ----------> user ---------> kernel
          ^ irqs enabled   ^ irqs disabled

No kernel code can run on the local CPU until we've re-entered the
kernel through one of the exception handlers - and userspace can not
take any locks etc.  So, the kernel doesn't care about the IRQ mask
state while userspace is running unless we're doing IRQ off latency
tracing.  So, we can (and do) avoid the overhead of updating the IRQ
mask state on every kernel->user and user->kernel transition.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Russell King 14 years ago
parent
commit
bc089602d2
1 changed files with 16 additions and 1 deletions
  1. 16 1
      arch/arm/kernel/entry-armv.S

+ 16 - 1
arch/arm/kernel/entry-armv.S

@@ -421,6 +421,11 @@ ENDPROC(__pabt_svc)
 	.align	5
 	.align	5
 __dabt_usr:
 __dabt_usr:
 	usr_entry
 	usr_entry
+
+#ifdef CONFIG_IRQSOFF_TRACER
+	bl	trace_hardirqs_off
+#endif
+
 	kuser_cmpxchg_check
 	kuser_cmpxchg_check
 	dabt_helper
 	dabt_helper
 
 
@@ -433,12 +438,12 @@ ENDPROC(__dabt_usr)
 	.align	5
 	.align	5
 __irq_usr:
 __irq_usr:
 	usr_entry
 	usr_entry
-	kuser_cmpxchg_check
 
 
 #ifdef CONFIG_IRQSOFF_TRACER
 #ifdef CONFIG_IRQSOFF_TRACER
 	bl	trace_hardirqs_off
 	bl	trace_hardirqs_off
 #endif
 #endif
 
 
+	kuser_cmpxchg_check
 	irq_handler
 	irq_handler
 	get_thread_info tsk
 	get_thread_info tsk
 	mov	why, #0
 	mov	why, #0
@@ -451,6 +456,11 @@ ENDPROC(__irq_usr)
 	.align	5
 	.align	5
 __und_usr:
 __und_usr:
 	usr_entry
 	usr_entry
+
+#ifdef CONFIG_IRQSOFF_TRACER
+	bl	trace_hardirqs_off
+#endif
+
 	mov	r2, r4
 	mov	r2, r4
 	mov	r3, r5
 	mov	r3, r5
 
 
@@ -669,6 +679,11 @@ ENDPROC(__und_usr_unknown)
 	.align	5
 	.align	5
 __pabt_usr:
 __pabt_usr:
 	usr_entry
 	usr_entry
+
+#ifdef CONFIG_IRQSOFF_TRACER
+	bl	trace_hardirqs_off
+#endif
+
 	pabt_helper
 	pabt_helper
 	mov	r2, sp				@ regs
 	mov	r2, sp				@ regs
 	bl	do_PrefetchAbort		@ call abort handler
 	bl	do_PrefetchAbort		@ call abort handler