linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Con Kolivas <kernel@kolivas.org>
To: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
	Alfred Chen <cchalpha@gmail.com>, Ingo Molnar <mingo@redhat.com>
Subject: [PATCH] sched: Do not use smp_processor_id() with preempt enabled in smpboot_thread_fn
Date: Tue, 13 Sep 2016 16:27:05 +1000	[thread overview]
Message-ID: <2042051.3vvUWIM0vs@hex> (raw)

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;

             reply	other threads:[~2016-09-13  6:40 UTC|newest]

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

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=2042051.3vvUWIM0vs@hex \
    --to=kernel@kolivas.org \
    --cc=cchalpha@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /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 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).