From: Joerg Roedel <joro@8bytes.org>
To: Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>
Cc: x86@kernel.org, Borislav Petkov <bp@alien8.de>,
linux-kernel@vger.kernel.org, Joerg Roedel <jroedel@suse.de>
Subject: [PATCH] x86/smpboot: Check for cpu_active on cpu initialization
Date: Thu, 16 Jul 2015 11:17:17 +0200 [thread overview]
Message-ID: <1437038237-16741-1-git-send-email-joro@8bytes.org> (raw)
From: Joerg Roedel <jroedel@suse.de>
Currently the code to bring up secondary CPUs only checks
for cpu_online before it proceeds with launching the per-cpu
threads for the freshly booted remote CPU.
But the code to move these threads to the new CPU checks for
cpu_active to do so. If this check fails the threads end up
on the wrong CPU, causing warnings and bugs like:
WARNING: CPU: 0 PID: 1 at ../kernel/workqueue.c:4417 workqueue_cpu_up_callback
and/or:
kernel BUG at ../kernel/smpboot.c:135!
The reason is that the cpu_active bit for the new CPU
becomes visible significantly later than the cpu_online bit.
The reasons could be that the kernel runs in a KVM guest,
where the vCPU thread gets preempted when the cpu_online bit
is set, but with cpu_active still clear.
But this could also happen on bare-metal systems with lots
of CPUs. We have observed this issue on an 88 core x86
system on bare-metal.
To fix this issue, wait before the remote CPU is online
*and* active before launching the per-cpu threads.
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
arch/x86/kernel/smpboot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index d3010aa..30b7b8b 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -1006,7 +1006,7 @@ int native_cpu_up(unsigned int cpu, struct task_struct *tidle)
check_tsc_sync_source(cpu);
local_irq_restore(flags);
- while (!cpu_online(cpu)) {
+ while (!cpu_online(cpu) || !cpu_active(cpu)) {
cpu_relax();
touch_nmi_watchdog();
}
--
1.9.1
next reply other threads:[~2015-07-16 9:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-16 9:17 Joerg Roedel [this message]
2015-07-20 14:46 ` [PATCH] x86/smpboot: Check for cpu_active on cpu initialization Borislav Petkov
2015-07-20 15:02 ` Joerg Roedel
2015-07-20 15:10 ` Borislav Petkov
2015-07-20 15:18 ` Joerg Roedel
2015-07-20 15:27 ` Borislav Petkov
2015-07-27 18:21 ` [PATCH] sched: fix cpu_active_mask/cpu_online_mask race Jan H. Schönherr
2015-07-30 16:00 ` Peter Zijlstra
2015-07-30 19:17 ` [PATCH v2] " Jan H. Schönherr
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=1437038237-16741-1-git-send-email-joro@8bytes.org \
--to=joro@8bytes.org \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jroedel@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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).