Skip to content

Commit 77edffb

Browse files
Al Virotorvalds
authored andcommitted
alpha: fix hae_cache race in RESTORE_ALL
We want interrupts disabled on all paths leading to RESTORE_ALL; otherwise, we are risking an IRQ coming between the updates of alpha_mv->hae_cache and *alpha_mv->hae_register and set_hae() within the IRQ getting badly confused. RESTORE_ALL used to play with disabling IRQ itself, but that got removed back in 2002, without making sure we had them disabled on all paths. It's cheaper to make sure we have them disabled than to revert to original variant... Remove the detritus left from that commit back in 2002; we used to need a reload of $0 and $1 since swpipl would change those, but doing that had become pointless when we stopped doing swpipl in there... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 56162ba commit 77edffb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

arch/alpha/kernel/entry.S

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@
7373
ldq $20, HAE_REG($19); \
7474
stq $21, HAE_CACHE($19); \
7575
stq $21, 0($20); \
76-
ldq $0, 0($sp); \
77-
ldq $1, 8($sp); \
7876
99:; \
7977
ldq $19, 72($sp); \
8078
ldq $20, 80($sp); \
@@ -316,7 +314,7 @@ ret_from_sys_call:
316314
cmovne $26, 0, $19 /* $19 = 0 => non-restartable */
317315
ldq $0, SP_OFF($sp)
318316
and $0, 8, $0
319-
beq $0, restore_all
317+
beq $0, ret_to_kernel
320318
ret_to_user:
321319
/* Make sure need_resched and sigpending don't change between
322320
sampling and the rti. */
@@ -329,6 +327,11 @@ restore_all:
329327
RESTORE_ALL
330328
call_pal PAL_rti
331329

330+
ret_to_kernel:
331+
lda $16, 7
332+
call_pal PAL_swpipl
333+
br restore_all
334+
332335
.align 3
333336
$syscall_error:
334337
/*
@@ -657,7 +660,7 @@ kernel_thread:
657660
/* We don't actually care for a3 success widgetry in the kernel.
658661
Not for positive errno values. */
659662
stq $0, 0($sp) /* $0 */
660-
br restore_all
663+
br ret_to_kernel
661664
.end kernel_thread
662665

663666
/*

0 commit comments

Comments
 (0)