summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/arch-arm64-Add-lazy-preempt-support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches-rt/arch-arm64-Add-lazy-preempt-support.patch')
-rw-r--r--debian/patches-rt/arch-arm64-Add-lazy-preempt-support.patch39
1 files changed, 21 insertions, 18 deletions
diff --git a/debian/patches-rt/arch-arm64-Add-lazy-preempt-support.patch b/debian/patches-rt/arch-arm64-Add-lazy-preempt-support.patch
index 70a94e136..2b2fee304 100644
--- a/debian/patches-rt/arch-arm64-Add-lazy-preempt-support.patch
+++ b/debian/patches-rt/arch-arm64-Add-lazy-preempt-support.patch
@@ -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/5.2/older/patches-5.2.17-rt9.tar.xz
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/5.4/older/patches-5.4.3-rt1.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,
@@ -13,16 +13,16 @@ indicate that support for full RT preemption is now available.
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
---
arch/arm64/Kconfig | 1 +
- arch/arm64/include/asm/preempt.h | 23 ++++++++++++++++++++++-
+ arch/arm64/include/asm/preempt.h | 25 ++++++++++++++++++++++++-
arch/arm64/include/asm/thread_info.h | 6 +++++-
arch/arm64/kernel/asm-offsets.c | 1 +
- arch/arm64/kernel/entry.S | 12 ++++++++++--
+ arch/arm64/kernel/entry.S | 13 +++++++++++--
arch/arm64/kernel/signal.c | 2 +-
- 6 files changed, 40 insertions(+), 5 deletions(-)
+ 6 files changed, 43 insertions(+), 5 deletions(-)
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
-@@ -152,6 +152,7 @@ config ARM64
+@@ -158,6 +158,7 @@ config ARM64
select HAVE_PERF_EVENTS
select HAVE_PERF_REGS
select HAVE_PERF_USER_STACK_DUMP
@@ -32,7 +32,7 @@ Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
select HAVE_RCU_TABLE_FREE
--- a/arch/arm64/include/asm/preempt.h
+++ b/arch/arm64/include/asm/preempt.h
-@@ -70,13 +70,34 @@ static inline bool __preempt_count_dec_a
+@@ -70,13 +70,36 @@ static inline bool __preempt_count_dec_a
* interrupt occurring between the non-atomic READ_ONCE/WRITE_ONCE
* pair.
*/
@@ -40,6 +40,8 @@ Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
+ if (!pc || !READ_ONCE(ti->preempt_count))
+ return true;
+#ifdef CONFIG_PREEMPT_LAZY
++ if ((pc & ~PREEMPT_NEED_RESCHED))
++ return false;
+ if (current_thread_info()->preempt_lazy_count)
+ return false;
+ return test_thread_flag(TIF_NEED_RESCHED_LAZY);
@@ -67,10 +69,10 @@ Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
+#endif
}
- #ifdef CONFIG_PREEMPT
+ #ifdef CONFIG_PREEMPTION
--- a/arch/arm64/include/asm/thread_info.h
+++ b/arch/arm64/include/asm/thread_info.h
-@@ -31,6 +31,7 @@ struct thread_info {
+@@ -29,6 +29,7 @@ struct thread_info {
#ifdef CONFIG_ARM64_SW_TTBR0_PAN
u64 ttbr0; /* saved TTBR0_EL1 */
#endif
@@ -78,15 +80,15 @@ Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
union {
u64 preempt_count; /* 0 => preemptible, <0 => bug */
struct {
-@@ -75,6 +76,7 @@ void arch_release_task_struct(struct tas
+@@ -63,6 +64,7 @@ void arch_release_task_struct(struct tas
#define TIF_FOREIGN_FPSTATE 3 /* CPU's FP state is not current's */
#define TIF_UPROBE 4 /* uprobe breakpoint or singlestep */
#define TIF_FSCHECK 5 /* Check FS is USER_DS on return */
+#define TIF_NEED_RESCHED_LAZY 6
#define TIF_NOHZ 7
- #define TIF_SYSCALL_TRACE 8
- #define TIF_SYSCALL_AUDIT 9
-@@ -93,6 +95,7 @@ void arch_release_task_struct(struct tas
+ #define TIF_SYSCALL_TRACE 8 /* syscall trace active */
+ #define TIF_SYSCALL_AUDIT 9 /* syscall auditing */
+@@ -83,6 +85,7 @@ void arch_release_task_struct(struct tas
#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
#define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME)
#define _TIF_FOREIGN_FPSTATE (1 << TIF_FOREIGN_FPSTATE)
@@ -94,7 +96,7 @@ Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
#define _TIF_NOHZ (1 << TIF_NOHZ)
#define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE)
#define _TIF_SYSCALL_AUDIT (1 << TIF_SYSCALL_AUDIT)
-@@ -105,8 +108,9 @@ void arch_release_task_struct(struct tas
+@@ -96,8 +99,9 @@ void arch_release_task_struct(struct tas
#define _TIF_WORK_MASK (_TIF_NEED_RESCHED | _TIF_SIGPENDING | \
_TIF_NOTIFY_RESUME | _TIF_FOREIGN_FPSTATE | \
@@ -104,7 +106,7 @@ Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
+#define _TIF_NEED_RESCHED_MASK (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY)
#define _TIF_SYSCALL_WORK (_TIF_SYSCALL_TRACE | _TIF_SYSCALL_AUDIT | \
_TIF_SYSCALL_TRACEPOINT | _TIF_SECCOMP | \
- _TIF_NOHZ)
+ _TIF_NOHZ | _TIF_SYSCALL_EMU)
--- a/arch/arm64/kernel/asm-offsets.c
+++ b/arch/arm64/kernel/asm-offsets.c
@@ -30,6 +30,7 @@ int main(void)
@@ -117,14 +119,15 @@ Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
DEFINE(TSK_TI_TTBR0, offsetof(struct task_struct, thread_info.ttbr0));
--- a/arch/arm64/kernel/entry.S
+++ b/arch/arm64/kernel/entry.S
-@@ -679,9 +679,17 @@ alternative_if ARM64_HAS_IRQ_PRIO_MASKIN
+@@ -679,9 +679,18 @@ alternative_if ARM64_HAS_IRQ_PRIO_MASKIN
mrs x0, daif
orr x24, x24, x0
alternative_else_nop_endif
- cbnz x24, 1f // preempt count != 0 || NMI return path
-- bl preempt_schedule_irq // irq en/disable is done inside
+- bl arm64_preempt_schedule_irq // irq en/disable is done inside
+
-+ cbnz x24, 2f // preempt count != 0
++ cbz x24, 1f // (need_resched + count) == 0
++ cbnz w24, 2f // count != 0
+
+ ldr w24, [tsk, #TSK_TI_PREEMPT_LAZY] // get preempt lazy count
+ cbnz w24, 2f // preempt lazy count != 0
@@ -132,7 +135,7 @@ Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
+ ldr x0, [tsk, #TSK_TI_FLAGS] // get flags
+ tbz x0, #TIF_NEED_RESCHED_LAZY, 2f // needs rescheduling?
1:
-+ bl preempt_schedule_irq // irq en/disable is done inside
++ bl arm64_preempt_schedule_irq // irq en/disable is done inside
+2:
#endif