Skip to content

Commit

Permalink
sh: resume_kernel fix for kernel oops built with CONFIG_BKL_PREEMPT=y.
Browse files Browse the repository at this point in the history
This patch fixes a problem within the SH implementation of resume_kernel code,
that implements in assembly the bulk of preempt_schedule_irq function without
taking care of the extra code needed to handle the BKL preemptible.

The patch basically consists of removing this asm code and calling the common
C implementation (see kernel/sched.c) as other archs do.

Another change is the missing 'cli' macro invocation at the beginning of
the resume_kernel.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Carmelo Amoroso authored and Paul Mundt committed Sep 5, 2008
1 parent 3c31bf7 commit 323b8c4
Showing 1 changed file with 3 additions and 24 deletions.
27 changes: 3 additions & 24 deletions arch/sh/kernel/entry-common.S
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ ENTRY(ret_from_irq)
bra resume_userspace
nop
ENTRY(resume_kernel)
cli
mov.l @(TI_PRE_COUNT,r8), r0 ! current_thread_info->preempt_count
tst r0, r0
bf noresched
Expand All @@ -105,28 +106,9 @@ need_resched:
and #0xf0, r0 ! interrupts off (exception path)?
cmp/eq #0xf0, r0
bt noresched

mov.l 1f, r0
mov.l r0, @(TI_PRE_COUNT,r8)

#ifdef CONFIG_TRACE_IRQFLAGS
mov.l 3f, r0
jsr @r0
nop
#endif
sti
mov.l 2f, r0
jsr @r0
nop
mov #0, r0
mov.l r0, @(TI_PRE_COUNT,r8)
cli
#ifdef CONFIG_TRACE_IRQFLAGS
mov.l 4f, r0
jsr @r0
jsr @r0 ! call preempt_schedule_irq
nop
#endif

bra need_resched
nop

Expand All @@ -137,10 +119,7 @@ noresched:
.align 2
1: .long PREEMPT_ACTIVE
2: .long schedule
#ifdef CONFIG_TRACE_IRQFLAGS
3: .long trace_hardirqs_on
4: .long trace_hardirqs_off
#endif
3: .long preempt_schedule_irq
#endif

ENTRY(resume_userspace)
Expand Down

0 comments on commit 323b8c4

Please sign in to comment.