[GIT PULL] x86 generic hotplug changes for v3.8

2012-12-11 Thread Ingo Molnar
Linus,

Please pull the latest x86-bsp-hotplug-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
x86-bsp-hotplug-for-linus

   HEAD: a71c8bc5dfefbbf80ef90739791554ef7ea4401b x86, topology: Debug CPU0 
hotplug

This tree enables CPU#0 (the boot processor) to be 
onlined/offlined on x86, just like any other CPU. Enabled on 
Intel CPUs for now.

Allowing this required the identification and fixing of latent 
CPU#0 assumptions (such as CPU#0 initializations, etc.) in the 
x86 architecture code, plus the identification of barriers to 
BSP-offlining, such as active PIC interrupts which can only be 
serviced on the BSP.

It's behind a default-off option, and there's a debug option 
that allows the automatic testing of this feature.

The motivation of this feature is to allow and prepare for true 
CPU-hotplug hardware support: recent changes to MCE support 
enable us to detect a deteriorating but not yet hard-failing 
L1/L2 cache on a CPU that could be soft-unplugged - or a failing 
L3 cache on a multi-socket system.

Note that true hardware hot-plug is not yet fully enabled by 
this, because that requires a special platform wakeup sequence 
to be sent to the freshly powered up CPU#0. Future patches for 
this are planned, once such a platform exists. Chicken and egg 
...

out-of-topic modifications in x86-bsp-hotplug-for-linus:

kernel/cpu.c   # 6e32d47: kernel/cpu.c: Add comment for pri

 Thanks,

Ingo

-->
Fenghua Yu (14):
  doc: Add x86 CPU0 online/offline feature
  x86, Kconfig: Add config switch for CPU0 hotplug
  x86, topology: Don't offline CPU0 if any PIC irq can not be migrated out 
of it
  x86, hotplug: Support functions for CPU0 online/offline
  x86, hotplug, suspend: Online CPU0 for suspend or hibernate
  kernel/cpu.c: Add comment for priority in cpu_hotplug_pm_callback
  x86-64, hotplug: Add start_cpu0() entry point to head_64.S
  x86-32, hotplug: Add start_cpu0() entry point to head_32.S
  x86, hotplug: Wake up CPU0 via NMI instead of INIT, SIPI, SIPI
  x86, hotplug: During CPU0 online, enable x2apic, set_numa_node.
  x86, hotplug: The first online processor saves the MTRR state
  x86, hotplug: Handle retrigger irq by the first available CPU
  x86/i387.c: Initialize thread xstate only on CPU0 only once
  x86, topology: Debug CPU0 hotplug


 Documentation/cpu-hotplug.txt   |  24 ++
 Documentation/kernel-parameters.txt |  14 
 arch/x86/Kconfig|  44 +++
 arch/x86/include/asm/cpu.h  |   4 +
 arch/x86/include/asm/smp.h  |   1 +
 arch/x86/kernel/apic/io_apic.c  |   4 +-
 arch/x86/kernel/cpu/common.c|   5 +-
 arch/x86/kernel/cpu/mtrr/main.c |   9 ++-
 arch/x86/kernel/head_32.S   |  13 
 arch/x86/kernel/head_64.S   |  16 
 arch/x86/kernel/i387.c  |   6 +-
 arch/x86/kernel/smpboot.c   | 149 +---
 arch/x86/kernel/topology.c  | 101 ++--
 arch/x86/power/cpu.c|  82 
 kernel/cpu.c|   5 ++
 15 files changed, 436 insertions(+), 41 deletions(-)

diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt
index 66ef8f3..9f40135 100644
--- a/Documentation/cpu-hotplug.txt
+++ b/Documentation/cpu-hotplug.txt
@@ -207,6 +207,30 @@ by making it not-removable.
 
 In such cases you will also notice that the online file is missing under cpu0.
 
+Q: Is CPU0 removable on X86?
+A: Yes. If kernel is compiled with CONFIG_BOOTPARAM_HOTPLUG_CPU0=y, CPU0 is
+removable by default. Otherwise, CPU0 is also removable by kernel option
+cpu0_hotplug.
+
+But some features depend on CPU0. Two known dependencies are:
+
+1. Resume from hibernate/suspend depends on CPU0. Hibernate/suspend will fail 
if
+CPU0 is offline and you need to online CPU0 before hibernate/suspend can
+continue.
+2. PIC interrupts also depend on CPU0. CPU0 can't be removed if a PIC interrupt
+is detected.
+
+It's said poweroff/reboot may depend on CPU0 on some machines although I 
haven't
+seen any poweroff/reboot failure so far after CPU0 is offline on a few tested
+machines.
+
+Please let me know if you know or see any other dependencies of CPU0.
+
+If the dependencies are under your control, you can turn on CPU0 hotplug 
feature
+either by CONFIG_BOOTPARAM_HOTPLUG_CPU0 or by kernel parameter cpu0_hotplug.
+
+--Fenghua Yu 
+
 Q: How do i find out if a particular CPU is not removable?
 A: Depending on the implementation, some architectures may show this by the
 absence of the "online" file. This is done if it can be determined ahead of
diff --git a/Documentation/kernel-parameters.txt 
b/Documentation/kernel-parameters.txt
index 9776f06..f7cbe1d 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt

[GIT PULL] x86 generic hotplug changes for v3.8

2012-12-11 Thread Ingo Molnar
Linus,

Please pull the latest x86-bsp-hotplug-for-linus git tree from:

   git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git 
x86-bsp-hotplug-for-linus

   HEAD: a71c8bc5dfefbbf80ef90739791554ef7ea4401b x86, topology: Debug CPU0 
hotplug

This tree enables CPU#0 (the boot processor) to be 
onlined/offlined on x86, just like any other CPU. Enabled on 
Intel CPUs for now.

Allowing this required the identification and fixing of latent 
CPU#0 assumptions (such as CPU#0 initializations, etc.) in the 
x86 architecture code, plus the identification of barriers to 
BSP-offlining, such as active PIC interrupts which can only be 
serviced on the BSP.

It's behind a default-off option, and there's a debug option 
that allows the automatic testing of this feature.

The motivation of this feature is to allow and prepare for true 
CPU-hotplug hardware support: recent changes to MCE support 
enable us to detect a deteriorating but not yet hard-failing 
L1/L2 cache on a CPU that could be soft-unplugged - or a failing 
L3 cache on a multi-socket system.

Note that true hardware hot-plug is not yet fully enabled by 
this, because that requires a special platform wakeup sequence 
to be sent to the freshly powered up CPU#0. Future patches for 
this are planned, once such a platform exists. Chicken and egg 
...

out-of-topic modifications in x86-bsp-hotplug-for-linus:

kernel/cpu.c   # 6e32d47: kernel/cpu.c: Add comment for pri

 Thanks,

Ingo

--
Fenghua Yu (14):
  doc: Add x86 CPU0 online/offline feature
  x86, Kconfig: Add config switch for CPU0 hotplug
  x86, topology: Don't offline CPU0 if any PIC irq can not be migrated out 
of it
  x86, hotplug: Support functions for CPU0 online/offline
  x86, hotplug, suspend: Online CPU0 for suspend or hibernate
  kernel/cpu.c: Add comment for priority in cpu_hotplug_pm_callback
  x86-64, hotplug: Add start_cpu0() entry point to head_64.S
  x86-32, hotplug: Add start_cpu0() entry point to head_32.S
  x86, hotplug: Wake up CPU0 via NMI instead of INIT, SIPI, SIPI
  x86, hotplug: During CPU0 online, enable x2apic, set_numa_node.
  x86, hotplug: The first online processor saves the MTRR state
  x86, hotplug: Handle retrigger irq by the first available CPU
  x86/i387.c: Initialize thread xstate only on CPU0 only once
  x86, topology: Debug CPU0 hotplug


 Documentation/cpu-hotplug.txt   |  24 ++
 Documentation/kernel-parameters.txt |  14 
 arch/x86/Kconfig|  44 +++
 arch/x86/include/asm/cpu.h  |   4 +
 arch/x86/include/asm/smp.h  |   1 +
 arch/x86/kernel/apic/io_apic.c  |   4 +-
 arch/x86/kernel/cpu/common.c|   5 +-
 arch/x86/kernel/cpu/mtrr/main.c |   9 ++-
 arch/x86/kernel/head_32.S   |  13 
 arch/x86/kernel/head_64.S   |  16 
 arch/x86/kernel/i387.c  |   6 +-
 arch/x86/kernel/smpboot.c   | 149 +---
 arch/x86/kernel/topology.c  | 101 ++--
 arch/x86/power/cpu.c|  82 
 kernel/cpu.c|   5 ++
 15 files changed, 436 insertions(+), 41 deletions(-)

diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt
index 66ef8f3..9f40135 100644
--- a/Documentation/cpu-hotplug.txt
+++ b/Documentation/cpu-hotplug.txt
@@ -207,6 +207,30 @@ by making it not-removable.
 
 In such cases you will also notice that the online file is missing under cpu0.
 
+Q: Is CPU0 removable on X86?
+A: Yes. If kernel is compiled with CONFIG_BOOTPARAM_HOTPLUG_CPU0=y, CPU0 is
+removable by default. Otherwise, CPU0 is also removable by kernel option
+cpu0_hotplug.
+
+But some features depend on CPU0. Two known dependencies are:
+
+1. Resume from hibernate/suspend depends on CPU0. Hibernate/suspend will fail 
if
+CPU0 is offline and you need to online CPU0 before hibernate/suspend can
+continue.
+2. PIC interrupts also depend on CPU0. CPU0 can't be removed if a PIC interrupt
+is detected.
+
+It's said poweroff/reboot may depend on CPU0 on some machines although I 
haven't
+seen any poweroff/reboot failure so far after CPU0 is offline on a few tested
+machines.
+
+Please let me know if you know or see any other dependencies of CPU0.
+
+If the dependencies are under your control, you can turn on CPU0 hotplug 
feature
+either by CONFIG_BOOTPARAM_HOTPLUG_CPU0 or by kernel parameter cpu0_hotplug.
+
+--Fenghua Yu fenghua...@intel.com
+
 Q: How do i find out if a particular CPU is not removable?
 A: Depending on the implementation, some architectures may show this by the
 absence of the online file. This is done if it can be determined ahead of
diff --git a/Documentation/kernel-parameters.txt 
b/Documentation/kernel-parameters.txt
index 9776f06..f7cbe1d 100644
--- a/Documentation/kernel-parameters.txt
+++