diff options
author | alc <alc@FreeBSD.org> | 1999-06-30 03:39:29 +0000 |
---|---|---|
committer | alc <alc@FreeBSD.org> | 1999-06-30 03:39:29 +0000 |
commit | fb44239c8b962072cf10138d0c32baa69c180e32 (patch) | |
tree | 1f9257af61cabbf097d58bf905c80272095b4f30 /sys | |
parent | 0154a689b36d47b7e5a8521af5492d8e892d94f9 (diff) | |
download | FreeBSD-src-fb44239c8b962072cf10138d0c32baa69c180e32.zip FreeBSD-src-fb44239c8b962072cf10138d0c32baa69c180e32.tar.gz |
An SMP-specific change: Remove unnecessary lock acquires and releases
surrounding critical sections that consist of (1) a single read or
(2) a single locked RMW operation.
(Thanks to thomma@slip.net (Tamiji Homma) for helping to test
these changes.)
Diffstat (limited to 'sys')
-rw-r--r-- | sys/i386/isa/ipl_funcs.c | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/sys/i386/isa/ipl_funcs.c b/sys/i386/isa/ipl_funcs.c index 359ef51..602ce01 100644 --- a/sys/i386/isa/ipl_funcs.c +++ b/sys/i386/isa/ipl_funcs.c @@ -23,7 +23,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ipl_funcs.c,v 1.19 1999/05/09 23:29:56 peter Exp $ + * $Id: ipl_funcs.c,v 1.20 1999/05/09 23:40:29 peter Exp $ */ #include <sys/types.h> @@ -35,28 +35,26 @@ /* * The volatile bitmap variables must be set atomically. This normally * involves using a machine-dependent bit-set or `or' instruction. + * + * Note: setbits uses a locked or, making simple cases MP safe. */ -#ifndef SMP - #define DO_SETBITS(name, var, bits) \ void name(void) \ { \ setbits(var, bits); \ } +#ifndef SMP +DO_SETBITS(setdelayed, &ipending, loadandclear(&idelayed)) #else /* !SMP */ - -#define DO_SETBITS(name, var, bits) \ -void name(void) \ -{ \ - IFCPL_LOCK(); \ - setbits(var, bits); \ - IFCPL_UNLOCK(); \ +void setdelayed(void) +{ + IFCPL_LOCK(); + setbits(&ipending, loadandclear(&idelayed)); + IFCPL_UNLOCK(); } - #endif /* !SMP */ -DO_SETBITS(setdelayed, &ipending, loadandclear(&idelayed)) DO_SETBITS(setsoftast, &ipending, SWI_AST_PENDING) DO_SETBITS(setsoftcamnet,&ipending, SWI_CAMNET_PENDING) DO_SETBITS(setsoftcambio,&ipending, SWI_CAMBIO_PENDING) @@ -71,14 +69,14 @@ DO_SETBITS(schedsoftnet, &idelayed, SWI_NET_PENDING) DO_SETBITS(schedsofttty, &idelayed, SWI_TTY_PENDING) DO_SETBITS(schedsoftvm, &idelayed, SWI_VM_PENDING) -#ifndef SMP - unsigned softclockpending(void) { return (ipending & SWI_CLOCK_PENDING); } +#ifndef SMP + #define GENSPL(name, set_cpl) \ unsigned name(void) \ { \ @@ -144,19 +142,6 @@ splq(intrmask_t mask) #endif /* SPL_DEBUG_POSTCODE */ -unsigned -softclockpending(void) -{ - unsigned x; - - IFCPL_LOCK(); - x = ipending & SWI_CLOCK_PENDING; - IFCPL_UNLOCK(); - - return (x); -} - - /* * This version has to check for bsp_apic_ready, * as calling simple_lock() (ie ss_lock) before then deadlocks the system. |