Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1482176 > unrolled thread

[PATCH] sched: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn

Started byCon Kolivas <kernel@kolivas.org>
First post2016-09-13 08:50 +0200
Last post2016-09-22 14:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] sched: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn Con Kolivas <kernel@kolivas.org> - 2016-09-13 08:50 +0200
    [tip:sched/core] sched/core: Do not use smp_processor_id() with  preempt enabled in smpboot_thread_fn() tip-bot for Con Kolivas <tipbot@zytor.com> - 2016-09-22 14:00 +0200

#1482176 — [PATCH] sched: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn

FromCon Kolivas <kernel@kolivas.org>
Date2016-09-13 08:50 +0200
Subject[PATCH] sched: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn
Message-ID<sgPHz-6Bw-11@gated-at.bofh.it>
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;

[toc] | [next] | [standalone]


#1488815 — [tip:sched/core] sched/core: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn()

Fromtip-bot for Con Kolivas <tipbot@zytor.com>
Date2016-09-22 14:00 +0200
Subject[tip:sched/core] sched/core: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn()
Message-ID<skaPv-5PF-13@gated-at.bofh.it>
In reply to#1482176
Commit-ID:  4fa5cd5245b627db88c9ca08ae442373b02596b4
Gitweb:     http://git.kernel.org/tip/4fa5cd5245b627db88c9ca08ae442373b02596b4
Author:     Con Kolivas <kernel@kolivas.org>
AuthorDate: Tue, 13 Sep 2016 16:27:05 +1000
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Thu, 22 Sep 2016 12:28:00 +0200

sched/core: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn()

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

Bug identified and fix provided by Alfred Chen.

Reported-by: Alfred Chen <cchalpha@gmail.com>
Signed-off-by: Con Kolivas <kernel@kolivas.org>
Cc: Alfred Chen <cchalpha@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/2042051.3vvUWIM0vs@hex
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 kernel/smpboot.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index 13bc43d..fc0d8270 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -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;

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web