svn commit: r244793 - in user/attilio/membarclean/dev: drm drm2 netmap virtio

David Chisnall theraven at FreeBSD.org
Fri Dec 28 23:00:25 UTC 2012


On 28 Dec 2012, at 22:43, Bryan Venteicher wrote:

> VirtIO uses 16-bit fields which makes it hard to adapt to MI
> atomic(9). 

At some point, we should start deprecating atomic(9) and moving to the C11 standard versions of the same functions.  These are implemented in recent clang and gcc as builtins, which provides the compiler much better optimisation opportunities, because it can reorder instructions that do not touch memory around them and can reorder any loads and stores that would not violate the happens-before relationships established by the barrier semantics (the inline asm is always a full barrier, from the perspective of the compiler, though not from the perspective of the CPU, meaning that we penalise in-order architectures).  

It can also ensure that sufficient padding exists.  For example, an _Atomic(short) on ARM should have 2 bytes of padding so that it can be used in an ll / sc pair.  The standard explicitly does not permit arbitrary casts between pointers to T and _Atomic(T) for this reason.  Finally, the _Atomic qualifier can statically check that atomic and non-atomic operations are not mixed on the same type, avoiding races.

David
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.freebsd.org/pipermail/svn-src-user/attachments/20121228/fbdce2bf/attachment.sig>


More information about the svn-src-user mailing list