Subject: CVS commit: [newlock] syssrc/sys/arch/alpha/alpha
To: None <source-changes@netbsd.org>
From: Jason R Thorpe <thorpej@netbsd.org>
List: source-changes
Date: 03/11/2002 19:55:37
Module Name: syssrc
Committed By: thorpej
Date: Mon Mar 11 17:55:37 UTC 2002
Modified Files:
syssrc/sys/arch/alpha/alpha [newlock]: lock_stubs.s
Log Message:
Document a critical section in mutex_exit(). From the comment:
THIS IS IMPORTANT WHEN WE ADD SUPPORT FOR KERNEL PREEMPTION.
There is a critical section within mutex_exit(); if we are
preempted, between checking for waiters and releasing the
lock, then we must check for waiters again.
On some architectures, we could simply disable interrupts
(and, thus, preemption) for the short duration of this
critical section.
On others, where disabling interrupts might be too expensive,
a restartable sequence could be used; in the interrupt handler,
if the PC is within the critical section, then then PC should
be reset to the beginning of the critical section so that the
sequence will be restarted when we are resumed. NOTE: In this
case, it is very important that the insn that actually clears
the lock must NEVER be executed twice.
On the Alpha, it'd be nice to be able to use load-locked/store-conditional,
but since we're storing zero, that breaks the store-conditional logic. On
the alpha, we'll use the restartable sequence method.
To generate a diff of this commit:
cvs rdiff -r1.1.2.2 -r1.1.2.3 syssrc/sys/arch/alpha/alpha/lock_stubs.s
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.