From: Shaohua Li <shaohua.li@intel.com>

Dead CPU notifies online CPU that it's dead using cpu_state variable. 
After switching to physical cpu hotplug, we forgot setting the variable. 
This patch fixes it.  Currently only __cpu_die uses it.  We changed other
locations for consistency in case others use it.

Signed-off-by: Shaohua Li <shaohua.li@intel.com>
Acked-by: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 arch/i386/kernel/smpboot.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletion(-)

diff -puN arch/i386/kernel/smpboot.c~cpu-state-clean-after-hot-remove-set-cpu_state-for-cpu-hotplug arch/i386/kernel/smpboot.c
--- 25/arch/i386/kernel/smpboot.c~cpu-state-clean-after-hot-remove-set-cpu_state-for-cpu-hotplug	2005-06-15 00:00:23.000000000 -0700
+++ 25-akpm/arch/i386/kernel/smpboot.c	2005-06-15 00:00:23.000000000 -0700
@@ -508,6 +508,7 @@ static void __devinit start_secondary(vo
 	lock_ipi_call_lock();
 	cpu_set(smp_processor_id(), cpu_online_map);
 	unlock_ipi_call_lock();
+	per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE;
 
 	/* We can take interrupts now: we're officially "up". */
 	local_irq_enable();
@@ -1190,6 +1191,7 @@ void __devinit smp_prepare_boot_cpu(void
 	cpu_set(smp_processor_id(), cpu_online_map);
 	cpu_set(smp_processor_id(), cpu_callout_map);
 	cpu_set(smp_processor_id(), cpu_present_map);
+	per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE;
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
@@ -1265,8 +1267,10 @@ void __cpu_die(unsigned int cpu)
 
 	for (i = 0; i < 10; i++) {
 		/* They ack this in play_dead by setting CPU_DEAD */
-		if (per_cpu(cpu_state, cpu) == CPU_DEAD)
+		if (per_cpu(cpu_state, cpu) == CPU_DEAD) {
+			printk ("CPU %d is now offline\n", cpu);
 			return;
+		}
 		current->state = TASK_UNINTERRUPTIBLE;
 		schedule_timeout(HZ/10);
 	}
@@ -1303,6 +1307,7 @@ int __devinit __cpu_up(unsigned int cpu)
 #endif
 
 	local_irq_enable();
+	per_cpu(cpu_state, cpu) = CPU_UP_PREPARE;
 	/* Unleash the CPU! */
 	cpu_set(cpu, smp_commenced_mask);
 	while (!cpu_isset(cpu, cpu_online_map))
_