From: tip-bot for Borislav Petkov <bp@amd64.org>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, hpa@zytor.com, mingo@redhat.com,
bp@amd64.org, stable@kernel.org, tglx@linutronix.de,
hpa@linux.intel.com, borislav.petkov@amd.com
Subject: [tip:x86/urgent] x86, hotplug: Serialize CPU hotplug to avoid bringup concurrency issues
Date: Thu, 19 Aug 2010 22:58:03 GMT [thread overview]
Message-ID: <tip-d7c53c9e822a4fefa13a0cae76f3190bfd0d5c11@git.kernel.org> (raw)
In-Reply-To: <20100819181029.GC17171@aftab>
Commit-ID: d7c53c9e822a4fefa13a0cae76f3190bfd0d5c11
Gitweb: http://git.kernel.org/tip/d7c53c9e822a4fefa13a0cae76f3190bfd0d5c11
Author: Borislav Petkov <bp@amd64.org>
AuthorDate: Thu, 19 Aug 2010 20:10:29 +0200
Committer: H. Peter Anvin <hpa@linux.intel.com>
CommitDate: Thu, 19 Aug 2010 14:47:43 -0700
x86, hotplug: Serialize CPU hotplug to avoid bringup concurrency issues
When testing cpu hotplug code on 32-bit we kept hitting the "CPU%d:
Stuck ??" message due to multiple cores concurrently accessing the
cpu_callin_mask, among others.
Since these codepaths are not protected from concurrent access due to
the fact that there's no sane reason for making an already complex
code unnecessarily more complex - we hit the issue only when insanely
switching cores off- and online - serialize hotplugging cores on the
sysfs level and be done with it.
[ v2.1: fix !HOTPLUG_CPU build ]
Cc: <stable@kernel.org>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
LKML-Reference: <20100819181029.GC17171@aftab>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
---
arch/x86/Kconfig | 5 +++++
arch/x86/kernel/smpboot.c | 19 +++++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index a84fc34..ac7827f 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -245,6 +245,11 @@ config ARCH_HWEIGHT_CFLAGS
config KTIME_SCALAR
def_bool X86_32
+
+config ARCH_CPU_PROBE_RELEASE
+ def_bool y
+ depends on HOTPLUG_CPU
+
source "init/Kconfig"
source "kernel/Kconfig.freezer"
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index abf4a86..8b3bfc4 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -90,6 +90,25 @@ DEFINE_PER_CPU(int, cpu_state) = { 0 };
static DEFINE_PER_CPU(struct task_struct *, idle_thread_array);
#define get_idle_for_cpu(x) (per_cpu(idle_thread_array, x))
#define set_idle_for_cpu(x, p) (per_cpu(idle_thread_array, x) = (p))
+
+/*
+ * We need this for trampoline_base protection from concurrent accesses when
+ * off- and onlining cores wildly.
+ */
+static DEFINE_MUTEX(x86_cpu_hotplug_driver_mutex);
+
+void cpu_hotplug_driver_lock()
+{
+ mutex_lock(&x86_cpu_hotplug_driver_mutex);
+}
+
+void cpu_hotplug_driver_unlock()
+{
+ mutex_unlock(&x86_cpu_hotplug_driver_mutex);
+}
+
+ssize_t arch_cpu_probe(const char *buf, size_t count) { return -1; }
+ssize_t arch_cpu_release(const char *buf, size_t count) { return -1; }
#else
static struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
#define get_idle_for_cpu(x) (idle_thread_array[(x)])
next prev parent reply other threads:[~2010-08-19 22:58 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-04 16:45 [PATCH 0/2] Fix 32-bit CPU hotplug issue on AMD Borislav Petkov
2010-08-04 16:45 ` [PATCH 1/2] x86-32: Fix crashes with CPU hotplug on AMD machines Borislav Petkov
2010-08-04 23:05 ` H. Peter Anvin
2010-08-05 4:48 ` Borislav Petkov
2010-08-05 7:45 ` Roedel, Joerg
2010-08-05 14:14 ` H. Peter Anvin
2010-08-12 14:41 ` Joerg Roedel
2010-08-12 15:34 ` H. Peter Anvin
2010-08-12 15:47 ` Borislav Petkov
2010-08-12 15:47 ` H. Peter Anvin
2010-08-12 17:38 ` Borislav Petkov
2010-08-24 7:33 ` Initial working version (Re: [PATCH 1/2] x86-32: Fix crashes with CPU hotplug on AMD machines) Borislav Petkov
2010-08-29 20:32 ` [PATCH] x86-32, mm: Add an initial page table for core bootstrapping Borislav Petkov
2010-09-02 9:10 ` [PATCH -v1.1] " Borislav Petkov
2010-08-12 17:06 ` [PATCH 1/2] x86-32: Fix crashes with CPU hotplug on AMD machines Joerg Roedel
2010-08-12 19:01 ` H. Peter Anvin
2010-08-12 19:04 ` Joerg Roedel
2010-08-13 12:35 ` Borislav Petkov
2010-08-16 12:19 ` Borislav Petkov
2010-08-16 12:38 ` [PATCH -v2 " Borislav Petkov
2010-08-18 18:41 ` H. Peter Anvin
2010-08-18 19:09 ` Borislav Petkov
2010-08-18 20:55 ` [tip:x86/urgent] x86-32: Fix dummy trampoline-related inline stubs tip-bot for H. Peter Anvin
2010-08-18 20:55 ` [tip:x86/urgent] x86-32: Separate 1:1 pagetables from swapper_pg_dir tip-bot for Joerg Roedel
2010-08-16 12:39 ` [PATCH -v2 2/2] x86, cpu hotplug: Fix cpu bringup concurrency issue Borislav Petkov
2010-08-18 19:03 ` H. Peter Anvin
2010-08-18 19:28 ` Borislav Petkov
2010-08-18 20:04 ` H. Peter Anvin
2010-08-19 18:10 ` [PATCH -v2.1 " Borislav Petkov
2010-08-19 22:58 ` tip-bot for Borislav Petkov [this message]
2010-08-04 16:45 ` [PATCH " Borislav Petkov
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-d7c53c9e822a4fefa13a0cae76f3190bfd0d5c11@git.kernel.org \
--to=bp@amd64.org \
--cc=borislav.petkov@amd.com \
--cc=hpa@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=stable@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome