sh: Add a few missing irqflags tracing markers.
authorMatt Fleming <matt@console-pimps.org>
Tue, 18 Aug 2009 02:35:09 +0000 (11:35 +0900)
committerPaul Mundt <lethal@linux-sh.org>
Tue, 18 Aug 2009 02:35:09 +0000 (11:35 +0900)
save_regs contains an SR modification without an irqflags annotation,
which resulted in a missing TRACE_IRQS_OFF in the interrupt exception
path on SH-3/SH4.

I've also moved the TRACE_IRQS_OFF/ON annotation when returning from the
interrupt to just before we call __restore_all. This seems like the most
logical place to put this because the annotation is for when we restore
the SR register so we should delay the annotation until as last as
possible.

We were also missing a TRACE_IRQS_OFF in resume_kernel when
CONFIG_PREEMPT is enabled.

The end result is that this fixes up the lockdep engine debugging support
with CONFIG_PREEMPT enabled on all SH-3/4 parts.

Signed-off-by: Matt Fleming <matt@console-pimps.org>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
arch/sh/kernel/cpu/sh3/entry.S
arch/sh/kernel/entry-common.S

index 67ad646..272636e 100644 (file)
@@ -508,6 +508,14 @@ ENTRY(handle_interrupt)
        bsr     save_regs       ! needs original pr value in k3
         mov    #-1, k2         ! default vector kept in k2
 
        bsr     save_regs       ! needs original pr value in k3
         mov    #-1, k2         ! default vector kept in k2
 
+       stc     sr, r0  ! get status register
+       shlr2   r0
+       and     #0x3c, r0
+       cmp/eq  #0x3c, r0
+       bf      9f
+       TRACE_IRQS_OFF
+9:
+
        ! Setup return address and jump to do_IRQ
        mov.l   4f, r9          ! fetch return address
        lds     r9, pr          ! put return address in pr
        ! Setup return address and jump to do_IRQ
        mov.l   4f, r9          ! fetch return address
        lds     r9, pr          ! put return address in pr
index e63178f..7004776 100644 (file)
@@ -77,15 +77,6 @@ ENTRY(ret_from_irq)
        !
        mov     #OFF_SR, r0
        mov.l   @(r0,r15), r0   ! get status register
        !
        mov     #OFF_SR, r0
        mov.l   @(r0,r15), r0   ! get status register
-
-       shlr2   r0
-       and     #0x3c, r0
-       cmp/eq  #0x3c, r0
-       bt      9f
-       TRACE_IRQS_ON
-9:
-       mov     #OFF_SR, r0
-       mov.l   @(r0,r15), r0   ! get status register
        shll    r0
        shll    r0              ! kernel space?
        get_current_thread_info r8, r0
        shll    r0
        shll    r0              ! kernel space?
        get_current_thread_info r8, r0
@@ -96,6 +87,7 @@ ENTRY(ret_from_irq)
         nop
 ENTRY(resume_kernel)
        cli
         nop
 ENTRY(resume_kernel)
        cli
+       TRACE_IRQS_OFF
        mov.l   @(TI_PRE_COUNT,r8), r0  ! current_thread_info->preempt_count
        tst     r0, r0
        bf      noresched
        mov.l   @(TI_PRE_COUNT,r8), r0  ! current_thread_info->preempt_count
        tst     r0, r0
        bf      noresched
@@ -213,12 +205,25 @@ syscall_trace_entry:
         mov.l  r0, @(OFF_R0,r15)       ! Return value
 
 __restore_all:
         mov.l  r0, @(OFF_R0,r15)       ! Return value
 
 __restore_all:
-       mov.l   1f, r0
+       mov     #OFF_SR, r0
+       mov.l   @(r0,r15), r0   ! get status register
+
+       shlr2   r0
+       and     #0x3c, r0
+       cmp/eq  #0x3c, r0
+       bt      1f
+       TRACE_IRQS_ON
+       bra     2f
+        nop
+1:
+       TRACE_IRQS_OFF
+2:
+       mov.l   3f, r0
        jmp     @r0
         nop
 
        .align  2
        jmp     @r0
         nop
 
        .align  2
-1:     .long   restore_all
+3:     .long   restore_all
 
        .align  2
 syscall_badsys:                        ! Bad syscall number
 
        .align  2
 syscall_badsys:                        ! Bad syscall number