[rt] Update to 4.9.30-rt20
This commit is contained in:
parent
9c84459829
commit
894e593fa3
|
@ -419,6 +419,22 @@ linux (4.9.30-1) UNRELEASED; urgency=medium
|
|||
work again (Closes: #862723)
|
||||
* [arm64] serial: pl011: add console matching function (Closes: #861898)
|
||||
* [rt] Add new GPG subkeys for Sebastian Andrzej Siewior
|
||||
* [rt] Update to 4.9.30-rt20:
|
||||
- rtmutex: Deboost before waking up the top waiter
|
||||
- sched/rtmutex/deadline: Fix a PI crash for deadline tasks
|
||||
- sched/deadline/rtmutex: Dont miss the dl_runtime/dl_period update
|
||||
- rtmutex: Clean up
|
||||
- sched/rtmutex: Refactor rt_mutex_setprio()
|
||||
- sched,tracing: Update trace_sched_pi_setprio()
|
||||
- rtmutex: Fix PI chain order integrity
|
||||
- rtmutex: Fix more prio comparisons
|
||||
- rtmutex: Plug preempt count leak in rt_mutex_futex_unlock()
|
||||
- futex: Avoid freeing an active timer
|
||||
- futex: Fix small (and harmless looking) inconsistencies
|
||||
- futex,rt_mutex: Fix rt_mutex_cleanup_proxy_lock()
|
||||
- Revert "timers: Don't wake ktimersoftd on every tick"
|
||||
- futex/rtmutex: Cure RT double blocking issue
|
||||
- random: avoid preempt_disable()ed section
|
||||
|
||||
[ Salvatore Bonaccorso ]
|
||||
* tracing: Use strlcpy() instead of strcpy() in __trace_find_cmdline()
|
||||
|
|
53
debian/patches/features/all/rt/0001-futex-Avoid-freeing-an-active-timer.patch
vendored
Normal file
53
debian/patches/features/all/rt/0001-futex-Avoid-freeing-an-active-timer.patch
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Mon, 10 Apr 2017 18:03:36 +0200
|
||||
Subject: [PATCH] futex: Avoid freeing an active timer
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 97181f9bd57405b879403763284537e27d46963d
|
||||
|
||||
Alexander reported a hrtimer debug_object splat:
|
||||
|
||||
ODEBUG: free active (active state 0) object type: hrtimer hint: hrtimer_wakeup (kernel/time/hrtimer.c:1423)
|
||||
|
||||
debug_object_free (lib/debugobjects.c:603)
|
||||
destroy_hrtimer_on_stack (kernel/time/hrtimer.c:427)
|
||||
futex_lock_pi (kernel/futex.c:2740)
|
||||
do_futex (kernel/futex.c:3399)
|
||||
SyS_futex (kernel/futex.c:3447 kernel/futex.c:3415)
|
||||
do_syscall_64 (arch/x86/entry/common.c:284)
|
||||
entry_SYSCALL64_slow_path (arch/x86/entry/entry_64.S:249)
|
||||
|
||||
Which was caused by commit:
|
||||
|
||||
cfafcd117da0 ("futex: Rework futex_lock_pi() to use rt_mutex_*_proxy_lock()")
|
||||
|
||||
... losing the hrtimer_cancel() in the shuffle. Where previously the
|
||||
hrtimer_cancel() was done by rt_mutex_slowlock() we now need to do it
|
||||
manually.
|
||||
|
||||
Reported-by: Alexander Levin <alexander.levin@verizon.com>
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
|
||||
Cc: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
Cc: Peter Zijlstra <peterz@infradead.org>
|
||||
Fixes: cfafcd117da0 ("futex: Rework futex_lock_pi() to use rt_mutex_*_proxy_lock()")
|
||||
Link: http://lkml.kernel.org/r/alpine.DEB.2.20.1704101802370.2906@nanos
|
||||
Signed-off-by: Ingo Molnar <mingo@kernel.org>
|
||||
---
|
||||
kernel/futex.c | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
--- a/kernel/futex.c
|
||||
+++ b/kernel/futex.c
|
||||
@@ -2734,8 +2734,10 @@ static int futex_lock_pi(u32 __user *uad
|
||||
out_put_key:
|
||||
put_futex_key(&q.key);
|
||||
out:
|
||||
- if (to)
|
||||
+ if (to) {
|
||||
+ hrtimer_cancel(&to->timer);
|
||||
destroy_hrtimer_on_stack(&to->timer);
|
||||
+ }
|
||||
return ret != -EINTR ? ret : -ERESTARTNOINTR;
|
||||
|
||||
uaddr_faulted:
|
|
@ -1,7 +1,7 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Wed, 22 Mar 2017 11:35:48 +0100
|
||||
Subject: [PATCH] futex: Cleanup variable names for futex_top_waiter()
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 499f5aca2cdd5e958b27e2655e7e7f82524f46b1
|
||||
|
||||
|
|
180
debian/patches/features/all/rt/0001-rtmutex-Deboost-before-waking-up-the-top-waiter.patch
vendored
Normal file
180
debian/patches/features/all/rt/0001-rtmutex-Deboost-before-waking-up-the-top-waiter.patch
vendored
Normal file
|
@ -0,0 +1,180 @@
|
|||
From: Xunlei Pang <xlpang@redhat.com>
|
||||
Date: Thu, 23 Mar 2017 15:56:07 +0100
|
||||
Subject: [PATCH] rtmutex: Deboost before waking up the top waiter
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 2a1c6029940675abb2217b590512dbf691867ec4
|
||||
|
||||
We should deboost before waking the high-priority task, such that we
|
||||
don't run two tasks with the same "state" (priority, deadline,
|
||||
sched_class, etc).
|
||||
|
||||
In order to make sure the boosting task doesn't start running between
|
||||
unlock and deboost (due to 'spurious' wakeup), we move the deboost
|
||||
under the wait_lock, that way its serialized against the wait loop in
|
||||
__rt_mutex_slowlock().
|
||||
|
||||
Doing the deboost early can however lead to priority-inversion if
|
||||
current would get preempted after the deboost but before waking our
|
||||
high-prio task, hence we disable preemption before doing deboost, and
|
||||
enabling it after the wake up is over.
|
||||
|
||||
This gets us the right semantic order, but most importantly however;
|
||||
this change ensures pointer stability for the next patch, where we
|
||||
have rt_mutex_setprio() cache a pointer to the top-most waiter task.
|
||||
If we, as before this change, do the wakeup first and then deboost,
|
||||
this pointer might point into thin air.
|
||||
|
||||
[peterz: Changelog + patch munging]
|
||||
Suggested-by: Peter Zijlstra <peterz@infradead.org>
|
||||
Signed-off-by: Xunlei Pang <xlpang@redhat.com>
|
||||
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
|
||||
Acked-by: Steven Rostedt <rostedt@goodmis.org>
|
||||
Cc: juri.lelli@arm.com
|
||||
Cc: bigeasy@linutronix.de
|
||||
Cc: mathieu.desnoyers@efficios.com
|
||||
Cc: jdesfossez@efficios.com
|
||||
Cc: bristot@redhat.com
|
||||
Link: http://lkml.kernel.org/r/20170323150216.110065320@infradead.org
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
---
|
||||
kernel/futex.c | 5 ---
|
||||
kernel/locking/rtmutex.c | 59 +++++++++++++++++++++-------------------
|
||||
kernel/locking/rtmutex_common.h | 2 -
|
||||
3 files changed, 34 insertions(+), 32 deletions(-)
|
||||
|
||||
--- a/kernel/futex.c
|
||||
+++ b/kernel/futex.c
|
||||
@@ -1458,10 +1458,7 @@ static int wake_futex_pi(u32 __user *uad
|
||||
out_unlock:
|
||||
raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
|
||||
|
||||
- if (deboost) {
|
||||
- wake_up_q(&wake_q);
|
||||
- rt_mutex_adjust_prio(current);
|
||||
- }
|
||||
+ rt_mutex_postunlock(&wake_q, deboost);
|
||||
|
||||
return ret;
|
||||
}
|
||||
--- a/kernel/locking/rtmutex.c
|
||||
+++ b/kernel/locking/rtmutex.c
|
||||
@@ -371,24 +371,6 @@ static void __rt_mutex_adjust_prio(struc
|
||||
}
|
||||
|
||||
/*
|
||||
- * Adjust task priority (undo boosting). Called from the exit path of
|
||||
- * rt_mutex_slowunlock() and rt_mutex_slowlock().
|
||||
- *
|
||||
- * (Note: We do this outside of the protection of lock->wait_lock to
|
||||
- * allow the lock to be taken while or before we readjust the priority
|
||||
- * of task. We do not use the spin_xx_mutex() variants here as we are
|
||||
- * outside of the debug path.)
|
||||
- */
|
||||
-void rt_mutex_adjust_prio(struct task_struct *task)
|
||||
-{
|
||||
- unsigned long flags;
|
||||
-
|
||||
- raw_spin_lock_irqsave(&task->pi_lock, flags);
|
||||
- __rt_mutex_adjust_prio(task);
|
||||
- raw_spin_unlock_irqrestore(&task->pi_lock, flags);
|
||||
-}
|
||||
-
|
||||
-/*
|
||||
* Deadlock detection is conditional:
|
||||
*
|
||||
* If CONFIG_DEBUG_RT_MUTEXES=n, deadlock detection is only conducted
|
||||
@@ -1049,6 +1031,7 @@ static void mark_wakeup_next_waiter(stru
|
||||
* lock->wait_lock.
|
||||
*/
|
||||
rt_mutex_dequeue_pi(current, waiter);
|
||||
+ __rt_mutex_adjust_prio(current);
|
||||
|
||||
/*
|
||||
* As we are waking up the top waiter, and the waiter stays
|
||||
@@ -1391,6 +1374,16 @@ static bool __sched rt_mutex_slowunlock(
|
||||
*/
|
||||
mark_wakeup_next_waiter(wake_q, lock);
|
||||
|
||||
+ /*
|
||||
+ * We should deboost before waking the top waiter task such that
|
||||
+ * we don't run two tasks with the 'same' priority. This however
|
||||
+ * can lead to prio-inversion if we would get preempted after
|
||||
+ * the deboost but before waking our high-prio task, hence the
|
||||
+ * preempt_disable before unlock. Pairs with preempt_enable() in
|
||||
+ * rt_mutex_postunlock();
|
||||
+ */
|
||||
+ preempt_disable();
|
||||
+
|
||||
raw_spin_unlock_irqrestore(&lock->wait_lock, flags);
|
||||
|
||||
/* check PI boosting */
|
||||
@@ -1440,6 +1433,18 @@ rt_mutex_fasttrylock(struct rt_mutex *lo
|
||||
return slowfn(lock);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Undo pi boosting (if necessary) and wake top waiter.
|
||||
+ */
|
||||
+void rt_mutex_postunlock(struct wake_q_head *wake_q, bool deboost)
|
||||
+{
|
||||
+ wake_up_q(wake_q);
|
||||
+
|
||||
+ /* Pairs with preempt_disable() in rt_mutex_slowunlock() */
|
||||
+ if (deboost)
|
||||
+ preempt_enable();
|
||||
+}
|
||||
+
|
||||
static inline void
|
||||
rt_mutex_fastunlock(struct rt_mutex *lock,
|
||||
bool (*slowfn)(struct rt_mutex *lock,
|
||||
@@ -1453,11 +1458,7 @@ rt_mutex_fastunlock(struct rt_mutex *loc
|
||||
|
||||
deboost = slowfn(lock, &wake_q);
|
||||
|
||||
- wake_up_q(&wake_q);
|
||||
-
|
||||
- /* Undo pi boosting if necessary: */
|
||||
- if (deboost)
|
||||
- rt_mutex_adjust_prio(current);
|
||||
+ rt_mutex_postunlock(&wake_q, deboost);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1570,6 +1571,13 @@ bool __sched __rt_mutex_futex_unlock(str
|
||||
}
|
||||
|
||||
mark_wakeup_next_waiter(wake_q, lock);
|
||||
+ /*
|
||||
+ * We've already deboosted, retain preempt_disabled when dropping
|
||||
+ * the wait_lock to avoid inversion until the wakeup. Matched
|
||||
+ * by rt_mutex_postunlock();
|
||||
+ */
|
||||
+ preempt_disable();
|
||||
+
|
||||
return true; /* deboost and wakeups */
|
||||
}
|
||||
|
||||
@@ -1582,10 +1590,7 @@ void __sched rt_mutex_futex_unlock(struc
|
||||
deboost = __rt_mutex_futex_unlock(lock, &wake_q);
|
||||
raw_spin_unlock_irq(&lock->wait_lock);
|
||||
|
||||
- if (deboost) {
|
||||
- wake_up_q(&wake_q);
|
||||
- rt_mutex_adjust_prio(current);
|
||||
- }
|
||||
+ rt_mutex_postunlock(&wake_q, deboost);
|
||||
}
|
||||
|
||||
/**
|
||||
--- a/kernel/locking/rtmutex_common.h
|
||||
+++ b/kernel/locking/rtmutex_common.h
|
||||
@@ -122,7 +122,7 @@ extern void rt_mutex_futex_unlock(struct
|
||||
extern bool __rt_mutex_futex_unlock(struct rt_mutex *lock,
|
||||
struct wake_q_head *wqh);
|
||||
|
||||
-extern void rt_mutex_adjust_prio(struct task_struct *task);
|
||||
+extern void rt_mutex_postunlock(struct wake_q_head *wake_q, bool deboost);
|
||||
|
||||
#ifdef CONFIG_DEBUG_RT_MUTEXES
|
||||
# include "rtmutex-debug.h"
|
57
debian/patches/features/all/rt/0002-futex-Fix-small-and-harmless-looking-inconsistencies.patch
vendored
Normal file
57
debian/patches/features/all/rt/0002-futex-Fix-small-and-harmless-looking-inconsistencies.patch
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Fri, 7 Apr 2017 09:04:07 +0200
|
||||
Subject: [PATCH] futex: Fix small (and harmless looking) inconsistencies
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 94ffac5d847cfd790bb37b7cef1cad803743985e
|
||||
|
||||
During (post-commit) review Darren spotted a few minor things. One
|
||||
(harmless AFAICT) type inconsistency and a comment that wasn't as
|
||||
clear as hoped.
|
||||
|
||||
Reported-by: Darren Hart (VMWare) <dvhart@infradead.org>
|
||||
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
|
||||
Reviewed-by: Darren Hart (VMware) <dvhart@infradead.org>
|
||||
Cc: Linus Torvalds <torvalds@linux-foundation.org>
|
||||
Cc: Peter Zijlstra <peterz@infradead.org>
|
||||
Cc: Thomas Gleixner <tglx@linutronix.de>
|
||||
Cc: linux-kernel@vger.kernel.org
|
||||
Signed-off-by: Ingo Molnar <mingo@kernel.org>
|
||||
---
|
||||
kernel/futex.c | 11 +++++++----
|
||||
1 file changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/kernel/futex.c
|
||||
+++ b/kernel/futex.c
|
||||
@@ -1023,7 +1023,8 @@ static int attach_to_pi_state(u32 __user
|
||||
struct futex_pi_state **ps)
|
||||
{
|
||||
pid_t pid = uval & FUTEX_TID_MASK;
|
||||
- int ret, uval2;
|
||||
+ u32 uval2;
|
||||
+ int ret;
|
||||
|
||||
/*
|
||||
* Userspace might have messed up non-PI and PI futexes [3]
|
||||
@@ -1439,6 +1440,11 @@ static int wake_futex_pi(u32 __user *uad
|
||||
if (ret)
|
||||
goto out_unlock;
|
||||
|
||||
+ /*
|
||||
+ * This is a point of no return; once we modify the uval there is no
|
||||
+ * going back and subsequent operations must not fail.
|
||||
+ */
|
||||
+
|
||||
raw_spin_lock(&pi_state->owner->pi_lock);
|
||||
WARN_ON(list_empty(&pi_state->list));
|
||||
list_del_init(&pi_state->list);
|
||||
@@ -1450,9 +1456,6 @@ static int wake_futex_pi(u32 __user *uad
|
||||
pi_state->owner = new_owner;
|
||||
raw_spin_unlock(&new_owner->pi_lock);
|
||||
|
||||
- /*
|
||||
- * We've updated the uservalue, this unlock cannot fail.
|
||||
- */
|
||||
postunlock = __rt_mutex_futex_unlock(&pi_state->pi_mutex, &wake_q);
|
||||
|
||||
out_unlock:
|
|
@ -1,7 +1,7 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Wed, 22 Mar 2017 11:35:49 +0100
|
||||
Subject: [PATCH] futex: Use smp_store_release() in mark_wake_futex()
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 1b367ece0d7e696cab1c8501bab282cc6a538b3f
|
||||
|
||||
|
|
169
debian/patches/features/all/rt/0002-sched-rtmutex-deadline-Fix-a-PI-crash-for-deadline-t.patch
vendored
Normal file
169
debian/patches/features/all/rt/0002-sched-rtmutex-deadline-Fix-a-PI-crash-for-deadline-t.patch
vendored
Normal file
|
@ -0,0 +1,169 @@
|
|||
From: Xunlei Pang <xlpang@redhat.com>
|
||||
Date: Thu, 23 Mar 2017 15:56:08 +0100
|
||||
Subject: [PATCH] sched/rtmutex/deadline: Fix a PI crash for deadline tasks
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit e96a7705e7d3fef96aec9b590c63b2f6f7d2ba22
|
||||
|
||||
A crash happened while I was playing with deadline PI rtmutex.
|
||||
|
||||
BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
|
||||
IP: [<ffffffff810eeb8f>] rt_mutex_get_top_task+0x1f/0x30
|
||||
PGD 232a75067 PUD 230947067 PMD 0
|
||||
Oops: 0000 [#1] SMP
|
||||
CPU: 1 PID: 10994 Comm: a.out Not tainted
|
||||
|
||||
Call Trace:
|
||||
[<ffffffff810b658c>] enqueue_task+0x2c/0x80
|
||||
[<ffffffff810ba763>] activate_task+0x23/0x30
|
||||
[<ffffffff810d0ab5>] pull_dl_task+0x1d5/0x260
|
||||
[<ffffffff810d0be6>] pre_schedule_dl+0x16/0x20
|
||||
[<ffffffff8164e783>] __schedule+0xd3/0x900
|
||||
[<ffffffff8164efd9>] schedule+0x29/0x70
|
||||
[<ffffffff8165035b>] __rt_mutex_slowlock+0x4b/0xc0
|
||||
[<ffffffff81650501>] rt_mutex_slowlock+0xd1/0x190
|
||||
[<ffffffff810eeb33>] rt_mutex_timed_lock+0x53/0x60
|
||||
[<ffffffff810ecbfc>] futex_lock_pi.isra.18+0x28c/0x390
|
||||
[<ffffffff810ed8b0>] do_futex+0x190/0x5b0
|
||||
[<ffffffff810edd50>] SyS_futex+0x80/0x180
|
||||
|
||||
This is because rt_mutex_enqueue_pi() and rt_mutex_dequeue_pi()
|
||||
are only protected by pi_lock when operating pi waiters, while
|
||||
rt_mutex_get_top_task(), will access them with rq lock held but
|
||||
not holding pi_lock.
|
||||
|
||||
In order to tackle it, we introduce new "pi_top_task" pointer
|
||||
cached in task_struct, and add new rt_mutex_update_top_task()
|
||||
to update its value, it can be called by rt_mutex_setprio()
|
||||
which held both owner's pi_lock and rq lock. Thus "pi_top_task"
|
||||
can be safely accessed by enqueue_task_dl() under rq lock.
|
||||
|
||||
Originally-From: Peter Zijlstra <peterz@infradead.org>
|
||||
Signed-off-by: Xunlei Pang <xlpang@redhat.com>
|
||||
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
|
||||
Acked-by: Steven Rostedt <rostedt@goodmis.org>
|
||||
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Cc: juri.lelli@arm.com
|
||||
Cc: bigeasy@linutronix.de
|
||||
Cc: mathieu.desnoyers@efficios.com
|
||||
Cc: jdesfossez@efficios.com
|
||||
Cc: bristot@redhat.com
|
||||
Link: http://lkml.kernel.org/r/20170323150216.157682758@infradead.org
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
---
|
||||
include/linux/init_task.h | 1 +
|
||||
include/linux/sched.h | 2 ++
|
||||
include/linux/sched/rt.h | 1 +
|
||||
kernel/fork.c | 1 +
|
||||
kernel/locking/rtmutex.c | 29 +++++++++++++++++++++--------
|
||||
kernel/sched/core.c | 2 ++
|
||||
6 files changed, 28 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/include/linux/init_task.h
|
||||
+++ b/include/linux/init_task.h
|
||||
@@ -164,6 +164,7 @@ extern struct task_group root_task_group
|
||||
#ifdef CONFIG_RT_MUTEXES
|
||||
# define INIT_RT_MUTEXES(tsk) \
|
||||
.pi_waiters = RB_ROOT, \
|
||||
+ .pi_top_task = NULL, \
|
||||
.pi_waiters_leftmost = NULL,
|
||||
#else
|
||||
# define INIT_RT_MUTEXES(tsk)
|
||||
--- a/include/linux/sched.h
|
||||
+++ b/include/linux/sched.h
|
||||
@@ -1723,6 +1723,8 @@ struct task_struct {
|
||||
/* PI waiters blocked on a rt_mutex held by this task */
|
||||
struct rb_root pi_waiters;
|
||||
struct rb_node *pi_waiters_leftmost;
|
||||
+ /* Updated under owner's pi_lock and rq lock */
|
||||
+ struct task_struct *pi_top_task;
|
||||
/* Deadlock detection and priority inheritance handling */
|
||||
struct rt_mutex_waiter *pi_blocked_on;
|
||||
#endif
|
||||
--- a/include/linux/sched/rt.h
|
||||
+++ b/include/linux/sched/rt.h
|
||||
@@ -19,6 +19,7 @@ static inline int rt_task(struct task_st
|
||||
extern int rt_mutex_getprio(struct task_struct *p);
|
||||
extern void rt_mutex_setprio(struct task_struct *p, int prio);
|
||||
extern int rt_mutex_get_effective_prio(struct task_struct *task, int newprio);
|
||||
+extern void rt_mutex_update_top_task(struct task_struct *p);
|
||||
extern struct task_struct *rt_mutex_get_top_task(struct task_struct *task);
|
||||
extern void rt_mutex_adjust_pi(struct task_struct *p);
|
||||
static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
|
||||
--- a/kernel/fork.c
|
||||
+++ b/kernel/fork.c
|
||||
@@ -1417,6 +1417,7 @@ static void rt_mutex_init_task(struct ta
|
||||
#ifdef CONFIG_RT_MUTEXES
|
||||
p->pi_waiters = RB_ROOT;
|
||||
p->pi_waiters_leftmost = NULL;
|
||||
+ p->pi_top_task = NULL;
|
||||
p->pi_blocked_on = NULL;
|
||||
#endif
|
||||
}
|
||||
--- a/kernel/locking/rtmutex.c
|
||||
+++ b/kernel/locking/rtmutex.c
|
||||
@@ -321,6 +321,19 @@ rt_mutex_dequeue_pi(struct task_struct *
|
||||
}
|
||||
|
||||
/*
|
||||
+ * Must hold both p->pi_lock and task_rq(p)->lock.
|
||||
+ */
|
||||
+void rt_mutex_update_top_task(struct task_struct *p)
|
||||
+{
|
||||
+ if (!task_has_pi_waiters(p)) {
|
||||
+ p->pi_top_task = NULL;
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ p->pi_top_task = task_top_pi_waiter(p)->task;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* Calculate task priority from the waiter tree priority
|
||||
*
|
||||
* Return task->normal_prio when the waiter tree is empty or when
|
||||
@@ -335,12 +348,12 @@ int rt_mutex_getprio(struct task_struct
|
||||
task->normal_prio);
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * Must hold either p->pi_lock or task_rq(p)->lock.
|
||||
+ */
|
||||
struct task_struct *rt_mutex_get_top_task(struct task_struct *task)
|
||||
{
|
||||
- if (likely(!task_has_pi_waiters(task)))
|
||||
- return NULL;
|
||||
-
|
||||
- return task_top_pi_waiter(task)->task;
|
||||
+ return task->pi_top_task;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -349,12 +362,12 @@ struct task_struct *rt_mutex_get_top_tas
|
||||
*/
|
||||
int rt_mutex_get_effective_prio(struct task_struct *task, int newprio)
|
||||
{
|
||||
- if (!task_has_pi_waiters(task))
|
||||
+ struct task_struct *top_task = rt_mutex_get_top_task(task);
|
||||
+
|
||||
+ if (!top_task)
|
||||
return newprio;
|
||||
|
||||
- if (task_top_pi_waiter(task)->task->prio <= newprio)
|
||||
- return task_top_pi_waiter(task)->task->prio;
|
||||
- return newprio;
|
||||
+ return min(top_task->prio, newprio);
|
||||
}
|
||||
|
||||
/*
|
||||
--- a/kernel/sched/core.c
|
||||
+++ b/kernel/sched/core.c
|
||||
@@ -3669,6 +3669,8 @@ void rt_mutex_setprio(struct task_struct
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
+ rt_mutex_update_top_task(p);
|
||||
+
|
||||
trace_sched_pi_setprio(p, prio);
|
||||
oldprio = p->prio;
|
||||
|
38
debian/patches/features/all/rt/0003-futex-Clarify-mark_wake_futex-memory-barrier-usage.patch
vendored
Normal file
38
debian/patches/features/all/rt/0003-futex-Clarify-mark_wake_futex-memory-barrier-usage.patch
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
From: "Darren Hart (VMware)" <dvhart@infradead.org>
|
||||
Date: Fri, 14 Apr 2017 15:31:38 -0700
|
||||
Subject: [PATCH] futex: Clarify mark_wake_futex memory barrier usage
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 38fcd06e9b7f6855db1f3ebac5e18b8fdb467ffd
|
||||
|
||||
Clarify the scenario described in mark_wake_futex requiring the
|
||||
smp_store_release(). Update the comment to explicitly refer to the
|
||||
plist_del now under __unqueue_futex() (previously plist_del was in the
|
||||
same function as the comment).
|
||||
|
||||
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
|
||||
Cc: Peter Zijlstra <peterz@infradead.org>
|
||||
Link: http://lkml.kernel.org/r/20170414223138.GA4222@fury
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
---
|
||||
kernel/futex.c | 9 +++++----
|
||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/kernel/futex.c
|
||||
+++ b/kernel/futex.c
|
||||
@@ -1378,10 +1378,11 @@ static void mark_wake_futex(struct wake_
|
||||
wake_q_add(wake_q, p);
|
||||
__unqueue_futex(q);
|
||||
/*
|
||||
- * The waiting task can free the futex_q as soon as
|
||||
- * q->lock_ptr = NULL is written, without taking any locks. A
|
||||
- * memory barrier is required here to prevent the following
|
||||
- * store to lock_ptr from getting ahead of the plist_del.
|
||||
+ * The waiting task can free the futex_q as soon as q->lock_ptr = NULL
|
||||
+ * is written, without taking any locks. This is possible in the event
|
||||
+ * of a spurious wakeup, for example. A memory barrier is required here
|
||||
+ * to prevent the following store to lock_ptr from getting ahead of the
|
||||
+ * plist_del in __unqueue_futex().
|
||||
*/
|
||||
smp_store_release(&q->lock_ptr, NULL);
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Wed, 22 Mar 2017 11:35:50 +0100
|
||||
Subject: [PATCH] futex: Remove rt_mutex_deadlock_account_*()
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit fffa954fb528963c2fb7b0c0084eb77e2be7ab52
|
||||
|
||||
|
|
54
debian/patches/features/all/rt/0003-sched-deadline-rtmutex-Dont-miss-the-dl_runtime-dl_p.patch
vendored
Normal file
54
debian/patches/features/all/rt/0003-sched-deadline-rtmutex-Dont-miss-the-dl_runtime-dl_p.patch
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
From: Xunlei Pang <xlpang@redhat.com>
|
||||
Date: Thu, 23 Mar 2017 15:56:09 +0100
|
||||
Subject: [PATCH] sched/deadline/rtmutex: Dont miss the
|
||||
dl_runtime/dl_period update
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 85e2d4f992868ad78dc8bb2c077b652fcfb3661a
|
||||
|
||||
Currently dl tasks will actually return at the very beginning
|
||||
of rt_mutex_adjust_prio_chain() in !detect_deadlock cases:
|
||||
|
||||
if (waiter->prio == task->prio) {
|
||||
if (!detect_deadlock)
|
||||
goto out_unlock_pi; // out here
|
||||
else
|
||||
requeue = false;
|
||||
}
|
||||
|
||||
As the deadline value of blocked deadline tasks(waiters) without
|
||||
changing their sched_class(thus prio doesn't change) never changes,
|
||||
this seems reasonable, but it actually misses the chance of updating
|
||||
rt_mutex_waiter's "dl_runtime(period)_copy" if a waiter updates its
|
||||
deadline parameters(dl_runtime, dl_period) or boosted waiter changes
|
||||
to !deadline class.
|
||||
|
||||
Thus, force deadline task not out by adding the !dl_prio() condition.
|
||||
|
||||
Signed-off-by: Xunlei Pang <xlpang@redhat.com>
|
||||
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
|
||||
Acked-by: Steven Rostedt <rostedt@goodmis.org>
|
||||
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Cc: juri.lelli@arm.com
|
||||
Cc: bigeasy@linutronix.de
|
||||
Cc: mathieu.desnoyers@efficios.com
|
||||
Cc: jdesfossez@efficios.com
|
||||
Cc: bristot@redhat.com
|
||||
Link: http://lkml.kernel.org/r/1460633827-345-7-git-send-email-xlpang@redhat.com
|
||||
Link: http://lkml.kernel.org/r/20170323150216.206577901@infradead.org
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
---
|
||||
kernel/locking/rtmutex.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
--- a/kernel/locking/rtmutex.c
|
||||
+++ b/kernel/locking/rtmutex.c
|
||||
@@ -603,7 +603,7 @@ static int rt_mutex_adjust_prio_chain(st
|
||||
* enabled we continue, but stop the requeueing in the chain
|
||||
* walk.
|
||||
*/
|
||||
- if (waiter->prio == task->prio) {
|
||||
+ if (waiter->prio == task->prio && !dl_task(task)) {
|
||||
if (!detect_deadlock)
|
||||
goto out_unlock_pi;
|
||||
else
|
|
@ -0,0 +1,50 @@
|
|||
From: "Darren Hart (VMware)" <dvhart@infradead.org>
|
||||
Date: Fri, 14 Apr 2017 15:46:08 -0700
|
||||
Subject: [PATCH] MAINTAINERS: Add FUTEX SUBSYSTEM
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 59cd42c29618c45cd3c56da43402b14f611888dd
|
||||
|
||||
Add a MAINTAINERS block for the FUTEX SUBSYSTEM which includes the core
|
||||
kernel code, include headers, testing code, and Documentation. Excludes
|
||||
arch files, and higher level test code.
|
||||
|
||||
I added tglx and mingo as M as they have made the tip commits and peterz
|
||||
and myself as R.
|
||||
|
||||
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
|
||||
Cc: Peter Zijlstra <peterz@infradead.org>
|
||||
Cc: Shuah Khan <shuah@kernel.org>
|
||||
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
|
||||
Link: http://lkml.kernel.org/r/20170414224608.GA5180@fury
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
---
|
||||
MAINTAINERS | 17 +++++++++++++++++
|
||||
1 file changed, 17 insertions(+)
|
||||
|
||||
--- a/MAINTAINERS
|
||||
+++ b/MAINTAINERS
|
||||
@@ -5196,6 +5196,23 @@ F: fs/fuse/
|
||||
F: include/uapi/linux/fuse.h
|
||||
F: Documentation/filesystems/fuse.txt
|
||||
|
||||
+FUTEX SUBSYSTEM
|
||||
+M: Thomas Gleixner <tglx@linutronix.de>
|
||||
+M: Ingo Molnar <mingo@redhat.com>
|
||||
+R: Peter Zijlstra <peterz@infradead.org>
|
||||
+R: Darren Hart <dvhart@infradead.org>
|
||||
+L: linux-kernel@vger.kernel.org
|
||||
+T: git git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git locking/core
|
||||
+S: Maintained
|
||||
+F: kernel/futex.c
|
||||
+F: kernel/futex_compat.c
|
||||
+F: include/asm-generic/futex.h
|
||||
+F: include/linux/futex.h
|
||||
+F: include/uapi/linux/futex.h
|
||||
+F: tools/testing/selftests/futex/
|
||||
+F: tools/perf/bench/futex*
|
||||
+F: Documentation/*futex*
|
||||
+
|
||||
FUTURE DOMAIN TMC-16x0 SCSI DRIVER (16-bit)
|
||||
M: Rik Faith <faith@cs.unc.edu>
|
||||
L: linux-scsi@vger.kernel.org
|
|
@ -1,7 +1,7 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Wed, 22 Mar 2017 11:35:51 +0100
|
||||
Subject: [PATCH] futex,rt_mutex: Provide futex specific rt_mutex API
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 5293c2efda37775346885c7e924d4ef7018ea60b
|
||||
|
||||
|
|
|
@ -0,0 +1,147 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Thu, 23 Mar 2017 15:56:10 +0100
|
||||
Subject: [PATCH] rtmutex: Clean up
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit aa2bfe55366552cb7e93e8709d66e698d79ccc47
|
||||
|
||||
Previous patches changed the meaning of the return value of
|
||||
rt_mutex_slowunlock(); update comments and code to reflect this.
|
||||
|
||||
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
|
||||
Cc: juri.lelli@arm.com
|
||||
Cc: bigeasy@linutronix.de
|
||||
Cc: xlpang@redhat.com
|
||||
Cc: rostedt@goodmis.org
|
||||
Cc: mathieu.desnoyers@efficios.com
|
||||
Cc: jdesfossez@efficios.com
|
||||
Cc: bristot@redhat.com
|
||||
Link: http://lkml.kernel.org/r/20170323150216.255058238@infradead.org
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
---
|
||||
kernel/futex.c | 7 ++++---
|
||||
kernel/locking/rtmutex.c | 28 +++++++++++++---------------
|
||||
kernel/locking/rtmutex_common.h | 2 +-
|
||||
3 files changed, 18 insertions(+), 19 deletions(-)
|
||||
|
||||
--- a/kernel/futex.c
|
||||
+++ b/kernel/futex.c
|
||||
@@ -1392,7 +1392,7 @@ static int wake_futex_pi(u32 __user *uad
|
||||
{
|
||||
u32 uninitialized_var(curval), newval;
|
||||
struct task_struct *new_owner;
|
||||
- bool deboost = false;
|
||||
+ bool postunlock = false;
|
||||
WAKE_Q(wake_q);
|
||||
int ret = 0;
|
||||
|
||||
@@ -1453,12 +1453,13 @@ static int wake_futex_pi(u32 __user *uad
|
||||
/*
|
||||
* We've updated the uservalue, this unlock cannot fail.
|
||||
*/
|
||||
- deboost = __rt_mutex_futex_unlock(&pi_state->pi_mutex, &wake_q);
|
||||
+ postunlock = __rt_mutex_futex_unlock(&pi_state->pi_mutex, &wake_q);
|
||||
|
||||
out_unlock:
|
||||
raw_spin_unlock_irq(&pi_state->pi_mutex.wait_lock);
|
||||
|
||||
- rt_mutex_postunlock(&wake_q, deboost);
|
||||
+ if (postunlock)
|
||||
+ rt_mutex_postunlock(&wake_q);
|
||||
|
||||
return ret;
|
||||
}
|
||||
--- a/kernel/locking/rtmutex.c
|
||||
+++ b/kernel/locking/rtmutex.c
|
||||
@@ -1328,7 +1328,8 @@ static inline int rt_mutex_slowtrylock(s
|
||||
|
||||
/*
|
||||
* Slow path to release a rt-mutex.
|
||||
- * Return whether the current task needs to undo a potential priority boosting.
|
||||
+ *
|
||||
+ * Return whether the current task needs to call rt_mutex_postunlock().
|
||||
*/
|
||||
static bool __sched rt_mutex_slowunlock(struct rt_mutex *lock,
|
||||
struct wake_q_head *wake_q)
|
||||
@@ -1399,8 +1400,7 @@ static bool __sched rt_mutex_slowunlock(
|
||||
|
||||
raw_spin_unlock_irqrestore(&lock->wait_lock, flags);
|
||||
|
||||
- /* check PI boosting */
|
||||
- return true;
|
||||
+ return true; /* call rt_mutex_postunlock() */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1447,15 +1447,14 @@ rt_mutex_fasttrylock(struct rt_mutex *lo
|
||||
}
|
||||
|
||||
/*
|
||||
- * Undo pi boosting (if necessary) and wake top waiter.
|
||||
+ * Performs the wakeup of the the top-waiter and re-enables preemption.
|
||||
*/
|
||||
-void rt_mutex_postunlock(struct wake_q_head *wake_q, bool deboost)
|
||||
+void rt_mutex_postunlock(struct wake_q_head *wake_q)
|
||||
{
|
||||
wake_up_q(wake_q);
|
||||
|
||||
/* Pairs with preempt_disable() in rt_mutex_slowunlock() */
|
||||
- if (deboost)
|
||||
- preempt_enable();
|
||||
+ preempt_enable();
|
||||
}
|
||||
|
||||
static inline void
|
||||
@@ -1464,14 +1463,12 @@ rt_mutex_fastunlock(struct rt_mutex *loc
|
||||
struct wake_q_head *wqh))
|
||||
{
|
||||
WAKE_Q(wake_q);
|
||||
- bool deboost;
|
||||
|
||||
if (likely(rt_mutex_cmpxchg_release(lock, current, NULL)))
|
||||
return;
|
||||
|
||||
- deboost = slowfn(lock, &wake_q);
|
||||
-
|
||||
- rt_mutex_postunlock(&wake_q, deboost);
|
||||
+ if (slowfn(lock, &wake_q))
|
||||
+ rt_mutex_postunlock(&wake_q);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1591,19 +1588,20 @@ bool __sched __rt_mutex_futex_unlock(str
|
||||
*/
|
||||
preempt_disable();
|
||||
|
||||
- return true; /* deboost and wakeups */
|
||||
+ return true; /* call postunlock() */
|
||||
}
|
||||
|
||||
void __sched rt_mutex_futex_unlock(struct rt_mutex *lock)
|
||||
{
|
||||
WAKE_Q(wake_q);
|
||||
- bool deboost;
|
||||
+ bool postunlock;
|
||||
|
||||
raw_spin_lock_irq(&lock->wait_lock);
|
||||
- deboost = __rt_mutex_futex_unlock(lock, &wake_q);
|
||||
+ postunlock = __rt_mutex_futex_unlock(lock, &wake_q);
|
||||
raw_spin_unlock_irq(&lock->wait_lock);
|
||||
|
||||
- rt_mutex_postunlock(&wake_q, deboost);
|
||||
+ if (postunlock)
|
||||
+ rt_mutex_postunlock(&wake_q);
|
||||
}
|
||||
|
||||
/**
|
||||
--- a/kernel/locking/rtmutex_common.h
|
||||
+++ b/kernel/locking/rtmutex_common.h
|
||||
@@ -122,7 +122,7 @@ extern void rt_mutex_futex_unlock(struct
|
||||
extern bool __rt_mutex_futex_unlock(struct rt_mutex *lock,
|
||||
struct wake_q_head *wqh);
|
||||
|
||||
-extern void rt_mutex_postunlock(struct wake_q_head *wake_q, bool deboost);
|
||||
+extern void rt_mutex_postunlock(struct wake_q_head *wake_q);
|
||||
|
||||
#ifdef CONFIG_DEBUG_RT_MUTEXES
|
||||
# include "rtmutex-debug.h"
|
|
@ -1,7 +1,7 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Wed, 22 Mar 2017 11:35:52 +0100
|
||||
Subject: [PATCH] futex: Change locking rules
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 734009e96d1983ad739e5b656e03430b3660c913
|
||||
|
||||
|
|
393
debian/patches/features/all/rt/0005-sched-rtmutex-Refactor-rt_mutex_setprio.patch
vendored
Normal file
393
debian/patches/features/all/rt/0005-sched-rtmutex-Refactor-rt_mutex_setprio.patch
vendored
Normal file
|
@ -0,0 +1,393 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Thu, 23 Mar 2017 15:56:11 +0100
|
||||
Subject: [PATCH] sched/rtmutex: Refactor rt_mutex_setprio()
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit acd58620e415aee4a43a808d7d2fd87259ee0001
|
||||
|
||||
With the introduction of SCHED_DEADLINE the whole notion that priority
|
||||
is a single number is gone, therefore the @prio argument to
|
||||
rt_mutex_setprio() doesn't make sense anymore.
|
||||
|
||||
So rework the code to pass a pi_task instead.
|
||||
|
||||
Note this also fixes a problem with pi_top_task caching; previously we
|
||||
would not set the pointer (call rt_mutex_update_top_task) if the
|
||||
priority didn't change, this could lead to a stale pointer.
|
||||
|
||||
As for the XXX, I think its fine to use pi_task->prio, because if it
|
||||
differs from waiter->prio, a PI chain update is immenent.
|
||||
|
||||
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
|
||||
Cc: juri.lelli@arm.com
|
||||
Cc: bigeasy@linutronix.de
|
||||
Cc: xlpang@redhat.com
|
||||
Cc: rostedt@goodmis.org
|
||||
Cc: mathieu.desnoyers@efficios.com
|
||||
Cc: jdesfossez@efficios.com
|
||||
Cc: bristot@redhat.com
|
||||
Link: http://lkml.kernel.org/r/20170323150216.303827095@infradead.org
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
---
|
||||
include/linux/sched/rt.h | 24 +++-------
|
||||
kernel/locking/rtmutex.c | 112 ++++++++++++-----------------------------------
|
||||
kernel/sched/core.c | 66 ++++++++++++++++++++++-----
|
||||
3 files changed, 91 insertions(+), 111 deletions(-)
|
||||
|
||||
--- a/include/linux/sched/rt.h
|
||||
+++ b/include/linux/sched/rt.h
|
||||
@@ -16,28 +16,20 @@ static inline int rt_task(struct task_st
|
||||
}
|
||||
|
||||
#ifdef CONFIG_RT_MUTEXES
|
||||
-extern int rt_mutex_getprio(struct task_struct *p);
|
||||
-extern void rt_mutex_setprio(struct task_struct *p, int prio);
|
||||
-extern int rt_mutex_get_effective_prio(struct task_struct *task, int newprio);
|
||||
-extern void rt_mutex_update_top_task(struct task_struct *p);
|
||||
-extern struct task_struct *rt_mutex_get_top_task(struct task_struct *task);
|
||||
+/*
|
||||
+ * Must hold either p->pi_lock or task_rq(p)->lock.
|
||||
+ */
|
||||
+static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *p)
|
||||
+{
|
||||
+ return p->pi_top_task;
|
||||
+}
|
||||
+extern void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task);
|
||||
extern void rt_mutex_adjust_pi(struct task_struct *p);
|
||||
static inline bool tsk_is_pi_blocked(struct task_struct *tsk)
|
||||
{
|
||||
return tsk->pi_blocked_on != NULL;
|
||||
}
|
||||
#else
|
||||
-static inline int rt_mutex_getprio(struct task_struct *p)
|
||||
-{
|
||||
- return p->normal_prio;
|
||||
-}
|
||||
-
|
||||
-static inline int rt_mutex_get_effective_prio(struct task_struct *task,
|
||||
- int newprio)
|
||||
-{
|
||||
- return newprio;
|
||||
-}
|
||||
-
|
||||
static inline struct task_struct *rt_mutex_get_top_task(struct task_struct *task)
|
||||
{
|
||||
return NULL;
|
||||
--- a/kernel/locking/rtmutex.c
|
||||
+++ b/kernel/locking/rtmutex.c
|
||||
@@ -320,67 +320,16 @@ rt_mutex_dequeue_pi(struct task_struct *
|
||||
RB_CLEAR_NODE(&waiter->pi_tree_entry);
|
||||
}
|
||||
|
||||
-/*
|
||||
- * Must hold both p->pi_lock and task_rq(p)->lock.
|
||||
- */
|
||||
-void rt_mutex_update_top_task(struct task_struct *p)
|
||||
-{
|
||||
- if (!task_has_pi_waiters(p)) {
|
||||
- p->pi_top_task = NULL;
|
||||
- return;
|
||||
- }
|
||||
-
|
||||
- p->pi_top_task = task_top_pi_waiter(p)->task;
|
||||
-}
|
||||
-
|
||||
-/*
|
||||
- * Calculate task priority from the waiter tree priority
|
||||
- *
|
||||
- * Return task->normal_prio when the waiter tree is empty or when
|
||||
- * the waiter is not allowed to do priority boosting
|
||||
- */
|
||||
-int rt_mutex_getprio(struct task_struct *task)
|
||||
-{
|
||||
- if (likely(!task_has_pi_waiters(task)))
|
||||
- return task->normal_prio;
|
||||
-
|
||||
- return min(task_top_pi_waiter(task)->prio,
|
||||
- task->normal_prio);
|
||||
-}
|
||||
-
|
||||
-/*
|
||||
- * Must hold either p->pi_lock or task_rq(p)->lock.
|
||||
- */
|
||||
-struct task_struct *rt_mutex_get_top_task(struct task_struct *task)
|
||||
-{
|
||||
- return task->pi_top_task;
|
||||
-}
|
||||
-
|
||||
-/*
|
||||
- * Called by sched_setscheduler() to get the priority which will be
|
||||
- * effective after the change.
|
||||
- */
|
||||
-int rt_mutex_get_effective_prio(struct task_struct *task, int newprio)
|
||||
+static void rt_mutex_adjust_prio(struct task_struct *p)
|
||||
{
|
||||
- struct task_struct *top_task = rt_mutex_get_top_task(task);
|
||||
+ struct task_struct *pi_task = NULL;
|
||||
|
||||
- if (!top_task)
|
||||
- return newprio;
|
||||
+ lockdep_assert_held(&p->pi_lock);
|
||||
|
||||
- return min(top_task->prio, newprio);
|
||||
-}
|
||||
+ if (task_has_pi_waiters(p))
|
||||
+ pi_task = task_top_pi_waiter(p)->task;
|
||||
|
||||
-/*
|
||||
- * Adjust the priority of a task, after its pi_waiters got modified.
|
||||
- *
|
||||
- * This can be both boosting and unboosting. task->pi_lock must be held.
|
||||
- */
|
||||
-static void __rt_mutex_adjust_prio(struct task_struct *task)
|
||||
-{
|
||||
- int prio = rt_mutex_getprio(task);
|
||||
-
|
||||
- if (task->prio != prio || dl_prio(prio))
|
||||
- rt_mutex_setprio(task, prio);
|
||||
+ rt_mutex_setprio(p, pi_task);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -740,7 +689,7 @@ static int rt_mutex_adjust_prio_chain(st
|
||||
*/
|
||||
rt_mutex_dequeue_pi(task, prerequeue_top_waiter);
|
||||
rt_mutex_enqueue_pi(task, waiter);
|
||||
- __rt_mutex_adjust_prio(task);
|
||||
+ rt_mutex_adjust_prio(task);
|
||||
|
||||
} else if (prerequeue_top_waiter == waiter) {
|
||||
/*
|
||||
@@ -756,7 +705,7 @@ static int rt_mutex_adjust_prio_chain(st
|
||||
rt_mutex_dequeue_pi(task, waiter);
|
||||
waiter = rt_mutex_top_waiter(lock);
|
||||
rt_mutex_enqueue_pi(task, waiter);
|
||||
- __rt_mutex_adjust_prio(task);
|
||||
+ rt_mutex_adjust_prio(task);
|
||||
} else {
|
||||
/*
|
||||
* Nothing changed. No need to do any priority
|
||||
@@ -964,7 +913,7 @@ static int task_blocks_on_rt_mutex(struc
|
||||
return -EDEADLK;
|
||||
|
||||
raw_spin_lock(&task->pi_lock);
|
||||
- __rt_mutex_adjust_prio(task);
|
||||
+ rt_mutex_adjust_prio(task);
|
||||
waiter->task = task;
|
||||
waiter->lock = lock;
|
||||
waiter->prio = task->prio;
|
||||
@@ -986,7 +935,7 @@ static int task_blocks_on_rt_mutex(struc
|
||||
rt_mutex_dequeue_pi(owner, top_waiter);
|
||||
rt_mutex_enqueue_pi(owner, waiter);
|
||||
|
||||
- __rt_mutex_adjust_prio(owner);
|
||||
+ rt_mutex_adjust_prio(owner);
|
||||
if (owner->pi_blocked_on)
|
||||
chain_walk = 1;
|
||||
} else if (rt_mutex_cond_detect_deadlock(waiter, chwalk)) {
|
||||
@@ -1038,13 +987,14 @@ static void mark_wakeup_next_waiter(stru
|
||||
waiter = rt_mutex_top_waiter(lock);
|
||||
|
||||
/*
|
||||
- * Remove it from current->pi_waiters. We do not adjust a
|
||||
- * possible priority boost right now. We execute wakeup in the
|
||||
- * boosted mode and go back to normal after releasing
|
||||
- * lock->wait_lock.
|
||||
+ * Remove it from current->pi_waiters and deboost.
|
||||
+ *
|
||||
+ * We must in fact deboost here in order to ensure we call
|
||||
+ * rt_mutex_setprio() to update p->pi_top_task before the
|
||||
+ * task unblocks.
|
||||
*/
|
||||
rt_mutex_dequeue_pi(current, waiter);
|
||||
- __rt_mutex_adjust_prio(current);
|
||||
+ rt_mutex_adjust_prio(current);
|
||||
|
||||
/*
|
||||
* As we are waking up the top waiter, and the waiter stays
|
||||
@@ -1056,9 +1006,19 @@ static void mark_wakeup_next_waiter(stru
|
||||
*/
|
||||
lock->owner = (void *) RT_MUTEX_HAS_WAITERS;
|
||||
|
||||
- raw_spin_unlock(¤t->pi_lock);
|
||||
-
|
||||
+ /*
|
||||
+ * We deboosted before waking the top waiter task such that we don't
|
||||
+ * run two tasks with the 'same' priority (and ensure the
|
||||
+ * p->pi_top_task pointer points to a blocked task). This however can
|
||||
+ * lead to priority inversion if we would get preempted after the
|
||||
+ * deboost but before waking our donor task, hence the preempt_disable()
|
||||
+ * before unlock.
|
||||
+ *
|
||||
+ * Pairs with preempt_enable() in rt_mutex_postunlock();
|
||||
+ */
|
||||
+ preempt_disable();
|
||||
wake_q_add(wake_q, waiter->task);
|
||||
+ raw_spin_unlock(¤t->pi_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1093,7 +1053,7 @@ static void remove_waiter(struct rt_mute
|
||||
if (rt_mutex_has_waiters(lock))
|
||||
rt_mutex_enqueue_pi(owner, rt_mutex_top_waiter(lock));
|
||||
|
||||
- __rt_mutex_adjust_prio(owner);
|
||||
+ rt_mutex_adjust_prio(owner);
|
||||
|
||||
/* Store the lock on which owner is blocked or NULL */
|
||||
next_lock = task_blocked_on_lock(owner);
|
||||
@@ -1132,8 +1092,7 @@ void rt_mutex_adjust_pi(struct task_stru
|
||||
raw_spin_lock_irqsave(&task->pi_lock, flags);
|
||||
|
||||
waiter = task->pi_blocked_on;
|
||||
- if (!waiter || (waiter->prio == task->prio &&
|
||||
- !dl_prio(task->prio))) {
|
||||
+ if (!waiter || (waiter->prio == task->prio && !dl_prio(task->prio))) {
|
||||
raw_spin_unlock_irqrestore(&task->pi_lock, flags);
|
||||
return;
|
||||
}
|
||||
@@ -1387,17 +1346,6 @@ static bool __sched rt_mutex_slowunlock(
|
||||
* Queue the next waiter for wakeup once we release the wait_lock.
|
||||
*/
|
||||
mark_wakeup_next_waiter(wake_q, lock);
|
||||
-
|
||||
- /*
|
||||
- * We should deboost before waking the top waiter task such that
|
||||
- * we don't run two tasks with the 'same' priority. This however
|
||||
- * can lead to prio-inversion if we would get preempted after
|
||||
- * the deboost but before waking our high-prio task, hence the
|
||||
- * preempt_disable before unlock. Pairs with preempt_enable() in
|
||||
- * rt_mutex_postunlock();
|
||||
- */
|
||||
- preempt_disable();
|
||||
-
|
||||
raw_spin_unlock_irqrestore(&lock->wait_lock, flags);
|
||||
|
||||
return true; /* call rt_mutex_postunlock() */
|
||||
--- a/kernel/sched/core.c
|
||||
+++ b/kernel/sched/core.c
|
||||
@@ -3629,10 +3629,25 @@ EXPORT_SYMBOL(default_wake_function);
|
||||
|
||||
#ifdef CONFIG_RT_MUTEXES
|
||||
|
||||
+static inline int __rt_effective_prio(struct task_struct *pi_task, int prio)
|
||||
+{
|
||||
+ if (pi_task)
|
||||
+ prio = min(prio, pi_task->prio);
|
||||
+
|
||||
+ return prio;
|
||||
+}
|
||||
+
|
||||
+static inline int rt_effective_prio(struct task_struct *p, int prio)
|
||||
+{
|
||||
+ struct task_struct *pi_task = rt_mutex_get_top_task(p);
|
||||
+
|
||||
+ return __rt_effective_prio(pi_task, prio);
|
||||
+}
|
||||
+
|
||||
/*
|
||||
* rt_mutex_setprio - set the current priority of a task
|
||||
- * @p: task
|
||||
- * @prio: prio value (kernel-internal form)
|
||||
+ * @p: task to boost
|
||||
+ * @pi_task: donor task
|
||||
*
|
||||
* This function changes the 'effective' priority of a task. It does
|
||||
* not touch ->normal_prio like __setscheduler().
|
||||
@@ -3640,16 +3655,40 @@ EXPORT_SYMBOL(default_wake_function);
|
||||
* Used by the rt_mutex code to implement priority inheritance
|
||||
* logic. Call site only calls if the priority of the task changed.
|
||||
*/
|
||||
-void rt_mutex_setprio(struct task_struct *p, int prio)
|
||||
+void rt_mutex_setprio(struct task_struct *p, struct task_struct *pi_task)
|
||||
{
|
||||
- int oldprio, queued, running, queue_flag = DEQUEUE_SAVE | DEQUEUE_MOVE;
|
||||
+ int prio, oldprio, queued, running, queue_flag = DEQUEUE_SAVE | DEQUEUE_MOVE;
|
||||
const struct sched_class *prev_class;
|
||||
struct rq_flags rf;
|
||||
struct rq *rq;
|
||||
|
||||
- BUG_ON(prio > MAX_PRIO);
|
||||
+ /* XXX used to be waiter->prio, not waiter->task->prio */
|
||||
+ prio = __rt_effective_prio(pi_task, p->normal_prio);
|
||||
+
|
||||
+ /*
|
||||
+ * If nothing changed; bail early.
|
||||
+ */
|
||||
+ if (p->pi_top_task == pi_task && prio == p->prio && !dl_prio(prio))
|
||||
+ return;
|
||||
|
||||
rq = __task_rq_lock(p, &rf);
|
||||
+ /*
|
||||
+ * Set under pi_lock && rq->lock, such that the value can be used under
|
||||
+ * either lock.
|
||||
+ *
|
||||
+ * Note that there is loads of tricky to make this pointer cache work
|
||||
+ * right. rt_mutex_slowunlock()+rt_mutex_postunlock() work together to
|
||||
+ * ensure a task is de-boosted (pi_task is set to NULL) before the
|
||||
+ * task is allowed to run again (and can exit). This ensures the pointer
|
||||
+ * points to a blocked task -- which guaratees the task is present.
|
||||
+ */
|
||||
+ p->pi_top_task = pi_task;
|
||||
+
|
||||
+ /*
|
||||
+ * For FIFO/RR we only need to set prio, if that matches we're done.
|
||||
+ */
|
||||
+ if (prio == p->prio && !dl_prio(prio))
|
||||
+ goto out_unlock;
|
||||
|
||||
/*
|
||||
* Idle task boosting is a nono in general. There is one
|
||||
@@ -3669,9 +3708,7 @@ void rt_mutex_setprio(struct task_struct
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
- rt_mutex_update_top_task(p);
|
||||
-
|
||||
- trace_sched_pi_setprio(p, prio);
|
||||
+ trace_sched_pi_setprio(p, prio); /* broken */
|
||||
oldprio = p->prio;
|
||||
|
||||
if (oldprio == prio)
|
||||
@@ -3695,7 +3732,6 @@ void rt_mutex_setprio(struct task_struct
|
||||
* running task
|
||||
*/
|
||||
if (dl_prio(prio)) {
|
||||
- struct task_struct *pi_task = rt_mutex_get_top_task(p);
|
||||
if (!dl_prio(p->normal_prio) ||
|
||||
(pi_task && dl_entity_preempt(&pi_task->dl, &p->dl))) {
|
||||
p->dl.dl_boosted = 1;
|
||||
@@ -3732,6 +3768,11 @@ void rt_mutex_setprio(struct task_struct
|
||||
balance_callback(rq);
|
||||
preempt_enable();
|
||||
}
|
||||
+#else
|
||||
+static inline int rt_effective_prio(struct task_struct *p, int prio)
|
||||
+{
|
||||
+ return prio;
|
||||
+}
|
||||
#endif
|
||||
|
||||
void set_user_nice(struct task_struct *p, long nice)
|
||||
@@ -3976,10 +4017,9 @@ static void __setscheduler(struct rq *rq
|
||||
* Keep a potential priority boosting if called from
|
||||
* sched_setscheduler().
|
||||
*/
|
||||
+ p->prio = normal_prio(p);
|
||||
if (keep_boost)
|
||||
- p->prio = rt_mutex_get_effective_prio(p, normal_prio(p));
|
||||
- else
|
||||
- p->prio = normal_prio(p);
|
||||
+ p->prio = rt_effective_prio(p, p->prio);
|
||||
|
||||
if (dl_prio(p->prio))
|
||||
p->sched_class = &dl_sched_class;
|
||||
@@ -4266,7 +4306,7 @@ static int __sched_setscheduler(struct t
|
||||
* the runqueue. This will be done when the task deboost
|
||||
* itself.
|
||||
*/
|
||||
- new_effective_prio = rt_mutex_get_effective_prio(p, newprio);
|
||||
+ new_effective_prio = rt_effective_prio(p, newprio);
|
||||
if (new_effective_prio == oldprio)
|
||||
queue_flags &= ~DEQUEUE_MOVE;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Wed, 22 Mar 2017 11:35:53 +0100
|
||||
Subject: [PATCH] futex: Cleanup refcounting
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit bf92cf3a5100f5a0d5f9834787b130159397cb22
|
||||
|
||||
|
|
109
debian/patches/features/all/rt/0006-sched-tracing-Update-trace_sched_pi_setprio.patch
vendored
Normal file
109
debian/patches/features/all/rt/0006-sched-tracing-Update-trace_sched_pi_setprio.patch
vendored
Normal file
|
@ -0,0 +1,109 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Thu, 23 Mar 2017 15:56:12 +0100
|
||||
Subject: [PATCH] sched,tracing: Update trace_sched_pi_setprio()
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit b91473ff6e979c0028f02f90e40c844959c736d8
|
||||
|
||||
Pass the PI donor task, instead of a numerical priority.
|
||||
|
||||
Numerical priorities are not sufficient to describe state ever since
|
||||
SCHED_DEADLINE.
|
||||
|
||||
Annotate all sched tracepoints that are currently broken; fixing them
|
||||
will bork userspace. *hate*.
|
||||
|
||||
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
|
||||
Reviewed-by: Steven Rostedt <rostedt@goodmis.org>
|
||||
Cc: juri.lelli@arm.com
|
||||
Cc: bigeasy@linutronix.de
|
||||
Cc: xlpang@redhat.com
|
||||
Cc: mathieu.desnoyers@efficios.com
|
||||
Cc: jdesfossez@efficios.com
|
||||
Cc: bristot@redhat.com
|
||||
Link: http://lkml.kernel.org/r/20170323150216.353599881@infradead.org
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
---
|
||||
include/trace/events/sched.h | 16 +++++++++-------
|
||||
kernel/sched/core.c | 2 +-
|
||||
2 files changed, 10 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/include/trace/events/sched.h
|
||||
+++ b/include/trace/events/sched.h
|
||||
@@ -70,7 +70,7 @@ DECLARE_EVENT_CLASS(sched_wakeup_templat
|
||||
TP_fast_assign(
|
||||
memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
|
||||
__entry->pid = p->pid;
|
||||
- __entry->prio = p->prio;
|
||||
+ __entry->prio = p->prio; /* XXX SCHED_DEADLINE */
|
||||
__entry->success = 1; /* rudiment, kill when possible */
|
||||
__entry->target_cpu = task_cpu(p);
|
||||
),
|
||||
@@ -147,6 +147,7 @@ TRACE_EVENT(sched_switch,
|
||||
memcpy(__entry->prev_comm, prev->comm, TASK_COMM_LEN);
|
||||
__entry->next_pid = next->pid;
|
||||
__entry->next_prio = next->prio;
|
||||
+ /* XXX SCHED_DEADLINE */
|
||||
),
|
||||
|
||||
TP_printk("prev_comm=%s prev_pid=%d prev_prio=%d prev_state=%s%s ==> next_comm=%s next_pid=%d next_prio=%d",
|
||||
@@ -181,7 +182,7 @@ TRACE_EVENT(sched_migrate_task,
|
||||
TP_fast_assign(
|
||||
memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
|
||||
__entry->pid = p->pid;
|
||||
- __entry->prio = p->prio;
|
||||
+ __entry->prio = p->prio; /* XXX SCHED_DEADLINE */
|
||||
__entry->orig_cpu = task_cpu(p);
|
||||
__entry->dest_cpu = dest_cpu;
|
||||
),
|
||||
@@ -206,7 +207,7 @@ DECLARE_EVENT_CLASS(sched_process_templa
|
||||
TP_fast_assign(
|
||||
memcpy(__entry->comm, p->comm, TASK_COMM_LEN);
|
||||
__entry->pid = p->pid;
|
||||
- __entry->prio = p->prio;
|
||||
+ __entry->prio = p->prio; /* XXX SCHED_DEADLINE */
|
||||
),
|
||||
|
||||
TP_printk("comm=%s pid=%d prio=%d",
|
||||
@@ -253,7 +254,7 @@ TRACE_EVENT(sched_process_wait,
|
||||
TP_fast_assign(
|
||||
memcpy(__entry->comm, current->comm, TASK_COMM_LEN);
|
||||
__entry->pid = pid_nr(pid);
|
||||
- __entry->prio = current->prio;
|
||||
+ __entry->prio = current->prio; /* XXX SCHED_DEADLINE */
|
||||
),
|
||||
|
||||
TP_printk("comm=%s pid=%d prio=%d",
|
||||
@@ -413,9 +414,9 @@ DEFINE_EVENT(sched_stat_runtime, sched_s
|
||||
*/
|
||||
TRACE_EVENT(sched_pi_setprio,
|
||||
|
||||
- TP_PROTO(struct task_struct *tsk, int newprio),
|
||||
+ TP_PROTO(struct task_struct *tsk, struct task_struct *pi_task),
|
||||
|
||||
- TP_ARGS(tsk, newprio),
|
||||
+ TP_ARGS(tsk, pi_task),
|
||||
|
||||
TP_STRUCT__entry(
|
||||
__array( char, comm, TASK_COMM_LEN )
|
||||
@@ -428,7 +429,8 @@ TRACE_EVENT(sched_pi_setprio,
|
||||
memcpy(__entry->comm, tsk->comm, TASK_COMM_LEN);
|
||||
__entry->pid = tsk->pid;
|
||||
__entry->oldprio = tsk->prio;
|
||||
- __entry->newprio = newprio;
|
||||
+ __entry->newprio = pi_task ? pi_task->prio : tsk->prio;
|
||||
+ /* XXX SCHED_DEADLINE bits missing */
|
||||
),
|
||||
|
||||
TP_printk("comm=%s pid=%d oldprio=%d newprio=%d",
|
||||
--- a/kernel/sched/core.c
|
||||
+++ b/kernel/sched/core.c
|
||||
@@ -3708,7 +3708,7 @@ void rt_mutex_setprio(struct task_struct
|
||||
goto out_unlock;
|
||||
}
|
||||
|
||||
- trace_sched_pi_setprio(p, prio); /* broken */
|
||||
+ trace_sched_pi_setprio(p, pi_task);
|
||||
oldprio = p->prio;
|
||||
|
||||
if (oldprio == prio)
|
|
@ -1,7 +1,7 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Wed, 22 Mar 2017 11:35:54 +0100
|
||||
Subject: [PATCH] futex: Rework inconsistent rt_mutex/futex_q state
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 73d786bd043ebc855f349c81ea805f6b11cbf2aa
|
||||
|
||||
|
|
122
debian/patches/features/all/rt/0007-rtmutex-Fix-PI-chain-order-integrity.patch
vendored
Normal file
122
debian/patches/features/all/rt/0007-rtmutex-Fix-PI-chain-order-integrity.patch
vendored
Normal file
|
@ -0,0 +1,122 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Thu, 23 Mar 2017 15:56:13 +0100
|
||||
Subject: [PATCH] rtmutex: Fix PI chain order integrity
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit e0aad5b44ff5d28ac1d6ae70cdf84ca228e889dc
|
||||
|
||||
rt_mutex_waiter::prio is a copy of task_struct::prio which is updated
|
||||
during the PI chain walk, such that the PI chain order isn't messed up
|
||||
by (asynchronous) task state updates.
|
||||
|
||||
Currently rt_mutex_waiter_less() uses task state for deadline tasks;
|
||||
this is broken, since the task state can, as said above, change
|
||||
asynchronously, causing the RB tree order to change without actual
|
||||
tree update -> FAIL.
|
||||
|
||||
Fix this by also copying the deadline into the rt_mutex_waiter state
|
||||
and updating it along with its prio field.
|
||||
|
||||
Ideally we would also force PI chain updates whenever DL tasks update
|
||||
their deadline parameter, but for first approximation this is less
|
||||
broken than it was.
|
||||
|
||||
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
|
||||
Cc: juri.lelli@arm.com
|
||||
Cc: bigeasy@linutronix.de
|
||||
Cc: xlpang@redhat.com
|
||||
Cc: rostedt@goodmis.org
|
||||
Cc: mathieu.desnoyers@efficios.com
|
||||
Cc: jdesfossez@efficios.com
|
||||
Cc: bristot@redhat.com
|
||||
Link: http://lkml.kernel.org/r/20170323150216.403992539@infradead.org
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
---
|
||||
kernel/locking/rtmutex.c | 29 +++++++++++++++++++++++++++--
|
||||
kernel/locking/rtmutex_common.h | 1 +
|
||||
2 files changed, 28 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/kernel/locking/rtmutex.c
|
||||
+++ b/kernel/locking/rtmutex.c
|
||||
@@ -236,8 +236,7 @@ rt_mutex_waiter_less(struct rt_mutex_wai
|
||||
* then right waiter has a dl_prio() too.
|
||||
*/
|
||||
if (dl_prio(left->prio))
|
||||
- return dl_time_before(left->task->dl.deadline,
|
||||
- right->task->dl.deadline);
|
||||
+ return dl_time_before(left->deadline, right->deadline);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -648,7 +647,26 @@ static int rt_mutex_adjust_prio_chain(st
|
||||
|
||||
/* [7] Requeue the waiter in the lock waiter tree. */
|
||||
rt_mutex_dequeue(lock, waiter);
|
||||
+
|
||||
+ /*
|
||||
+ * Update the waiter prio fields now that we're dequeued.
|
||||
+ *
|
||||
+ * These values can have changed through either:
|
||||
+ *
|
||||
+ * sys_sched_set_scheduler() / sys_sched_setattr()
|
||||
+ *
|
||||
+ * or
|
||||
+ *
|
||||
+ * DL CBS enforcement advancing the effective deadline.
|
||||
+ *
|
||||
+ * Even though pi_waiters also uses these fields, and that tree is only
|
||||
+ * updated in [11], we can do this here, since we hold [L], which
|
||||
+ * serializes all pi_waiters access and rb_erase() does not care about
|
||||
+ * the values of the node being removed.
|
||||
+ */
|
||||
waiter->prio = task->prio;
|
||||
+ waiter->deadline = task->dl.deadline;
|
||||
+
|
||||
rt_mutex_enqueue(lock, waiter);
|
||||
|
||||
/* [8] Release the task */
|
||||
@@ -775,6 +793,8 @@ static int rt_mutex_adjust_prio_chain(st
|
||||
static int try_to_take_rt_mutex(struct rt_mutex *lock, struct task_struct *task,
|
||||
struct rt_mutex_waiter *waiter)
|
||||
{
|
||||
+ lockdep_assert_held(&lock->wait_lock);
|
||||
+
|
||||
/*
|
||||
* Before testing whether we can acquire @lock, we set the
|
||||
* RT_MUTEX_HAS_WAITERS bit in @lock->owner. This forces all
|
||||
@@ -900,6 +920,8 @@ static int task_blocks_on_rt_mutex(struc
|
||||
struct rt_mutex *next_lock;
|
||||
int chain_walk = 0, res;
|
||||
|
||||
+ lockdep_assert_held(&lock->wait_lock);
|
||||
+
|
||||
/*
|
||||
* Early deadlock detection. We really don't want the task to
|
||||
* enqueue on itself just to untangle the mess later. It's not
|
||||
@@ -917,6 +939,7 @@ static int task_blocks_on_rt_mutex(struc
|
||||
waiter->task = task;
|
||||
waiter->lock = lock;
|
||||
waiter->prio = task->prio;
|
||||
+ waiter->deadline = task->dl.deadline;
|
||||
|
||||
/* Get the top priority waiter on the lock */
|
||||
if (rt_mutex_has_waiters(lock))
|
||||
@@ -1034,6 +1057,8 @@ static void remove_waiter(struct rt_mute
|
||||
struct task_struct *owner = rt_mutex_owner(lock);
|
||||
struct rt_mutex *next_lock;
|
||||
|
||||
+ lockdep_assert_held(&lock->wait_lock);
|
||||
+
|
||||
raw_spin_lock(¤t->pi_lock);
|
||||
rt_mutex_dequeue(lock, waiter);
|
||||
current->pi_blocked_on = NULL;
|
||||
--- a/kernel/locking/rtmutex_common.h
|
||||
+++ b/kernel/locking/rtmutex_common.h
|
||||
@@ -33,6 +33,7 @@ struct rt_mutex_waiter {
|
||||
struct rt_mutex *deadlock_lock;
|
||||
#endif
|
||||
int prio;
|
||||
+ u64 deadline;
|
||||
};
|
||||
|
||||
/*
|
|
@ -1,7 +1,7 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Wed, 22 Mar 2017 11:35:55 +0100
|
||||
Subject: [PATCH] futex: Pull rt_mutex_futex_unlock() out from under hb->lock
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 16ffa12d742534d4ff73e8b3a4e81c1de39196f0
|
||||
|
||||
|
|
102
debian/patches/features/all/rt/0008-rtmutex-Fix-more-prio-comparisons.patch
vendored
Normal file
102
debian/patches/features/all/rt/0008-rtmutex-Fix-more-prio-comparisons.patch
vendored
Normal file
|
@ -0,0 +1,102 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Thu, 23 Mar 2017 15:56:14 +0100
|
||||
Subject: [PATCH] rtmutex: Fix more prio comparisons
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 19830e55247cddb3f46f1bf60b8e245593491bea
|
||||
|
||||
There was a pure ->prio comparison left in try_to_wake_rt_mutex(),
|
||||
convert it to use rt_mutex_waiter_less(), noting that greater-or-equal
|
||||
is not-less (both in kernel priority view).
|
||||
|
||||
This necessitated the introduction of cmp_task() which creates a
|
||||
pointer to an unnamed stack variable of struct rt_mutex_waiter type to
|
||||
compare against tasks.
|
||||
|
||||
With this, we can now also create and employ rt_mutex_waiter_equal().
|
||||
|
||||
Reviewed-and-tested-by: Juri Lelli <juri.lelli@arm.com>
|
||||
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
|
||||
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
Cc: juri.lelli@arm.com
|
||||
Cc: bigeasy@linutronix.de
|
||||
Cc: xlpang@redhat.com
|
||||
Cc: rostedt@goodmis.org
|
||||
Cc: mathieu.desnoyers@efficios.com
|
||||
Cc: jdesfossez@efficios.com
|
||||
Cc: bristot@redhat.com
|
||||
Link: http://lkml.kernel.org/r/20170323150216.455584638@infradead.org
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
---
|
||||
kernel/locking/rtmutex.c | 32 +++++++++++++++++++++++++++++---
|
||||
1 file changed, 29 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/kernel/locking/rtmutex.c
|
||||
+++ b/kernel/locking/rtmutex.c
|
||||
@@ -222,6 +222,12 @@ static inline bool unlock_rt_mutex_safe(
|
||||
}
|
||||
#endif
|
||||
|
||||
+/*
|
||||
+ * Only use with rt_mutex_waiter_{less,equal}()
|
||||
+ */
|
||||
+#define task_to_waiter(p) \
|
||||
+ &(struct rt_mutex_waiter){ .prio = (p)->prio, .deadline = (p)->dl.deadline }
|
||||
+
|
||||
static inline int
|
||||
rt_mutex_waiter_less(struct rt_mutex_waiter *left,
|
||||
struct rt_mutex_waiter *right)
|
||||
@@ -241,6 +247,25 @@ rt_mutex_waiter_less(struct rt_mutex_wai
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static inline int
|
||||
+rt_mutex_waiter_equal(struct rt_mutex_waiter *left,
|
||||
+ struct rt_mutex_waiter *right)
|
||||
+{
|
||||
+ if (left->prio != right->prio)
|
||||
+ return 0;
|
||||
+
|
||||
+ /*
|
||||
+ * If both waiters have dl_prio(), we check the deadlines of the
|
||||
+ * associated tasks.
|
||||
+ * If left waiter has a dl_prio(), and we didn't return 0 above,
|
||||
+ * then right waiter has a dl_prio() too.
|
||||
+ */
|
||||
+ if (dl_prio(left->prio))
|
||||
+ return left->deadline == right->deadline;
|
||||
+
|
||||
+ return 1;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
rt_mutex_enqueue(struct rt_mutex *lock, struct rt_mutex_waiter *waiter)
|
||||
{
|
||||
@@ -551,7 +576,7 @@ static int rt_mutex_adjust_prio_chain(st
|
||||
* enabled we continue, but stop the requeueing in the chain
|
||||
* walk.
|
||||
*/
|
||||
- if (waiter->prio == task->prio && !dl_task(task)) {
|
||||
+ if (rt_mutex_waiter_equal(waiter, task_to_waiter(task))) {
|
||||
if (!detect_deadlock)
|
||||
goto out_unlock_pi;
|
||||
else
|
||||
@@ -854,7 +879,8 @@ static int try_to_take_rt_mutex(struct r
|
||||
* the top waiter priority (kernel view),
|
||||
* @task lost.
|
||||
*/
|
||||
- if (task->prio >= rt_mutex_top_waiter(lock)->prio)
|
||||
+ if (!rt_mutex_waiter_less(task_to_waiter(task),
|
||||
+ rt_mutex_top_waiter(lock)))
|
||||
return 0;
|
||||
|
||||
/*
|
||||
@@ -1117,7 +1143,7 @@ void rt_mutex_adjust_pi(struct task_stru
|
||||
raw_spin_lock_irqsave(&task->pi_lock, flags);
|
||||
|
||||
waiter = task->pi_blocked_on;
|
||||
- if (!waiter || (waiter->prio == task->prio && !dl_prio(task->prio))) {
|
||||
+ if (!waiter || rt_mutex_waiter_equal(waiter, task_to_waiter(task))) {
|
||||
raw_spin_unlock_irqrestore(&task->pi_lock, flags);
|
||||
return;
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Wed, 22 Mar 2017 11:35:56 +0100
|
||||
Subject: [PATCH] futex,rt_mutex: Introduce rt_mutex_init_waiter()
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 50809358dd7199aa7ce232f6877dd09ec30ef374
|
||||
|
||||
|
|
43
debian/patches/features/all/rt/0009-rtmutex-Plug-preempt-count-leak-in-rt_mutex_futex_un.patch
vendored
Normal file
43
debian/patches/features/all/rt/0009-rtmutex-Plug-preempt-count-leak-in-rt_mutex_futex_un.patch
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
From: Mike Galbraith <efault@gmx.de>
|
||||
Date: Wed, 5 Apr 2017 10:08:27 +0200
|
||||
Subject: [PATCH] rtmutex: Plug preempt count leak in
|
||||
rt_mutex_futex_unlock()
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit def34eaae5ce04b324e48e1bfac873091d945213
|
||||
|
||||
mark_wakeup_next_waiter() already disables preemption, doing so again
|
||||
leaves us with an unpaired preempt_disable().
|
||||
|
||||
Fixes: 2a1c60299406 ("rtmutex: Deboost before waking up the top waiter")
|
||||
Signed-off-by: Mike Galbraith <efault@gmx.de>
|
||||
Cc: Peter Zijlstra <peterz@infradead.org>
|
||||
Cc: xlpang@redhat.com
|
||||
Cc: rostedt@goodmis.org
|
||||
Link: http://lkml.kernel.org/r/1491379707.6538.2.camel@gmx.de
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
---
|
||||
kernel/locking/rtmutex.c | 10 +++++-----
|
||||
1 file changed, 5 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/kernel/locking/rtmutex.c
|
||||
+++ b/kernel/locking/rtmutex.c
|
||||
@@ -1579,13 +1579,13 @@ bool __sched __rt_mutex_futex_unlock(str
|
||||
return false; /* done */
|
||||
}
|
||||
|
||||
- mark_wakeup_next_waiter(wake_q, lock);
|
||||
/*
|
||||
- * We've already deboosted, retain preempt_disabled when dropping
|
||||
- * the wait_lock to avoid inversion until the wakeup. Matched
|
||||
- * by rt_mutex_postunlock();
|
||||
+ * We've already deboosted, mark_wakeup_next_waiter() will
|
||||
+ * retain preempt_disabled when we drop the wait_lock, to
|
||||
+ * avoid inversion prior to the wakeup. preempt_disable()
|
||||
+ * therein pairs with rt_mutex_postunlock().
|
||||
*/
|
||||
- preempt_disable();
|
||||
+ mark_wakeup_next_waiter(wake_q, lock);
|
||||
|
||||
return true; /* call postunlock() */
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Wed, 22 Mar 2017 11:35:57 +0100
|
||||
Subject: [PATCH] futex,rt_mutex: Restructure rt_mutex_finish_proxy_lock()
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 38d589f2fd08f1296aea3ce62bebd185125c6d81
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Wed, 22 Mar 2017 11:35:58 +0100
|
||||
Subject: [PATCH] futex: Rework futex_lock_pi() to use rt_mutex_*_proxy_lock()
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit cfafcd117da0216520568c195cb2f6cd1980c4bb
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Wed, 22 Mar 2017 11:35:59 +0100
|
||||
Subject: [PATCH] futex: Futex_unlock_pi() determinism
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit bebe5b514345f09be2c15e414d076b02ecb9cce8
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Peter Zijlstra <peterz@infradead.org>
|
||||
Date: Wed, 22 Mar 2017 11:36:00 +0100
|
||||
Subject: [PATCH] futex: Drop hb->lock before enqueueing on the rtmutex
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Upstream commit 56222b212e8edb1cf51f5dd73ff645809b082b40
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: "Yadi.hu" <yadi.hu@windriver.com>
|
||||
Date: Wed, 10 Dec 2014 10:32:09 +0800
|
||||
Subject: ARM: enable irq in translation/section permission fault handlers
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Probably happens on all ARM, with
|
||||
CONFIG_PREEMPT_RT_FULL
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Thu, 21 Mar 2013 19:01:05 +0100
|
||||
Subject: printk: Drop the logbuf_lock more often
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
The lock is hold with irgs off. The latency drops 500us+ on my arm bugs
|
||||
with a "full" buffer after executing "dmesg" on the shell.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Josh Cartwright <joshc@ni.com>
|
||||
Date: Thu, 11 Feb 2016 11:54:01 -0600
|
||||
Subject: KVM: arm/arm64: downgrade preempt_disable()d region to migrate_disable()
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
kvm_arch_vcpu_ioctl_run() disables the use of preemption when updating
|
||||
the vgic and timer states to prevent the calling task from migrating to
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Marcelo Tosatti <mtosatti@redhat.com>
|
||||
Date: Wed, 8 Apr 2015 20:33:25 -0300
|
||||
Subject: KVM: lapic: mark LAPIC timer handler as irqsafe
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Since lapic timer handler only wakes up a simple waitqueue,
|
||||
it can be executed from hardirq context.
|
||||
|
|
|
@ -5,7 +5,7 @@ Cc: Anna Schumaker <anna.schumaker@netapp.com>,
|
|||
linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org,
|
||||
tglx@linutronix.de
|
||||
Subject: NFSv4: replace seqcount_t with a seqlock_t
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
The raw_write_seqcount_begin() in nfs4_reclaim_open_state() bugs me
|
||||
because it maps to preempt_disable() in -RT which I can't have at this
|
||||
|
@ -58,7 +58,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|||
|
||||
--- a/fs/nfs/nfs4proc.c
|
||||
+++ b/fs/nfs/nfs4proc.c
|
||||
@@ -2698,7 +2698,7 @@ static int _nfs4_open_and_get_state(stru
|
||||
@@ -2697,7 +2697,7 @@ static int _nfs4_open_and_get_state(stru
|
||||
unsigned int seq;
|
||||
int ret;
|
||||
|
||||
|
@ -67,7 +67,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|||
|
||||
ret = _nfs4_proc_open(opendata);
|
||||
if (ret != 0)
|
||||
@@ -2736,7 +2736,7 @@ static int _nfs4_open_and_get_state(stru
|
||||
@@ -2735,7 +2735,7 @@ static int _nfs4_open_and_get_state(stru
|
||||
|
||||
if (d_inode(dentry) == state->inode) {
|
||||
nfs_inode_attach_open_context(ctx);
|
||||
|
|
218
debian/patches/features/all/rt/Revert-timers-Don-t-wake-ktimersoftd-on-every-tick.patch
vendored
Normal file
218
debian/patches/features/all/rt/Revert-timers-Don-t-wake-ktimersoftd-on-every-tick.patch
vendored
Normal file
|
@ -0,0 +1,218 @@
|
|||
From 16145f9c01a2e671aceb731050de9fbf977d31d0 Mon Sep 17 00:00:00 2001
|
||||
From: Anna-Maria Gleixner <anna-maria@linutronix.de>
|
||||
Date: Fri, 26 May 2017 19:16:07 +0200
|
||||
Subject: [PATCH] Revert "timers: Don't wake ktimersoftd on every tick"
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
This reverts commit 032f93cae150a ("timers: Don't wake ktimersoftd on
|
||||
every tick").
|
||||
|
||||
The problem is that the look ahead optimization from the tick timer
|
||||
interrupt context can race with the softirq thread expiring timer. As
|
||||
a consequence the temporary hlist heads which hold the to expire
|
||||
timers are overwritten and the timers which are already removed from
|
||||
the wheel bucket for expiry are now dangling w/o a list head.
|
||||
|
||||
That means those timers never get expired. If one of those timers is
|
||||
canceled the removal operation will result in a hlist corruption.
|
||||
|
||||
Signed-off-by: Anna-Maria Gleixner <anna-maria@linutronix.de>
|
||||
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
---
|
||||
kernel/time/timer.c | 96 +++++++++++++++-------------------------------------
|
||||
1 file changed, 29 insertions(+), 67 deletions(-)
|
||||
|
||||
--- a/kernel/time/timer.c
|
||||
+++ b/kernel/time/timer.c
|
||||
@@ -206,8 +206,6 @@ struct timer_base {
|
||||
bool is_idle;
|
||||
DECLARE_BITMAP(pending_map, WHEEL_SIZE);
|
||||
struct hlist_head vectors[WHEEL_SIZE];
|
||||
- struct hlist_head expired_lists[LVL_DEPTH];
|
||||
- int expired_count;
|
||||
} ____cacheline_aligned;
|
||||
|
||||
static DEFINE_PER_CPU(struct timer_base, timer_bases[NR_BASES]);
|
||||
@@ -1355,8 +1353,7 @@ static void call_timer_fn(struct timer_l
|
||||
}
|
||||
}
|
||||
|
||||
-static inline void __expire_timers(struct timer_base *base,
|
||||
- struct hlist_head *head)
|
||||
+static void expire_timers(struct timer_base *base, struct hlist_head *head)
|
||||
{
|
||||
while (!hlist_empty(head)) {
|
||||
struct timer_list *timer;
|
||||
@@ -1387,38 +1384,21 @@ static inline void __expire_timers(struc
|
||||
}
|
||||
}
|
||||
|
||||
-static void expire_timers(struct timer_base *base)
|
||||
-{
|
||||
- struct hlist_head *head;
|
||||
-
|
||||
- while (base->expired_count--) {
|
||||
- head = base->expired_lists + base->expired_count;
|
||||
- __expire_timers(base, head);
|
||||
- }
|
||||
- base->expired_count = 0;
|
||||
-}
|
||||
-
|
||||
-static void __collect_expired_timers(struct timer_base *base)
|
||||
+static int __collect_expired_timers(struct timer_base *base,
|
||||
+ struct hlist_head *heads)
|
||||
{
|
||||
unsigned long clk = base->clk;
|
||||
struct hlist_head *vec;
|
||||
- int i;
|
||||
+ int i, levels = 0;
|
||||
unsigned int idx;
|
||||
|
||||
- /*
|
||||
- * expire_timers() must be called at least once before we can
|
||||
- * collect more timers
|
||||
- */
|
||||
- if (WARN_ON(base->expired_count))
|
||||
- return;
|
||||
-
|
||||
for (i = 0; i < LVL_DEPTH; i++) {
|
||||
idx = (clk & LVL_MASK) + i * LVL_SIZE;
|
||||
|
||||
if (__test_and_clear_bit(idx, base->pending_map)) {
|
||||
vec = base->vectors + idx;
|
||||
- hlist_move_list(vec,
|
||||
- &base->expired_lists[base->expired_count++]);
|
||||
+ hlist_move_list(vec, heads++);
|
||||
+ levels++;
|
||||
}
|
||||
/* Is it time to look at the next level? */
|
||||
if (clk & LVL_CLK_MASK)
|
||||
@@ -1426,6 +1406,7 @@ static void __collect_expired_timers(str
|
||||
/* Shift clock for the next level granularity */
|
||||
clk >>= LVL_CLK_SHIFT;
|
||||
}
|
||||
+ return levels;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NO_HZ_COMMON
|
||||
@@ -1618,7 +1599,8 @@ void timer_clear_idle(void)
|
||||
base->is_idle = false;
|
||||
}
|
||||
|
||||
-static void collect_expired_timers(struct timer_base *base)
|
||||
+static int collect_expired_timers(struct timer_base *base,
|
||||
+ struct hlist_head *heads)
|
||||
{
|
||||
/*
|
||||
* NOHZ optimization. After a long idle sleep we need to forward the
|
||||
@@ -1635,49 +1617,20 @@ static void collect_expired_timers(struc
|
||||
if (time_after(next, jiffies)) {
|
||||
/* The call site will increment clock! */
|
||||
base->clk = jiffies - 1;
|
||||
- return;
|
||||
+ return 0;
|
||||
}
|
||||
base->clk = next;
|
||||
}
|
||||
- __collect_expired_timers(base);
|
||||
+ return __collect_expired_timers(base, heads);
|
||||
}
|
||||
#else
|
||||
-static inline void collect_expired_timers(struct timer_base *base)
|
||||
+static inline int collect_expired_timers(struct timer_base *base,
|
||||
+ struct hlist_head *heads)
|
||||
{
|
||||
- __collect_expired_timers(base);
|
||||
+ return __collect_expired_timers(base, heads);
|
||||
}
|
||||
#endif
|
||||
|
||||
-static int find_expired_timers(struct timer_base *base)
|
||||
-{
|
||||
- const unsigned long int end_clk = jiffies;
|
||||
-
|
||||
- while (!base->expired_count && time_after_eq(end_clk, base->clk)) {
|
||||
- collect_expired_timers(base);
|
||||
- base->clk++;
|
||||
- }
|
||||
-
|
||||
- return base->expired_count;
|
||||
-}
|
||||
-
|
||||
-/* Called from CPU tick routine to quickly collect expired timers */
|
||||
-static int tick_find_expired(struct timer_base *base)
|
||||
-{
|
||||
- int count;
|
||||
-
|
||||
- raw_spin_lock(&base->lock);
|
||||
-
|
||||
- if (unlikely(time_after(jiffies, base->clk + HZ))) {
|
||||
- /* defer to ktimersoftd; don't spend too long in irq context */
|
||||
- count = -1;
|
||||
- } else
|
||||
- count = find_expired_timers(base);
|
||||
-
|
||||
- raw_spin_unlock(&base->lock);
|
||||
-
|
||||
- return count;
|
||||
-}
|
||||
-
|
||||
/*
|
||||
* Called from the timer interrupt handler to charge one tick to the current
|
||||
* process. user_tick is 1 if the tick is user time, 0 for system.
|
||||
@@ -1704,11 +1657,22 @@ void update_process_times(int user_tick)
|
||||
*/
|
||||
static inline void __run_timers(struct timer_base *base)
|
||||
{
|
||||
+ struct hlist_head heads[LVL_DEPTH];
|
||||
+ int levels;
|
||||
+
|
||||
+ if (!time_after_eq(jiffies, base->clk))
|
||||
+ return;
|
||||
+
|
||||
raw_spin_lock_irq(&base->lock);
|
||||
|
||||
- while (find_expired_timers(base))
|
||||
- expire_timers(base);
|
||||
+ while (time_after_eq(jiffies, base->clk)) {
|
||||
+
|
||||
+ levels = collect_expired_timers(base, heads);
|
||||
+ base->clk++;
|
||||
|
||||
+ while (levels--)
|
||||
+ expire_timers(base, heads + levels);
|
||||
+ }
|
||||
raw_spin_unlock_irq(&base->lock);
|
||||
wakeup_timer_waiters(base);
|
||||
}
|
||||
@@ -1734,12 +1698,12 @@ void run_local_timers(void)
|
||||
|
||||
hrtimer_run_queues();
|
||||
/* Raise the softirq only if required. */
|
||||
- if (time_before(jiffies, base->clk) || !tick_find_expired(base)) {
|
||||
+ if (time_before(jiffies, base->clk)) {
|
||||
if (!IS_ENABLED(CONFIG_NO_HZ_COMMON) || !base->nohz_active)
|
||||
return;
|
||||
/* CPU is awake, so check the deferrable base. */
|
||||
base++;
|
||||
- if (time_before(jiffies, base->clk) || !tick_find_expired(base))
|
||||
+ if (time_before(jiffies, base->clk))
|
||||
return;
|
||||
}
|
||||
raise_softirq(TIMER_SOFTIRQ);
|
||||
@@ -1909,7 +1873,6 @@ int timers_dead_cpu(unsigned int cpu)
|
||||
raw_spin_lock_nested(&old_base->lock, SINGLE_DEPTH_NESTING);
|
||||
|
||||
BUG_ON(old_base->running_timer);
|
||||
- BUG_ON(old_base->expired_count);
|
||||
|
||||
for (i = 0; i < WHEEL_SIZE; i++)
|
||||
migrate_timer_list(new_base, old_base->vectors + i);
|
||||
@@ -1936,7 +1899,6 @@ static void __init init_timer_cpu(int cp
|
||||
#ifdef CONFIG_PREEMPT_RT_FULL
|
||||
init_swait_queue_head(&base->wait_for_running_timer);
|
||||
#endif
|
||||
- base->expired_count = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
From: Steven Rostedt <rostedt@goodmis.org>
|
||||
Date: Wed, 13 Feb 2013 09:26:05 -0500
|
||||
Subject: acpi/rt: Convert acpi_gbl_hardware lock back to a raw_spinlock_t
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
We hit the following bug with 3.6-rt:
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Anders Roxell <anders.roxell@linaro.org>
|
||||
Date: Thu, 14 May 2015 17:52:17 +0200
|
||||
Subject: arch/arm64: Add lazy preempt support
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
arm64 is missing support for PREEMPT_RT. The main feature which is
|
||||
lacking is support for lazy preemption. The arch-specific entry code,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Benedikt Spranger <b.spranger@linutronix.de>
|
||||
Date: Sat, 6 Mar 2010 17:47:10 +0100
|
||||
Subject: ARM: AT91: PIT: Remove irq handler when clock event is unused
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Setup and remove the interrupt handler in clock event mode selection.
|
||||
This avoids calling the (shared) interrupt handler when the device is
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Sat, 1 May 2010 18:29:35 +0200
|
||||
Subject: ARM: at91: tclib: Default to tclib timer for RT
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
RT is not too happy about the shared timer interrupt in AT91
|
||||
devices. Default to tclib timer for RT.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Frank Rowand <frank.rowand@am.sony.com>
|
||||
Date: Mon, 19 Sep 2011 14:51:14 -0700
|
||||
Subject: arm: Convert arm boot_lock to raw
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
The arm boot_lock is used by the secondary processor startup code. The locking
|
||||
task is the idle thread, which has idle->sched_class == &idle_sched_class.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: arm: Enable highmem for rt
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Wed, 13 Feb 2013 11:03:11 +0100
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
fixup highmem for ARM.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Mon, 11 Mar 2013 21:37:27 +0100
|
||||
Subject: arm/highmem: Flush tlb on unmap
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
The tlb should be flushed on unmap and thus make the mapping entry
|
||||
invalid. This is only done in the non-debug case which does not look
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Thu, 22 Dec 2016 17:28:33 +0100
|
||||
Subject: [PATCH] arm: include definition for cpumask_t
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
This definition gets pulled in by other files. With the (later) split of
|
||||
RCU and spinlock.h it won't compile anymore.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Yang Shi <yang.shi@linaro.org>
|
||||
Date: Thu, 10 Nov 2016 16:17:55 -0800
|
||||
Subject: [PATCH] arm: kprobe: replace patch_lock to raw lock
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
When running kprobe on -rt kernel, the below bug is caught:
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: arm: Add support for lazy preemption
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Wed, 31 Oct 2012 12:04:11 +0100
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Implement the arm pieces for lazy preempt.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Fri, 20 Sep 2013 14:31:54 +0200
|
||||
Subject: arm/unwind: use a raw_spin_lock
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Mostly unwind is done with irqs enabled however SLUB may call it with
|
||||
irqs disabled while creating a new SLUB cache.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: arm64/xen: Make XEN depend on !RT
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Mon, 12 Oct 2015 11:18:40 +0200
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
It's not ready and probably never will be, unless xen folks have a
|
||||
look at it.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Wed, 09 Mar 2016 10:51:06 +0100
|
||||
Subject: arm: at91: do not disable/enable clocks in a row
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Currently the driver will disable the clock and enable it one line later
|
||||
if it is switching from periodic mode into one shot.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Steven Rostedt <srostedt@redhat.com>
|
||||
Date: Fri, 3 Jul 2009 08:44:29 -0500
|
||||
Subject: ata: Do not disable interrupts in ide code for preempt-rt
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Use the local_irq_*_nort variants.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Fri, 13 Feb 2015 11:01:26 +0100
|
||||
Subject: block: blk-mq: Use swait
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
| BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:914
|
||||
| in_atomic(): 1, irqs_disabled(): 0, pid: 255, name: kworker/u257:6
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Thu, 29 Jan 2015 15:10:08 +0100
|
||||
Subject: block/mq: don't complete requests via IPI
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
The IPI runs in hardirq context and there are sleeping locks. This patch
|
||||
moves the completion into a workqueue.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Tue, 14 Jul 2015 14:26:34 +0200
|
||||
Subject: block/mq: do not invoke preempt_disable()
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
preempt_disable() and get_cpu() don't play well together with the sleeping
|
||||
locks it tries to allocate later.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Wed, 9 Apr 2014 10:37:23 +0200
|
||||
Subject: block: mq: use cpu_light()
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
there is a might sleep splat because get_cpu() disables preemption and
|
||||
later we grab a lock. As a workaround for this we use get_cpu_light().
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: block: Shorten interrupt disabled regions
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Wed, 22 Jun 2011 19:47:02 +0200
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Moving the blk_sched_flush_plug() call out of the interrupt/preempt
|
||||
disabled region in the scheduler allows us to replace
|
||||
|
@ -48,7 +48,7 @@ Link: http://lkml.kernel.org/r/20110622174919.025446432@linutronix.de
|
|||
|
||||
--- a/block/blk-core.c
|
||||
+++ b/block/blk-core.c
|
||||
@@ -3177,7 +3177,7 @@ static void queue_unplugged(struct reque
|
||||
@@ -3200,7 +3200,7 @@ static void queue_unplugged(struct reque
|
||||
blk_run_queue_async(q);
|
||||
else
|
||||
__blk_run_queue(q);
|
||||
|
@ -57,7 +57,7 @@ Link: http://lkml.kernel.org/r/20110622174919.025446432@linutronix.de
|
|||
}
|
||||
|
||||
static void flush_plug_callbacks(struct blk_plug *plug, bool from_schedule)
|
||||
@@ -3225,7 +3225,6 @@ EXPORT_SYMBOL(blk_check_plugged);
|
||||
@@ -3248,7 +3248,6 @@ EXPORT_SYMBOL(blk_check_plugged);
|
||||
void blk_flush_plug_list(struct blk_plug *plug, bool from_schedule)
|
||||
{
|
||||
struct request_queue *q;
|
||||
|
@ -65,7 +65,7 @@ Link: http://lkml.kernel.org/r/20110622174919.025446432@linutronix.de
|
|||
struct request *rq;
|
||||
LIST_HEAD(list);
|
||||
unsigned int depth;
|
||||
@@ -3245,11 +3244,6 @@ void blk_flush_plug_list(struct blk_plug
|
||||
@@ -3268,11 +3267,6 @@ void blk_flush_plug_list(struct blk_plug
|
||||
q = NULL;
|
||||
depth = 0;
|
||||
|
||||
|
@ -77,7 +77,7 @@ Link: http://lkml.kernel.org/r/20110622174919.025446432@linutronix.de
|
|||
while (!list_empty(&list)) {
|
||||
rq = list_entry_rq(list.next);
|
||||
list_del_init(&rq->queuelist);
|
||||
@@ -3262,7 +3256,7 @@ void blk_flush_plug_list(struct blk_plug
|
||||
@@ -3285,7 +3279,7 @@ void blk_flush_plug_list(struct blk_plug
|
||||
queue_unplugged(q, depth, from_schedule);
|
||||
q = rq->q;
|
||||
depth = 0;
|
||||
|
@ -86,7 +86,7 @@ Link: http://lkml.kernel.org/r/20110622174919.025446432@linutronix.de
|
|||
}
|
||||
|
||||
/*
|
||||
@@ -3289,8 +3283,6 @@ void blk_flush_plug_list(struct blk_plug
|
||||
@@ -3312,8 +3306,6 @@ void blk_flush_plug_list(struct blk_plug
|
||||
*/
|
||||
if (q)
|
||||
queue_unplugged(q, depth, from_schedule);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: block: Use cpu_chill() for retry loops
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Thu, 20 Dec 2012 18:28:26 +0100
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Retry loops on RT might loop forever when the modifying side was
|
||||
preempted. Steven also observed a live lock when there was a
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Ingo Molnar <mingo@elte.hu>
|
||||
Date: Fri, 3 Jul 2009 08:29:58 -0500
|
||||
Subject: bug: BUG_ON/WARN_ON variants dependend on RT/!RT
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Introduce RT/NON-RT WARN/BUG statements to avoid ifdefs in the code.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Mike Galbraith <umgwanakikbuti@gmail.com>
|
||||
Date: Sat, 21 Jun 2014 10:09:48 +0200
|
||||
Subject: memcontrol: Prevent scheduling while atomic in cgroup code
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
mm, memcg: make refill_stock() use get_cpu_light()
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Fri, 13 Feb 2015 15:52:24 +0100
|
||||
Subject: cgroups: use simple wait in css_release()
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
To avoid:
|
||||
|BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:914
|
||||
|
@ -53,7 +53,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|||
/*
|
||||
--- a/kernel/cgroup.c
|
||||
+++ b/kernel/cgroup.c
|
||||
@@ -5040,10 +5040,10 @@ static void css_free_rcu_fn(struct rcu_h
|
||||
@@ -5041,10 +5041,10 @@ static void css_free_rcu_fn(struct rcu_h
|
||||
queue_work(cgroup_destroy_wq, &css->destroy_work);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|||
struct cgroup_subsys *ss = css->ss;
|
||||
struct cgroup *cgrp = css->cgroup;
|
||||
|
||||
@@ -5086,8 +5086,8 @@ static void css_release(struct percpu_re
|
||||
@@ -5087,8 +5087,8 @@ static void css_release(struct percpu_re
|
||||
struct cgroup_subsys_state *css =
|
||||
container_of(ref, struct cgroup_subsys_state, refcnt);
|
||||
|
||||
|
@ -77,7 +77,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|||
}
|
||||
|
||||
static void init_and_link_css(struct cgroup_subsys_state *css,
|
||||
@@ -5739,6 +5739,7 @@ static int __init cgroup_wq_init(void)
|
||||
@@ -5740,6 +5740,7 @@ static int __init cgroup_wq_init(void)
|
||||
*/
|
||||
cgroup_destroy_wq = alloc_workqueue("cgroup_destroy", 0, 1);
|
||||
BUG_ON(!cgroup_destroy_wq);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
|
||||
Date: Thu, 17 Mar 2016 21:09:43 +0100
|
||||
Subject: [PATCH] clockevents/drivers/timer-atmel-pit: fix double free_irq
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
clockevents_exchange_device() changes the state from detached to shutdown
|
||||
and so at that point the IRQ has not yet been requested.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Benedikt Spranger <b.spranger@linutronix.de>
|
||||
Date: Mon, 8 Mar 2010 18:57:04 +0100
|
||||
Subject: clocksource: TCLIB: Allow higher clock rates for clock events
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
As default the TCLIB uses the 32KiHz base clock rate for clock events.
|
||||
Add a compile time selection to allow higher clock resulution.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: completion: Use simple wait queues
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Fri, 11 Jan 2013 11:23:51 +0100
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Completions have no long lasting callbacks and therefor do not need
|
||||
the complex waitqueue variant. Use simple waitqueues which reduces the
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: sched: Use the proper LOCK_OFFSET for cond_resched()
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Sun, 17 Jul 2011 22:51:33 +0200
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
RT does not increment preempt count when a 'sleeping' spinlock is
|
||||
locked. Update PREEMPT_LOCK_OFFSET for that case.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: sched: Take RT softirq semantics into account in cond_resched()
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Thu, 14 Jul 2011 09:56:44 +0200
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
The softirq semantics work different on -RT. There is no SOFTIRQ_MASK in
|
||||
the preemption counter which leads to the BUG_ON() statement in
|
||||
|
@ -16,7 +16,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|||
|
||||
--- a/include/linux/sched.h
|
||||
+++ b/include/linux/sched.h
|
||||
@@ -3367,12 +3367,16 @@ extern int __cond_resched_lock(spinlock_
|
||||
@@ -3373,12 +3373,16 @@ extern int __cond_resched_lock(spinlock_
|
||||
__cond_resched_lock(lock); \
|
||||
})
|
||||
|
||||
|
@ -35,7 +35,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|||
{
|
||||
--- a/kernel/sched/core.c
|
||||
+++ b/kernel/sched/core.c
|
||||
@@ -5050,6 +5050,7 @@ int __cond_resched_lock(spinlock_t *lock
|
||||
@@ -5092,6 +5092,7 @@ int __cond_resched_lock(spinlock_t *lock
|
||||
}
|
||||
EXPORT_SYMBOL(__cond_resched_lock);
|
||||
|
||||
|
@ -43,7 +43,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|||
int __sched __cond_resched_softirq(void)
|
||||
{
|
||||
BUG_ON(!in_softirq());
|
||||
@@ -5063,6 +5064,7 @@ int __sched __cond_resched_softirq(void)
|
||||
@@ -5105,6 +5106,7 @@ int __sched __cond_resched_softirq(void)
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL(__cond_resched_softirq);
|
||||
|
|
|
@ -2,7 +2,7 @@ From: Mike Galbraith <umgwanakikbuti@gmail.com>
|
|||
Date: Sun, 16 Oct 2016 05:11:54 +0200
|
||||
Subject: [PATCH] connector/cn_proc: Protect send_msg() with a local lock
|
||||
on RT
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
|BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:931
|
||||
|in_atomic(): 1, irqs_disabled(): 0, pid: 31807, name: sleep
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Steven Rostedt <rostedt@goodmis.org>
|
||||
Date: Thu, 5 Dec 2013 09:16:52 -0500
|
||||
Subject: cpu hotplug: Document why PREEMPT_RT uses a spinlock
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
The patch:
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: cpu: Make hotplug.lock a "sleeping" spinlock on RT
|
||||
From: Steven Rostedt <rostedt@goodmis.org>
|
||||
Date: Fri, 02 Mar 2012 10:36:57 -0500
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Tasks can block on hotplug.lock in pin_current_cpu(), but their state
|
||||
might be != RUNNING. So the mutex wakeup will set the state
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Steven Rostedt <srostedt@redhat.com>
|
||||
Date: Mon, 16 Jul 2012 08:07:43 +0000
|
||||
Subject: cpu/rt: Rework cpu down for PREEMPT_RT
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Bringing a CPU down is a pain with the PREEMPT_RT kernel because
|
||||
tasks can be preempted in many more places than in non-RT. In
|
||||
|
@ -57,7 +57,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|||
|
||||
--- a/include/linux/sched.h
|
||||
+++ b/include/linux/sched.h
|
||||
@@ -2474,6 +2474,10 @@ extern void do_set_cpus_allowed(struct t
|
||||
@@ -2480,6 +2480,10 @@ extern void do_set_cpus_allowed(struct t
|
||||
|
||||
extern int set_cpus_allowed_ptr(struct task_struct *p,
|
||||
const struct cpumask *new_mask);
|
||||
|
@ -68,7 +68,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|||
#else
|
||||
static inline void do_set_cpus_allowed(struct task_struct *p,
|
||||
const struct cpumask *new_mask)
|
||||
@@ -2486,6 +2490,9 @@ static inline int set_cpus_allowed_ptr(s
|
||||
@@ -2492,6 +2496,9 @@ static inline int set_cpus_allowed_ptr(s
|
||||
return -EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Steven Rostedt <rostedt@goodmis.org>
|
||||
Date: Tue, 4 Mar 2014 12:28:32 -0500
|
||||
Subject: cpu_chill: Add a UNINTERRUPTIBLE hrtimer_nanosleep
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
We hit another bug that was caused by switching cpu_chill() from
|
||||
msleep() to hrtimer_nanosleep().
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Tiejun Chen <tiejun.chen@windriver.com>
|
||||
Subject: cpu_down: move migrate_enable() back
|
||||
Date: Thu, 7 Nov 2013 10:06:07 +0800
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Commit 08c1ab68, "hotplug-use-migrate-disable.patch", intends to
|
||||
use migrate_enable()/migrate_disable() to replace that combination
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Thu, 9 Apr 2015 15:23:01 +0200
|
||||
Subject: cpufreq: drop K8's driver from beeing selected
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Ralf posted a picture of a backtrace from
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: cpumask: Disable CONFIG_CPUMASK_OFFSTACK for RT
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Wed, 14 Dec 2011 01:03:49 +0100
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
There are "valid" GFP_ATOMIC allocations such as
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Mike Galbraith <efault@gmx.de>
|
||||
Date: Sun, 8 Jan 2017 09:32:25 +0100
|
||||
Subject: [PATCH] cpuset: Convert callback_lock to raw_spinlock_t
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
The two commits below add up to a cpuset might_sleep() splat for RT:
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Fri, 21 Feb 2014 17:24:04 +0100
|
||||
Subject: crypto: Reduce preempt disabled regions, more algos
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Don Estabrook reported
|
||||
| kernel: WARNING: CPU: 2 PID: 858 at kernel/sched/core.c:2428 migrate_disable+0xed/0x100()
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: debugobjects: Make RT aware
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Sun, 17 Jul 2011 21:41:35 +0200
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Avoid filling the pool / allocating memory with irqs off().
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: dm: Make rt aware
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Mon, 14 Nov 2011 23:06:09 +0100
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Use the BUG_ON_NORT variant for the irq_disabled() checks. RT has
|
||||
interrupts legitimately enabled here as we cant deadlock against the
|
||||
|
|
|
@ -2,14 +2,13 @@ From: Mike Galbraith <umgwanakikbuti@gmail.com>
|
|||
Date: Thu, 31 Mar 2016 04:08:28 +0200
|
||||
Subject: [PATCH] drivers/block/zram: Replace bit spinlocks with rtmutex
|
||||
for -rt
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
They're nondeterministic, and lead to ___might_sleep() splats in -rt.
|
||||
OTOH, they're a lot less wasteful than an rtmutex per page.
|
||||
|
||||
Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
|
||||
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
[bwh: Adjust context for 4.9.24]
|
||||
---
|
||||
drivers/block/zram/zram_drv.c | 30 ++++++++++++++++--------------
|
||||
drivers/block/zram/zram_drv.h | 41 +++++++++++++++++++++++++++++++++++++++++
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Ingo Molnar <mingo@elte.hu>
|
||||
Date: Fri, 3 Jul 2009 08:29:24 -0500
|
||||
Subject: drivers/net: Use disable_irq_nosync() in 8139too
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Use disable_irq_nosync() instead of disable_irq() as this might be
|
||||
called in atomic context with netpoll.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Steven Rostedt <rostedt@goodmis.org>
|
||||
Date: Fri, 3 Jul 2009 08:30:00 -0500
|
||||
Subject: drivers/net: vortex fix locking issues
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Argh, cut and paste wasn't enough...
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Ingo Molnar <mingo@elte.hu>
|
||||
Date: Fri, 3 Jul 2009 08:29:30 -0500
|
||||
Subject: drivers: random: Reduce preempt disabled region
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
No need to keep preemption disabled across the whole function.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: tty/serial/omap: Make the locking RT aware
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Thu, 28 Jul 2011 13:32:57 +0200
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
The lock is a sleeping lock and local_irq_save() is not the
|
||||
optimsation we are looking for. Redo it to make it work on -RT and
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: tty/serial/pl011: Make the locking work on RT
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Tue, 08 Jan 2013 21:36:51 +0100
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
The lock is a sleeping lock and local_irq_save() is not the optimsation
|
||||
we are looking for. Redo it to make it work on -RT and non-RT.
|
||||
|
|
|
@ -2,7 +2,7 @@ From: Mike Galbraith <umgwanakikbuti@gmail.com>
|
|||
Date: Thu, 20 Oct 2016 11:15:22 +0200
|
||||
Subject: [PATCH] drivers/zram: Don't disable preemption in
|
||||
zcomp_stream_get/put()
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
In v4.7, the driver switched to percpu compression streams, disabling
|
||||
preemption via get/put_cpu_ptr(). Use a per-zcomp_strm lock here. We
|
||||
|
@ -13,7 +13,6 @@ zram_bvec_write().
|
|||
Signed-off-by: Mike Galbraith <umgwanakikbuti@gmail.com>
|
||||
[bigeasy: get_locked_var() -> per zcomp_strm lock]
|
||||
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
[bwh: Adjust context for 4.9.24]
|
||||
---
|
||||
drivers/block/zram/zcomp.c | 12 ++++++++++--
|
||||
drivers/block/zram/zcomp.h | 1 +
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Thu, 25 Apr 2013 18:12:52 +0200
|
||||
Subject: drm/i915: drop trace_i915_gem_ring_dispatch on rt
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
This tracepoint is responsible for:
|
||||
|
||||
|
@ -47,7 +47,7 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
|||
|
||||
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
|
||||
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
|
||||
@@ -1537,7 +1537,9 @@ execbuf_submit(struct i915_execbuffer_pa
|
||||
@@ -1489,7 +1489,9 @@ execbuf_submit(struct i915_execbuffer_pa
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: drm,i915: Use local_lock/unlock_irq() in intel_pipe_update_start/end()
|
||||
From: Mike Galbraith <umgwanakikbuti@gmail.com>
|
||||
Date: Sat, 27 Feb 2016 09:01:42 +0100
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
|
||||
[ 8.014039] BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:918
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: drm,radeon,i915: Use preempt_disable/enable_rt() where recommended
|
||||
From: Mike Galbraith <umgwanakikbuti@gmail.com>
|
||||
Date: Sat, 27 Feb 2016 08:09:11 +0100
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
DRM folks identified the spots, so use them.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: fs/epoll: Do not disable preemption on RT
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Fri, 08 Jul 2011 16:35:35 +0200
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
ep_call_nested() takes a sleeping lock so we can't disable preemption.
|
||||
The light version is enough since ep_call_nested() doesn't mind beeing
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Mon, 16 Feb 2015 18:49:10 +0100
|
||||
Subject: fs/aio: simple simple work
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
|BUG: sleeping function called from invalid context at kernel/locking/rtmutex.c:768
|
||||
|in_atomic(): 1, irqs_disabled(): 0, pid: 26, name: rcuos/2
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: block: Turn off warning which is bogus on RT
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Tue, 14 Jun 2011 17:05:09 +0200
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
On -RT the context is always with IRQs enabled. Ignore this warning on -RT.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Wed, 14 Sep 2016 11:55:23 +0200
|
||||
Subject: fs/dcache: include wait.h
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Since commit d9171b934526 ("parallel lookups machinery, part 4 (and
|
||||
last)") dcache.h is using but does not include wait.h. It works as long
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Wed, 14 Sep 2016 17:57:03 +0200
|
||||
Subject: [PATCH] fs/dcache: init in_lookup_hashtable
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
in_lookup_hashtable was introduced in commit 94bdd655caba ("parallel
|
||||
lookups machinery, part 3") and never initialized but since it is in
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
Subject: fs: dcache: Use cpu_chill() in trylock loops
|
||||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Wed, 07 Mar 2012 21:00:34 +0100
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Retry loops on RT might loop forever when the modifying side was
|
||||
preempted. Use cpu_chill() instead of cpu_relax() to let the system
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Wed, 14 Sep 2016 14:35:49 +0200
|
||||
Subject: [PATCH] fs/dcache: use swait_queue instead of waitqueue
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
__d_lookup_done() invokes wake_up_all() while holding a hlist_bl_lock()
|
||||
which disables preemption. As a workaround convert it to swait.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Fri, 18 Mar 2011 10:11:25 +0100
|
||||
Subject: fs: jbd/jbd2: Make state lock and journal head lock rt safe
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
bit_spin_locks break under RT.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Mon, 17 Feb 2014 17:30:03 +0100
|
||||
Subject: fs: jbd2: pull your plug when waiting for space
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Two cps in parallel managed to stall the the ext4 fs. It seems that
|
||||
journal code is either waiting for locks or sleeping waiting for
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Sun, 19 Jul 2009 08:44:27 -0500
|
||||
Subject: fs: namespace preemption fix
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
On RT we cannot loop with preemption disabled here as
|
||||
mnt_make_readonly() might have been preempted. We can safely enable
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
|
||||
Date: Thu, 15 Sep 2016 10:51:27 +0200
|
||||
Subject: [PATCH] fs/nfs: turn rmdir_sem into a semaphore
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
The RW semaphore had a reader side which used the _non_owner version
|
||||
because it most likely took the reader lock in one thread and released it
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Mike Galbraith <efault@gmx.de>
|
||||
Date: Fri, 3 Jul 2009 08:44:12 -0500
|
||||
Subject: fs: ntfs: disable interrupt only on !RT
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
On Sat, 2007-10-27 at 11:44 +0200, Ingo Molnar wrote:
|
||||
> * Nick Piggin <nickpiggin@yahoo.com.au> wrote:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Fri, 18 Mar 2011 09:18:52 +0100
|
||||
Subject: buffer_head: Replace bh_uptodate_lock for -rt
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Wrap the bit_spin_lock calls into a separate inline and add the RT
|
||||
replacements with a real spinlock.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Mike Galbraith <umgwanakikbuti@gmail.com>
|
||||
Date: Sun, 16 Oct 2016 05:08:30 +0200
|
||||
Subject: [PATCH] ftrace: Fix trace header alignment
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Line up helper arrows to the right column.
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Sun, 17 Jul 2011 21:56:42 +0200
|
||||
Subject: trace: Add migrate-disabled counter to tracing output
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
||||
---
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Thomas Gleixner <tglx@linutronix.de>
|
||||
Date: Fri, 1 Mar 2013 11:17:42 +0100
|
||||
Subject: futex: Ensure lock/unlock symetry versus pi_lock and hash bucket lock
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
In exit_pi_state_list() we have the following locking construct:
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
From: Steven Rostedt <rostedt@goodmis.org>
|
||||
Date: Tue, 14 Jul 2015 14:26:34 +0200
|
||||
Subject: futex: Fix bug on when a requeued RT task times out
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.20-rt16.tar.xz
|
||||
Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.9/older/patches-4.9.30-rt20.tar.xz
|
||||
|
||||
Requeue with timeout causes a bug with PREEMPT_RT_FULL.
|
||||
|
||||
|
@ -66,7 +66,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|||
}
|
||||
|
||||
/*
|
||||
@@ -1696,6 +1697,35 @@ int __rt_mutex_start_proxy_lock(struct r
|
||||
@@ -1712,6 +1713,35 @@ int __rt_mutex_start_proxy_lock(struct r
|
||||
if (try_to_take_rt_mutex(lock, task, NULL))
|
||||
return 1;
|
||||
|
||||
|
@ -104,7 +104,7 @@ Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
|
|||
RT_MUTEX_FULL_CHAINWALK);
|
||||
--- a/kernel/locking/rtmutex_common.h
|
||||
+++ b/kernel/locking/rtmutex_common.h
|
||||
@@ -99,6 +99,7 @@ enum rtmutex_chainwalk {
|
||||
@@ -100,6 +100,7 @@ enum rtmutex_chainwalk {
|
||||
* PI-futex support (proxy locking functions, etc.):
|
||||
*/
|
||||
#define PI_WAKEUP_INPROGRESS ((struct rt_mutex_waiter *) 1)
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue