diff options
| author | Sunil Dora <sunilkumar.dora@windriver.com> | 2025-06-17 03:08:53 -0700 |
|---|---|---|
| committer | Steve Sakoman <steve@sakoman.com> | 2025-06-20 08:06:30 -0700 |
| commit | 614a3abb3a2a8cf84d4090f18c89540232dffccd (patch) | |
| tree | 7074d610730ab4e4ef0059e503f7bf981dd44406 /meta/recipes-core | |
| parent | 548a08daabc1ab4120a188f13ee8112a1a7eca29 (diff) | |
| download | poky-614a3abb3a2a8cf84d4090f18c89540232dffccd.tar.gz | |
glibc: nptl Fix indentation
The following commits have been cherry-picked from Glibc master branch:
Bug : https://sourceware.org/bugzilla/show_bug.cgi?id=25847
Upstream-Status: Backport
[https://sourceware.org/git/?p=glibc.git;a=commit;h=ee6c14ed59d480720721aaacc5fb03213dc153da]
(From OE-Core rev: e4b4cd362cfcb7fd6517165ae59cb218420b9039)
Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-core')
| -rw-r--r-- | meta/recipes-core/glibc/glibc/0026-PR25847-6.patch | 169 | ||||
| -rw-r--r-- | meta/recipes-core/glibc/glibc_2.35.bb | 1 |
2 files changed, 170 insertions, 0 deletions
diff --git a/meta/recipes-core/glibc/glibc/0026-PR25847-6.patch b/meta/recipes-core/glibc/glibc/0026-PR25847-6.patch new file mode 100644 index 0000000000..cf87e21ddd --- /dev/null +++ b/meta/recipes-core/glibc/glibc/0026-PR25847-6.patch | |||
| @@ -0,0 +1,169 @@ | |||
| 1 | From a2faee6d0dac6e5232255da9afda4d9ed6cfb6e5 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Malte Skarupke <malteskarupke@fastmail.fm> | ||
| 3 | Date: Tue, 17 Jun 2025 01:37:12 -0700 | ||
| 4 | Subject: [PATCH] nptl: Fix indentation | ||
| 5 | |||
| 6 | In my previous change I turned a nested loop into a simple loop. I'm doing | ||
| 7 | the resulting indentation changes in a separate commit to make the diff on | ||
| 8 | the previous commit easier to review. | ||
| 9 | |||
| 10 | The following commits have been cherry-picked from Glibc master branch: | ||
| 11 | Bug : https://sourceware.org/bugzilla/show_bug.cgi?id=25847 | ||
| 12 | |||
| 13 | Upstream-Status: Backport | ||
| 14 | [https://sourceware.org/git/?p=glibc.git;a=commit;h=ee6c14ed59d480720721aaacc5fb03213dc153da] | ||
| 15 | |||
| 16 | Signed-off-by: Sunil Dora <sunilkumar.dora@windriver.com> | ||
| 17 | --- | ||
| 18 | nptl/pthread_cond_wait.c | 132 ++++++++++++++++----------------------- | ||
| 19 | 1 file changed, 54 insertions(+), 78 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/nptl/pthread_cond_wait.c b/nptl/pthread_cond_wait.c | ||
| 22 | index 5c86880105..104ebd48ca 100644 | ||
| 23 | --- a/nptl/pthread_cond_wait.c | ||
| 24 | +++ b/nptl/pthread_cond_wait.c | ||
| 25 | @@ -410,87 +410,63 @@ __pthread_cond_wait_common (pthread_cond_t *cond, pthread_mutex_t *mutex, | ||
| 26 | return err; | ||
| 27 | } | ||
| 28 | |||
| 29 | - | ||
| 30 | - while (1) | ||
| 31 | - { | ||
| 32 | - /* Now wait until a signal is available in our group or it is closed. | ||
| 33 | - Acquire MO so that if we observe (signals == lowseq) after group | ||
| 34 | - switching in __condvar_quiesce_and_switch_g1, we synchronize with that | ||
| 35 | - store and will see the prior update of __g1_start done while switching | ||
| 36 | - groups too. */ | ||
| 37 | - unsigned int signals = atomic_load_acquire (cond->__data.__g_signals + g); | ||
| 38 | - uint64_t g1_start = __condvar_load_g1_start_relaxed (cond); | ||
| 39 | - unsigned int lowseq = (g1_start & 1) == g ? signals : g1_start & ~1U; | ||
| 40 | - | ||
| 41 | - if (seq < (g1_start >> 1)) | ||
| 42 | - { | ||
| 43 | - /* If the group is closed already, | ||
| 44 | - then this waiter originally had enough extra signals to | ||
| 45 | - consume, up until the time its group was closed. */ | ||
| 46 | - break; | ||
| 47 | - } | ||
| 48 | - | ||
| 49 | - /* If there is an available signal, don't block. | ||
| 50 | - If __g1_start has advanced at all, then we must be in G1 | ||
| 51 | - by now, perhaps in the process of switching back to an older | ||
| 52 | - G2, but in either case we're allowed to consume the available | ||
| 53 | - signal and should not block anymore. */ | ||
| 54 | - if ((int)(signals - lowseq) >= 2) | ||
| 55 | - { | ||
| 56 | - /* Try to grab a signal. See above for MO. (if we do another loop | ||
| 57 | - iteration we need to see the correct value of g1_start) */ | ||
| 58 | - if (atomic_compare_exchange_weak_acquire ( | ||
| 59 | - cond->__data.__g_signals + g, | ||
| 60 | + while (1) | ||
| 61 | + { | ||
| 62 | + /* Now wait until a signal is available in our group or it is closed. | ||
| 63 | + Acquire MO so that if we observe (signals == lowseq) after group | ||
| 64 | + switching in __condvar_quiesce_and_switch_g1, we synchronize with that | ||
| 65 | + store and will see the prior update of __g1_start done while switching | ||
| 66 | + groups too. */ | ||
| 67 | + unsigned int signals = atomic_load_acquire (cond->__data.__g_signals + g); | ||
| 68 | + uint64_t g1_start = __condvar_load_g1_start_relaxed (cond); | ||
| 69 | + unsigned int lowseq = (g1_start & 1) == g ? signals : g1_start & ~1U; | ||
| 70 | + | ||
| 71 | + if (seq < (g1_start >> 1)) | ||
| 72 | + { | ||
| 73 | + /* If the group is closed already, | ||
| 74 | + then this waiter originally had enough extra signals to | ||
| 75 | + consume, up until the time its group was closed. */ | ||
| 76 | + break; | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + /* If there is an available signal, don't block. | ||
| 80 | + If __g1_start has advanced at all, then we must be in G1 | ||
| 81 | + by now, perhaps in the process of switching back to an older | ||
| 82 | + G2, but in either case we're allowed to consume the available | ||
| 83 | + signal and should not block anymore. */ | ||
| 84 | + if ((int)(signals - lowseq) >= 2) | ||
| 85 | + { | ||
| 86 | + /* Try to grab a signal. See above for MO. (if we do another loop | ||
| 87 | + iteration we need to see the correct value of g1_start) */ | ||
| 88 | + if (atomic_compare_exchange_weak_acquire ( | ||
| 89 | + cond->__data.__g_signals + g, | ||
| 90 | &signals, signals - 2)) | ||
| 91 | - break; | ||
| 92 | - else | ||
| 93 | - continue; | ||
| 94 | - } | ||
| 95 | - /* No signals available after spinning, so prepare to block. | ||
| 96 | - We first acquire a group reference and use acquire MO for that so | ||
| 97 | - that we synchronize with the dummy read-modify-write in | ||
| 98 | - __condvar_quiesce_and_switch_g1 if we read from that. In turn, | ||
| 99 | - in this case this will make us see the advancement of __g_signals | ||
| 100 | - to the upcoming new g1_start that occurs with a concurrent | ||
| 101 | - attempt to reuse the group's slot. | ||
| 102 | - We use acquire MO for the __g_signals check to make the | ||
| 103 | - __g1_start check work (see spinning above). | ||
| 104 | - Note that the group reference acquisition will not mask the | ||
| 105 | - release MO when decrementing the reference count because we use | ||
| 106 | - an atomic read-modify-write operation and thus extend the release | ||
| 107 | - sequence. */ | ||
| 108 | - atomic_fetch_add_acquire (cond->__data.__g_refs + g, 2); | ||
| 109 | - | ||
| 110 | - // Now block. | ||
| 111 | - struct _pthread_cleanup_buffer buffer; | ||
| 112 | - struct _condvar_cleanup_buffer cbuffer; | ||
| 113 | - cbuffer.wseq = wseq; | ||
| 114 | - cbuffer.cond = cond; | ||
| 115 | - cbuffer.mutex = mutex; | ||
| 116 | - cbuffer.private = private; | ||
| 117 | - __pthread_cleanup_push (&buffer, __condvar_cleanup_waiting, &cbuffer); | ||
| 118 | - | ||
| 119 | - err = __futex_abstimed_wait_cancelable64 ( | ||
| 120 | - cond->__data.__g_signals + g, signals, clockid, abstime, private); | ||
| 121 | - | ||
| 122 | - __pthread_cleanup_pop (&buffer, 0); | ||
| 123 | - | ||
| 124 | - if (__glibc_unlikely (err == ETIMEDOUT || err == EOVERFLOW)) | ||
| 125 | - { | ||
| 126 | - __condvar_dec_grefs (cond, g, private); | ||
| 127 | - /* If we timed out, we effectively cancel waiting. Note that | ||
| 128 | - we have decremented __g_refs before cancellation, so that a | ||
| 129 | - deadlock between waiting for quiescence of our group in | ||
| 130 | - __condvar_quiesce_and_switch_g1 and us trying to acquire | ||
| 131 | - the lock during cancellation is not possible. */ | ||
| 132 | - __condvar_cancel_waiting (cond, seq, g, private); | ||
| 133 | - result = err; | ||
| 134 | break; | ||
| 135 | - } | ||
| 136 | - else | ||
| 137 | - __condvar_dec_grefs (cond, g, private); | ||
| 138 | - | ||
| 139 | + else | ||
| 140 | + continue; | ||
| 141 | } | ||
| 142 | + // Now block. | ||
| 143 | + struct _pthread_cleanup_buffer buffer; | ||
| 144 | + struct _condvar_cleanup_buffer cbuffer; | ||
| 145 | + cbuffer.wseq = wseq; | ||
| 146 | + cbuffer.cond = cond; | ||
| 147 | + cbuffer.mutex = mutex; | ||
| 148 | + cbuffer.private = private; | ||
| 149 | + __pthread_cleanup_push (&buffer, __condvar_cleanup_waiting, &cbuffer); | ||
| 150 | + | ||
| 151 | + err = __futex_abstimed_wait_cancelable64 ( | ||
| 152 | + cond->__data.__g_signals + g, signals, clockid, abstime, private); | ||
| 153 | + | ||
| 154 | + __pthread_cleanup_pop (&buffer, 0); | ||
| 155 | + | ||
| 156 | + if (__glibc_unlikely (err == ETIMEDOUT || err == EOVERFLOW)) | ||
| 157 | + { | ||
| 158 | + /* If we timed out, we effectively cancel waiting. */ | ||
| 159 | + __condvar_cancel_waiting (cond, seq, g, private); | ||
| 160 | + result = err; | ||
| 161 | + break; | ||
| 162 | + } | ||
| 163 | + } | ||
| 164 | |||
| 165 | /* Confirm that we have been woken. We do that before acquiring the mutex | ||
| 166 | to allow for execution of pthread_cond_destroy while having acquired the | ||
| 167 | -- | ||
| 168 | 2.49.0 | ||
| 169 | |||
diff --git a/meta/recipes-core/glibc/glibc_2.35.bb b/meta/recipes-core/glibc/glibc_2.35.bb index 04dcb22c3d..d3c0cbd703 100644 --- a/meta/recipes-core/glibc/glibc_2.35.bb +++ b/meta/recipes-core/glibc/glibc_2.35.bb | |||
| @@ -67,6 +67,7 @@ SRC_URI = "${GLIBC_GIT_URI};branch=${SRCBRANCH};name=glibc \ | |||
| 67 | file://0026-PR25847-3.patch \ | 67 | file://0026-PR25847-3.patch \ |
| 68 | file://0026-PR25847-4.patch \ | 68 | file://0026-PR25847-4.patch \ |
| 69 | file://0026-PR25847-5.patch \ | 69 | file://0026-PR25847-5.patch \ |
| 70 | file://0026-PR25847-6.patch \ | ||
| 70 | \ | 71 | \ |
| 71 | file://0001-Revert-Linux-Implement-a-useful-version-of-_startup_.patch \ | 72 | file://0001-Revert-Linux-Implement-a-useful-version-of-_startup_.patch \ |
| 72 | file://0002-get_nscd_addresses-Fix-subscript-typos-BZ-29605.patch \ | 73 | file://0002-get_nscd_addresses-Fix-subscript-typos-BZ-29605.patch \ |
