Date: Thu, 18 Sep 2003 01:22:59 -0700 From: Terry Lambert <tlambert2@mindspring.com> To: frank@exit.com Cc: smp@freebsd.org Subject: Re: atomicity of unlocked reads Message-ID: <3F696B63.A5F36511@mindspring.com> References: <200309171750.h8HHowEf092627@realtime.exit.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Frank Mayhar wrote: > John Baldwin wrote: > > I think you can assume that the read will be atomic. I don't think FreeBSD > > would work very well on a machine where aligned pointer reads/writes weren't > > atomic. > > I dunno, I tend to think that making such assumptions may well come back to > bite me in the ass when I least expect it. In such situation, I invariably > use some kind of "atomic_xxx_load/store" primitive that does the job safely > and in a machine-dependent way while hiding the details from the MI code. > > Just call me paranoid. It would definitely bite you on an MP PPC machine, which can do the operations non-atomically, branch-predictively, and doesn't support a "lock" prefix to its instructions. One of the side effects of doing a lock is that you will get an idync and dsync that flush the data and instruction caches, and ensure cache line coherency between processors. It would probably bite you on a SPARC as well, unless you explicitly flushed your register windows before and after the operation (and even then, you would likely need additional voodoo for anything over 4 CPUs, the way they do things). -- Terry
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3F696B63.A5F36511>