summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Gortmaker <paul.gortmaker@windriver.com>2016-12-25 09:04:27 -0500
committerPaul Gortmaker <paul.gortmaker@windriver.com>2016-12-25 09:04:27 -0500
commitbf7ea5b9a8b167ef3f3fc8359333e6c7b117dd18 (patch)
tree3628258d8257ed48a82e7ded4efac72827603e27
parent1f3f584fe003da9b6d7004717ae8ac5a2b426773 (diff)
download4.9-rt-patches-bf7ea5b9a8b167ef3f3fc8359333e6c7b117dd18.tar.gz
rtmutex: unrefresh for 4.8.15 --> 4.8.0rt-v4.8.0
-rw-r--r--patches/rtmutex-futex-prepare-rt.patch48
1 files changed, 29 insertions, 19 deletions
diff --git a/patches/rtmutex-futex-prepare-rt.patch b/patches/rtmutex-futex-prepare-rt.patch
index e2887fa2adadf..71583c5636cc9 100644
--- a/patches/rtmutex-futex-prepare-rt.patch
+++ b/patches/rtmutex-futex-prepare-rt.patch
@@ -1,6 +1,7 @@
-Subject: rtmutex: Handle the various new futex race conditions
+From b4498097109b0fa232869ad8b8e0593c6ea59766 Mon Sep 17 00:00:00 2001
From: Thomas Gleixner <tglx@linutronix.de>
Date: Fri, 10 Jun 2011 11:04:15 +0200
+Subject: [PATCH] rtmutex: Handle the various new futex race conditions
RT opens a few new interesting race conditions in the rtmutex/futex
combo due to futex hash bucket lock being a 'sleeping' spinlock and
@@ -8,14 +9,16 @@ therefor not disabling preemption.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
- kernel/futex.c | 77 ++++++++++++++++++++++++++++++++--------
- kernel/locking/rtmutex.c | 36 +++++++++++++++---
- kernel/locking/rtmutex_common.h | 2 +
+ kernel/futex.c | 77 +++++++++++++++++++++++++++++++++--------
+ kernel/locking/rtmutex.c | 36 +++++++++++++++----
+ kernel/locking/rtmutex_common.h | 2 ++
3 files changed, 94 insertions(+), 21 deletions(-)
+diff --git a/kernel/futex.c b/kernel/futex.c
+index 46cb3a301bc1..76abbf8568b3 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
-@@ -1915,6 +1915,16 @@ static int futex_requeue(u32 __user *uad
+@@ -1915,6 +1915,16 @@ retry_private:
requeue_pi_wake_futex(this, &key2, hb2);
drop_count++;
continue;
@@ -32,7 +35,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
} else if (ret) {
/*
* rt_mutex_start_proxy_lock() detected a
-@@ -2805,7 +2815,7 @@ static int futex_wait_requeue_pi(u32 __u
+@@ -2805,7 +2815,7 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
struct hrtimer_sleeper timeout, *to = NULL;
struct rt_mutex_waiter rt_waiter;
struct rt_mutex *pi_mutex = NULL;
@@ -41,7 +44,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
union futex_key key2 = FUTEX_KEY_INIT;
struct futex_q q = futex_q_init;
int res, ret;
-@@ -2864,20 +2874,55 @@ static int futex_wait_requeue_pi(u32 __u
+@@ -2864,20 +2874,55 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
/* Queue the futex_q, drop the hb lock, wait for wakeup. */
futex_wait_queue_me(hb, &q, to);
@@ -108,7 +111,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
/* Check if the requeue code acquired the second futex for us. */
if (!q.rt_waiter) {
-@@ -2886,14 +2931,15 @@ static int futex_wait_requeue_pi(u32 __u
+@@ -2886,14 +2931,15 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
* did a lock-steal - fix up the PI-state in that case.
*/
if (q.pi_state && (q.pi_state->owner != current)) {
@@ -126,7 +129,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
}
} else {
/*
-@@ -2906,7 +2952,8 @@ static int futex_wait_requeue_pi(u32 __u
+@@ -2906,7 +2952,8 @@ static int futex_wait_requeue_pi(u32 __user *uaddr, unsigned int flags,
ret = rt_mutex_finish_proxy_lock(pi_mutex, to, &rt_waiter);
debug_rt_mutex_free_waiter(&rt_waiter);
@@ -136,10 +139,12 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
/*
* Fixup the pi_state owner and possibly acquire the lock if we
* haven't already.
+diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c
+index dbbf116249e6..6e2fcc026a88 100644
--- a/kernel/locking/rtmutex.c
+++ b/kernel/locking/rtmutex.c
-@@ -133,6 +133,11 @@ static void fixup_rt_mutex_waiters(struc
- WRITE_ONCE(*p, owner & ~RT_MUTEX_HAS_WAITERS);
+@@ -69,6 +69,11 @@ static void fixup_rt_mutex_waiters(struct rt_mutex *lock)
+ clear_rt_mutex_waiters(lock);
}
+static int rt_mutex_real_waiter(struct rt_mutex_waiter *waiter)
@@ -150,7 +155,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
/*
* We can speed up the acquire/release, if there's no debugging state to be
* set up.
-@@ -421,7 +426,8 @@ int max_lock_depth = 1024;
+@@ -357,7 +362,8 @@ int max_lock_depth = 1024;
static inline struct rt_mutex *task_blocked_on_lock(struct task_struct *p)
{
@@ -160,7 +165,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
}
/*
-@@ -557,7 +563,7 @@ static int rt_mutex_adjust_prio_chain(st
+@@ -493,7 +499,7 @@ static int rt_mutex_adjust_prio_chain(struct task_struct *task,
* reached or the state of the chain has changed while we
* dropped the locks.
*/
@@ -169,7 +174,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
goto out_unlock_pi;
/*
-@@ -971,6 +977,23 @@ static int task_blocks_on_rt_mutex(struc
+@@ -907,6 +913,23 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
return -EDEADLK;
raw_spin_lock(&task->pi_lock);
@@ -193,7 +198,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
__rt_mutex_adjust_prio(task);
waiter->task = task;
waiter->lock = lock;
-@@ -994,7 +1017,7 @@ static int task_blocks_on_rt_mutex(struc
+@@ -930,7 +953,7 @@ static int task_blocks_on_rt_mutex(struct rt_mutex *lock,
rt_mutex_enqueue_pi(owner, waiter);
__rt_mutex_adjust_prio(owner);
@@ -202,7 +207,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
chain_walk = 1;
} else if (rt_mutex_cond_detect_deadlock(waiter, chwalk)) {
chain_walk = 1;
-@@ -1078,7 +1101,7 @@ static void remove_waiter(struct rt_mute
+@@ -1014,7 +1037,7 @@ static void remove_waiter(struct rt_mutex *lock,
{
bool is_top_waiter = (waiter == rt_mutex_top_waiter(lock));
struct task_struct *owner = rt_mutex_owner(lock);
@@ -211,7 +216,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
raw_spin_lock(&current->pi_lock);
rt_mutex_dequeue(lock, waiter);
-@@ -1102,7 +1125,8 @@ static void remove_waiter(struct rt_mute
+@@ -1038,7 +1061,8 @@ static void remove_waiter(struct rt_mutex *lock,
__rt_mutex_adjust_prio(owner);
/* Store the lock on which owner is blocked or NULL */
@@ -221,7 +226,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
raw_spin_unlock(&owner->pi_lock);
-@@ -1138,7 +1162,7 @@ void rt_mutex_adjust_pi(struct task_stru
+@@ -1074,7 +1098,7 @@ void rt_mutex_adjust_pi(struct task_struct *task)
raw_spin_lock_irqsave(&task->pi_lock, flags);
waiter = task->pi_blocked_on;
@@ -230,9 +235,11 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
!dl_prio(task->prio))) {
raw_spin_unlock_irqrestore(&task->pi_lock, flags);
return;
+diff --git a/kernel/locking/rtmutex_common.h b/kernel/locking/rtmutex_common.h
+index 4f5f83c7d2d3..1c1bcc5cbd69 100644
--- a/kernel/locking/rtmutex_common.h
+++ b/kernel/locking/rtmutex_common.h
-@@ -98,6 +98,8 @@ enum rtmutex_chainwalk {
+@@ -97,6 +97,8 @@ enum rtmutex_chainwalk {
/*
* PI-futex support (proxy locking functions, etc.):
*/
@@ -241,3 +248,6 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
extern struct task_struct *rt_mutex_next_owner(struct rt_mutex *lock);
extern void rt_mutex_init_proxy_locked(struct rt_mutex *lock,
struct task_struct *proxy_owner);
+--
+2.10.1
+