linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sched: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn
@ 2016-09-13  6:27 Con Kolivas
  2016-09-22 11:58 ` [tip:sched/core] sched/core: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn() tip-bot for Con Kolivas
  0 siblings, 1 reply; 2+ messages in thread
From: Con Kolivas @ 2016-09-13  6:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: Peter Zijlstra, Alfred Chen, Ingo Molnar

We should not be using smp_processor_id() with preempt enabled.

Bug identified and fix provided by Alfred Chen.

Signed-off-by: Con Kolivas <kernel@kolivas.org>

---
 kernel/smpboot.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-4.7.3-ck3/kernel/smpboot.c
===================================================================
--- linux-4.7.3-ck3.orig/kernel/smpboot.c	2016-05-16 08:43:13.000000000 +1000
+++ linux-4.7.3-ck3/kernel/smpboot.c	2016-09-13 16:17:33.535655129 +1000
@@ -122,12 +122,12 @@ static int smpboot_thread_fn(void *data)
 
 		if (kthread_should_park()) {
 			__set_current_state(TASK_RUNNING);
-			preempt_enable();
 			if (ht->park && td->status == HP_THREAD_ACTIVE) {
 				BUG_ON(td->cpu != smp_processor_id());
 				ht->park(td->cpu);
 				td->status = HP_THREAD_PARKED;
 			}
+			preempt_enable();
 			kthread_parkme();
 			/* We might have been woken for stop */
 			continue;

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-09-22 11:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-13  6:27 [PATCH] sched: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn Con Kolivas
2016-09-22 11:58 ` [tip:sched/core] sched/core: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn() tip-bot for Con Kolivas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).