Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/sparc nmi_hard: convert nmi_hard_wait to use ...



details:   https://anonhg.NetBSD.org/src/rev/3b20d3678109
branches:  trunk
changeset: 765262:3b20d3678109
user:      rmind <rmind%NetBSD.org@localhost>
date:      Mon May 23 18:40:30 2011 +0000

description:
nmi_hard: convert nmi_hard_wait to use atomics.

OK mrg@

diffstat:

 sys/arch/sparc/sparc/intr.c |  17 ++++++-----------
 1 files changed, 6 insertions(+), 11 deletions(-)

diffs (60 lines):

diff -r fe5c2d319b0a -r 3b20d3678109 sys/arch/sparc/sparc/intr.c
--- a/sys/arch/sparc/sparc/intr.c       Mon May 23 18:38:51 2011 +0000
+++ b/sys/arch/sparc/sparc/intr.c       Mon May 23 18:40:30 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intr.c,v 1.114 2011/02/15 10:59:25 mrg Exp $ */
+/*     $NetBSD: intr.c,v 1.115 2011/05/23 18:40:30 rmind Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.114 2011/02/15 10:59:25 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.115 2011/05/23 18:40:30 rmind Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_sparc_arch.h"
@@ -52,7 +52,7 @@
 #include <sys/malloc.h>
 #include <sys/cpu.h>
 #include <sys/intr.h>
-#include <sys/simplelock.h>
+#include <sys/atomic.h>
 
 #include <uvm/uvm_extern.h>
 
@@ -187,9 +187,8 @@
 int    (*moduleerr_handler)(void);
 
 #if defined(MULTIPROCESSOR)
-volatile int nmi_hard_wait = 0;
-struct simplelock nmihard_lock = SIMPLELOCK_INITIALIZER;
-int drop_into_rom_on_fatal = 1;
+static volatile u_int  nmi_hard_wait = 0;
+int                    drop_into_rom_on_fatal = 1;
 #endif
 
 void
@@ -221,9 +220,7 @@
         * variable is non-zero.  If we are the master, loop while this
         * variable is less than the number of cpus.
         */
-       simple_lock(&nmihard_lock);
-       nmi_hard_wait++;
-       simple_unlock(&nmihard_lock);
+       atomic_inc_uint(&nmi_hard_wait);
 
        if (cpuinfo.master == 0) {
                while (nmi_hard_wait)
@@ -275,9 +272,7 @@
        /*
         * Tell everyone else we've finished dealing with the hard NMI.
         */
-       simple_lock(&nmihard_lock);
        nmi_hard_wait = 0;
-       simple_unlock(&nmihard_lock);
        if (fatal && drop_into_rom_on_fatal) {
                prom_abort();
                return;



Home | Main Index | Thread Index | Old Index