LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] Fix race in arch/sparc64/kernel/trampoline.S
@ 2008-10-18 0:06 Andrea Shepard
2008-10-20 6:33 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Andrea Shepard @ 2008-10-18 0:06 UTC (permalink / raw)
To: davem; +Cc: linux-kernel
Make arch/sparc64/kernel/trampoline.S in 2.6.27.1 lock prom_entry_lock
when calling the PROM. This prevents a race condition that I observed
causing a hang on startup on a 12-CPU E4500.
I am not subscribed to this list, so please CC me on replies.
Signed-off-by: Andrea Shepard <andrea@persephoneslair.org>
diff -Naur linux-2.6.27.1/arch/sparc64/kernel/trampoline.S linux-2.6.27.1.patched/arch/sparc64/kernel/trampoline.S
--- linux-2.6.27.1/arch/sparc64/kernel/trampoline.S 2008-10-15 16:02:53.000000000 -0700
+++ linux-2.6.27.1.patched/arch/sparc64/kernel/trampoline.S 2008-10-17 13:17:09.401334338 -0700
@@ -328,6 +328,12 @@
wrpr %g0, 0, %wstate
+ sethi %hi(prom_entry_lock), %g2
+1: ldstub [%g2 + %lo(prom_entry_lock)], %g1
+ membar #StoreLoad | #StoreStore
+ brnz,pn %g1, 1b
+ nop
+
/* As a hack, put &init_thread_union into %g6.
* prom_world() loads from here to restore the %asi
* register.
@@ -337,9 +343,9 @@
sethi %hi(is_sun4v), %o0
lduw [%o0 + %lo(is_sun4v)], %o0
- brz,pt %o0, 1f
+ brz,pt %o0, 2f
nop
TRAP_LOAD_TRAP_BLOCK(%g2, %g3)
add %g2, TRAP_PER_CPU_FAULT_INFO, %g2
stxa %g2, [%g0] ASI_SCRATCHPAD
@@ -369,10 +375,10 @@
call %o1
add %sp, (2047 + 128), %o0
- ba,pt %xcc, 2f
+ ba,pt %xcc, 3f
nop
-1: sethi %hi(sparc64_ttable_tl0), %o0
+2: sethi %hi(sparc64_ttable_tl0), %o0
set prom_set_trap_table_name, %g2
stx %g2, [%sp + 2047 + 128 + 0x00]
mov 1, %g2
@@ -386,9 +392,13 @@
call %o1
add %sp, (2047 + 128), %o0
-2: ldx [%l0], %g6
+3: sethi %hi(prom_entry_lock), %g2
+ stb %g0, [%g2 + %lo(prom_entry_lock)]
+ membar #StoreStore | #StoreLoad
+
+ ldx [%l0], %g6
ldx [%g6 + TI_TASK], %g4
mov 1, %g5
sllx %g5, THREAD_SHIFT, %g5
sub %g5, (STACKFRAME_SZ + STACK_BIAS), %g5
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Fix race in arch/sparc64/kernel/trampoline.S
2008-10-18 0:06 [PATCH] Fix race in arch/sparc64/kernel/trampoline.S Andrea Shepard
@ 2008-10-20 6:33 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2008-10-20 6:33 UTC (permalink / raw)
To: andrea; +Cc: linux-kernel
From: Andrea Shepard <andrea@persephoneslair.org>
Date: Fri, 17 Oct 2008 17:06:35 -0700
> Make arch/sparc64/kernel/trampoline.S in 2.6.27.1 lock prom_entry_lock
> when calling the PROM. This prevents a race condition that I observed
> causing a hang on startup on a 12-CPU E4500.
>
> I am not subscribed to this list, so please CC me on replies.
>
> Signed-off-by: Andrea Shepard <andrea@persephoneslair.org>
Applied, thanks a lot Andrea.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-10-20 6:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-18 0:06 [PATCH] Fix race in arch/sparc64/kernel/trampoline.S Andrea Shepard
2008-10-20 6:33 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).