]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
x86: merge __cpu_disable and cpu_die
authorGlauber Costa <gcosta@redhat.com>
Mon, 3 Mar 2008 17:13:07 +0000 (14:13 -0300)
committerIngo Molnar <mingo@elte.hu>
Thu, 17 Apr 2008 15:40:56 +0000 (17:40 +0200)
They are now equal, and are moved to a common file

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/kernel/smpboot.c
arch/x86/kernel/smpboot_32.c
arch/x86/kernel/smpboot_64.c
include/asm-x86/smp.h
include/asm-x86/smp_32.h
include/asm-x86/smp_64.h

index 644e60969f902c93137f59e6ea1d2f8059b9a943..c35cd319d1ed3dcda873adbbee4d8c729b1c0a4e 100644 (file)
@@ -2,6 +2,13 @@
 #include <linux/smp.h>
 #include <linux/module.h>
 #include <linux/sched.h>
+#include <linux/percpu.h>
+
+#include <asm/nmi.h>
+#include <asm/irq.h>
+#include <asm/smp.h>
+#include <asm/cpu.h>
+#include <asm/numa.h>
 
 /* Number of siblings per CPU package */
 int smp_num_siblings = 1;
@@ -181,5 +188,83 @@ __init void prefill_possible_map(void)
        for (i = 0; i < possible; i++)
                cpu_set(i, cpu_possible_map);
 }
+
+static void __ref remove_cpu_from_maps(int cpu)
+{
+       cpu_clear(cpu, cpu_online_map);
+#ifdef CONFIG_X86_64
+       cpu_clear(cpu, cpu_callout_map);
+       cpu_clear(cpu, cpu_callin_map);
+       /* was set by cpu_init() */
+       clear_bit(cpu, (unsigned long *)&cpu_initialized);
+       clear_node_cpumask(cpu);
+#endif
+}
+
+int __cpu_disable(void)
+{
+       int cpu = smp_processor_id();
+
+       /*
+        * Perhaps use cpufreq to drop frequency, but that could go
+        * into generic code.
+        *
+        * We won't take down the boot processor on i386 due to some
+        * interrupts only being able to be serviced by the BSP.
+        * Especially so if we're not using an IOAPIC   -zwane
+        */
+       if (cpu == 0)
+               return -EBUSY;
+
+       if (nmi_watchdog == NMI_LOCAL_APIC)
+               stop_apic_nmi_watchdog(NULL);
+       clear_local_APIC();
+
+       /*
+        * HACK:
+        * Allow any queued timer interrupts to get serviced
+        * This is only a temporary solution until we cleanup
+        * fixup_irqs as we do for IA64.
+        */
+       local_irq_enable();
+       mdelay(1);
+
+       local_irq_disable();
+       remove_siblinginfo(cpu);
+
+       /* It's now safe to remove this processor from the online map */
+       remove_cpu_from_maps(cpu);
+       fixup_irqs(cpu_online_map);
+       return 0;
+}
+
+void __cpu_die(unsigned int cpu)
+{
+       /* We don't do anything here: idle task is faking death itself. */
+       unsigned int i;
+
+       for (i = 0; i < 10; i++) {
+               /* They ack this in play_dead by setting CPU_DEAD */
+               if (per_cpu(cpu_state, cpu) == CPU_DEAD) {
+                       printk(KERN_INFO "CPU %d is now offline\n", cpu);
+                       if (1 == num_online_cpus())
+                               alternatives_smp_switch(0);
+                       return;
+               }
+               msleep(100);
+       }
+       printk(KERN_ERR "CPU %u didn't die...\n", cpu);
+}
+#else /* ... !CONFIG_HOTPLUG_CPU */
+int __cpu_disable(void)
+{
+       return -ENOSYS;
+}
+
+void __cpu_die(unsigned int cpu)
+{
+       /* We said "no" in __cpu_disable */
+       BUG();
+}
 #endif
 
index 3d21c663aa764c3b8622df8269f6e2a861118fda..00b1b59cd560dd8d7a59b3b9f4b9546eef0da14c 100644 (file)
@@ -1040,73 +1040,6 @@ void __init native_smp_prepare_boot_cpu(void)
        __get_cpu_var(cpu_state) = CPU_ONLINE;
 }
 
-#ifdef CONFIG_HOTPLUG_CPU
-static void __ref remove_cpu_from_maps(int cpu)
-{
-       cpu_clear(cpu, cpu_online_map);
-}
-
-int __cpu_disable(void)
-{
-       cpumask_t map = cpu_online_map;
-       int cpu = smp_processor_id();
-
-       /*
-        * Perhaps use cpufreq to drop frequency, but that could go
-        * into generic code.
-        *
-        * We won't take down the boot processor on i386 due to some
-        * interrupts only being able to be serviced by the BSP.
-        * Especially so if we're not using an IOAPIC   -zwane
-        */
-       if (cpu == 0)
-               return -EBUSY;
-       if (nmi_watchdog == NMI_LOCAL_APIC)
-               stop_apic_nmi_watchdog(NULL);
-       clear_local_APIC();
-       /* Allow any queued timer interrupts to get serviced */
-       local_irq_enable();
-       mdelay(1);
-       local_irq_disable();
-
-       remove_siblinginfo(cpu);
-
-       remove_cpu_from_maps(cpu);
-       fixup_irqs(map);
-
-       return 0;
-}
-
-void __cpu_die(unsigned int cpu)
-{
-       /* We don't do anything here: idle task is faking death itself. */
-       unsigned int i;
-
-       for (i = 0; i < 10; i++) {
-               /* They ack this in play_dead by setting CPU_DEAD */
-               if (per_cpu(cpu_state, cpu) == CPU_DEAD) {
-                       printk ("CPU %d is now offline\n", cpu);
-                       if (1 == num_online_cpus())
-                               alternatives_smp_switch(0);
-                       return;
-               }
-               msleep(100);
-       }
-       printk(KERN_ERR "CPU %u didn't die...\n", cpu);
-}
-#else /* ... !CONFIG_HOTPLUG_CPU */
-int __cpu_disable(void)
-{
-       return -ENOSYS;
-}
-
-void __cpu_die(unsigned int cpu)
-{
-       /* We said "no" in __cpu_disable */
-       BUG();
-}
-#endif /* CONFIG_HOTPLUG_CPU */
-
 int __cpuinit native_cpu_up(unsigned int cpu)
 {
        unsigned long flags;
index 6509d3c1b3dfd9a84064d11297dd165f418a3961..0c67e5ae9c9d2a9daacdaf036fd9b4a3bd548025 100644 (file)
@@ -836,82 +836,3 @@ void __init native_smp_cpus_done(unsigned int max_cpus)
        setup_ioapic_dest();
        check_nmi_watchdog();
 }
-
-#ifdef CONFIG_HOTPLUG_CPU
-static void __ref remove_cpu_from_maps(int cpu)
-{
-       cpu_clear(cpu, cpu_online_map);
-       cpu_clear(cpu, cpu_callout_map);
-       cpu_clear(cpu, cpu_callin_map);
-       clear_bit(cpu, (unsigned long *)&cpu_initialized); /* was set by cpu_init() */
-       clear_node_cpumask(cpu);
-}
-
-int __cpu_disable(void)
-{
-       int cpu = smp_processor_id();
-
-       /*
-        * Perhaps use cpufreq to drop frequency, but that could go
-        * into generic code.
-        *
-        * We won't take down the boot processor on i386 due to some
-        * interrupts only being able to be serviced by the BSP.
-        * Especially so if we're not using an IOAPIC   -zwane
-        */
-       if (cpu == 0)
-               return -EBUSY;
-
-       if (nmi_watchdog == NMI_LOCAL_APIC)
-               stop_apic_nmi_watchdog(NULL);
-       clear_local_APIC();
-
-       /*
-        * HACK:
-        * Allow any queued timer interrupts to get serviced
-        * This is only a temporary solution until we cleanup
-        * fixup_irqs as we do for IA64.
-        */
-       local_irq_enable();
-       mdelay(1);
-
-       local_irq_disable();
-       remove_siblinginfo(cpu);
-
-       /* It's now safe to remove this processor from the online map */
-       remove_cpu_from_maps(cpu);
-       fixup_irqs(cpu_online_map);
-       return 0;
-}
-
-void __cpu_die(unsigned int cpu)
-{
-       /* We don't do anything here: idle task is faking death itself. */
-       unsigned int i;
-
-       for (i = 0; i < 10; i++) {
-               /* They ack this in play_dead by setting CPU_DEAD */
-               if (per_cpu(cpu_state, cpu) == CPU_DEAD) {
-                       printk ("CPU %d is now offline\n", cpu);
-                       if (1 == num_online_cpus())
-                               alternatives_smp_switch(0);
-                       return;
-               }
-               msleep(100);
-       }
-       printk(KERN_ERR "CPU %u didn't die...\n", cpu);
-}
-
-#else /* ... !CONFIG_HOTPLUG_CPU */
-
-int __cpu_disable(void)
-{
-       return -ENOSYS;
-}
-
-void __cpu_die(unsigned int cpu)
-{
-       /* We said "no" in __cpu_disable */
-       BUG();
-}
-#endif /* CONFIG_HOTPLUG_CPU */
index c800b815d378c9fd014cb1cf4162b39da1ca1d49..27d9f659523299731e6351950cda313019e20fb5 100644 (file)
@@ -70,6 +70,9 @@ void native_smp_prepare_cpus(unsigned int max_cpus);
 void native_smp_cpus_done(unsigned int max_cpus);
 int native_cpu_up(unsigned int cpunum);
 
+extern int __cpu_disable(void);
+extern void __cpu_die(unsigned int cpu);
+
 extern unsigned disabled_cpus;
 extern void prefill_possible_map(void);
 #endif
index 0b2513468870e9461ef4a853887aa1773018b493..4fec2feb6ac82b088e4fe969beb718459fb1bd6f 100644 (file)
@@ -34,9 +34,6 @@ DECLARE_PER_CPU(u16, x86_cpu_to_apicid);
 #define startup_ipi_hook(phys_apicid, start_eip, start_esp) do { } while (0)
 #endif
 
-extern int __cpu_disable(void);
-extern void __cpu_die(unsigned int cpu);
-
 /*
  * This function is needed by all SMP systems. It must _always_ be valid
  * from the initial startup. We map APIC_BASE very early in page_setup(),
index 1ecf8134bdc975d03a9bccc0a3c2863f60cda31e..d554d7d57327b86e2b9f9a63a2c3181558c2ffff 100644 (file)
@@ -42,9 +42,6 @@ static inline int cpu_present_to_apicid(int mps_cpu)
 
 #define SMP_TRAMPOLINE_BASE 0x6000
 
-extern int __cpu_disable(void);
-extern void __cpu_die(unsigned int cpu);
-
 #define raw_smp_processor_id() read_pda(cpunumber)
 #define cpu_physical_id(cpu)   per_cpu(x86_cpu_to_apicid, cpu)