The following patch adds requeue pi support for i386 arch. It closely follows
the x86_64 implementation in current git. This is an RFC as it has atleast one
bug that is yet to be resolved, details below. Appreciate the review !
One important change (it needs to be changed in x86_64 as well) though,
specifically check the return code from the futex requeue pi call for
ENOSYS and only then use the non requeue pi functionality. For other
errors (such as EAGAIN etc), just return back to the application.
This is required as the kernel now treats mixing requeue pi and non requeue
pi APIs as an EINVAL (and rightly so). I'll be sending a separate patch
to modify the x86_64 implementation
The patch is against latest glibc git (13 Aug 2009)
Testing: prio-wake testcase (Part of the LTP realtime testcases) passes
with this patch. However some long running java tests randomly hang.
Attaching and detaching gdb to the hung process results in the process
continuing. I'm suspecting that the internal counters are getting
messed up in an error path somewhere and we are missing a wake,
still debugging this
-Dinakar
diff -X ignore -Nurp glibc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S glibc.mod/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
--- glibc/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S 2009-08-13 04:13:10.000000000 -0700
+++ glibc.mod/nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S 2009-08-13 23:47:08.000000000 -0700
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2004, 2006, 2007, 2009 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -90,12 +90,14 @@ __pthread_cond_broadcast:
8: cmpl $-1, %edi
je 9f
- /* XXX: The kernel so far doesn't support requeue to PI futex. */
- /* XXX: The kernel only supports FUTEX_CMP_REQUEUE to the same
- type of futex (private resp. shared). */