Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 77edffb6 authored by Al Viro's avatar Al Viro Committed by Linus Torvalds
Browse files

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: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 56162bad
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line Diff line number Diff line
@@ -73,8 +73,6 @@
	ldq	$20, HAE_REG($19);	\
	ldq	$20, HAE_REG($19);	\
	stq	$21, HAE_CACHE($19);	\
	stq	$21, HAE_CACHE($19);	\
	stq	$21, 0($20);		\
	stq	$21, 0($20);		\
	ldq	$0, 0($sp);		\
	ldq	$1, 8($sp);		\
99:;					\
99:;					\
	ldq	$19, 72($sp);		\
	ldq	$19, 72($sp);		\
	ldq	$20, 80($sp);		\
	ldq	$20, 80($sp);		\
@@ -316,7 +314,7 @@ ret_from_sys_call:
	cmovne	$26, 0, $19		/* $19 = 0 => non-restartable */
	cmovne	$26, 0, $19		/* $19 = 0 => non-restartable */
	ldq	$0, SP_OFF($sp)
	ldq	$0, SP_OFF($sp)
	and	$0, 8, $0
	and	$0, 8, $0
	beq	$0, restore_all
	beq	$0, ret_to_kernel
ret_to_user:
ret_to_user:
	/* Make sure need_resched and sigpending don't change between
	/* Make sure need_resched and sigpending don't change between
		sampling and the rti.  */
		sampling and the rti.  */
@@ -329,6 +327,11 @@ restore_all:
	RESTORE_ALL
	RESTORE_ALL
	call_pal PAL_rti
	call_pal PAL_rti


ret_to_kernel:
	lda	$16, 7
	call_pal PAL_swpipl
	br restore_all

	.align 3
	.align 3
$syscall_error:
$syscall_error:
	/*
	/*
@@ -657,7 +660,7 @@ kernel_thread:
	/* We don't actually care for a3 success widgetry in the kernel.
	/* We don't actually care for a3 success widgetry in the kernel.
	   Not for positive errno values.  */
	   Not for positive errno values.  */
	stq	$0, 0($sp)		/* $0 */
	stq	$0, 0($sp)		/* $0 */
	br	restore_all
	br	ret_to_kernel
.end kernel_thread
.end kernel_thread


/*
/*