mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Fenghua Yu" <fenghua.yu@intel.com>
To: "Ingo Molnar" <mingo@elte.hu>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"H Peter Anvin" <hpa@zytor.com>,
	"Zwane Mwaikambo" <zwane@arm.linux.org.uk>,
	"Tony Luck" <tony.luck@intel.com>,
	"Asit K Mallick" <asit.k.mallick@intel.com>,
	"Suresh B Siddha" <suresh.b.siddha@intel.com>,
	"Len Brown" <lenb@kernel.org>
Cc: "linux-kernel" <linux-kernel@vger.kernel.org>,
	"Fenghua Yu" <fenghua.yu@intel.com>
Subject: [PATCH 6/8] x86, topology.c: Enable CPU0 online/offline
Date: Wed,  5 Oct 2011 09:39:17 -0700	[thread overview]
Message-ID: <1317832759-10223-7-git-send-email-fenghua.yu@intel.com> (raw)
In-Reply-To: <1317832759-10223-1-git-send-email-fenghua.yu@intel.com>

From: Fenghua Yu <fenghua.yu@intel.com>

Enable CPU0 online/offline by setting up its sysfs control file. By default,
this feature is disabled. You can enabled it by bsp_hotplug kernel option.

Resume from hibernate, standby, or suspend needs CPU0 online. According to
arch/x86/kernel/topology.c, some PCI quirks(??) need CPU0 online as well. Anyone
knows which PCI quirks depends on CPU0 online?

Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
---
 Documentation/kernel-parameters.txt |    7 +++++++
 arch/x86/kernel/topology.c          |   22 +++++++++++++++-------
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 854ed5c..bf011ee 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -1805,6 +1805,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
 
 	nox2apic	[X86-64,APIC] Do not enable x2APIC mode.
 
+	bsp_hotplug	[X86] BSP (aka CPU0) is hotpluggable.
+			Suspend/resume depends on BSP. It's said some PCI
+			quirks depend on BSP too. But not sure which quirks.
+			If don't care the dependencies, you can turn on
+			bsp_ hotplug. Suspend will fail if BSP is offlined and
+			you need to online BSP before suspend/resume.
+
 	nptcg=		[IA-64] Override max number of concurrent global TLB
 			purges which is reported from either PAL_VM_SUMMARY or
 			SAL PALO.
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index 8927486..ed2da5c 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -34,18 +34,26 @@
 static DEFINE_PER_CPU(struct x86_cpu, cpu_devices);
 
 #ifdef CONFIG_HOTPLUG_CPU
+
+static int __init enable_bsp_hotplug(char *str)
+{
+	bsp_hotpluggable = 1;
+	return 0;
+}
+
+__setup("bsp_hotplug", enable_bsp_hotplug);
+
 int __ref arch_register_cpu(int num)
 {
 	/*
-	 * CPU0 cannot be offlined due to several
-	 * restrictions and assumptions in kernel. This basically
-	 * doesn't add a control file, one cannot attempt to offline
-	 * BSP.
+	 * Suspend/resume depends on BSP. Certain PCI quirks (which PCI
+	 * quirks??) require not to enable hotplug control for all CPU's.
 	 *
-	 * Also certain PCI quirks require not to enable hotplug control
-	 * for all CPU's.
+	 * If one don't care those BSP depencies, tell kernel to
+	 * enable BSP hotplug. This basically adds a control file and
+	 * one can attempt to offline BSP.
 	 */
-	if (num)
+	if (num || bsp_hotpluggable)
 		per_cpu(cpu_devices, num).cpu.hotpluggable = 1;
 
 	return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
-- 
1.6.0.3


  parent reply	other threads:[~2011-10-05 16:56 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-05 16:39 [PATCH 0/8] Online/offline BSP on x86 Fenghua Yu
2011-10-05 16:39 ` [PATCH 1/8] x86, apic.c: Disable irq0 if CPU enables ARAT for local apic timer Fenghua Yu
2011-10-05 18:47   ` Thomas Gleixner
2011-10-05 19:12     ` Yu, Fenghua
2011-10-05 19:38       ` Thomas Gleixner
2011-10-05 20:11         ` Yu, Fenghua
2011-10-06  2:43           ` Andi Kleen
2011-10-05 16:39 ` [PATCH 2/8] x86/mtrr/main.c: Ask the first online CPU to save mtrr Fenghua Yu
2011-10-05 19:03   ` Srivatsa S. Bhat
2011-10-05 16:39 ` [PATCH 3/8] x86, i387.c: thread xstate is initialized only on BSP once Fenghua Yu
2011-10-05 18:49   ` Thomas Gleixner
2011-10-05 19:53     ` Yu, Fenghua
2011-10-05 16:39 ` [PATCH 4/8] kernel/workqueue.c: unbound work queue rescuer runs on first cpu in cpumask_online_cpu Fenghua Yu
2011-10-05 18:52   ` Thomas Gleixner
2011-10-05 19:19     ` Peter Zijlstra
2011-10-05 20:00       ` Tejun Heo
2011-10-05 16:39 ` [PATCH 5/8] x86, common.c, smpboot.c: Init BSP during BSP online and don't offline BSP if irq is bound to it Fenghua Yu
2011-10-05 19:13   ` Thomas Gleixner
2011-10-05 16:39 ` Fenghua Yu [this message]
2011-10-05 19:20   ` [PATCH 6/8] x86, topology.c: Enable CPU0 online/offline Thomas Gleixner
2011-10-05 23:05     ` Yu, Fenghua
2011-11-03 22:47     ` Yu, Fenghua
2011-11-07  2:11       ` Len Brown
2011-11-07 21:02         ` Yu, Fenghua
2011-10-05 16:39 ` [PATCH 7/8] kernel/power/main.c: Not suspend/resume if CPU0 is offlined Fenghua Yu
2011-10-05 18:37   ` Srivatsa S. Bhat
2011-10-05 19:22   ` Thomas Gleixner
2011-10-05 16:39 ` [PATCH 8/8] kernel/cpu.c: Define bsp_hotpluggable variable Fenghua Yu
2011-10-05 19:25   ` Thomas Gleixner
2011-10-05 20:25     ` Yu, Fenghua
2011-10-05 21:19       ` Thomas Gleixner
2011-10-05 19:16 ` [PATCH 0/8] Online/offline BSP on x86 Peter Zijlstra
2011-10-05 19:22   ` Yu, Fenghua
2011-10-05 19:28     ` Peter Zijlstra
2011-10-05 20:29       ` Yu, Fenghua
2011-10-05 20:37         ` Peter Zijlstra

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=1317832759-10223-7-git-send-email-fenghua.yu@intel.com \
    --to=fenghua.yu@intel.com \
    --cc=asit.k.mallick@intel.com \
    --cc=hpa@zytor.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tony.luck@intel.com \
    --cc=zwane@arm.linux.org.uk \
    /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

all inboxes | Powered by JetHome®