summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glibc/glibc/0006-Fix-atomic_fetch_xor_release.patch
diff options
context:
space:
mode:
authorCatalin Enache <catalin.enache@windriver.com>2017-07-07 19:43:34 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-29 16:50:53 +0100
commite6955b7d0de1900bfc3c8e83a5a00b2604f10916 (patch)
tree778c38ead0535bf9e6676d589fab755567e8bf05 /meta/recipes-core/glibc/glibc/0006-Fix-atomic_fetch_xor_release.patch
parent5b2a7393f98081946e30e311e7277d253f6ddd9a (diff)
downloadpoky-e6955b7d0de1900bfc3c8e83a5a00b2604f10916.tar.gz
glibc: fix pthread_cond_broadcast issue (arm)
pthread_mutex functions such as pthread_cond_wait(), pthread_mutex_unlock() return errors after PTHREAD_PRIO_INHERIT is enabled Reference: https://sourceware.org/bugzilla/show_bug.cgi?id=18463 Upstream patches: https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=f0e3925bf3b8df6940c3346db17e42615979d458 https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=13cb8f76da9d9420330796f469dbf10643ba5b12 https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=23b5cae1af04f2d912910fdaf73cb482265798c1 https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=ed19993b5b0d05d62cc883571519a67dae481a14 https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=2e4cf778972573221e9b87fd992844ea9b67b9bf https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=abff18c0c6055ca5d1cd46923fd1205c057139a5 This issue is Morty specific (glibc 2.24). The issue is no longer present in glibc 2.25 (master branch). (From OE-Core rev: 6dc1f1c3cc871d00ecd59d5aeeef86b7e6965750) Signed-off-by: Catalin Enache <catalin.enache@windriver.com> Signed-off-by: Armin Kuster <akuster808@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/glibc/glibc/0006-Fix-atomic_fetch_xor_release.patch')
-rw-r--r--meta/recipes-core/glibc/glibc/0006-Fix-atomic_fetch_xor_release.patch81
1 files changed, 81 insertions, 0 deletions
diff --git a/meta/recipes-core/glibc/glibc/0006-Fix-atomic_fetch_xor_release.patch b/meta/recipes-core/glibc/glibc/0006-Fix-atomic_fetch_xor_release.patch
new file mode 100644
index 0000000000..7616efa183
--- /dev/null
+++ b/meta/recipes-core/glibc/glibc/0006-Fix-atomic_fetch_xor_release.patch
@@ -0,0 +1,81 @@
1From b671f20cc160238b62894d032a55baf85867106e Mon Sep 17 00:00:00 2001
2From: Catalin Enache <catalin.enache@windriver.com>
3Date: Fri, 30 Jun 2017 19:12:43 +0300
4Subject: [PATCH 6/6] Fix atomic_fetch_xor_release.
5
6No code uses atomic_fetch_xor_release except for the upcoming
7conditional variable rewrite. Therefore there is no user
8visible bug here. The use of atomic_compare_and_exchange_bool_rel
9is removed (since it doesn't exist anymore), and is replaced
10by atomic_compare_exchange_weak_release.
11
12We use weak_release because it provides better performance in
13the loop (the weak semantic) and because the xor is release MO
14(the release semantic). We don't reload expected in the loop
15because atomic_compare_and_exchange_weak_release does this for
16us as part of the CAS failure.
17
18It is otherwise a fairly plain conversion that fixes building
19the new condvar for 32-bit x86. Passes all regression tests
20for x86.
21
22Upstream-Status: Backport
23
24Author: Carlos O'Donell <carlos@systemhalted.org>
25Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
26---
27 ChangeLog | 6 ++++++
28 include/atomic.h | 19 +++++++++++--------
29 2 files changed, 17 insertions(+), 8 deletions(-)
30
31diff --git a/ChangeLog b/ChangeLog
32index 44c518b..893262d 100644
33--- a/ChangeLog
34+++ b/ChangeLog
35@@ -1,3 +1,9 @@
36+2016-10-26 Carlos O'Donell <carlos@redhat.com>
37+
38+ * include/atomic.h
39+ [USE_COMPILER_ATOMIC_BUILTINS && !atomic_fetch_xor_release]
40+ (atomic_fetch_xor_release): Use atomic_compare_exchange_weak_release.
41+
42 2017-04-04 Adhemerval Zanella <adhemerval.zanella@linaro.org>
43
44 * nptl/pthreadP.h (USE_REQUEUE_PI): Remove ununsed macro.
45diff --git a/include/atomic.h b/include/atomic.h
46index 5a8e7e7..c8b4664 100644
47--- a/include/atomic.h
48+++ b/include/atomic.h
49@@ -777,18 +777,21 @@ void __atomic_link_error (void);
50 # endif
51
52 # ifndef atomic_fetch_xor_release
53+/* Failing the atomic_compare_exchange_weak_release reloads the value in
54+ __atg104_expected, so we need only do the XOR again and retry. */
55 # define atomic_fetch_xor_release(mem, operand) \
56- ({ __typeof (*(mem)) __atg104_old; \
57- __typeof (mem) __atg104_memp = (mem); \
58+ ({ __typeof (mem) __atg104_memp = (mem); \
59+ __typeof (*(mem)) __atg104_expected = (*__atg104_memp); \
60+ __typeof (*(mem)) __atg104_desired; \
61 __typeof (*(mem)) __atg104_op = (operand); \
62 \
63 do \
64- __atg104_old = (*__atg104_memp); \
65- while (__builtin_expect \
66- (atomic_compare_and_exchange_bool_rel ( \
67- __atg104_memp, __atg104_old ^ __atg104_op, __atg104_old), 0));\
68- \
69- __atg104_old; })
70+ __atg104_desired = __atg104_expected ^ __atg104_op; \
71+ while (__glibc_unlikely \
72+ (atomic_compare_exchange_weak_release ( \
73+ __atg104_memp, &__atg104_expected, __atg104_desired) \
74+ == 0)); \
75+ __atg104_expected; })
76 #endif
77
78 #endif /* !USE_ATOMIC_COMPILER_BUILTINS */
79--
802.10.2
81