Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 5 Feb 2014 18:06:05 -0500
From: Rich Felker <dalias@...ifal.cx>
To: musl@...ts.openwall.com
Cc: Matthew Fernandez <matthew.fernandez@...ta.com.au>
Subject: Re: 64-bit atomic ops on 32-bit ARM

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

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.