Date: Sat, 16 Dec 2000 10:41:24 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: =?ISO-8859-1?Q?G=E9rard_Roudier?= <groudier@club-internet.fr> Cc: Bernd Walter <ticso@cicely5.cicely.de>, freebsd-alpha@FreeBSD.org Subject: RE: mb and wmb in atomic_ Message-ID: <XFMail.001216104124.jhb@FreeBSD.org> In-Reply-To: <Pine.LNX.4.10.10012160938330.918-100000@linux.local>
next in thread | previous in thread | raw e-mail | index | archive | help
>> Also, note that in FreeBSD, >> we have specific variants of atomic operations that include memory barriers >> (see the atomic(9) manpage in -current). If the actual atomicity of the >> operation doesn't need the mb, they should be removed. > > Atomicity seems here for both Alpha and i386. > > About Alpha, I doubt that using wmb() is a good idea, given that its does > not guarantee ordering of memory-like with respect to non memory-like and > this may lead to incorrect assumption from programmer when the both kinds > of memory are used (device drivers for example). From src/sys/alpha/include/alpha_cpu.h: static __inline void alpha_wmb(void) { /* * XXX dfr: NetBSD originally had mb instead of wmb for * alpha_wmb(). I'm not sure why so I'm leaving it alone. I * think it should be safe to use wmb though. */ __asm__ __volatile__ ("mb"); } > About i386 I donnot seem to see the promised read barrier for the > atomic_load_acq_X() primitives. Note that I also donnot see where such > primitive might be useful. :-) > Anyway, they seems wrong to me given that Pentia II and above may reorder > LOADs and LOADs against STOREs. We are only guaranteed STOREs to be > carried out to system BUS in processor order when cachable is involved, > and hitting non-cachable to insert implicit barriers. I'll have to look at this next week. So far only atomic_store_rel() has been used for the mutex operations. It could be that I need to change those to use lock'd cmpxchgl's in order to enforce ordering. > Gérard. -- John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.Baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-alpha" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.001216104124.jhb>