All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Con Kolivas <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org,
	mingo@kernel.org, hpa@zytor.com, peterz@infradead.org,
	kernel@kolivas.org, cchalpha@gmail.com
Subject: [tip:sched/core] sched/core: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn()
Date: Thu, 22 Sep 2016 04:58:39 -0700	[thread overview]
Message-ID: <tip-4fa5cd5245b627db88c9ca08ae442373b02596b4@git.kernel.org> (raw)
In-Reply-To: <2042051.3vvUWIM0vs@hex>

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;

      reply	other threads:[~2016-09-22 11:59 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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-bot for Con Kolivas [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-4fa5cd5245b627db88c9ca08ae442373b02596b4@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=cchalpha@gmail.com \
    --cc=hpa@zytor.com \
    --cc=kernel@kolivas.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.