From b701be7c869038ae880e038252a3c75d78f5986b Mon Sep 17 00:00:00 2001 From: thorpej Date: Tue, 10 Aug 1999 18:53:03 +0000 Subject: [PATCH] Use atomic operations to manipulate the SSIR, and fix a problem introduced with the spllowersoftclock() changes where more interrupts than necessary were blocked while software interrupts were being processed. --- sys/arch/alpha/alpha/machdep.c | 19 ++++++++----------- sys/arch/alpha/include/intr.h | 10 ++++++---- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/sys/arch/alpha/alpha/machdep.c b/sys/arch/alpha/alpha/machdep.c index 73f412362e22..0ac7333770c9 100644 --- a/sys/arch/alpha/alpha/machdep.c +++ b/sys/arch/alpha/alpha/machdep.c @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.177 1999/06/29 07:21:30 ross Exp $ */ +/* $NetBSD: machdep.c,v 1.178 1999/08/10 18:53:03 thorpej Exp $ */ /*- * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. @@ -80,7 +80,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.177 1999/06/29 07:21:30 ross Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.178 1999/08/10 18:53:03 thorpej Exp $"); #include #include @@ -1939,12 +1939,7 @@ do_sir() { u_int64_t n; - do { - (void)splhigh(); - n = ssir; - ssir = 0; - splsoft(); /* don't recurse through spl0() */ - + while ((n = alpha_atomic_loadlatch_q(&ssir, 0)) != 0) { #define COUNT_SOFT uvmexp.softs++ #define DO_SIR(bit, fn) \ @@ -1963,15 +1958,17 @@ do_sir() #undef COUNT_SOFT #undef DO_SIR - } while (ssir != 0); + } } int spl0() { - if (ssir) - do_sir(); /* it lowers the IPL itself */ + if (ssir) { + (void) alpha_pal_swpipl(ALPHA_PSL_IPL_SOFT); + do_sir(); + } return (alpha_pal_swpipl(ALPHA_PSL_IPL_0)); } diff --git a/sys/arch/alpha/include/intr.h b/sys/arch/alpha/include/intr.h index a15135dc154d..b95ba8903187 100644 --- a/sys/arch/alpha/include/intr.h +++ b/sys/arch/alpha/include/intr.h @@ -1,4 +1,4 @@ -/* $NetBSD: intr.h,v 1.20 1999/08/05 18:08:08 thorpej Exp $ */ +/* $NetBSD: intr.h,v 1.21 1999/08/10 18:53:03 thorpej Exp $ */ /* * Copyright (c) 1997 Christopher G. Demetriou. All rights reserved. @@ -87,9 +87,11 @@ extern u_int64_t ssir; #define SIR_CLOCK 0x2 #define SIR_SERIAL 0x4 -#define setsoftnet() ssir |= SIR_NET -#define setsoftclock() ssir |= SIR_CLOCK -#define setsoftserial() ssir |= SIR_SERIAL +#define setsoft(x) alpha_atomic_setbits_q(&ssir, (x)) + +#define setsoftnet() setsoft(SIR_NET) +#define setsoftclock() setsoft(SIR_CLOCK) +#define setsoftserial() setsoft(SIR_SERIAL) /* * Interprocessor interrupts. In order how we want them processed.