Subject: Re: inter-cpu coherency and kernel data structures
To: None <thorpej@zembu.com>
From: Chris G. Demetriou <cgd@sibyte.com>
List: tech-smp
Date: 08/14/2000 09:55:27
thorpej@zembu.com (Jason R Thorpe) writes:
> Well, after disassembling OSF/1's simple lock routines, they clearly
> are using MBs after stl_c, and Brown Book (newer version of Green Book :-)
> doesn't say anything about stl_c performing a barrier. stl_c merely
> interacts with the "locked" register in the memory controller, as far
> as I can tell.
"Why bother disassembling when they've been so kind as to _document_
things for you?"
Take a look at e.g. green book 5.5.3 "Atomic Updates to Data
Structures" (I 5-7). I doubt they've changed this substantially,
especially removed it, in later editions, but my brown book is at
home.
in a nutshell, either you're doing the accesses themselves with
LDx_L/STx_C, which are atomic, or you're using LDx_T/STx_C to frob a
mutex in which case you need additional protection in the form of
memory barriers for the accesses to the data structures.
while you probably don't _have_ to include those in the modex
instructions, it's fairly obvious that that's a good idea (and is even
suggested by the grouping of instructions in that section's example
8-).
cgd