Skip to content

Commit

Permalink
* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_PSELECT,
Browse files Browse the repository at this point in the history
	__ASSUME_PPOLL, __ASSUME_ATFCTS, __ASSUME_SET_ROBUST_LIST,
	__ASSUME_UTIMENSAT, __ASSUME_FALLOCATE): Update per-arch conditions
	when each feature was introduced.

	* sysdeps/unix/sysv/linux/dl-vdso.c: Don't include dl-hash.h.
	* sysdeps/unix/sysv/linux/dl-vdso.h: Don't include dl-hash.h if NDEBUG.
	(CHECK_HASH): New macro.
	(PREPARE_VERSION): Use it.

	* sysdeps/unix/sysv/linux/pselect.c (__generic_pselect): Only provide
	prototype if not __ASSUME_PSELECT.
	* sysdeps/unix/sysv/linux/ppoll.c (__generic_ppoll): Only provide
	prototype if not __ASSUME_PPOLL.

	* sysdeps/unix/sysv/linux/dl-osinfo.h (ROUND): #undef after use.

	* sysdeps/unix/clock_settime.c (freq, __pthread_clock_settime,
	hp_timing_settime): Don't define or declare if HANDLED_CPUTIME
	is defined.
  • Loading branch information
Ulrich Drepper committed Aug 14, 2007
1 parent 4baf59a commit 22502ea
Show file tree
Hide file tree
Showing 21 changed files with 465 additions and 103 deletions.
23 changes: 23 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
2007-08-13 Jakub Jelinek <jakub@redhat.com>

* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_PSELECT,
__ASSUME_PPOLL, __ASSUME_ATFCTS, __ASSUME_SET_ROBUST_LIST,
__ASSUME_UTIMENSAT, __ASSUME_FALLOCATE): Update per-arch conditions
when each feature was introduced.

* sysdeps/unix/sysv/linux/dl-vdso.c: Don't include dl-hash.h.
* sysdeps/unix/sysv/linux/dl-vdso.h: Don't include dl-hash.h if NDEBUG.
(CHECK_HASH): New macro.
(PREPARE_VERSION): Use it.

* sysdeps/unix/sysv/linux/pselect.c (__generic_pselect): Only provide
prototype if not __ASSUME_PSELECT.
* sysdeps/unix/sysv/linux/ppoll.c (__generic_ppoll): Only provide
prototype if not __ASSUME_PPOLL.

* sysdeps/unix/sysv/linux/dl-osinfo.h (ROUND): #undef after use.

* sysdeps/unix/clock_settime.c (freq, __pthread_clock_settime,
hp_timing_settime): Don't define or declare if HANDLED_CPUTIME
is defined.

2007-08-13 Ulrich Drepper <drepper@redhat.com>

* sysdeps/unix/sysv/linux/x86_64/libc-start.c
Expand Down
37 changes: 37 additions & 0 deletions nptl/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
2007-08-13 Jakub Jelinek <jakub@redhat.com>

* sysdeps/unix/sysv/linux/i386/lowlevellock.h (__lll_private_flag):
Fix a pasto.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
(__pthread_cond_broadcast): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
Don't use FUTEX_CMP_REQUEUE if dep_mutex is not process private.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
(__pthread_cond_signal): Pass LLL_PRIVATE to lll_* and or
FUTEX_PRIVATE_FLAG into SYS_futex op if cv is process private.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_wait.S: Include
kernel-features.h.
(__pthread_cond_wait, __condvar_w_cleanup): Pass LLL_PRIVATE to
lll_* and or FUTEX_PRIVATE_FLAG into SYS_futex op if cv is
process private. Switch DW_CFA_advance_loc1 and some
DW_CFA_advance_loc .eh_frame opcodes to DW_CFA_advance_loc4.
* sysdeps/unix/sysv/linux/i386/i486/pthread_cond_timedwait.S
(__pthread_cond_timedwait, __condvar_tw_cleanup): Pass LLL_PRIVATE to
lll_* and or FUTEX_PRIVATE_FLAG into SYS_futex op if cv is
process private. Switch DW_CFA_advance_loc{1,2} and some
DW_CFA_advance_loc .eh_frame opcodes to DW_CFA_advance_loc4.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_rdlock.S: Use
#ifdef __ASSUME_PRIVATE_FUTEX instead of #if __ASSUME_PRIVATE_FUTEX.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedwrlock.S:
Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_unlock.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_wrlock.S: Likewise.
* sysdeps/unix/sysv/linux/i386/i486/pthread_rwlock_timedrdlock.S:
Likewise.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_broadcast.S
(__pthread_cond_broadcast): Compare %r8 instead of
dep_mutex-cond_*(%rdi) with $-1.
* sysdeps/unix/sysv/linux/x86_64/pthread_cond_signal.S
(__pthread_cond_signal): Xor FUTEX_WAKE_OP with FUTEX_WAKE instead
of oring.

2007-08-13 Ulrich Drepper <drepper@redhat.com>

* sysdeps/unix/sysv/linux/i386/i786/Implies: New file.
Expand Down
60 changes: 51 additions & 9 deletions nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_broadcast.S
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,18 @@ __pthread_cond_broadcast:
je 9f

/* XXX: The kernel so far doesn't support requeue to PI futex. */
testl $PI_BIT, MUTEX_KIND(%edi)
/* XXX: The kernel only supports FUTEX_CMP_REQUEUE to the same
type of futex (private resp. shared). */
testl $(PI_BIT | PS_BIT), MUTEX_KIND(%edi)
jne 9f

/* Wake up all threads. */
movl $FUTEX_CMP_REQUEUE, %ecx
#ifdef __ASSUME_PRIVATE_FUTEX
movl $(FUTEX_CMP_REQUEUE|FUTEX_PRIVATE_FLAG), %ecx
#else
movl %gs:PRIVATE_FUTEX, %ecx
orl $FUTEX_CMP_REQUEUE, %ecx
#endif
movl $SYS_futex, %eax
movl $0x7fffffff, %esi
movl $1, %edx
Expand Down Expand Up @@ -132,28 +139,63 @@ __pthread_cond_broadcast:
#else
leal cond_lock(%ebx), %edx
#endif
/* XYZ */
movl $LLL_SHARED, %ecx
#if (LLL_SHARED-LLL_PRIVATE) > 255
xorl %ecx, %ecx
#endif
cmpl $-1, dep_mutex(%ebx)
setne %cl
subl $1, %ecx
andl $(LLL_SHARED-LLL_PRIVATE), %ecx
#if LLL_PRIVATE != 0
addl $LLL_PRIVATE, %ecx
#endif
call __lll_lock_wait
jmp 2b

/* Unlock in loop requires waekup. */
5: leal cond_lock-cond_futex(%ebx), %eax
/* XYZ */
movl $LLL_SHARED, %ecx
#if (LLL_SHARED-LLL_PRIVATE) > 255
xorl %ecx, %ecx
#endif
cmpl $-1, dep_mutex-cond_futex(%ebx)
setne %cl
subl $1, %ecx
andl $(LLL_SHARED-LLL_PRIVATE), %ecx
#if LLL_PRIVATE != 0
addl $LLL_PRIVATE, %ecx
#endif
call __lll_unlock_wake
jmp 6b

/* Unlock in loop requires waekup. */
7: leal cond_lock-cond_futex(%ebx), %eax
/* XYZ */
movl $LLL_SHARED, %ecx
#if (LLL_SHARED-LLL_PRIVATE) > 255
xorl %ecx, %ecx
#endif
cmpl $-1, dep_mutex-cond_futex(%ebx)
setne %cl
subl $1, %ecx
andl $(LLL_SHARED-LLL_PRIVATE), %ecx
#if LLL_PRIVATE != 0
addl $LLL_PRIVATE, %ecx
#endif
call __lll_unlock_wake
jmp 8b

9: /* The futex requeue functionality is not available. */
movl $0x7fffffff, %edx
movl $FUTEX_WAKE, %ecx
#if FUTEX_PRIVATE_FLAG > 255
xorl %ecx, %ecx
#endif
cmpl $-1, dep_mutex-cond_futex(%ebx)
sete %cl
subl $1, %ecx
#ifdef __ASSUME_PRIVATE_FUTEX
andl $FUTEX_PRIVATE_FLAG, %ecx
#else
andl %gs:PRIVATE_FUTEX, %ecx
#endif
addl $FUTEX_WAKE, %ecx
movl $SYS_futex, %eax
ENTER_KERNEL
jmp 10b
Expand Down
41 changes: 35 additions & 6 deletions nptl/sysdeps/unix/sysv/linux/i386/i486/pthread_cond_signal.S
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,18 @@ __pthread_cond_signal:
/* Wake up one thread. */
pushl %esi
pushl %ebp
movl $FUTEX_WAKE_OP, %ecx
#if FUTEX_PRIVATE_FLAG > 255
xorl %ecx, %ecx
#endif
cmpl $-1, dep_mutex-cond_futex(%ebx)
sete %cl
subl $1, %ecx
#ifdef __ASSUME_PRIVATE_FUTEX
andl $FUTEX_PRIVATE_FLAG, %ecx
#else
andl %gs:PRIVATE_FUTEX, %ecx
#endif
addl $FUTEX_WAKE_OP, %ecx
movl $SYS_futex, %eax
movl $1, %edx
movl $1, %esi
Expand All @@ -92,7 +103,9 @@ __pthread_cond_signal:
popl %ebx
ret

7: movl $FUTEX_WAKE, %ecx
7: /* %ecx should be either FUTEX_WAKE_OP or
FUTEX_WAKE_OP|FUTEX_PRIVATE_FLAG from the previous syscall. */
xorl $(FUTEX_WAKE ^ FUTEX_WAKE_OP), %ecx
movl $SYS_futex, %eax
/* %edx should be 1 already from $FUTEX_WAKE_OP syscall.
movl $1, %edx */
Expand All @@ -106,8 +119,16 @@ __pthread_cond_signal:

/* Unlock in loop requires wakeup. */
5: movl %edi, %eax
/* XYZ */
movl $LLL_SHARED, %ecx
#if (LLL_SHARED-LLL_PRIVATE) > 255
xorl %ecx, %ecx
#endif
cmpl $-1, dep_mutex-cond_futex(%ebx)
setne %cl
subl $1, %ecx
andl $(LLL_SHARED-LLL_PRIVATE), %ecx
#if LLL_PRIVATE != 0
addl $LLL_PRIVATE, %ecx
#endif
call __lll_unlock_wake
jmp 6b

Expand All @@ -118,8 +139,16 @@ __pthread_cond_signal:
#else
leal cond_lock(%edi), %edx
#endif
/* XYZ */
movl $LLL_SHARED, %ecx
#if (LLL_SHARED-LLL_PRIVATE) > 255
xorl %ecx, %ecx
#endif
cmpl $-1, dep_mutex(%edi)
setne %cl
subl $1, %ecx
andl $(LLL_SHARED-LLL_PRIVATE), %ecx
#if LLL_PRIVATE != 0
addl $LLL_PRIVATE, %ecx
#endif
call __lll_lock_wait
jmp 2b

Expand Down
Loading

0 comments on commit 22502ea

Please sign in to comment.