diff -p -up linux-2.6.9/arch/x86_64/kernel/reboot.c.orig linux-2.6.9/arch/x86_64/kernel/reboot.c
--- linux-2.6.9/arch/x86_64/kernel/reboot.c.orig	2009-12-08 09:56:10.000000000 +0800
+++ linux-2.6.9/arch/x86_64/kernel/reboot.c	2009-12-17 13:23:46.000000000 +0800
@@ -105,9 +105,6 @@ static void smp_halt(void)
 	if (first_entry) { 
 		first_entry = 0;
 
-		/* Make certain I only run on the appropriate processor */
-		set_cpus_allowed(current, cpumask_of_cpu(boot_cpu_id));
-
 		/* If nobody's alive, just return to machine_restart */
 		if (num_online_cpus() == 1)
 			return;
@@ -140,6 +137,16 @@ static inline void kb_wait(void)
 void machine_restart(char * __unused)
 {
 	int i;
+	static int first_entry = 1;
+
+	if (first_entry) {
+		first_entry = 0;
+		if (boot_cpu_id < 0 || !cpu_isset(boot_cpu_id, cpu_online_map))
+			boot_cpu_id = hard_smp_processor_id();
+
+		/* Make certain I only run on the appropriate processor */
+		set_cpus_allowed(current, cpumask_of_cpu(boot_cpu_id));
+	}
 
 #ifdef CONFIG_SMP
 	if (!crashdump_mode())
