aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/topology.c
diff options
context:
space:
mode:
authorFenghua Yu <fenghua.yu@intel.com>2012-11-13 14:32:40 -0500
committerH. Peter Anvin <hpa@linux.intel.com>2012-11-14 12:39:47 -0500
commit4d25031a81d3cd32edc00de6596db76cc4010685 (patch)
treef0786770dd05073e31781099b6645a5302a95e35 /arch/x86/kernel/topology.c
parent80aa1dff65717e7518647d4e27d1d3dcea5818e6 (diff)
x86, topology: Don't offline CPU0 if any PIC irq can not be migrated out of it
If CONFIG_BOOTPARAM_HOTPLUG_CPU is turned on, CPU0 hotplug feature is enabled by default. If CONFIG_BOOTPARAM_HOTPLUG_CPU is not turned on, CPU0 hotplug feature is not enabled by default. The kernel parameter cpu0_hotplug can enable CPU0 hotplug feature at boot. Currently the feature is supported on Intel platforms only. Signed-off-by: Fenghua Yu <fenghua.yu@intel.com> Link: http://lkml.kernel.org/r/1352835171-3958-4-git-send-email-fenghua.yu@intel.com Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'arch/x86/kernel/topology.c')
-rw-r--r--arch/x86/kernel/topology.c50
1 files changed, 43 insertions, 7 deletions
diff --git a/arch/x86/kernel/topology.c b/arch/x86/kernel/topology.c
index 76ee97709a00..0e7b4a7a7fb8 100644
--- a/arch/x86/kernel/topology.c
+++ b/arch/x86/kernel/topology.c
@@ -30,23 +30,59 @@
30#include <linux/mmzone.h> 30#include <linux/mmzone.h>
31#include <linux/init.h> 31#include <linux/init.h>
32#include <linux/smp.h> 32#include <linux/smp.h>
33#include <linux/irq.h>
33#include <asm/cpu.h> 34#include <asm/cpu.h>
34 35
35static DEFINE_PER_CPU(struct x86_cpu, cpu_devices); 36static DEFINE_PER_CPU(struct x86_cpu, cpu_devices);
36 37
37#ifdef CONFIG_HOTPLUG_CPU 38#ifdef CONFIG_HOTPLUG_CPU
39
40#ifdef CONFIG_BOOTPARAM_HOTPLUG_CPU0
41static int cpu0_hotpluggable = 1;
42#else
43static int cpu0_hotpluggable;
44static int __init enable_cpu0_hotplug(char *str)
45{
46 cpu0_hotpluggable = 1;
47 return 1;
48}
49
50__setup("cpu0_hotplug", enable_cpu0_hotplug);
51#endif
52
38int __ref arch_register_cpu(int num) 53int __ref arch_register_cpu(int num)
39{ 54{
55 struct cpuinfo_x86 *c = &cpu_data(num);
56
57 /*
58 * Currently CPU0 is only hotpluggable on Intel platforms. Other
59 * vendors can add hotplug support later.
60 */
61 if (c->x86_vendor != X86_VENDOR_INTEL)
62 cpu0_hotpluggable = 0;
63
40 /* 64 /*
41 * CPU0 cannot be offlined due to several 65 * Two known BSP/CPU0 dependencies: Resume from suspend/hibernate
42 * restrictions and assumptions in kernel. This basically 66 * depends on BSP. PIC interrupts depend on BSP.
43 * doesn't add a control file, one cannot attempt to offline
44 * BSP.
45 * 67 *
46 * Also certain PCI quirks require not to enable hotplug control 68 * If the BSP depencies are under control, one can tell kernel to
47 * for all CPU's. 69 * enable BSP hotplug. This basically adds a control file and
70 * one can attempt to offline BSP.
48 */ 71 */
49 if (num) 72 if (num == 0 && cpu0_hotpluggable) {
73 unsigned int irq;
74 /*
75 * We won't take down the boot processor on i386 if some
76 * interrupts only are able to be serviced by the BSP in PIC.
77 */
78 for_each_active_irq(irq) {
79 if (!IO_APIC_IRQ(irq) && irq_has_action(irq)) {
80 cpu0_hotpluggable = 0;
81 break;
82 }
83 }
84 }
85 if (num || cpu0_hotpluggable)
50 per_cpu(cpu_devices, num).cpu.hotpluggable = 1; 86 per_cpu(cpu_devices, num).cpu.hotpluggable = 1;
51 87
52 return register_cpu(&per_cpu(cpu_devices, num).cpu, num); 88 return register_cpu(&per_cpu(cpu_devices, num).cpu, num);