From 0f6595ecf58f103c0688302f219759d593d39fb2 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Fri, 10 Feb 2012 12:56:02 -0700 Subject: [PATCH] Fix lost wakeups in pthread_cond_*. (#552960, #769421) --- glibc-rh552960-2.patch | 27 +++++++++++++++++++++++++++ glibc.spec | 6 +++--- 2 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 glibc-rh552960-2.patch diff --git a/glibc-rh552960-2.patch b/glibc-rh552960-2.patch new file mode 100644 index 0000000..3859a32 --- /dev/null +++ b/glibc-rh552960-2.patch @@ -0,0 +1,27 @@ +diff -rup a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S +--- a/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S 2012-02-10 12:49:42.609737373 -0700 ++++ b/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S 2012-02-10 12:52:00.962150379 -0700 +@@ -438,6 +438,10 @@ __pthread_cond_wait: + addl $1, cond_futex(%ebx) + movl cond_futex(%ebx), %ebp + ++ /* Increment total_seq to ensure we do not lose wakeups. */ ++ addl $1, total_seq(%ebx) ++ adcl $0, total_seq+4(%ebx) ++ + /* Unlock. */ + LOCK + #if cond_lock == 0 +diff -rup a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S +--- a/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S 2012-02-10 12:49:42.612737361 -0700 ++++ b/nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S 2012-02-10 12:52:36.179000963 -0700 +@@ -366,6 +366,9 @@ __pthread_cond_wait: + incl cond_futex(%rdi) + movl cond_futex(%rdi), %edx + ++ /* Increment total_seq to ensure we do not lose wakeups. */ ++ incq total_seq(%rdi) ++ + /* Release internal lock. */ + LOCK + #if cond_lock == 0 diff --git a/glibc.spec b/glibc.spec index 23f3738..c20f94a 100644 --- a/glibc.spec +++ b/glibc.spec @@ -51,9 +51,8 @@ Patch3: %{name}-rh757881.patch Patch4: %{name}-rh740506.patch # Not sure of upstream status Patch5: %{name}-rh730856.patch -# Reverting an upstream patch. I don't think this has been discussed upstream yet. -# Caused a variety of problems for Fedora & Debian -Patch6: %{name}-rh769421.patch +# Follow-on to 552960's original patch to avoid losing wakeups +Patch6: %{name}-rh552960-2.patch Patch7: %{name}-rh729661.patch Patch8: %{name}-rh446078.patch Patch9: %{name}-rh454629.patch @@ -1185,6 +1184,7 @@ rm -f *.filelist* %changelog * Fri Feb 8 2012 Jeff Law - 2.15-17 + - Fix lost wakeups in pthread_cond_*. (#552960, #769421) - Clarify info page for snprintf (#564528) - Fix first_weekday and first_workday for ru_UA (#624296)