Skip to content
Commit bb433427 authored by Adhemerval Zanella's avatar Adhemerval Zanella
Browse files

Add runtime check for __ASSUME_REQUEUE_PI (BZ# 18463)

This patch adds a runtime check for requeue priority futexes
(FUTEX_{WAIT,CMP}_REQUEUE_PI) for configurations that do not define
__ASSUME_REQUEUE_PI.

It uses the same check uses for priority lock/unlock support, where
issuing a futex operation with FUTEX_UNLOCK_PI returns if kernel has
or not internal 'futex_cmpxchg_enabled' support (which is also used
on requeue priority futexes operations).

For architectures that already have __ASSUME_REQUEUE_PI the code
flow does not change, 'use_requeue_pi' returns the previous chec
logic.  Also, if 'futex_cmpxchg_enabled' is not supported by the
kernel, the previous logic will be used (by issuing a default futex
operation).

Tested on ARM (v3.8 kernel) and x86_64.

	* nptl/pthreadP.h (prio_inherit_missing): Change name to
	__prio_inherit_missing.
	(USE_REQUEUE_PI): Remove define.
	(use_requeue_pi): New function.
	* nptl/pthread_cond_broadcast.c [__ASSUME_REQUEUE_PI]
	(__pthread_cond_broadcast): Remove ifdef.
	(USE_REQUEUE_PI): Change to use_requeue_pi.
	* nptl/pthread_cond_signal.c [__ASSUME_REQUEUE_PI]
	(__pthread_cond_signal): Remove ifdef.
	(USE_REQUEUE_PI): Change to use_requeue_pi.
	* nptl/pthread_cond_timedwait.c [__ASSUME_REQUEUE_PI]
	(__pthread_cond_timedwait): Remove ifdef.
	(USE_REQUEUE_PI): Change to use_requeue_pi.
	( nptl/pthread_cond_wait.c [__ASSUME_REQUEUE_PI]
	(__pthread_cond_wait): Remove ifdef.
	(USE_REQUEUE_PI): Change to use_requeue_pi.
	* nptl/pthread_mutex_init.c (prio_inherit_missing): Remove 'static'
	qualifier and change name to __prio_inherit_missing.
parent 3501fea6
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment