summaryrefslogtreecommitdiffstats
path: root/debian/patches-rt/0314-sched-migrate_enable-Busy-loop-until-the-migration-r.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:02:38 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:02:38 +0000
commit08b74a000942a380fe028845f92cd3a0dee827d5 (patch)
treeaa78b4e12607c3e1fcce8d5cc42df4330792f118 /debian/patches-rt/0314-sched-migrate_enable-Busy-loop-until-the-migration-r.patch
parentAdding upstream version 4.19.249. (diff)
downloadlinux-08b74a000942a380fe028845f92cd3a0dee827d5.tar.xz
linux-08b74a000942a380fe028845f92cd3a0dee827d5.zip
Adding debian version 4.19.249-2.debian/4.19.249-2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches-rt/0314-sched-migrate_enable-Busy-loop-until-the-migration-r.patch')
-rw-r--r--debian/patches-rt/0314-sched-migrate_enable-Busy-loop-until-the-migration-r.patch57
1 files changed, 57 insertions, 0 deletions
diff --git a/debian/patches-rt/0314-sched-migrate_enable-Busy-loop-until-the-migration-r.patch b/debian/patches-rt/0314-sched-migrate_enable-Busy-loop-until-the-migration-r.patch
new file mode 100644
index 000000000..d51c9b637
--- /dev/null
+++ b/debian/patches-rt/0314-sched-migrate_enable-Busy-loop-until-the-migration-r.patch
@@ -0,0 +1,57 @@
+From 090c26864ec17b496dea3397656b006550e31852 Mon Sep 17 00:00:00 2001
+From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Date: Thu, 12 Dec 2019 10:53:59 +0100
+Subject: [PATCH 314/347] sched: migrate_enable: Busy loop until the migration
+ request is completed
+Origin: https://www.kernel.org/pub/linux/kernel/projects/rt/4.19/older/patches-4.19.246-rt110.tar.xz
+
+[ Upstream commit 140d7f54a5fff02898d2ca9802b39548bf7455f1 ]
+
+If user task changes the CPU affinity mask of a running task it will
+dispatch migration request if the current CPU is no longer allowed. This
+might happen shortly before a task enters a migrate_disable() section.
+Upon leaving the migrate_disable() section, the task will notice that
+the current CPU is no longer allowed and will will dispatch its own
+migration request to move it off the current CPU.
+While invoking __schedule() the first migration request will be
+processed and the task returns on the "new" CPU with "arg.done = 0". Its
+own migration request will be processed shortly after and will result in
+memory corruption if the stack memory, designed for request, was used
+otherwise in the meantime.
+
+Spin until the migration request has been processed if it was accepted.
+
+Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
+Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
+---
+ kernel/sched/core.c | 7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+diff --git a/kernel/sched/core.c b/kernel/sched/core.c
+index 270adb525d93..d190d9e6b10f 100644
+--- a/kernel/sched/core.c
++++ b/kernel/sched/core.c
+@@ -7323,7 +7323,7 @@ void migrate_enable(void)
+
+ WARN_ON(smp_processor_id() != cpu);
+ if (!is_cpu_allowed(p, cpu)) {
+- struct migration_arg arg = { p };
++ struct migration_arg arg = { .task = p };
+ struct cpu_stop_work work;
+ struct rq_flags rf;
+
+@@ -7336,7 +7336,10 @@ void migrate_enable(void)
+ &arg, &work);
+ tlb_migrate_finish(p->mm);
+ __schedule(true);
+- WARN_ON_ONCE(!arg.done && !work.disabled);
++ if (!work.disabled) {
++ while (!arg.done)
++ cpu_relax();
++ }
+ }
+
+ out:
+--
+2.36.1
+