Module Name:    src
Committed By:   mhitch
Date:           Sun Oct 25 20:39:45 UTC 2009

Modified Files:
        src/sys/arch/alpha/alpha: machdep.c

Log Message:
We might switch cpu in between the start of cpu_reboot() and where we
actually start shutting down cpus.  This caused problems because the
wait_mask computed at the beginning of cpu_reboot() wouldn't be correct
when actually waiting for the other cpus to shutdown, and cpu_halt()
might be called instead of prom_halt() at the end, leading to a hung
machine.


To generate a diff of this commit:
cvs rdiff -u -r1.320 -r1.321 src/sys/arch/alpha/alpha/machdep.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/alpha/alpha/machdep.c
diff -u src/sys/arch/alpha/alpha/machdep.c:1.320 src/sys/arch/alpha/alpha/machdep.c:1.321
--- src/sys/arch/alpha/alpha/machdep.c:1.320	Sat Aug 15 23:44:58 2009
+++ src/sys/arch/alpha/alpha/machdep.c	Sun Oct 25 20:39:45 2009
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.320 2009/08/15 23:44:58 matt Exp $ */
+/* $NetBSD: machdep.c,v 1.321 2009/10/25 20:39:45 mhitch Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.320 2009/08/15 23:44:58 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.321 2009/10/25 20:39:45 mhitch Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -962,8 +962,7 @@
 {
 #if defined(MULTIPROCESSOR)
 	u_long cpu_id = cpu_number();
-	u_long wait_mask = (1UL << cpu_id) |
-			   (1UL << hwrpb->rpb_primary_cpu_id);
+	u_long wait_mask;
 	int i;
 #endif
 
@@ -997,6 +996,9 @@
 	 * Halt all other CPUs.  If we're not the primary, the
 	 * primary will spin, waiting for us to halt.
 	 */
+	cpu_id = cpu_number();		/* may have changed cpu */
+	wait_mask = (1UL << cpu_id) | (1UL << hwrpb->rpb_primary_cpu_id);
+
 	alpha_broadcast_ipi(ALPHA_IPI_HALT);
 
 	/* Ensure any CPUs paused by DDB resume execution so they can halt */

Reply via email to