|
@@ -1228,16 +1228,15 @@ rt_mutex_slowunlock(struct rt_mutex *lock)
|
|
*/
|
|
*/
|
|
static inline int
|
|
static inline int
|
|
rt_mutex_fastlock(struct rt_mutex *lock, int state,
|
|
rt_mutex_fastlock(struct rt_mutex *lock, int state,
|
|
- int detect_deadlock,
|
|
|
|
int (*slowfn)(struct rt_mutex *lock, int state,
|
|
int (*slowfn)(struct rt_mutex *lock, int state,
|
|
struct hrtimer_sleeper *timeout,
|
|
struct hrtimer_sleeper *timeout,
|
|
int detect_deadlock))
|
|
int detect_deadlock))
|
|
{
|
|
{
|
|
- if (!detect_deadlock && likely(rt_mutex_cmpxchg(lock, NULL, current))) {
|
|
|
|
|
|
+ if (likely(rt_mutex_cmpxchg(lock, NULL, current))) {
|
|
rt_mutex_deadlock_account_lock(lock, current);
|
|
rt_mutex_deadlock_account_lock(lock, current);
|
|
return 0;
|
|
return 0;
|
|
} else
|
|
} else
|
|
- return slowfn(lock, state, NULL, detect_deadlock);
|
|
|
|
|
|
+ return slowfn(lock, state, NULL, 0);
|
|
}
|
|
}
|
|
|
|
|
|
static inline int
|
|
static inline int
|
|
@@ -1284,54 +1283,59 @@ void __sched rt_mutex_lock(struct rt_mutex *lock)
|
|
{
|
|
{
|
|
might_sleep();
|
|
might_sleep();
|
|
|
|
|
|
- rt_mutex_fastlock(lock, TASK_UNINTERRUPTIBLE, 0, rt_mutex_slowlock);
|
|
|
|
|
|
+ rt_mutex_fastlock(lock, TASK_UNINTERRUPTIBLE, rt_mutex_slowlock);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(rt_mutex_lock);
|
|
EXPORT_SYMBOL_GPL(rt_mutex_lock);
|
|
|
|
|
|
/**
|
|
/**
|
|
* rt_mutex_lock_interruptible - lock a rt_mutex interruptible
|
|
* rt_mutex_lock_interruptible - lock a rt_mutex interruptible
|
|
*
|
|
*
|
|
- * @lock: the rt_mutex to be locked
|
|
|
|
- * @detect_deadlock: deadlock detection on/off
|
|
|
|
|
|
+ * @lock: the rt_mutex to be locked
|
|
*
|
|
*
|
|
* Returns:
|
|
* Returns:
|
|
- * 0 on success
|
|
|
|
- * -EINTR when interrupted by a signal
|
|
|
|
- * -EDEADLK when the lock would deadlock (when deadlock detection is on)
|
|
|
|
|
|
+ * 0 on success
|
|
|
|
+ * -EINTR when interrupted by a signal
|
|
*/
|
|
*/
|
|
-int __sched rt_mutex_lock_interruptible(struct rt_mutex *lock,
|
|
|
|
- int detect_deadlock)
|
|
|
|
|
|
+int __sched rt_mutex_lock_interruptible(struct rt_mutex *lock)
|
|
{
|
|
{
|
|
might_sleep();
|
|
might_sleep();
|
|
|
|
|
|
- return rt_mutex_fastlock(lock, TASK_INTERRUPTIBLE,
|
|
|
|
- detect_deadlock, rt_mutex_slowlock);
|
|
|
|
|
|
+ return rt_mutex_fastlock(lock, TASK_INTERRUPTIBLE, rt_mutex_slowlock);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(rt_mutex_lock_interruptible);
|
|
EXPORT_SYMBOL_GPL(rt_mutex_lock_interruptible);
|
|
|
|
|
|
|
|
+/*
|
|
|
|
+ * Futex variant with full deadlock detection.
|
|
|
|
+ */
|
|
|
|
+int rt_mutex_timed_futex_lock(struct rt_mutex *lock,
|
|
|
|
+ struct hrtimer_sleeper *timeout)
|
|
|
|
+{
|
|
|
|
+ might_sleep();
|
|
|
|
+
|
|
|
|
+ return rt_mutex_timed_fastlock(lock, TASK_INTERRUPTIBLE, timeout, 1,
|
|
|
|
+ rt_mutex_slowlock);
|
|
|
|
+}
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* rt_mutex_timed_lock - lock a rt_mutex interruptible
|
|
* rt_mutex_timed_lock - lock a rt_mutex interruptible
|
|
* the timeout structure is provided
|
|
* the timeout structure is provided
|
|
* by the caller
|
|
* by the caller
|
|
*
|
|
*
|
|
- * @lock: the rt_mutex to be locked
|
|
|
|
|
|
+ * @lock: the rt_mutex to be locked
|
|
* @timeout: timeout structure or NULL (no timeout)
|
|
* @timeout: timeout structure or NULL (no timeout)
|
|
- * @detect_deadlock: deadlock detection on/off
|
|
|
|
*
|
|
*
|
|
* Returns:
|
|
* Returns:
|
|
- * 0 on success
|
|
|
|
- * -EINTR when interrupted by a signal
|
|
|
|
|
|
+ * 0 on success
|
|
|
|
+ * -EINTR when interrupted by a signal
|
|
* -ETIMEDOUT when the timeout expired
|
|
* -ETIMEDOUT when the timeout expired
|
|
- * -EDEADLK when the lock would deadlock (when deadlock detection is on)
|
|
|
|
*/
|
|
*/
|
|
int
|
|
int
|
|
-rt_mutex_timed_lock(struct rt_mutex *lock, struct hrtimer_sleeper *timeout,
|
|
|
|
- int detect_deadlock)
|
|
|
|
|
|
+rt_mutex_timed_lock(struct rt_mutex *lock, struct hrtimer_sleeper *timeout)
|
|
{
|
|
{
|
|
might_sleep();
|
|
might_sleep();
|
|
|
|
|
|
- return rt_mutex_timed_fastlock(lock, TASK_INTERRUPTIBLE, timeout,
|
|
|
|
- detect_deadlock, rt_mutex_slowlock);
|
|
|
|
|
|
+ return rt_mutex_timed_fastlock(lock, TASK_INTERRUPTIBLE, timeout, 0,
|
|
|
|
+ rt_mutex_slowlock);
|
|
}
|
|
}
|
|
EXPORT_SYMBOL_GPL(rt_mutex_timed_lock);
|
|
EXPORT_SYMBOL_GPL(rt_mutex_timed_lock);
|
|
|
|
|
|
@@ -1437,7 +1441,6 @@ void rt_mutex_proxy_unlock(struct rt_mutex *lock,
|
|
* @lock: the rt_mutex to take
|
|
* @lock: the rt_mutex to take
|
|
* @waiter: the pre-initialized rt_mutex_waiter
|
|
* @waiter: the pre-initialized rt_mutex_waiter
|
|
* @task: the task to prepare
|
|
* @task: the task to prepare
|
|
- * @detect_deadlock: perform deadlock detection (1) or not (0)
|
|
|
|
*
|
|
*
|
|
* Returns:
|
|
* Returns:
|
|
* 0 - task blocked on lock
|
|
* 0 - task blocked on lock
|
|
@@ -1448,7 +1451,7 @@ void rt_mutex_proxy_unlock(struct rt_mutex *lock,
|
|
*/
|
|
*/
|
|
int rt_mutex_start_proxy_lock(struct rt_mutex *lock,
|
|
int rt_mutex_start_proxy_lock(struct rt_mutex *lock,
|
|
struct rt_mutex_waiter *waiter,
|
|
struct rt_mutex_waiter *waiter,
|
|
- struct task_struct *task, int detect_deadlock)
|
|
|
|
|
|
+ struct task_struct *task)
|
|
{
|
|
{
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
@@ -1506,22 +1509,20 @@ struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock)
|
|
* rt_mutex_finish_proxy_lock() - Complete lock acquisition
|
|
* rt_mutex_finish_proxy_lock() - Complete lock acquisition
|
|
* @lock: the rt_mutex we were woken on
|
|
* @lock: the rt_mutex we were woken on
|
|
* @to: the timeout, null if none. hrtimer should already have
|
|
* @to: the timeout, null if none. hrtimer should already have
|
|
- * been started.
|
|
|
|
|
|
+ * been started.
|
|
* @waiter: the pre-initialized rt_mutex_waiter
|
|
* @waiter: the pre-initialized rt_mutex_waiter
|
|
- * @detect_deadlock: perform deadlock detection (1) or not (0)
|
|
|
|
*
|
|
*
|
|
* Complete the lock acquisition started our behalf by another thread.
|
|
* Complete the lock acquisition started our behalf by another thread.
|
|
*
|
|
*
|
|
* Returns:
|
|
* Returns:
|
|
* 0 - success
|
|
* 0 - success
|
|
- * <0 - error, one of -EINTR, -ETIMEDOUT, or -EDEADLK
|
|
|
|
|
|
+ * <0 - error, one of -EINTR, -ETIMEDOUT
|
|
*
|
|
*
|
|
* Special API call for PI-futex requeue support
|
|
* Special API call for PI-futex requeue support
|
|
*/
|
|
*/
|
|
int rt_mutex_finish_proxy_lock(struct rt_mutex *lock,
|
|
int rt_mutex_finish_proxy_lock(struct rt_mutex *lock,
|
|
struct hrtimer_sleeper *to,
|
|
struct hrtimer_sleeper *to,
|
|
- struct rt_mutex_waiter *waiter,
|
|
|
|
- int detect_deadlock)
|
|
|
|
|
|
+ struct rt_mutex_waiter *waiter)
|
|
{
|
|
{
|
|
int ret;
|
|
int ret;
|
|
|
|
|