Module Name: src
Committed By: rmind
Date: Mon May 23 18:40:30 UTC 2011
Modified Files:
src/sys/arch/sparc/sparc: intr.c
Log Message:
nmi_hard: convert nmi_hard_wait to use atomics.
OK mrg@
To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/sparc/sparc/intr.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/sparc/sparc/intr.c
diff -u src/sys/arch/sparc/sparc/intr.c:1.114 src/sys/arch/sparc/sparc/intr.c:1.115
--- src/sys/arch/sparc/sparc/intr.c:1.114 Tue Feb 15 10:59:25 2011
+++ src/sys/arch/sparc/sparc/intr.c Mon May 23 18:40:30 2011
@@ -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;