Date: Fri, 18 Jan 2002 20:58:23 -0800 From: Terry Lambert <tlambert2@mindspring.com> To: Garrett Wollman <wollman@khavrinen.lcs.mit.edu> Cc: mime@traveller.cz, arch@FreeBSD.org Subject: Re: 64 bit counters again Message-ID: <3C48FCEF.9190CA08@mindspring.com> References: <mit.lcs.mail.freebsd-arch/3C48A0E7.F97BC01@mindspring.com> <200201190350.g0J3oNN08944@khavrinen.lcs.mit.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
Garrett Wollman wrote: > >> Yes. IA64. SPARC 9b (SPARC64) and Alpha, which are 64 > >> bits, require locks, since they don't have the ability to > >> do an atomic "lock; cmpxchg8b". > > > >Can they do "lock; add const,(mem)" in 32 or 64 bit? > > Terry is talking out of his ear again. > > Alpha most definitely does have 64-bit load-linked/store-conditional, > which is entirely equivalent to i386's 64-bit compare-exchange. (For > some reason in the Alpha ARM it's called ``load locked'' instead.) If > we cared about running on MIPS architectures, they have LL/SC as well. > SPARC v9 has 64-bit compare-and-swap (although unlike in IA32 a memory > barrier is also required); see the SPARC v9 Architecture Reference > Manual. IA64 has 64-bit compare-exchange as well; see the Itanium > Architecture Software Developer's Manual, volume 2 (Intel document > number 245318-003), where there's a whole section on implementing > synchronization primitives on IA84; it also has an atomic FETCHADD > instruction which I didn't bother to look more closely at. John Baldwin said: | Well, SMP on Pentium's maybe, but not on Alpha, sparc64, or ia64, all of which | support OOE and looser memory models than x86, meaning that you really need | locks unless you are going to have 386-specific code all over the place. I | suppose you can wrap it behind an MI API but that seems like a lot of work for | fairly small gain that can end up making the code uglier. So you can argue it out with him, Garrett. Meanwhile, with a 32 bit cmpxchg, I don't need locks at all, unless I want 64 bit counters so I can measure the wrong thing. -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C48FCEF.9190CA08>