Source-Changes-HG archive

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

[src/trunk]: src/sys adjust the spinlock macros in the non-MULTIPROCESSOR, no...



details:   https://anonhg.NetBSD.org/src/rev/242499010223
branches:  trunk
changeset: 499581:242499010223
user:      chs <chs%NetBSD.org@localhost>
date:      Fri Nov 24 03:59:07 2000 +0000

description:
adjust the spinlock macros in the non-MULTIPROCESSOR, non-LOCKDEBUG case
so that gcc will think that static spinlock are used.
this allows us to remove the ugly conditionalization of
static spinlock declarations.

diffstat:

 sys/arch/alpha/alpha/machdep.c |   9 +++------
 sys/arch/i386/i386/pmap.c      |  42 +++++++++++++++---------------------------
 sys/dev/pci/cy82c693.c         |   6 ++----
 sys/kern/tty_pty.c             |   5 +----
 sys/kern/vfs_subr.c            |   4 +---
 sys/sys/lock.h                 |  16 ++++++++++------
 6 files changed, 32 insertions(+), 50 deletions(-)

diffs (234 lines):

diff -r b39e600a708c -r 242499010223 sys/arch/alpha/alpha/machdep.c
--- a/sys/arch/alpha/alpha/machdep.c    Fri Nov 24 03:43:20 2000 +0000
+++ b/sys/arch/alpha/alpha/machdep.c    Fri Nov 24 03:59:07 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: machdep.c,v 1.226 2000/11/24 02:21:56 simonb Exp $ */
+/* $NetBSD: machdep.c,v 1.227 2000/11/24 03:59:07 chs Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.226 2000/11/24 02:21:56 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.227 2000/11/24 03:59:07 chs Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1932,10 +1932,7 @@
        register struct timeval *tvp;
 {
        static struct timeval lasttime;
-#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
-       static struct simplelock microtime_slock =
-           SIMPLELOCK_INITIALIZER;
-#endif
+       static struct simplelock microtime_slock = SIMPLELOCK_INITIALIZER;
        int s;
 
        s = splclock();
diff -r b39e600a708c -r 242499010223 sys/arch/i386/i386/pmap.c
--- a/sys/arch/i386/i386/pmap.c Fri Nov 24 03:43:20 2000 +0000
+++ b/sys/arch/i386/i386/pmap.c Fri Nov 24 03:59:07 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap.c,v 1.110 2000/11/14 22:55:06 thorpej Exp $       */
+/*     $NetBSD: pmap.c,v 1.111 2000/11/24 03:59:08 chs Exp $   */
 
 /*
  *
@@ -61,8 +61,6 @@
 
 #include "opt_cputype.h"
 #include "opt_user_ldt.h"
-#include "opt_lockdebug.h"
-#include "opt_multiprocessor.h"
 #include "opt_largepages.h"
 
 #include <sys/param.h>
@@ -253,33 +251,22 @@
  * locking data structures
  */
 
-#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
-struct lock pmap_main_lock;
-simple_lock_data_t pvalloc_lock;
-simple_lock_data_t pmaps_lock;
-simple_lock_data_t pmap_copy_page_lock;
-simple_lock_data_t pmap_zero_page_lock;
-simple_lock_data_t pmap_tmpptp_lock;
+static struct lock pmap_main_lock;
+static simple_lock_data_t pvalloc_lock;
+static simple_lock_data_t pmaps_lock;
+static simple_lock_data_t pmap_copy_page_lock;
+static simple_lock_data_t pmap_zero_page_lock;
+static simple_lock_data_t pmap_tmpptp_lock;
 
 #define PMAP_MAP_TO_HEAD_LOCK() \
-     spinlockmgr(&pmap_main_lock, LK_SHARED, (void *) 0)
+     (void) spinlockmgr(&pmap_main_lock, LK_SHARED, NULL)
 #define PMAP_MAP_TO_HEAD_UNLOCK() \
-     spinlockmgr(&pmap_main_lock, LK_RELEASE, (void *) 0)
+     (void) spinlockmgr(&pmap_main_lock, LK_RELEASE, NULL)
 
 #define PMAP_HEAD_TO_MAP_LOCK() \
-     spinlockmgr(&pmap_main_lock, LK_EXCLUSIVE, (void *) 0)
+     (void) spinlockmgr(&pmap_main_lock, LK_EXCLUSIVE, NULL)
 #define PMAP_HEAD_TO_MAP_UNLOCK() \
-     spinlockmgr(&pmap_main_lock, LK_RELEASE, (void *) 0)
-
-#else
-
-#define PMAP_MAP_TO_HEAD_LOCK()                /* null */
-#define PMAP_MAP_TO_HEAD_UNLOCK()      /* null */
-
-#define PMAP_HEAD_TO_MAP_LOCK()                /* null */
-#define PMAP_HEAD_TO_MAP_UNLOCK()      /* null */
-
-#endif
+     (void) spinlockmgr(&pmap_main_lock, LK_RELEASE, NULL)
 
 /*
  * global data structures
@@ -914,14 +901,12 @@
         * init the static-global locks and global lists.
         */
 
-#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
        spinlockinit(&pmap_main_lock, "pmaplk", 0);
        simple_lock_init(&pvalloc_lock);
        simple_lock_init(&pmaps_lock);
        simple_lock_init(&pmap_copy_page_lock);
        simple_lock_init(&pmap_zero_page_lock);
        simple_lock_init(&pmap_tmpptp_lock);
-#endif
        LIST_INIT(&pmaps);
        TAILQ_INIT(&pv_freepages);
        TAILQ_INIT(&pv_unusedpgs);
@@ -2616,6 +2601,9 @@
                ptes = pmap_map_ptes(pve->pv_pmap);             /* locks pmap */
 
 #ifdef DIAGNOSTIC
+               if (pve->pv_va >= uvm.pager_sva && pve->pv_va < uvm.pager_eva) {
+                       printf("pmap_page_remove: found pager VA on pv_list\n");
+               }
                if (pve->pv_ptp && (pve->pv_pmap->pm_pdir[pdei(pve->pv_va)] &
                                    PG_FRAME)
                    != VM_PAGE_TO_PHYS(pve->pv_ptp)) {
@@ -2989,7 +2977,7 @@
 
 #ifdef DIAGNOSTIC
                if (!pmap_valid_entry(ptes[i386_btop(va)]))
-                       panic("pmap_unwire: invalid (unmapped) va");
+                       panic("pmap_unwire: invalid (unmapped) va 0x%lx", va);
 #endif
                if ((ptes[i386_btop(va)] & PG_W) != 0) {
                        ptes[i386_btop(va)] &= ~PG_W;
diff -r b39e600a708c -r 242499010223 sys/dev/pci/cy82c693.c
--- a/sys/dev/pci/cy82c693.c    Fri Nov 24 03:43:20 2000 +0000
+++ b/sys/dev/pci/cy82c693.c    Fri Nov 24 03:59:07 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cy82c693.c,v 1.1 2000/06/06 03:07:39 thorpej Exp $ */
+/* $NetBSD: cy82c693.c,v 1.2 2000/11/24 03:59:08 chs Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -43,7 +43,7 @@
 
 #include <sys/cdefs.h>                 /* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: cy82c693.c,v 1.1 2000/06/06 03:07:39 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cy82c693.c,v 1.2 2000/11/24 03:59:08 chs Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_lockdebug.h"
@@ -64,9 +64,7 @@
 static struct cy82c693_handle cyhc_handle;
 static int cyhc_initialized;
 
-#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
 static struct simplelock cyhc_slock = SIMPLELOCK_INITIALIZER;
-#endif
 
 #define        CYHC_LOCK(s)                                                    \
 do {                                                                   \
diff -r b39e600a708c -r 242499010223 sys/kern/tty_pty.c
--- a/sys/kern/tty_pty.c        Fri Nov 24 03:43:20 2000 +0000
+++ b/sys/kern/tty_pty.c        Fri Nov 24 03:59:07 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty_pty.c,v 1.54 2000/11/21 03:53:27 enami Exp $       */
+/*     $NetBSD: tty_pty.c,v 1.55 2000/11/24 03:59:08 chs Exp $ */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -82,10 +82,7 @@
 static struct pt_softc **pt_softc = NULL;      /* pty array */
 static int npty = 0;                   /* for pstat -t */
 static int maxptys = DEFAULT_MAXPTYS;  /* maximum number of ptys (sysctable) */
-
-#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
 static struct simplelock pt_softc_mutex = SIMPLELOCK_INITIALIZER;
-#endif
 
 #define        PF_PKT          0x08            /* packet mode */
 #define        PF_STOPPED      0x10            /* user told stopped */
diff -r b39e600a708c -r 242499010223 sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Fri Nov 24 03:43:20 2000 +0000
+++ b/sys/kern/vfs_subr.c       Fri Nov 24 03:59:07 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.140 2000/09/19 22:00:58 fvdl Exp $      */
+/*     $NetBSD: vfs_subr.c,v 1.141 2000/11/24 03:59:09 chs Exp $       */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -148,9 +148,7 @@
 struct nfs_public nfs_pub;                     /* publicly exported FS */
 
 struct simplelock mountlist_slock = SIMPLELOCK_INITIALIZER;
-#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
 static struct simplelock mntid_slock = SIMPLELOCK_INITIALIZER;
-#endif
 struct simplelock mntvnode_slock = SIMPLELOCK_INITIALIZER;
 struct simplelock vnode_free_list_slock = SIMPLELOCK_INITIALIZER;
 struct simplelock spechash_slock = SIMPLELOCK_INITIALIZER;
diff -r b39e600a708c -r 242499010223 sys/sys/lock.h
--- a/sys/sys/lock.h    Fri Nov 24 03:43:20 2000 +0000
+++ b/sys/sys/lock.h    Fri Nov 24 03:59:07 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lock.h,v 1.40 2000/11/22 06:31:22 thorpej Exp $        */
+/*     $NetBSD: lock.h,v 1.41 2000/11/24 03:59:09 chs Exp $    */
 
 /*-
  * Copyright (c) 1999, 2000 The NetBSD Foundation, Inc.
@@ -296,11 +296,15 @@
 void   spinlock_switchcheck(void);
 #endif
 
+#if defined(MULTIPROCESSOR) || defined(LOCKDEBUG)
 #define        spinlockinit(lkp, name, flags)                                  \
        lockinit((lkp), 0, (name), 0, (flags) | LK_SPIN)
-
 #define        spinlockmgr(lkp, flags, intrlk)                                 \
        lockmgr((lkp), (flags) | LK_SPIN, (intrlk))
+#else
+#define        spinlockinit(lkp, name, flags)          (void)(lkp)
+#define        spinlockmgr(lkp, flags, intrlk)         (0)
+#endif
 
 #if defined(LOCKDEBUG)
 int    _spinlock_release_all(__volatile struct lock *, const char *, int);
@@ -340,10 +344,10 @@
 #define        LOCK_ASSERT(x)          /* nothing */
 #else
 #define        simple_lock_init(alp)   (alp)->lock_data = __SIMPLELOCK_UNLOCKED
-#define        simple_lock(alp)                /* nothing */
-#define        simple_lock_try(alp)    (1)     /* always succeeds */
-#define        simple_unlock(alp)              /* nothing */
-#define        LOCK_ASSERT(x)                  /* nothing */
+#define        simple_lock(alp)        (void)(alp)
+#define        simple_lock_try(alp)    (1)
+#define        simple_unlock(alp)      (void)(alp)
+#define        LOCK_ASSERT(x)          /* nothing */
 #endif
 
 #endif /* _KERNEL */



Home | Main Index | Thread Index | Old Index