From owner-freebsd-smp Sun Jun 27 21:22:38 1999 Delivered-To: freebsd-smp@freebsd.org Received: from cs.rice.edu (cs.rice.edu [128.42.1.30]) by hub.freebsd.org (Postfix) with ESMTP id B4C49152DE for ; Sun, 27 Jun 1999 21:22:34 -0700 (PDT) (envelope-from alc@cs.rice.edu) Received: (from alc@localhost) by cs.rice.edu (8.9.0/8.9.0) id XAA18408 for smp@freebsd.org; Sun, 27 Jun 1999 23:22:33 -0500 (CDT) Date: Sun, 27 Jun 1999 23:22:33 -0500 From: Alan Cox To: smp@freebsd.org Subject: try this... Message-ID: <19990627232233.K2738@cs.rice.edu> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="J2SCkAp4GZ/dPZZf" X-Mailer: Mutt 0.95.5us Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --J2SCkAp4GZ/dPZZf Content-Type: text/plain; charset=us-ascii This patch eliminates pointless lock acquires/releases from critical sections in the ipl code that consist of single atomic read-modify-write instruction. When I hear a few positive reports, I'll commit this patch. Alan --J2SCkAp4GZ/dPZZf Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="ipl_funcs.c.patch" Index: i386/isa/ipl_funcs.c =================================================================== RCS file: /home/ncvs/src/sys/i386/isa/ipl_funcs.c,v retrieving revision 1.20 diff -c -r1.20 ipl_funcs.c *** ipl_funcs.c 1999/05/09 23:40:29 1.20 --- ipl_funcs.c 1999/06/27 18:30:02 *************** *** 35,62 **** /* * The volatile bitmap variables must be set atomically. This normally * involves using a machine-dependent bit-set or `or' instruction. */ - #ifndef SMP - #define DO_SETBITS(name, var, bits) \ void name(void) \ { \ setbits(var, bits); \ } #else /* !SMP */ ! ! #define DO_SETBITS(name, var, bits) \ ! void name(void) \ ! { \ ! IFCPL_LOCK(); \ ! setbits(var, bits); \ ! 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) --- 35,60 ---- /* * The volatile bitmap variables must be set atomically. This normally * involves using a machine-dependent bit-set or `or' instruction. + * + * If setbits is atomic, this is MP-safe. */ #define DO_SETBITS(name, var, bits) \ void name(void) \ { \ setbits(var, bits); \ } + #ifndef SMP + DO_SETBITS(setdelayed, &ipending, loadandclear(&idelayed)) #else /* !SMP */ ! void setdelayed(void) ! { ! IFCPL_LOCK(); ! setbits(&ipending, loadandclear(&idelayed)); ! IFCPL_UNLOCK(); } #endif /* !SMP */ DO_SETBITS(setsoftast, &ipending, SWI_AST_PENDING) DO_SETBITS(setsoftcamnet,&ipending, SWI_CAMNET_PENDING) DO_SETBITS(setsoftcambio,&ipending, SWI_CAMBIO_PENDING) *************** *** 71,84 **** DO_SETBITS(schedsofttty, &idelayed, SWI_TTY_PENDING) DO_SETBITS(schedsoftvm, &idelayed, SWI_VM_PENDING) - #ifndef SMP - unsigned softclockpending(void) { return (ipending & SWI_CLOCK_PENDING); } #define GENSPL(name, set_cpl) \ unsigned name(void) \ { \ --- 69,82 ---- DO_SETBITS(schedsofttty, &idelayed, SWI_TTY_PENDING) DO_SETBITS(schedsoftvm, &idelayed, SWI_VM_PENDING) unsigned softclockpending(void) { return (ipending & SWI_CLOCK_PENDING); } + #ifndef SMP + #define GENSPL(name, set_cpl) \ unsigned name(void) \ { \ *************** *** 142,160 **** #define POSTCODE_LO(X) #define POSTCODE_HI(X) #endif /* SPL_DEBUG_POSTCODE */ - - - unsigned - softclockpending(void) - { - unsigned x; - - IFCPL_LOCK(); - x = ipending & SWI_CLOCK_PENDING; - IFCPL_UNLOCK(); - - return (x); - } /* --- 140,145 ---- --J2SCkAp4GZ/dPZZf-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message