Source-Changes-HG archive

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

[src/chs-ubc2]: src/sys Update from trunk.



details:   https://anonhg.NetBSD.org/src/rev/1ebfb36342f3
branches:  chs-ubc2
changeset: 471444:1ebfb36342f3
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Aug 02 22:55:59 1999 +0000

description:
Update from trunk.

diffstat:

 sys/sys/file.h                 |    5 +-
 sys/sys/kthread.h              |    6 +-
 sys/sys/lock.h                 |  227 ++++++++++++++++++--------
 sys/sys/mman.h                 |    3 +-
 sys/sys/mount.h                |    5 +-
 sys/sys/namei.h                |   29 +-
 sys/sys/param.h                |    5 +-
 sys/sys/proc.h                 |   26 ++-
 sys/sys/socket.h               |   10 +-
 sys/sys/vnode.h                |   29 ++-
 sys/ufs/ext2fs/ext2fs_vfsops.c |    8 +-
 sys/ufs/ext2fs/ext2fs_vnops.c  |    7 +-
 sys/ufs/ffs/ffs_vfsops.c       |    8 +-
 sys/ufs/lfs/lfs_alloc.c        |    3 +-
 sys/ufs/lfs/lfs_segment.c      |    4 +-
 sys/ufs/lfs/lfs_syscalls.c     |   10 +-
 sys/ufs/lfs/lfs_vfsops.c       |    7 +-
 sys/ufs/mfs/Makefile           |    4 +-
 sys/ufs/mfs/mfs_vfsops.c       |    7 +-
 sys/ufs/mfs/mfs_vnops.c        |    3 +-
 sys/ufs/mfs/mfsiom.h           |   39 ----
 sys/ufs/ufs/dinode.h           |    6 +-
 sys/ufs/ufs/inode.h            |    3 +-
 sys/ufs/ufs/ufs_extern.h       |    8 +-
 sys/ufs/ufs/ufs_ihash.c        |    4 +-
 sys/ufs/ufs/ufs_lookup.c       |   45 ++++-
 sys/ufs/ufs/ufs_vnops.c        |   58 +------
 sys/uvm/uvm.h                  |   12 +-
 sys/uvm/uvm_amap.c             |   37 ++-
 sys/uvm/uvm_amap.h             |    6 +-
 sys/uvm/uvm_amap_i.h           |   22 +-
 sys/uvm/uvm_aobj.c             |  207 +++++++++++++++++++++++-
 sys/uvm/uvm_extern.h           |   13 +-
 sys/uvm/uvm_fault.c            |   22 +-
 sys/uvm/uvm_glue.c             |   36 +++-
 sys/uvm/uvm_km.c               |  242 +----------------------------
 sys/uvm/uvm_map.c              |  343 +++++++++++++++++++++++++++-------------
 sys/uvm/uvm_meter.c            |    6 +-
 sys/uvm/uvm_mmap.c             |  116 +++++++++++--
 sys/uvm/uvm_pager_i.h          |    5 +-
 sys/vm/pmap.h                  |    4 +-
 sys/vm/vm_extern.h             |   14 +-
 sys/vm/vm_map.h                |   11 +-
 sys/vm/vm_page.h               |    4 +-
 44 files changed, 957 insertions(+), 712 deletions(-)

diffs (truncated from 3030 to 300 lines):

diff -r 1161823de8a6 -r 1ebfb36342f3 sys/sys/file.h
--- a/sys/sys/file.h    Mon Aug 02 22:40:26 1999 +0000
+++ b/sys/sys/file.h    Mon Aug 02 22:55:59 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: file.h,v 1.18.8.1 1999/06/21 01:30:17 thorpej Exp $    */
+/*     $NetBSD: file.h,v 1.18.8.2 1999/08/02 22:55:59 thorpej Exp $    */
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -54,12 +54,13 @@
  */
 struct file {
        LIST_ENTRY(file) f_list;/* list of active files */
-       short   f_flag;         /* see fcntl.h */
+       int     f_flag;         /* see fcntl.h */
 #define        DTYPE_VNODE     1       /* file */
 #define        DTYPE_SOCKET    2       /* communications endpoint */
        short   f_type;         /* descriptor type */
        short   f_count;        /* reference count */
        short   f_msgcount;     /* references from message queue */
+       short   f_pad0;         /* spare */
        struct  ucred *f_cred;  /* credentials associated with descriptor */
        struct  fileops {
                int     (*fo_read)      __P((struct file *fp, off_t *offset,
diff -r 1161823de8a6 -r 1ebfb36342f3 sys/sys/kthread.h
--- a/sys/sys/kthread.h Mon Aug 02 22:40:26 1999 +0000
+++ b/sys/sys/kthread.h Mon Aug 02 22:55:59 1999 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kthread.h,v 1.2 1998/11/14 00:08:49 thorpej Exp $      */
+/*     $NetBSD: kthread.h,v 1.2.6.1 1999/08/02 22:55:59 thorpej Exp $  */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -47,10 +47,10 @@
 #ifdef _KERNEL
 #include <sys/proc.h>  /* struct proc, tsleep(), wakeup() */
 
-int    kthread_create __P((void (*)(void *), void *, struct proc **,
+int    kthread_create1 __P((void (*)(void *), void *, struct proc **,
            const char *, ...))
            __attribute__((__format__(__printf__,4,5)));
-void   kthread_create_deferred __P((void (*)(void *), void *));
+void   kthread_create __P((void (*)(void *), void *));
 void   kthread_run_deferred_queue __P((void));
 void   kthread_exit __P((int)) __attribute__((__noreturn__));
 #endif /* _KERNEL */
diff -r 1161823de8a6 -r 1ebfb36342f3 sys/sys/lock.h
--- a/sys/sys/lock.h    Mon Aug 02 22:40:26 1999 +0000
+++ b/sys/sys/lock.h    Mon Aug 02 22:55:59 1999 +0000
@@ -1,4 +1,44 @@
-/*     $NetBSD: lock.h,v 1.17.2.1.2.1 1999/06/07 04:25:33 chs Exp $    */
+/*     $NetBSD: lock.h,v 1.17.2.1.2.2 1999/08/02 22:55:59 thorpej Exp $        */
+
+/*-
+ * Copyright (c) 1999 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
+ * NASA Ames Research Center.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Ross Harvey.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the NetBSD
+ *     Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
 
 /* 
  * Copyright (c) 1995
@@ -50,30 +90,37 @@
 #include <sys/queue.h>
 
 /*
- * Placeholder for simple lock structure until spinlocks are
- * really used an machine-dependently defined.
+ * The simple lock.  Provides a simple spinning mutex.  Note the
+ * member which is used in atomic operations must be aligned in
+ * order for it to work on the widest range of processor types.
  */
 struct simplelock {
-       int lock_data;
+       int lock_data __attribute__((__aligned__));
 #ifdef LOCKDEBUG
        const char *lock_file;
        int lock_line;
        const char *unlock_file;
        int unlock_line;
-       LIST_ENTRY(simplelock) list;
+       TAILQ_ENTRY(simplelock) list;
        unsigned long lock_holder;              /* CPU ID */
 #endif
 };
 
-#ifdef LOCKDEBUG
-#define        SIMPLELOCK_INITIALIZER  { 0, NULL, 0, NULL, 0, { NULL, NULL }, 0 }
-#else
-#define        SIMPLELOCK_INITIALIZER  { 0 }
+/*
+ * Machine-dependent code may #undef and override these.
+ */
+#define        SIMPLELOCK_LOCKED       1
+#define        SIMPLELOCK_UNLOCKED     0
+
+#if defined(MULTIPROCESSOR)
+#include <machine/lock.h>
 #endif
 
 #ifdef LOCKDEBUG
-#define SLOCK_UNLOCKED 0
-#define SLOCK_LOCKED   1
+#define        SIMPLELOCK_INITIALIZER  { SIMPLELOCK_UNLOCKED, NULL, 0, NULL, 0, \
+                                 { NULL, NULL }, 0 }
+#else
+#define        SIMPLELOCK_INITIALIZER  { SIMPLELOCK_UNLOCKED }
 #endif
 
 /* XXXCDC: kill typedefs later? */
@@ -84,21 +131,53 @@
 
 /*
  * The general lock structure.  Provides for multiple shared locks,
- * upgrading from shared to exclusive, and sleeping until the lock
- * can be gained. The simple locks are defined in <machine/param.h>.
+ * upgrading from shared to exclusive, and sleeping/spinning until the
+ * lock can be gained.
  */
 struct lock {
        struct  simplelock lk_interlock; /* lock on remaining fields */
        u_int   lk_flags;               /* see below */
        int     lk_sharecount;          /* # of accepted shared locks */
-       int     lk_waitcount;           /* # of processes sleeping for lock */
        short   lk_exclusivecount;      /* # of recursive exclusive locks */
-       short   lk_prio;                /* priority at which to sleep */
-       const char *lk_wmesg;           /* resource sleeping (for tsleep) */
-       int     lk_timo;                /* maximum sleep time (for tsleep) */
-       pid_t   lk_lockholder;          /* pid of exclusive lock holder */
        short   lk_recurselevel;        /* lvl above which recursion ok */
+       int     lk_waitcount;           /* # of sleepers/spinners */
+
+       /*
+        * This is the sleep message for sleep locks, and a simple name
+        * for spin locks.
+        */
+       const char *lk_wmesg;
+
+       union {
+               struct {
+                       /* pid of exclusive lock holder */
+                       pid_t lk_sleep_lockholder;
+
+                       /* priority at which to sleep */
+                       int lk_sleep_prio;
+
+                       /* maximum sleep time (for tsleep) */
+                       int lk_sleep_timo;
+               } lk_un_sleep;
+               struct {
+                       /* CPU ID of exclusive lock holder */
+                       u_long lk_spin_cpu;
+#if defined(LOCKDEBUG)
+                       TAILQ_ENTRY(lock) lk_spin_list;
+#endif
+               } lk_un_spin;
+       } lk_un;
+
+#define        lk_lockholder   lk_un.lk_un_sleep.lk_sleep_lockholder
+#define        lk_prio         lk_un.lk_un_sleep.lk_sleep_prio
+#define        lk_timo         lk_un.lk_un_sleep.lk_sleep_timo
+
+#define        lk_cpu          lk_un.lk_un_spin.lk_spin_cpu
+#if defined(LOCKDEBUG)
+#define        lk_list         lk_un.lk_un_spin.lk_spin_list
+#endif
 };
+
 /*
  * Lock request types:
  *   LK_SHARED - get one of many possible shared locks. If a process
@@ -132,14 +211,14 @@
  *
  * These are flags that are passed to the lockmgr routine.
  */
-#define LK_TYPE_MASK   0x0000000f      /* type of lock sought */
-#define LK_SHARED      0x00000001      /* shared lock */
-#define LK_EXCLUSIVE   0x00000002      /* exclusive lock */
-#define LK_UPGRADE     0x00000003      /* shared-to-exclusive upgrade */
-#define LK_EXCLUPGRADE 0x00000004      /* first shared-to-exclusive upgrade */
-#define LK_DOWNGRADE   0x00000005      /* exclusive-to-shared downgrade */
-#define LK_RELEASE     0x00000006      /* release any type of lock */
-#define LK_DRAIN       0x00000007      /* wait for all lock activity to end */
+#define        LK_TYPE_MASK    0x0000000f      /* type of lock sought */
+#define        LK_SHARED       0x00000001      /* shared lock */
+#define        LK_EXCLUSIVE    0x00000002      /* exclusive lock */
+#define        LK_UPGRADE      0x00000003      /* shared-to-exclusive upgrade */
+#define        LK_EXCLUPGRADE  0x00000004      /* first shared-to-exclusive upgrade */
+#define        LK_DOWNGRADE    0x00000005      /* exclusive-to-shared downgrade */
+#define        LK_RELEASE      0x00000006      /* release any type of lock */
+#define        LK_DRAIN        0x00000007      /* wait for all lock activity to end */
 /*
  * External lock flags.
  *
@@ -147,32 +226,33 @@
  * or passed in as arguments to the lock manager. The LK_REENABLE flag may be
  * set only at the release of a lock obtained by drain.
  */
-#define LK_EXTFLG_MASK 0x00300070      /* mask of external flags */
-#define LK_NOWAIT      0x00000010      /* do not sleep to await lock */
-#define LK_SLEEPFAIL   0x00000020      /* sleep, then return failure */
-#define LK_CANRECURSE  0x00000040      /* this may be recursive lock attempt */
-#define LK_REENABLE    0x00000080      /* lock is be reenabled after drain */
-#define LK_SETRECURSE  0x00100000      /* other locks while we have it OK */
-#define LK_RECURSEFAIL  0x00200000     /* attempt at recursive lock fails */
+#define        LK_EXTFLG_MASK  0x00700070      /* mask of external flags */
+#define        LK_NOWAIT       0x00000010      /* do not sleep to await lock */
+#define        LK_SLEEPFAIL    0x00000020      /* sleep, then return failure */
+#define        LK_CANRECURSE   0x00000040      /* this may be recursive lock attempt */
+#define        LK_REENABLE     0x00000080      /* lock is be reenabled after drain */
+#define        LK_SETRECURSE   0x00100000      /* other locks while we have it OK */
+#define        LK_RECURSEFAIL  0x00200000      /* attempt at recursive lock fails */
+#define        LK_SPIN         0x00400000      /* lock spins instead of sleeps */
 /*
  * Internal lock flags.
  *
  * These flags are used internally to the lock manager.
  */
-#define LK_WANT_UPGRADE        0x00000100      /* waiting for share-to-excl upgrade */
-#define LK_WANT_EXCL   0x00000200      /* exclusive lock sought */
-#define LK_HAVE_EXCL   0x00000400      /* exclusive lock obtained */
-#define LK_WAITDRAIN   0x00000800      /* process waiting for lock to drain */
-#define LK_DRAINING    0x00004000      /* lock is being drained */
-#define LK_DRAINED     0x00008000      /* lock has been decommissioned */
+#define        LK_WANT_UPGRADE 0x00000100      /* waiting for share-to-excl upgrade */
+#define        LK_WANT_EXCL    0x00000200      /* exclusive lock sought */
+#define        LK_HAVE_EXCL    0x00000400      /* exclusive lock obtained */
+#define        LK_WAITDRAIN    0x00000800      /* process waiting for lock to drain */
+#define        LK_DRAINING     0x00004000      /* lock is being drained */
+#define        LK_DRAINED      0x00008000      /* lock has been decommissioned */
 /*
  * Control flags
  *
  * Non-persistent external flags.
  */
-#define LK_INTERLOCK   0x00010000      /* unlock passed simple lock after
+#define        LK_INTERLOCK    0x00010000      /* unlock passed simple lock after
                                           getting lk_interlock */
-#define LK_RETRY       0x00020000      /* vn_lock: retry until locked */
+#define        LK_RETRY        0x00020000      /* vn_lock: retry until locked */
 
 /*
  * Lock return status.
@@ -192,10 +272,11 @@
  */
 
 /*
- * Indicator that no process holds exclusive lock
+ * Indicator that no process/cpu holds exclusive lock
  */
-#define LK_KERNPROC ((pid_t) -2)
-#define LK_NOPROC ((pid_t) -1)
+#define        LK_KERNPROC     ((pid_t) -2)
+#define        LK_NOPROC       ((pid_t) -1)
+#define        LK_NOCPU        ((u_long) -1)
 
 struct proc;
 
@@ -204,37 +285,37 @@
 int    lockmgr __P((__volatile struct lock *, u_int flags,
                        struct simplelock *));
 int    lockstatus __P((struct lock *));
-void   lockmgr_printinfo __P((struct lock *));
+void   lockmgr_printinfo __P((__volatile struct lock *));
+
+#define        spinlockinit(lkp, name, flags)                                  \
+       lockinit((lkp), 0, (name), 0, (flags) | LK_SPIN)



Home | Main Index | Thread Index | Old Index