[RT,20/23] lib/smp_processor_id: Adjust check_preemption_disabled()
diff mbox series

Message ID b0063a9a073a73c28d15a91336262922bac0dd9e.1582814004.git.zanussi@kernel.org
State New
Headers show
  • Linux v4.14.170-rt75-rc2
Related show

Commit Message

Tom Zanussi Feb. 27, 2020, 2:33 p.m. UTC
From: Daniel Wagner <dwagner@suse.de>

v4.14.170-rt75-rc2 stable review patch.
If anyone has any objections, please let me know.


[ Upstream commit af3c1c5fdf177870fb5e6e16b24e374696ab28f5 ]

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>
Signed-off-by: Tom Zanussi <zanussi@kernel.org>
 lib/smp_processor_id.c | 2 ++
 1 file changed, 2 insertions(+)

diff mbox series

diff --git a/lib/smp_processor_id.c b/lib/smp_processor_id.c
index 7a0c19c282cc..3ceb2cc1516b 100644
--- a/lib/smp_processor_id.c
+++ b/lib/smp_processor_id.c
@@ -23,8 +23,10 @@  notrace static unsigned int check_preemption_disabled(const char *what1,
 	 * 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;
 	if (current->nr_cpus_allowed == 1)
 		goto out;