Skip to content

Commit f3a8308

Browse files
mflemingpmundt
authored andcommitted
sh: Add a few missing irqflags tracing markers.
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>
1 parent 63cd91d commit f3a8308

2 files changed

Lines changed: 24 additions & 11 deletions

File tree

‎arch/sh/kernel/cpu/sh3/entry.S‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,14 @@ ENTRY(handle_interrupt)
508508
bsr save_regs ! needs original pr value in k3
509509
mov #-1, k2 ! default vector kept in k2
510510

511+
stc sr, r0 ! get status register
512+
shlr2 r0
513+
and #0x3c, r0
514+
cmp/eq #0x3c, r0
515+
bf 9f
516+
TRACE_IRQS_OFF
517+
9:
518+
511519
! Setup return address and jump to do_IRQ
512520
mov.l 4f, r9 ! fetch return address
513521
lds r9, pr ! put return address in pr

‎arch/sh/kernel/entry-common.S‎

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,6 @@ ENTRY(ret_from_irq)
7777
!
7878
mov #OFF_SR, r0
7979
mov.l @(r0,r15), r0 ! get status register
80-
81-
shlr2 r0
82-
and #0x3c, r0
83-
cmp/eq #0x3c, r0
84-
bt 9f
85-
TRACE_IRQS_ON
86-
9:
87-
mov #OFF_SR, r0
88-
mov.l @(r0,r15), r0 ! get status register
8980
shll r0
9081
shll r0 ! kernel space?
9182
get_current_thread_info r8, r0
@@ -96,6 +87,7 @@ ENTRY(ret_from_irq)
9687
nop
9788
ENTRY(resume_kernel)
9889
cli
90+
TRACE_IRQS_OFF
9991
mov.l @(TI_PRE_COUNT,r8), r0 ! current_thread_info->preempt_count
10092
tst r0, r0
10193
bf noresched
@@ -213,12 +205,25 @@ syscall_trace_entry:
213205
mov.l r0, @(OFF_R0,r15) ! Return value
214206

215207
__restore_all:
216-
mov.l 1f, r0
208+
mov #OFF_SR, r0
209+
mov.l @(r0,r15), r0 ! get status register
210+
211+
shlr2 r0
212+
and #0x3c, r0
213+
cmp/eq #0x3c, r0
214+
bt 1f
215+
TRACE_IRQS_ON
216+
bra 2f
217+
nop
218+
1:
219+
TRACE_IRQS_OFF
220+
2:
221+
mov.l 3f, r0
217222
jmp @r0
218223
nop
219224

220225
.align 2
221-
1: .long restore_all
226+
3: .long restore_all
222227

223228
.align 2
224229
syscall_badsys: ! Bad syscall number

0 commit comments

Comments
 (0)