From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4542 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: 64-bit atomic ops on 32-bit ARM Date: Wed, 5 Feb 2014 18:06:05 -0500 Message-ID: <20140205230605.GG15627@brightrain.aerifal.cx> References: <52F2C1AF.8020903@nicta.com.au> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1391641579 26782 80.91.229.3 (5 Feb 2014 23:06:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Feb 2014 23:06:19 +0000 (UTC) Cc: Matthew Fernandez To: musl@lists.openwall.com Original-X-From: musl-return-4546-gllmg-musl=m.gmane.org@lists.openwall.com Thu Feb 06 00:06:25 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WBBXw-0003SS-Qb for gllmg-musl@plane.gmane.org; Thu, 06 Feb 2014 00:06:20 +0100 Original-Received: (qmail 11368 invoked by uid 550); 5 Feb 2014 23:06:19 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 11358 invoked from network); 5 Feb 2014 23:06:19 -0000 Content-Disposition: inline In-Reply-To: <52F2C1AF.8020903@nicta.com.au> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:4542 Archived-At: On Thu, Feb 06, 2014 at 09:56:47AM +1100, Matthew Fernandez wrote: > Hi all, > > The header atomic.h contains a couple of functions for operations on 64-bit types. Despite their > name, these do not appear to be atomic to me. For example: > > static inline void a_and_64(volatile uint64_t *p, uint64_t v) The function name is simply a misnomer. It should be called "atomic bitclear" (and, for "or", "atomic bitset). That's the only way it's actually used. In other words we don't care that the and/or operation on both words happen atomically with respect to one another, only that each bit individually behaves atomically with respect to being set and cleared. BTW, changing the name and semantics would also allow us to drop from performing two atomic operations to just performing on atomic operation (on the word that actually needs to change). This would be a fairly significant optimization, I think. But for now it's not a bug, just a missed optimization. Rich