Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/alpha/alpha We might switch cpu in between the star...



details:   https://anonhg.NetBSD.org/src/rev/16b5068fba2d
branches:  trunk
changeset: 748497:16b5068fba2d
user:      mhitch <mhitch%NetBSD.org@localhost>
date:      Sun Oct 25 20:39:45 2009 +0000

description:
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.

diffstat:

 sys/arch/alpha/alpha/machdep.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 2ae1a136ee32 -r 16b5068fba2d sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c    Sun Oct 25 20:14:50 2009 +0000
+++ b/sys/arch/alpha/alpha/machdep.c    Sun Oct 25 20:39:45 2009 +0000
@@ -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 */



Home | Main Index | Thread Index | Old Index