Commit 77edffb652b33a565e099ff0a1687762f03eb46a
Committed by
Linus Torvalds
1 parent
56162badad
Exists in
master
and in
7 other branches
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>
Showing 1 changed file with 7 additions and 4 deletions Side-by-side Diff
arch/alpha/kernel/entry.S
... | ... | @@ -73,8 +73,6 @@ |
73 | 73 | ldq $20, HAE_REG($19); \ |
74 | 74 | stq $21, HAE_CACHE($19); \ |
75 | 75 | stq $21, 0($20); \ |
76 | - ldq $0, 0($sp); \ | |
77 | - ldq $1, 8($sp); \ | |
78 | 76 | 99:; \ |
79 | 77 | ldq $19, 72($sp); \ |
80 | 78 | ldq $20, 80($sp); \ |
... | ... | @@ -316,7 +314,7 @@ |
316 | 314 | cmovne $26, 0, $19 /* $19 = 0 => non-restartable */ |
317 | 315 | ldq $0, SP_OFF($sp) |
318 | 316 | and $0, 8, $0 |
319 | - beq $0, restore_all | |
317 | + beq $0, ret_to_kernel | |
320 | 318 | ret_to_user: |
321 | 319 | /* Make sure need_resched and sigpending don't change between |
322 | 320 | sampling and the rti. */ |
... | ... | @@ -329,6 +327,11 @@ |
329 | 327 | RESTORE_ALL |
330 | 328 | call_pal PAL_rti |
331 | 329 | |
330 | +ret_to_kernel: | |
331 | + lda $16, 7 | |
332 | + call_pal PAL_swpipl | |
333 | + br restore_all | |
334 | + | |
332 | 335 | .align 3 |
333 | 336 | $syscall_error: |
334 | 337 | /* |
... | ... | @@ -657,7 +660,7 @@ |
657 | 660 | /* We don't actually care for a3 success widgetry in the kernel. |
658 | 661 | Not for positive errno values. */ |
659 | 662 | stq $0, 0($sp) /* $0 */ |
660 | - br restore_all | |
663 | + br ret_to_kernel | |
661 | 664 | .end kernel_thread |
662 | 665 | |
663 | 666 | /* |