diff options
author | Daniel Wagner <dwagner@suse.de> | 2020-01-02 13:01:29 +0100 |
---|---|---|
committer | Daniel Wagner <dwagner@suse.de> | 2020-01-02 13:01:29 +0100 |
commit | c5f5acbd1a2caf7215bb91768d2b683758c50d44 (patch) | |
tree | 7a98ad10bc30ccc32e5007bb8bcf568632074003 | |
parent | 6a7e097290d6282f5bc4bd5d06963a8a51537726 (diff) | |
download | linux-stable-rt-v5.3-rt-patches.tar.gz |
[ANNOUNCE] v5.3.18-rt13v5.3.18-rt13-patchesv5.3-rt-patches
Changes since v5.3.18-rt12:
- Since the migrate_disable() rework, the kernel did not build on UP
or without RT enabled. Patch by Daniel Wagner.
- Since the migrate_disable() rework, with heave changing of the
task's affinity mask the kernel could issue a warning in
migrate_enable() and crash later.
Known issues
- none
You can get this release via the git tree at:
git://git.kernel.org/pub/scm/linux/kernel/git/wagi/linux-stable-rt.git v5.3.18-rt13
Daniel
Signed-off-by: Daniel Wagner <dwagner@suse.de>
-rw-r--r-- | patches/lib-smp_processor_id-Adjust-check_preemption_disable.patch | 30 | ||||
-rw-r--r-- | patches/localversion.patch | 2 | ||||
-rw-r--r-- | patches/sched-Lazy-migrate_disable-processing.patch | 8 | ||||
-rw-r--r-- | patches/sched-migrate_enable-Busy-loop-until-the-migration-r.patch | 47 | ||||
-rw-r--r-- | patches/series | 2 |
5 files changed, 83 insertions, 6 deletions
diff --git a/patches/lib-smp_processor_id-Adjust-check_preemption_disable.patch b/patches/lib-smp_processor_id-Adjust-check_preemption_disable.patch new file mode 100644 index 00000000000000..c9c57619a90fd6 --- /dev/null +++ b/patches/lib-smp_processor_id-Adjust-check_preemption_disable.patch @@ -0,0 +1,30 @@ +From: Daniel Wagner <dwagner@suse.de> +Date: Mon, 16 Dec 2019 16:15:57 +0100 +Subject: [PATCH] lib/smp_processor_id: Adjust check_preemption_disabled() + +The current->migrate_disable counter is not always defined leading to +build failures with DEBUG_PREEMPT && !PREEMPT_RT_BASE. + +Restrict the access to ->migrate_disable to same set where +->migrate_disable is modified. + +Signed-off-by: Daniel Wagner <dwagner@suse.de> +[bigeasy: adjust condition + description] +Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +--- + lib/smp_processor_id.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/lib/smp_processor_id.c ++++ b/lib/smp_processor_id.c +@@ -23,8 +23,10 @@ unsigned int check_preemption_disabled(c + * Kernel threads bound to a single CPU can safely use + * smp_processor_id(): + */ ++#if defined(CONFIG_PREEMPT_RT_BASE) && (defined(CONFIG_SMP) || defined(CONFIG_SCHED_DEBUG)) + if (current->migrate_disable) + goto out; ++#endif + + if (current->nr_cpus_allowed == 1) + goto out; diff --git a/patches/localversion.patch b/patches/localversion.patch index 507b529ef21276..9b4c46bf93b1a4 100644 --- a/patches/localversion.patch +++ b/patches/localversion.patch @@ -10,4 +10,4 @@ Signed-off-by: Daniel Wagner <dwagern@suse.de> --- /dev/null +++ b/localversion-rt @@ -0,0 +1 @@ -+-rt12 ++-rt13 diff --git a/patches/sched-Lazy-migrate_disable-processing.patch b/patches/sched-Lazy-migrate_disable-processing.patch index 0cc5d0f6681af4..052f0ded3cfbd6 100644 --- a/patches/sched-Lazy-migrate_disable-processing.patch +++ b/patches/sched-Lazy-migrate_disable-processing.patch @@ -36,8 +36,8 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> kernel/cpu.c | 103 ++++++++++------------------ kernel/sched/core.c | 180 +++++++++++++++++++------------------------------ kernel/sched/sched.h | 4 + - lib/smp_processor_id.c | 5 + - 7 files changed, 130 insertions(+), 181 deletions(-) + lib/smp_processor_id.c | 3 + 7 files changed, 128 insertions(+), 181 deletions(-) --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -579,14 +579,12 @@ Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> #ifdef CONFIG_FAIR_GROUP_SCHED --- a/lib/smp_processor_id.c +++ b/lib/smp_processor_id.c -@@ -23,6 +23,11 @@ unsigned int check_preemption_disabled(c +@@ -23,6 +23,9 @@ unsigned int check_preemption_disabled(c * Kernel threads bound to a single CPU can safely use * smp_processor_id(): */ -+#if defined(CONFIG_SMP) && defined(CONFIG_PREEMPT_RT_BASE) + if (current->migrate_disable) + goto out; -+#endif + if (current->nr_cpus_allowed == 1) goto out; diff --git a/patches/sched-migrate_enable-Busy-loop-until-the-migration-r.patch b/patches/sched-migrate_enable-Busy-loop-until-the-migration-r.patch new file mode 100644 index 00000000000000..623cfb9a953718 --- /dev/null +++ b/patches/sched-migrate_enable-Busy-loop-until-the-migration-r.patch @@ -0,0 +1,47 @@ +From: Sebastian Andrzej Siewior <bigeasy@linutronix.de> +Date: Thu, 12 Dec 2019 10:53:59 +0100 +Subject: [PATCH] sched: migrate_enable: Busy loop until the migration + request is completed + +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> +--- + kernel/sched/core.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/kernel/sched/core.c ++++ b/kernel/sched/core.c +@@ -7867,7 +7867,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; + +@@ -7879,7 +7879,10 @@ void migrate_enable(void) + stop_one_cpu_nowait(task_cpu(p), migration_cpu_stop, + &arg, &work); + __schedule(true); +- WARN_ON_ONCE(!arg.done && !work.disabled); ++ if (!work.disabled) { ++ while (!arg.done) ++ cpu_relax(); ++ } + } + + out: diff --git a/patches/series b/patches/series index 76740c232fb699..7831a342a0a1c7 100644 --- a/patches/series +++ b/patches/series @@ -416,6 +416,8 @@ sched-migrate_enable-Use-select_fallback_rq.patch sched-Lazy-migrate_disable-processing.patch sched-migrate_enable-Use-stop_one_cpu_nowait.patch sched-core-migrate_enable-must-access-takedown_cpu_t.patch +sched-migrate_enable-Busy-loop-until-the-migration-r.patch +lib-smp_processor_id-Adjust-check_preemption_disable.patch # DRIVERS connector-cn_proc-Protect-send_msg-with-a-local-lock.patch |