This is the mail archive of the
glibc-cvs@sourceware.org
mailing list for the glibc project.
GNU C Library master sources branch master updated. glibc-2.24-362-ga329844
- From: cmetcalf at sourceware dot org
- To: glibc-cvs at sourceware dot org
- Date: 11 Nov 2016 01:14:09 -0000
- Subject: GNU C Library master sources branch master updated. glibc-2.24-362-ga329844
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".
The branch, master has been updated
via a329844ff8adaffc25343a6f9bb12a3a9e841018 (commit)
from b4e75104b432e86dc8e308e8f58391bee6b33d78 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=a329844ff8adaffc25343a6f9bb12a3a9e841018
commit a329844ff8adaffc25343a6f9bb12a3a9e841018
Author: Chris Metcalf <cmetcalf@mellanox.com>
Date: Thu Nov 10 20:08:24 2016 -0500
Make sure tilepro uses kernel atomics fo atomic_store
It's not legal for raw stores to be mixed with atomic operations
on tilepro, since the atomics are managed by kernel fast syscalls.
It's possible for a hardware store and a kernel fast atomic to race
with each other in such a way that the hardware store is lost.
Suppose you have an initial zero value, and you race with a store
of 2 and a kernel cmpxchg from 0 to 1. The legal output is only 2:
either the store hit first and the cmpxchg failed, or the cmpxchg
hit first and succeeded, then was overwritten by the 2. But if
the kernel cmpxchg starts first and loads the zero, then the store
hits and sets the value to 2, the cmpxchg will still decide it was
successful and write the 1, leaving the value illegally set to 1.
Using atomic_exchange variants to implement atomic_store fixes this
problem for tilepro.
diff --git a/ChangeLog b/ChangeLog
index 40ef733..262069d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-11-10 Chris Metcalf <cmetcalf@mellanox.com>
+
+ * sysdeps/tile/tilepro/atomic-machine.h (atomic_store_relaxed)
+ (atomic_store_release): Provide tilepro-specific implementations.
+
2016-11-10 Joseph Myers <joseph@codesourcery.com>
* math/math.h (__MATH_TG): New macro.
diff --git a/sysdeps/tile/tilepro/atomic-machine.h b/sysdeps/tile/tilepro/atomic-machine.h
index 702e17d..5365929 100644
--- a/sysdeps/tile/tilepro/atomic-machine.h
+++ b/sysdeps/tile/tilepro/atomic-machine.h
@@ -83,6 +83,16 @@ int __atomic_update_32 (volatile int *mem, int mask, int addend)
({ __typeof (mask) __att1_v = (mask); \
__atomic_update ((mem), ~__att1_v, __att1_v); })
+/*
+ * We must use the kernel atomics for atomic_store, since otherwise an
+ * unsynchronized store could become visible after another core's
+ * kernel-atomic implementation had read the memory word in question,
+ * but before it had written the updated value to it, which would
+ * cause the unsynchronized store to be lost.
+ */
+#define atomic_store_relaxed(mem, val) atomic_exchange_acq (mem, val)
+#define atomic_store_release(mem, val) atomic_exchange_rel (mem, val)
+
#include <sysdeps/tile/atomic-machine.h>
#endif /* atomic-machine.h */
-----------------------------------------------------------------------
Summary of changes:
ChangeLog | 5 +++++
sysdeps/tile/tilepro/atomic-machine.h | 10 ++++++++++
2 files changed, 15 insertions(+), 0 deletions(-)
hooks/post-receive
--
GNU C Library master sources