CVS commit: [ad-namecache] src/sys/sys
Module Name:src Committed By: ad Date: Sun Mar 22 14:23:27 UTC 2020 Modified Files: src/sys/sys [ad-namecache]: vnode_impl.h Log Message: Keeping the namecache lock next to the vnode lock has a repeatable detrimental effect. So shuffle some stuff around in vnode_impl to save a bit of space, and give the namecache locks their own cache line. To generate a diff of this commit: cvs rdiff -u -r1.19.2.5 -r1.19.2.6 src/sys/sys/vnode_impl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/vnode_impl.h diff -u src/sys/sys/vnode_impl.h:1.19.2.5 src/sys/sys/vnode_impl.h:1.19.2.6 --- src/sys/sys/vnode_impl.h:1.19.2.5 Fri Jan 24 16:05:23 2020 +++ src/sys/sys/vnode_impl.h Sun Mar 22 14:23:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vnode_impl.h,v 1.19.2.5 2020/01/24 16:05:23 ad Exp $ */ +/* $NetBSD: vnode_impl.h,v 1.19.2.6 2020/03/22 14:23:27 ad Exp $ */ /*- * Copyright (c) 2016, 2019, 2020 The NetBSD Foundation, Inc. @@ -76,6 +76,19 @@ struct vnode_impl { struct vcache_key vi_key; /* c vnode cache key */ /* + * vnode cache, LRU and syncer. This all changes with some + * regularity so keep it together. + */ + struct vnodelst *vi_lrulisthd; /* d current lru list head */ + TAILQ_ENTRY(vnode_impl) vi_lrulist; /* d lru list */ + int vi_synclist_slot; /* s synclist slot index */ + int vi_lrulisttm; /* i time of lru enqueue */ + TAILQ_ENTRY(vnode_impl) vi_synclist; /* s vnodes with dirty bufs */ + SLIST_ENTRY(vnode_impl) vi_hash; /* c vnode cache list */ + enum vnode_state vi_state; /* i current state */ + TAILQ_ENTRY(vnode_impl) vi_mntvnodes; /* m vnodes for mount point */ + + /* * Namecache. Give it a separate line so activity doesn't impinge * on the stable stuff. */ @@ -88,27 +101,14 @@ struct vnode_impl { uint32_t vi_nc_spare; /* - spare (padding) */ /* - * vnode cache, LRU and syncer. This all changes with some - * regularity so keep it together. - */ - struct vnodelst *vi_lrulisthd /* d current lru list head */ - __aligned(COHERENCY_UNIT); - TAILQ_ENTRY(vnode_impl) vi_lrulist; /* d lru list */ - int vi_synclist_slot; /* s synclist slot index */ - int vi_lrulisttm; /* i time of lru enqueue */ - TAILQ_ENTRY(vnode_impl) vi_synclist; /* s vnodes with dirty bufs */ - SLIST_ENTRY(vnode_impl) vi_hash; /* c vnode cache list */ - enum vnode_state vi_state; /* i current state */ - - /* * Locks and expensive to access items which can be expected to * generate a cache miss. */ krwlock_t vi_lock /* - lock for this vnode */ __aligned(COHERENCY_UNIT); - krwlock_t vi_nc_lock; /* - lock on node */ + krwlock_t vi_nc_lock /* - lock on node */ + __aligned(COHERENCY_UNIT); krwlock_t vi_nc_listlock; /* - lock on nn_list */ - TAILQ_ENTRY(vnode_impl) vi_mntvnodes; /* m vnodes for mount point */ }; typedef struct vnode_impl vnode_impl_t;
CVS commit: [ad-namecache] src/sys/sys
Module Name:src Committed By: ad Date: Sun Mar 22 14:23:27 UTC 2020 Modified Files: src/sys/sys [ad-namecache]: vnode_impl.h Log Message: Keeping the namecache lock next to the vnode lock has a repeatable detrimental effect. So shuffle some stuff around in vnode_impl to save a bit of space, and give the namecache locks their own cache line. To generate a diff of this commit: cvs rdiff -u -r1.19.2.5 -r1.19.2.6 src/sys/sys/vnode_impl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sun Mar 22 14:16:50 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: Resurrect the counter stuff from HEAD, which tries to deal with 32-bit counter rollover. Drive it by sysctl and/or callout every 5 minutes, since there's no garbage collection kthread any more. To generate a diff of this commit: cvs rdiff -u -r1.126.2.16 -r1.126.2.17 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sun Mar 22 14:16:50 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: Resurrect the counter stuff from HEAD, which tries to deal with 32-bit counter rollover. Drive it by sysctl and/or callout every 5 minutes, since there's no garbage collection kthread any more. To generate a diff of this commit: cvs rdiff -u -r1.126.2.16 -r1.126.2.17 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_cache.c diff -u src/sys/kern/vfs_cache.c:1.126.2.16 src/sys/kern/vfs_cache.c:1.126.2.17 --- src/sys/kern/vfs_cache.c:1.126.2.16 Sun Mar 22 01:58:22 2020 +++ src/sys/kern/vfs_cache.c Sun Mar 22 14:16:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.126.2.16 2020/03/22 01:58:22 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.126.2.17 2020/03/22 14:16:50 ad Exp $ */ /*- * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -153,9 +153,10 @@ * and the definition of "struct vnode" for the particulars. * * Per-CPU statistics, and LRU list totals are read unlocked, since - * an approximate value is OK. We maintain uintptr_t sized per-CPU - * counters and 64-bit global counters under the theory that uintptr_t - * sized counters are less likely to be hosed by nonatomic increment. + * an approximate value is OK. We maintain 32-bit sized per-CPU + * counters and 64-bit global counters under the theory that 32-bit + * sized counters are less likely to be hosed by nonatomic increment + * (on 32-bit platforms). * * The lock order is: * @@ -171,7 +172,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.16 2020/03/22 01:58:22 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.17 2020/03/22 14:16:50 ad Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT @@ -180,6 +181,8 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c, #endif #include +#include +#include #include #include #include @@ -199,15 +202,13 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c, #include static void cache_activate(struct namecache *); +static void cache_update_stats(void *); static int cache_compare_key(void *, const void *, const void *); static int cache_compare_nodes(void *, const void *, const void *); static void cache_deactivate(void); static void cache_reclaim(void); static int cache_stat_sysctl(SYSCTLFN_ARGS); -/* Per-CPU counters. */ -struct nchstats_percpu _NAMEI_CACHE_STATS(uintptr_t); - /* Global pool cache. */ static pool_cache_t cache_pool __read_mostly; @@ -225,8 +226,15 @@ static struct { static kmutex_t cache_lru_lock __cacheline_aligned; -/* Cache effectiveness statistics. This holds total from per-cpu stats */ -struct nchstats nchstats __cacheline_aligned; +/* Cache effectiveness statistics. nchstats holds system-wide total. */ +struct nchstats nchstats; +struct nchstats_percpu _NAMEI_CACHE_STATS(uint32_t); +struct nchcpu { + struct nchstats_percpu cur; + struct nchstats_percpu last; +}; +static callout_t cache_stat_callout; +static kmutex_t cache_stat_lock __cacheline_aligned; #define COUNT(f) do { \ lwp_t *l = curlwp; \ @@ -235,6 +243,12 @@ struct nchstats nchstats __cacheline_ali KPREEMPT_ENABLE(l); \ } while (/* CONSTCOND */ 0); +#define UPDATE(nchcpu, f) do { \ + uint32_t cur = atomic_load_relaxed(>cur.f); \ + nchstats.f += cur - nchcpu->last.f; \ + nchcpu->last.f = cur; \ +} while (/* CONSTCOND */ 0) + /* * Tunables. cache_maxlen replaces the historical doingcache: * set it zero to disable caching for debugging purposes. @@ -242,6 +256,7 @@ struct nchstats nchstats __cacheline_ali int cache_lru_maxdeact __read_mostly = 2; /* max # to deactivate */ int cache_lru_maxscan __read_mostly = 64; /* max # to scan/reclaim */ int cache_maxlen __read_mostly = USHRT_MAX; /* max name length to cache */ +int cache_stat_interval __read_mostly = 300; /* in seconds */ /* sysctl */ static struct sysctllog *cache_sysctllog; @@ -1000,6 +1015,11 @@ nchinit(void) TAILQ_INIT(_lru.list[LRU_ACTIVE]); TAILQ_INIT(_lru.list[LRU_INACTIVE]); + mutex_init(_stat_lock, MUTEX_DEFAULT, IPL_NONE); + callout_init(_stat_callout, CALLOUT_MPSAFE); + callout_setfunc(_stat_callout, cache_update_stats, NULL); + callout_schedule(_stat_callout, cache_stat_interval * hz); + KASSERT(cache_sysctllog == NULL); sysctl_createv(_sysctllog, 0, NULL, NULL, CTLFLAG_PERMANENT, @@ -1362,6 +1382,41 @@ namecache_count_2passes(void) } /* + * Sum the stats from all CPUs into nchstats. This needs to run at least + * once within every window where a 32-bit counter could roll over. It's + * called regularly by timer to ensure this. + */ +static void +cache_update_stats(void *cookie) +{ + CPU_INFO_ITERATOR cii; + struct cpu_info *ci; + + mutex_enter(_stat_lock); + for (CPU_INFO_FOREACH(cii, ci)) { + struct nchcpu *nchcpu = ci->ci_data.cpu_nch; +
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sun Mar 22 01:58:22 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: - rb_tree_insert_node() refuses to insert duplicate nodes. It always returns a pointer to the current node in the tree for the given key. Therefore the call to rb_tree_lookup_node() in cache_enter() is not needed. - Adjust a comment and move some code for clarity. To generate a diff of this commit: cvs rdiff -u -r1.126.2.15 -r1.126.2.16 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_cache.c diff -u src/sys/kern/vfs_cache.c:1.126.2.15 src/sys/kern/vfs_cache.c:1.126.2.16 --- src/sys/kern/vfs_cache.c:1.126.2.15 Sun Mar 22 00:34:31 2020 +++ src/sys/kern/vfs_cache.c Sun Mar 22 01:58:22 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.126.2.15 2020/03/22 00:34:31 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.126.2.16 2020/03/22 01:58:22 ad Exp $ */ /*- * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -171,7 +171,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.15 2020/03/22 00:34:31 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.16 2020/03/22 01:58:22 ad Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT @@ -416,8 +416,6 @@ cache_lookup_entry(struct vnode *dvp, co * Search the RB tree for the key. This is an inlined lookup * tailored for exactly what's needed here (64-bit key and so on) * that is quite a bit faster than using rb_tree_find_node(). - * Elsewhere during entry/removal the usual functions are used as it - * doesn't matter there. */ for (;;) { if (__predict_false(RB_SENTINEL_P(node))) { @@ -525,6 +523,9 @@ cache_lookup(struct vnode *dvp, const ch return false; } + /* Compute the key up front - don't need the lock. */ + key = cache_key(name, namelen); + /* Could the entry be purged below? */ if ((cnflags & ISLASTCN) != 0 && ((cnflags & MAKEENTRY) == 0 || nameiop == CREATE)) { @@ -533,9 +534,6 @@ cache_lookup(struct vnode *dvp, const ch op = RW_READER; } - /* Compute the key up front - don't need the lock. */ - key = cache_key(name, namelen); - /* Now look for the name. */ rw_enter(>vi_nc_lock, op); ncp = cache_lookup_entry(dvp, name, namelen, key); @@ -890,18 +888,20 @@ cache_enter(struct vnode *dvp, struct vn /* * Insert to the directory. Concurrent lookups in the same * directory may race for a cache entry. There can also be hash - * value collisions. If there's a entry there already, free it. + * value collisions. If there's a entry there already, purge it. */ rw_enter(>vi_nc_lock, RW_WRITER); - oncp = rb_tree_find_node(>vi_nc_tree, >nc_key); - if (oncp) { + oncp = rb_tree_insert_node(>vi_nc_tree, ncp); + if (oncp != ncp) { + KASSERT(oncp->nc_key == ncp->nc_key); KASSERT(oncp->nc_nlen == ncp->nc_nlen); if (cache_namecmp(oncp, name, namelen)) { COUNT(ncs_collisions); } cache_remove(oncp, true); + oncp = rb_tree_insert_node(>vi_nc_tree, ncp); + KASSERT(oncp == ncp); } - rb_tree_insert_node(>vi_nc_tree, ncp); /* Then insert to the vnode. */ if (vp == NULL) {
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sun Mar 22 01:58:22 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: - rb_tree_insert_node() refuses to insert duplicate nodes. It always returns a pointer to the current node in the tree for the given key. Therefore the call to rb_tree_lookup_node() in cache_enter() is not needed. - Adjust a comment and move some code for clarity. To generate a diff of this commit: cvs rdiff -u -r1.126.2.15 -r1.126.2.16 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sun Mar 22 00:34:31 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: - Fold the "doingcache" conditional into the max length conditional. - Mark the tunables __read_mostly. To generate a diff of this commit: cvs rdiff -u -r1.126.2.14 -r1.126.2.15 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_cache.c diff -u src/sys/kern/vfs_cache.c:1.126.2.14 src/sys/kern/vfs_cache.c:1.126.2.15 --- src/sys/kern/vfs_cache.c:1.126.2.14 Sat Mar 21 22:00:55 2020 +++ src/sys/kern/vfs_cache.c Sun Mar 22 00:34:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.126.2.14 2020/03/21 22:00:55 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.126.2.15 2020/03/22 00:34:31 ad Exp $ */ /*- * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -171,7 +171,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.14 2020/03/21 22:00:55 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.15 2020/03/22 00:34:31 ad Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT @@ -235,10 +235,13 @@ struct nchstats nchstats __cacheline_ali KPREEMPT_ENABLE(l); \ } while (/* CONSTCOND */ 0); -/* Tunables */ -static const int cache_lru_maxdeact = 2; /* max # to deactivate */ -static const int cache_lru_maxscan = 64; /* max # to scan/reclaim */ -static int doingcache = 1; /* 1 => enable the cache */ +/* + * Tunables. cache_maxlen replaces the historical doingcache: + * set it zero to disable caching for debugging purposes. + */ +int cache_lru_maxdeact __read_mostly = 2; /* max # to deactivate */ +int cache_lru_maxscan __read_mostly = 64; /* max # to scan/reclaim */ +int cache_maxlen __read_mostly = USHRT_MAX; /* max name length to cache */ /* sysctl */ static struct sysctllog *cache_sysctllog; @@ -515,11 +518,7 @@ cache_lookup(struct vnode *dvp, const ch } *vn_ret = NULL; - if (__predict_false(!doingcache)) { - return false; - } - - if (__predict_false(namelen > USHRT_MAX)) { + if (__predict_false(namelen > cache_maxlen)) { SDT_PROBE(vfs, namecache, lookup, toolong, dvp, name, namelen, 0, 0); COUNT(ncs_long); @@ -644,7 +643,7 @@ cache_lookup_linked(struct vnode *dvp, c *vn_ret = NULL; /* If disabled, or file system doesn't support this, bail out. */ - if (__predict_false(!doingcache || + if (__predict_false(cache_maxlen == 0 || (dvp->v_mount->mnt_iflag & IMNT_NCLOOKUP) == 0)) { return false; } @@ -753,7 +752,7 @@ cache_revlookup(struct vnode *vp, struct KASSERT(vp != NULL); - if (!doingcache) + if (cache_maxlen == 0) goto out; rw_enter(>vi_nc_listlock, RW_READER); @@ -855,7 +854,7 @@ cache_enter(struct vnode *dvp, struct vn /* First, check whether we can/should add a cache entry. */ if ((cnflags & MAKEENTRY) == 0 || - __predict_false(namelen > USHRT_MAX || !doingcache)) { + __predict_false(namelen > cache_maxlen)) { SDT_PROBE(vfs, namecache, enter, toolong, vp, name, namelen, 0, 0); return;
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sun Mar 22 00:34:31 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: - Fold the "doingcache" conditional into the max length conditional. - Mark the tunables __read_mostly. To generate a diff of this commit: cvs rdiff -u -r1.126.2.14 -r1.126.2.15 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/sys
Module Name:src Committed By: ad Date: Sat Mar 21 22:04:17 UTC 2020 Modified Files: src/sys/sys [ad-namecache]: namei.src Log Message: Move nc_key up, so cache_lookup_entry() only needs to touch one cache line at each step. To generate a diff of this commit: cvs rdiff -u -r1.47.2.7 -r1.47.2.8 src/sys/sys/namei.src Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/sys
Module Name:src Committed By: ad Date: Sat Mar 21 22:04:17 UTC 2020 Modified Files: src/sys/sys [ad-namecache]: namei.src Log Message: Move nc_key up, so cache_lookup_entry() only needs to touch one cache line at each step. To generate a diff of this commit: cvs rdiff -u -r1.47.2.7 -r1.47.2.8 src/sys/sys/namei.src Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/namei.src diff -u src/sys/sys/namei.src:1.47.2.7 src/sys/sys/namei.src:1.47.2.8 --- src/sys/sys/namei.src:1.47.2.7 Wed Mar 4 20:21:05 2020 +++ src/sys/sys/namei.src Sat Mar 21 22:04:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: namei.src,v 1.47.2.7 2020/03/04 20:21:05 ad Exp $ */ +/* $NetBSD: namei.src,v 1.47.2.8 2020/03/21 22:04:17 ad Exp $ */ /* * Copyright (c) 1985, 1989, 1991, 1993 @@ -199,11 +199,12 @@ NAMEIFL PARAMASK 0x02ef800 /* mask of pa #define NCHNAMLEN sizeof(((struct namecache *)NULL)->nc_name) /* - * Namecache entry. + * Namecache entry. * * This structure describes the elements in the cache of recent names looked * up by namei. It's carefully sized to take up 128 bytes on _LP64, to make - * good use of space and the CPU caches. + * good use of space and the CPU caches. Items used during RB tree lookup + * (nc_tree, nc_key) are clustered at the start of the structure. * * Field markings and their corresponding locks: * @@ -216,11 +217,11 @@ NAMEIFL PARAMASK 0x02ef800 /* mask of pa struct nchnode; struct namecache { struct rb_node nc_tree; /* d red-black tree, must be first */ + int64_t nc_key; /* - hash key */ TAILQ_ENTRY(namecache) nc_list; /* v vp's list of cache entries */ TAILQ_ENTRY(namecache) nc_lru; /* l pseudo-lru chain */ struct vnode *nc_dvp; /* - vnode of parent of name */ struct vnode *nc_vp; /* - vnode the name refers to */ - int64_t nc_key; /* - hash key */ int nc_lrulist; /* l which LRU list its on */ short nc_nlen; /* - length of the name */ char nc_whiteout; /* - true if a whiteout */
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sat Mar 21 22:00:56 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: - Include sys/types.h for vax. - Use macro versions of kpreempt_disable()/enable(). - Use atomic_load_relaxed(). - Make cache_key() inline. To generate a diff of this commit: cvs rdiff -u -r1.126.2.13 -r1.126.2.14 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_cache.c diff -u src/sys/kern/vfs_cache.c:1.126.2.13 src/sys/kern/vfs_cache.c:1.126.2.14 --- src/sys/kern/vfs_cache.c:1.126.2.13 Tue Mar 10 21:53:45 2020 +++ src/sys/kern/vfs_cache.c Sat Mar 21 22:00:55 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.126.2.13 2020/03/10 21:53:45 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.126.2.14 2020/03/21 22:00:55 ad Exp $ */ /*- * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -171,7 +171,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.13 2020/03/10 21:53:45 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.14 2020/03/21 22:00:55 ad Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT @@ -179,6 +179,7 @@ __KERNEL_RCSID(0, "$NetBSD: vfs_cache.c, #include "opt_dtrace.h" #endif +#include #include #include #include @@ -228,9 +229,10 @@ static kmutex_t cache_lru_lock __cacheli struct nchstats nchstats __cacheline_aligned; #define COUNT(f) do { \ - kpreempt_disable(); \ + lwp_t *l = curlwp; \ + KPREEMPT_DISABLE(l); \ ((struct nchstats_percpu *)curcpu()->ci_data.cpu_nch)->f++; \ - kpreempt_enable(); \ + KPREEMPT_ENABLE(l); \ } while (/* CONSTCOND */ 0); /* Tunables */ @@ -314,7 +316,7 @@ cache_compare_key(void *context, const v * the key value to try and improve uniqueness, and so that length doesn't * need to be compared separately for string comparisons. */ -static int64_t +static inline int64_t cache_key(const char *name, size_t nlen) { int64_t key; @@ -403,6 +405,7 @@ cache_lookup_entry(struct vnode *dvp, co vnode_impl_t *dvi = VNODE_TO_VIMPL(dvp); struct rb_node *node = dvi->vi_nc_tree.rbt_root; struct namecache *ncp; + int lrulist; KASSERT(rw_lock_held(>vi_nc_lock)); @@ -436,7 +439,8 @@ cache_lookup_entry(struct vnode *dvp, co * unlocked check, but it will rarely be wrong and even then there * will be no harm caused. */ - if (__predict_false(ncp->nc_lrulist != LRU_ACTIVE)) { + lrulist = atomic_load_relaxed(>nc_lrulist); + if (__predict_false(lrulist != LRU_ACTIVE)) { cache_activate(ncp); } return ncp; @@ -744,8 +748,8 @@ cache_revlookup(struct vnode *vp, struct vnode_impl_t *vi = VNODE_TO_VIMPL(vp); struct namecache *ncp; struct vnode *dvp; + int error, nlen, lrulist; char *bp; - int error, nlen; KASSERT(vp != NULL); @@ -793,7 +797,8 @@ cache_revlookup(struct vnode *vp, struct } /* Record a hit on the entry. This is an unlocked read. */ - if (ncp->nc_lrulist != LRU_ACTIVE) { + lrulist = atomic_load_relaxed(>nc_lrulist); + if (lrulist != LRU_ACTIVE) { cache_activate(ncp); } @@ -863,7 +868,8 @@ cache_enter(struct vnode *dvp, struct vn * but it doesn't matter. Just need to catch up with things * eventually: it doesn't matter if we go over temporarily. */ - total = cache_lru.count[LRU_ACTIVE] + cache_lru.count[LRU_INACTIVE]; + total = atomic_load_relaxed(_lru.count[LRU_ACTIVE]); + total += atomic_load_relaxed(_lru.count[LRU_INACTIVE]); if (__predict_false(total > desiredvnodes)) { cache_reclaim(); }
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sat Mar 21 22:00:56 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: - Include sys/types.h for vax. - Use macro versions of kpreempt_disable()/enable(). - Use atomic_load_relaxed(). - Make cache_key() inline. To generate a diff of this commit: cvs rdiff -u -r1.126.2.13 -r1.126.2.14 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Tue Mar 10 21:53:46 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: __read_mostly -> const in one place To generate a diff of this commit: cvs rdiff -u -r1.126.2.12 -r1.126.2.13 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Tue Mar 10 21:53:46 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: __read_mostly -> const in one place To generate a diff of this commit: cvs rdiff -u -r1.126.2.12 -r1.126.2.13 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_cache.c diff -u src/sys/kern/vfs_cache.c:1.126.2.12 src/sys/kern/vfs_cache.c:1.126.2.13 --- src/sys/kern/vfs_cache.c:1.126.2.12 Sun Feb 16 22:00:53 2020 +++ src/sys/kern/vfs_cache.c Tue Mar 10 21:53:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.126.2.12 2020/02/16 22:00:53 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.126.2.13 2020/03/10 21:53:45 ad Exp $ */ /*- * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -171,7 +171,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.12 2020/02/16 22:00:53 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.13 2020/03/10 21:53:45 ad Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT @@ -242,7 +242,7 @@ static int doingcache = 1; /* 1 => ena static struct sysctllog *cache_sysctllog; /* Read-black tree */ -static rb_tree_ops_t cache_rbtree_ops __read_mostly = { +static const rb_tree_ops_t cache_rbtree_ops = { .rbto_compare_nodes = cache_compare_nodes, .rbto_compare_key = cache_compare_key, .rbto_node_offset = offsetof(struct namecache, nc_tree),
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Wed Mar 4 20:26:29 UTC 2020 Modified Files: src/sys/rump/include/rump [ad-namecache]: rump_namei.h src/sys/sys [ad-namecache]: namei.h Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.37.2.4 -r1.37.2.5 src/sys/rump/include/rump/rump_namei.h cvs rdiff -u -r1.103.2.5 -r1.103.2.6 src/sys/sys/namei.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/rump/include/rump/rump_namei.h diff -u src/sys/rump/include/rump/rump_namei.h:1.37.2.4 src/sys/rump/include/rump/rump_namei.h:1.37.2.5 --- src/sys/rump/include/rump/rump_namei.h:1.37.2.4 Sat Jan 25 21:45:00 2020 +++ src/sys/rump/include/rump/rump_namei.h Wed Mar 4 20:26:28 2020 @@ -1,11 +1,11 @@ -/* $NetBSD: rump_namei.h,v 1.37.2.4 2020/01/25 21:45:00 ad Exp $ */ +/* $NetBSD: rump_namei.h,v 1.37.2.5 2020/03/04 20:26:28 ad Exp $ */ /* * WARNING: GENERATED FILE. DO NOT EDIT * (edit namei.src and run make namei in src/sys/sys) * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp - * from: NetBSD: namei.src,v 1.48 2020/01/08 12:04:56 ad Exp + * from: NetBSD: namei.src,v 1.47.2.7 2020/03/04 20:21:05 ad Exp */ #ifndef _RUMP_RUMP_NAMEI_H_ @@ -23,10 +23,11 @@ #define RUMP_NAMEI_FOLLOW 0x0040 #define RUMP_NAMEI_NOFOLLOW 0x #define RUMP_NAMEI_EMULROOTSET 0x0080 +#define RUMP_NAMEI_LOCKSHARED 0x0100 #define RUMP_NAMEI_NOCHROOT 0x0100 -#define RUMP_NAMEI_MODMASK 0x01fc -#define RUMP_NAMEI_NOCROSSMOUNT 0x100 -#define RUMP_NAMEI_RDONLY 0x200 +#define RUMP_NAMEI_MODMASK 0x010001fc +#define RUMP_NAMEI_NOCROSSMOUNT 0x800 +#define RUMP_NAMEI_RDONLY 0x0001000 #define RUMP_NAMEI_ISDOTDOT 0x0002000 #define RUMP_NAMEI_MAKEENTRY 0x0004000 #define RUMP_NAMEI_ISLASTCN 0x0008000 @@ -34,6 +35,6 @@ #define RUMP_NAMEI_DOWHITEOUT 0x004 #define RUMP_NAMEI_REQUIREDIR 0x008 #define RUMP_NAMEI_CREATEDIR 0x020 -#define RUMP_NAMEI_PARAMASK 0x02ee300 +#define RUMP_NAMEI_PARAMASK 0x02ef800 #endif /* _RUMP_RUMP_NAMEI_H_ */ Index: src/sys/sys/namei.h diff -u src/sys/sys/namei.h:1.103.2.5 src/sys/sys/namei.h:1.103.2.6 --- src/sys/sys/namei.h:1.103.2.5 Fri Jan 24 16:49:12 2020 +++ src/sys/sys/namei.h Wed Mar 4 20:26:29 2020 @@ -1,11 +1,11 @@ -/* $NetBSD: namei.h,v 1.103.2.5 2020/01/24 16:49:12 ad Exp $ */ +/* $NetBSD: namei.h,v 1.103.2.6 2020/03/04 20:26:29 ad Exp $ */ /* * WARNING: GENERATED FILE. DO NOT EDIT * (edit namei.src and run make namei in src/sys/sys) * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp - * from: NetBSD: namei.src,v 1.47.2.6 2020/01/24 16:48:59 ad Exp + * from: NetBSD: namei.src,v 1.47.2.7 2020/03/04 20:21:05 ad Exp */ /* @@ -211,8 +211,7 @@ struct nameidata { * * This structure describes the elements in the cache of recent names looked * up by namei. It's carefully sized to take up 128 bytes on _LP64, to make - * good use of space and the CPU caches; nc_name is aligned on an 8-byte - * boundary to make string comparisons cheaper. + * good use of space and the CPU caches. * * Field markings and their corresponding locks: *
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Wed Mar 4 20:26:29 UTC 2020 Modified Files: src/sys/rump/include/rump [ad-namecache]: rump_namei.h src/sys/sys [ad-namecache]: namei.h Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.37.2.4 -r1.37.2.5 src/sys/rump/include/rump/rump_namei.h cvs rdiff -u -r1.103.2.5 -r1.103.2.6 src/sys/sys/namei.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/sys
Module Name:src Committed By: ad Date: Wed Mar 4 20:21:05 UTC 2020 Modified Files: src/sys/sys [ad-namecache]: namei.src Log Message: Fix a comment. To generate a diff of this commit: cvs rdiff -u -r1.47.2.6 -r1.47.2.7 src/sys/sys/namei.src Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/namei.src diff -u src/sys/sys/namei.src:1.47.2.6 src/sys/sys/namei.src:1.47.2.7 --- src/sys/sys/namei.src:1.47.2.6 Fri Jan 24 16:48:59 2020 +++ src/sys/sys/namei.src Wed Mar 4 20:21:05 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: namei.src,v 1.47.2.6 2020/01/24 16:48:59 ad Exp $ */ +/* $NetBSD: namei.src,v 1.47.2.7 2020/03/04 20:21:05 ad Exp $ */ /* * Copyright (c) 1985, 1989, 1991, 1993 @@ -203,8 +203,7 @@ NAMEIFL PARAMASK 0x02ef800 /* mask of pa * * This structure describes the elements in the cache of recent names looked * up by namei. It's carefully sized to take up 128 bytes on _LP64, to make - * good use of space and the CPU caches; nc_name is aligned on an 8-byte - * boundary to make string comparisons cheaper. + * good use of space and the CPU caches. * * Field markings and their corresponding locks: *
CVS commit: [ad-namecache] src/sys/sys
Module Name:src Committed By: ad Date: Wed Mar 4 20:21:05 UTC 2020 Modified Files: src/sys/sys [ad-namecache]: namei.src Log Message: Fix a comment. To generate a diff of this commit: cvs rdiff -u -r1.47.2.6 -r1.47.2.7 src/sys/sys/namei.src Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Tue Mar 3 22:30:57 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_lookup.c Log Message: lookup_fastforward(): bail out on mount -o union To generate a diff of this commit: cvs rdiff -u -r1.212.4.10 -r1.212.4.11 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.212.4.10 src/sys/kern/vfs_lookup.c:1.212.4.11 --- src/sys/kern/vfs_lookup.c:1.212.4.10 Sat Feb 29 20:21:03 2020 +++ src/sys/kern/vfs_lookup.c Tue Mar 3 22:30:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.212.4.10 2020/02/29 20:21:03 ad Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.212.4.11 2020/03/03 22:30:57 ad Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.212.4.10 2020/02/29 20:21:03 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.212.4.11 2020/03/03 22:30:57 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_magiclinks.h" @@ -1308,6 +1308,13 @@ lookup_fastforward(struct namei_state *s } } + /* Can't deal with -o union lookups. */ + if ((searchdir->v_vflag & VV_ROOT) != 0 && + (searchdir->v_mount->mnt_flag & MNT_UNION) != 0) { + error = EOPNOTSUPP; + break; + } + /* * Good, now look for it in cache. cache_lookup_linked() * will fail if there's nothing there, or if there's no @@ -1323,7 +1330,6 @@ lookup_fastforward(struct namei_state *s /* Scored a hit. Negative is good too (ENOENT). */ if (foundobj == NULL) { - /* XXXAD need to handle -o union mount. */ error = ENOENT; break; }
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Tue Mar 3 22:30:57 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_lookup.c Log Message: lookup_fastforward(): bail out on mount -o union To generate a diff of this commit: cvs rdiff -u -r1.212.4.10 -r1.212.4.11 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sat Feb 29 22:00:03 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_vnops.c Log Message: Back out experimental change - not ready for LK_SHARED on VOP_OPEN() just yet. To generate a diff of this commit: cvs rdiff -u -r1.204.2.3 -r1.204.2.4 src/sys/kern/vfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_vnops.c diff -u src/sys/kern/vfs_vnops.c:1.204.2.3 src/sys/kern/vfs_vnops.c:1.204.2.4 --- src/sys/kern/vfs_vnops.c:1.204.2.3 Sat Feb 29 20:21:03 2020 +++ src/sys/kern/vfs_vnops.c Sat Feb 29 22:00:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnops.c,v 1.204.2.3 2020/02/29 20:21:03 ad Exp $ */ +/* $NetBSD: vfs_vnops.c,v 1.204.2.4 2020/02/29 22:00:03 ad Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.204.2.3 2020/02/29 20:21:03 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.204.2.4 2020/02/29 22:00:03 ad Exp $"); #include "veriexec.h" @@ -163,10 +163,7 @@ vn_open(struct nameidata *ndp, int fmode ndp->ni_cnd.cn_flags |= FOLLOW; } else { ndp->ni_cnd.cn_nameiop = LOOKUP; - if ((fmode & O_TRUNC) == 0) /* XXXAD check nfs etc */ - ndp->ni_cnd.cn_flags |= LOCKLEAF | LOCKSHARED; - else - ndp->ni_cnd.cn_flags |= LOCKLEAF; + ndp->ni_cnd.cn_flags |= LOCKLEAF; if ((fmode & O_NOFOLLOW) == 0) ndp->ni_cnd.cn_flags |= FOLLOW; }
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sat Feb 29 22:00:03 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_vnops.c Log Message: Back out experimental change - not ready for LK_SHARED on VOP_OPEN() just yet. To generate a diff of this commit: cvs rdiff -u -r1.204.2.3 -r1.204.2.4 src/sys/kern/vfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sat Feb 29 21:50:45 UTC 2020 Modified Files: src/sys/arch/arm/arm32 [ad-namecache]: pmap.c src/sys/arch/i386/include [ad-namecache]: rwlock.h src/sys/kern [ad-namecache]: kern_idle.c uipc_usrreq.c Log Message: Sync with head. To generate a diff of this commit: cvs rdiff -u -r1.375.2.3 -r1.375.2.4 src/sys/arch/arm/arm32/pmap.c cvs rdiff -u -r1.2.144.1 -r1.2.144.2 src/sys/arch/i386/include/rwlock.h cvs rdiff -u -r1.29.2.3 -r1.29.2.4 src/sys/kern/kern_idle.c cvs rdiff -u -r1.194.4.2 -r1.194.4.3 src/sys/kern/uipc_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/arm/arm32/pmap.c diff -u src/sys/arch/arm/arm32/pmap.c:1.375.2.3 src/sys/arch/arm/arm32/pmap.c:1.375.2.4 --- src/sys/arch/arm/arm32/pmap.c:1.375.2.3 Sat Feb 29 20:18:17 2020 +++ src/sys/arch/arm/arm32/pmap.c Sat Feb 29 21:50:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.375.2.3 2020/02/29 20:18:17 ad Exp $ */ +/* $NetBSD: pmap.c,v 1.375.2.4 2020/02/29 21:50:45 ad Exp $ */ /* * Copyright 2003 Wasabi Systems, Inc. @@ -198,7 +198,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.375.2.3 2020/02/29 20:18:17 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.375.2.4 2020/02/29 21:50:45 ad Exp $"); #include #include @@ -224,8 +224,6 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.3 #include #endif -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.375.2.3 2020/02/29 20:18:17 ad Exp $"); - //#define PMAP_DEBUG #ifdef PMAP_DEBUG Index: src/sys/arch/i386/include/rwlock.h diff -u src/sys/arch/i386/include/rwlock.h:1.2.144.1 src/sys/arch/i386/include/rwlock.h:1.2.144.2 --- src/sys/arch/i386/include/rwlock.h:1.2.144.1 Sun Jan 19 21:10:59 2020 +++ src/sys/arch/i386/include/rwlock.h Sat Feb 29 21:50:45 2020 @@ -0,0 +1,3 @@ +/* $NetBSD: rwlock.h,v 1.2.144.2 2020/02/29 21:50:45 ad Exp $ */ + +#include Index: src/sys/kern/kern_idle.c diff -u src/sys/kern/kern_idle.c:1.29.2.3 src/sys/kern/kern_idle.c:1.29.2.4 --- src/sys/kern/kern_idle.c:1.29.2.3 Sat Feb 29 20:21:02 2020 +++ src/sys/kern/kern_idle.c Sat Feb 29 21:50:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_idle.c,v 1.29.2.3 2020/02/29 20:21:02 ad Exp $ */ +/* $NetBSD: kern_idle.c,v 1.29.2.4 2020/02/29 21:50:45 ad Exp $ */ /*- * Copyright (c)2002, 2006, 2007 YAMAMOTO Takashi, @@ -27,7 +27,8 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_idle.c,v 1.29.2.3 2020/02/29 20:21:02 ad Exp $"); + +__KERNEL_RCSID(0, "$NetBSD: kern_idle.c,v 1.29.2.4 2020/02/29 21:50:45 ad Exp $"); #include #include Index: src/sys/kern/uipc_usrreq.c diff -u src/sys/kern/uipc_usrreq.c:1.194.4.2 src/sys/kern/uipc_usrreq.c:1.194.4.3 --- src/sys/kern/uipc_usrreq.c:1.194.4.2 Sat Feb 29 20:21:03 2020 +++ src/sys/kern/uipc_usrreq.c Sat Feb 29 21:50:45 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_usrreq.c,v 1.194.4.2 2020/02/29 20:21:03 ad Exp $ */ +/* $NetBSD: uipc_usrreq.c,v 1.194.4.3 2020/02/29 21:50:45 ad Exp $ */ /*- * Copyright (c) 1998, 2000, 2004, 2008, 2009, 2020 The NetBSD Foundation, Inc. @@ -96,7 +96,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.194.4.2 2020/02/29 20:21:03 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.194.4.3 2020/02/29 21:50:45 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1431,7 +1431,7 @@ unp_externalize(struct mbuf *rights, str } } } - + restart: /* * First loop -- allocate file descriptor table slots for the
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sat Feb 29 21:50:45 UTC 2020 Modified Files: src/sys/arch/arm/arm32 [ad-namecache]: pmap.c src/sys/arch/i386/include [ad-namecache]: rwlock.h src/sys/kern [ad-namecache]: kern_idle.c uipc_usrreq.c Log Message: Sync with head. To generate a diff of this commit: cvs rdiff -u -r1.375.2.3 -r1.375.2.4 src/sys/arch/arm/arm32/pmap.c cvs rdiff -u -r1.2.144.1 -r1.2.144.2 src/sys/arch/i386/include/rwlock.h cvs rdiff -u -r1.29.2.3 -r1.29.2.4 src/sys/kern/kern_idle.c cvs rdiff -u -r1.194.4.2 -r1.194.4.3 src/sys/kern/uipc_usrreq.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/dev
Module Name:src Committed By: ad Date: Sat Feb 29 20:19:17 UTC 2020 Modified Files: src/sys/dev [ad-namecache]: DEVNAMES clockctl.c fss.c ld.c vnd.c src/sys/dev/acpi [ad-namecache]: acpi_mcfg.c acpi_mcfg.h files.acpi sdhc_acpi.c xhci_acpi.c src/sys/dev/audio [ad-namecache]: audio.c audiodef.h audiovar.h src/sys/dev/cadence [ad-namecache]: if_cemac.c src/sys/dev/dkwedge [ad-namecache]: dk.c src/sys/dev/fdt [ad-namecache]: fdt_intr.c fdt_subr.c fdtbus.c fdtvar.h files.fdt src/sys/dev/hdaudio [ad-namecache]: hdafg.c hdaudio.c hdaudiodevs hdaudiodevs.h hdaudiodevs_data.h src/sys/dev/hyperv [ad-namecache]: if_hvn.c src/sys/dev/i2c [ad-namecache]: axp20x.c axppmic.c dstemp.c files.i2c gttwsi_core.c src/sys/dev/ic [ad-namecache]: ad1848.c ad1848var.h ahcisata_core.c aic6915.c aic79xx_inline.h am7990.c am79900.c an.c arn5008.c arn9003.c ath.c athn.c atw.c awi.c ax88190.c bwfm.c bwi.c com.c cs89x0.c dl10019.c dm9000.c dp8390.c dp83932.c dwc_gmac.c elink3.c elinkxl.c gem.c hd64570.c hme.c i82557.c i82586.c i82596.c interwave.c interwavevar.h lan9118.c lance.c lemac.c malo.c mb86950.c mb86960.c mtd803.c mvsata.c pl041.c rt2560.c rt2661.c rt2860.c rtl8169.c rtl81x9.c rtw.c seeq8005.c sgec.c siisata.c sl811hs.c smc83c170.c smc90cx6.c smc91cxx.c ssdfb.c tulip.c wdc.c wi.c src/sys/dev/ieee1394 [ad-namecache]: if_fwip.c src/sys/dev/isa [ad-namecache]: cs89x0isa.c gus.c if_eg.c if_el.c if_iy.c mcd.c wss.c ym.c src/sys/dev/isapnp [ad-namecache]: gus_isapnp.c src/sys/dev/marvell [ad-namecache]: if_gfe.c if_mvgbe.c if_mvxpe.c src/sys/dev/mii [ad-namecache]: brgphy.c dmphy.c etphy.c makphy.c micphy.c miidevs miidevs.h miidevs_data.h rdcphy.c src/sys/dev/nvmm/x86 [ad-namecache]: nvmm_x86_svm.c nvmm_x86_vmx.c src/sys/dev/ofw [ad-namecache]: ofdisk.c ofnet.c src/sys/dev/pad [ad-namecache]: pad.c src/sys/dev/pci [ad-namecache]: auacer.c auich.c auixp.c autri.c auvia.c cmpci.c files.pci gcscaudio.c hifn7751.c ichsmb.c if_age.c if_alc.c if_alcreg.h if_ale.c if_an_pci.c if_aq.c if_bce.c if_bge.c if_bgevar.h if_bnx.c if_bnxvar.h if_cas.c if_casreg.h if_casvar.h if_dge.c if_ena.c if_et.c if_ipw.c if_iwi.c if_iwm.c if_iwn.c if_ixl.c if_ixlvar.h if_jme.c if_kse.c if_lii.c if_mcx.c if_msk.c if_nfe.c if_pcn.c if_re_pci.c if_rge.c if_rtwn.c if_sip.c if_sk.c if_ste.c if_stge.c if_ti.c if_tireg.h if_tl.c if_txp.c if_vge.c if_vioif.c if_vr.c if_vte.c if_vtevar.h if_wm.c if_wpi.c if_xge.c pci.c pciconf.c pcidevs pcidevs.h pcidevs_data.h pcireg.h radeonfb.c yds.c src/sys/dev/pci/bktr [ad-namecache]: bktr_core.c src/sys/dev/pci/cxgb [ad-namecache]: cxgb_main.c src/sys/dev/pci/igma [ad-namecache]: igmafb.c src/sys/dev/pci/ixgbe [ad-namecache]: ix_txrx.c ixgbe.c ixgbe.h ixgbe_common.c ixgbe_netbsd.c ixgbe_vf.c ixgbe_x550.c ixv.c src/sys/dev/pci/qat [ad-namecache]: qat.c src/sys/dev/pckbport [ad-namecache]: alps.c synaptics.c src/sys/dev/pcmcia [ad-namecache]: if_cnw.c if_malo_pcmcia.c if_ray.c if_xi.c src/sys/dev/ppbus [ad-namecache]: if_plip.c src/sys/dev/qbus [ad-namecache]: if_de.c if_dmc.c if_qt.c src/sys/dev/sbus [ad-namecache]: be.c dbri.c qe.c src/sys/dev/scsipi [ad-namecache]: atapi_wdc.c if_se.c scsiconf.c scsipi_base.c src/sys/dev/sdmmc [ad-namecache]: if_bwfm_sdio.c src/sys/dev/tprof [ad-namecache]: tprof_armv7.c src/sys/dev/usb [ad-namecache]: FILES Makefile TODO.usbmp ehci.c files.usb if_athn_usb.c if_atu.c if_aue.c if_axe.c if_axen.c if_bwfm_usb.c if_cdce.c if_cue.c if_kue.c if_mos.c if_mue.c if_otus.c if_rum.c if_run.c if_smsc.c if_udav.c if_umb.c if_upgt.c if_upl.c if_ural.c if_ure.c if_url.c if_urndis.c if_urtw.c if_urtwn.c if_zyd.c motg.c ohci.c u3g.c uatp.c uhci.c uhmodem.c uhso.c umass.c umass_scsipi.c umodeswitch.c usb.c usb_subr.c usbdevices.config usbdevs usbdevs.h usbdevs_data.h usbdi.c usbdi.h usbdi_util.c usbdi_util.h usbdivar.h usbnet.c uvideo.c vhci.c xhci.c src/sys/dev/wsfb [ad-namecache]: genfb.c Added Files: src/sys/dev/acpi [ad-namecache]: genet_acpi.c src/sys/dev/fdt [ad-namecache]: fdt_private.h genet_fdt.c src/sys/dev/i2c [ad-namecache]: pcagpio.c src/sys/dev/ic [ad-namecache]: bcmgenet.c bcmgenetreg.h bcmgenetvar.h src/sys/dev/ppbus [ad-namecache]: ppbusdevices.config src/sys/dev/scsipi [ad-namecache]: scsi_sdt.h src/sys/dev/usb
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sat Feb 29 20:21:12 UTC 2020 Modified Files: src/sys/coda [ad-namecache]: coda_vnops.c src/sys/compat/common [ad-namecache]: Makefile.sysio compat_sysctl_09_43.c kern_50.c kern_info_43.c kern_time_50.c kern_time_60.c kern_xxx_12.c rtsock_14.c rtsock_50.c uipc_syscalls_40.c uipc_syscalls_50.c vfs_syscalls_30.c vfs_syscalls_43.c src/sys/compat/linux/common [ad-namecache]: linux_exec.c src/sys/compat/netbsd32 [ad-namecache]: netbsd32_compat_30.c netbsd32_compat_50.c netbsd32_compat_60.c netbsd32_fs.c netbsd32_ioctl.c netbsd32_lwp.c src/sys/conf [ad-namecache]: files majors.usb ssp.mk src/sys/ddb [ad-namecache]: db_output.c db_proc.c db_xxx.c src/sys/dist/pf/net [ad-namecache]: if_pflog.c if_pfsync.c pf_ioctl.c src/sys/fs/hfs [ad-namecache]: hfs_vfsops.c src/sys/fs/msdosfs [ad-namecache]: msdosfs_vfsops.c msdosfs_vnops.c src/sys/fs/puffs [ad-namecache]: puffs_msgif.c puffs_vfsops.c puffs_vnops.c src/sys/fs/smbfs [ad-namecache]: smbfs_vfsops.c src/sys/fs/tmpfs [ad-namecache]: tmpfs_subr.c tmpfs_vnops.c src/sys/fs/udf [ad-namecache]: udf_subr.c udf_vnops.c src/sys/fs/union [ad-namecache]: union_subr.c union_vnops.c src/sys/fs/unionfs [ad-namecache]: unionfs_vnops.c src/sys/kern [ad-namecache]: files.kern init_main.c kern_condvar.c kern_descrip.c kern_event.c kern_exec.c kern_exit.c kern_fork.c kern_idle.c kern_ktrace.c kern_lock.c kern_lwp.c kern_module.c kern_pmf.c kern_proc.c kern_reboot.c kern_resource.c kern_rwlock.c kern_sig.c kern_sleepq.c kern_softint.c kern_synch.c kern_threadpool.c kern_veriexec.c subr_asan.c subr_autoconf.c subr_copy.c subr_cpu.c subr_disk_open.c subr_exec_fd.c subr_msan.c subr_percpu.c subr_pool.c sys_aio.c sys_descrip.c sys_lwp.c sys_pset.c sys_ptrace_common.c sys_sched.c sys_select.c sys_syscall.c sysv_ipc.c uipc_socket.c uipc_socket2.c uipc_usrreq.c vfs_bio.c vfs_cwd.c vfs_getcwd.c vfs_init.c vfs_lookup.c vfs_mount.c vfs_subr.c vfs_syscalls.c vfs_vnode.c vfs_vnops.c vnode_if.c vnode_if.sh src/sys/lib/libkern/arch/i386 [ad-namecache]: Makefile.inc src/sys/lib/libkern/arch/x86_64 [ad-namecache]: Makefile.inc src/sys/lib/libsa [ad-namecache]: nfs.c src/sys/miscfs/deadfs [ad-namecache]: dead_vnops.c src/sys/miscfs/fdesc [ad-namecache]: fdesc_vnops.c src/sys/miscfs/genfs [ad-namecache]: genfs_io.c genfs_vnops.c layer_vfsops.c layer_vnops.c src/sys/miscfs/kernfs [ad-namecache]: kernfs.h kernfs_vfsops.c kernfs_vnops.c src/sys/miscfs/procfs [ad-namecache]: procfs_vnops.c src/sys/modules [ad-namecache]: Makefile src/sys/modules/compat_crypto_50 [ad-namecache]: Makefile src/sys/modules/cyclic [ad-namecache]: Makefile src/sys/modules/drmkms [ad-namecache]: Makefile src/sys/modules/examples [ad-namecache]: Makefile README src/sys/modules/examples/luareadhappy [ad-namecache]: luareadhappy.c src/sys/modules/examples/mapper [ad-namecache]: mapper.c src/sys/modules/examples/panic_string [ad-namecache]: panic_string.c src/sys/modules/examples/ping [ad-namecache]: ping.c src/sys/modules/examples/readhappy_mpsafe [ad-namecache]: readhappy_mpsafe.c src/sys/modules/i915drmkms [ad-namecache]: Makefile src/sys/modules/opencrypto [ad-namecache]: opencrypto.ioconf src/sys/net [ad-namecache]: Makefile bpf.c bpfjit.c files.net if.c if.h if_arcsubr.c if_bridge.c if_ethersubr.c if_faith.c if_gif.c if_gif.h if_gre.c if_ipsec.c if_ipsec.h if_l2tp.c if_l2tp.h if_loop.c if_media.c if_media.h if_mpls.c if_ppp.c if_pppoe.c if_sl.c if_spppsubr.c if_srt.c if_stf.c if_tap.c if_tun.c if_vlan.c net_stats.c net_stats.h pfil.c pktqueue.c ppp_tty.c route.c route.h rtsock.c rtsock_shared.c src/sys/net/agr [ad-namecache]: ieee8023ad_lacp.c if_agr.c src/sys/net/npf [ad-namecache]: npf.c npf_ext_log.c npf_ruleset.c src/sys/net80211 [ad-namecache]: ieee80211.c ieee80211_input.c ieee80211_node.c ieee80211_output.c src/sys/netbt [ad-namecache]: l2cap_signal.c rfcomm_session.c src/sys/netcan [ad-namecache]: can.c if_canloop.c src/sys/netinet [ad-namecache]: in_l2tp.c ip_carp.c wqinput.c src/sys/netinet6 [ad-namecache]: in6_l2tp.c src/sys/netipsec [ad-namecache]: ipsecif.c key.c src/sys/netsmb [ad-namecache]: smb_conn.c src/sys/nfs [ad-namecache]: nfs_bio.c nfs_clntsubs.c nfs_node.c nfs_subs.c nfs_vfsops.c nfs_vnops.c src/sys/opencrypto
CVS commit: [ad-namecache] src/sys/dev
Module Name:src Committed By: ad Date: Sat Feb 29 20:19:17 UTC 2020 Modified Files: src/sys/dev [ad-namecache]: DEVNAMES clockctl.c fss.c ld.c vnd.c src/sys/dev/acpi [ad-namecache]: acpi_mcfg.c acpi_mcfg.h files.acpi sdhc_acpi.c xhci_acpi.c src/sys/dev/audio [ad-namecache]: audio.c audiodef.h audiovar.h src/sys/dev/cadence [ad-namecache]: if_cemac.c src/sys/dev/dkwedge [ad-namecache]: dk.c src/sys/dev/fdt [ad-namecache]: fdt_intr.c fdt_subr.c fdtbus.c fdtvar.h files.fdt src/sys/dev/hdaudio [ad-namecache]: hdafg.c hdaudio.c hdaudiodevs hdaudiodevs.h hdaudiodevs_data.h src/sys/dev/hyperv [ad-namecache]: if_hvn.c src/sys/dev/i2c [ad-namecache]: axp20x.c axppmic.c dstemp.c files.i2c gttwsi_core.c src/sys/dev/ic [ad-namecache]: ad1848.c ad1848var.h ahcisata_core.c aic6915.c aic79xx_inline.h am7990.c am79900.c an.c arn5008.c arn9003.c ath.c athn.c atw.c awi.c ax88190.c bwfm.c bwi.c com.c cs89x0.c dl10019.c dm9000.c dp8390.c dp83932.c dwc_gmac.c elink3.c elinkxl.c gem.c hd64570.c hme.c i82557.c i82586.c i82596.c interwave.c interwavevar.h lan9118.c lance.c lemac.c malo.c mb86950.c mb86960.c mtd803.c mvsata.c pl041.c rt2560.c rt2661.c rt2860.c rtl8169.c rtl81x9.c rtw.c seeq8005.c sgec.c siisata.c sl811hs.c smc83c170.c smc90cx6.c smc91cxx.c ssdfb.c tulip.c wdc.c wi.c src/sys/dev/ieee1394 [ad-namecache]: if_fwip.c src/sys/dev/isa [ad-namecache]: cs89x0isa.c gus.c if_eg.c if_el.c if_iy.c mcd.c wss.c ym.c src/sys/dev/isapnp [ad-namecache]: gus_isapnp.c src/sys/dev/marvell [ad-namecache]: if_gfe.c if_mvgbe.c if_mvxpe.c src/sys/dev/mii [ad-namecache]: brgphy.c dmphy.c etphy.c makphy.c micphy.c miidevs miidevs.h miidevs_data.h rdcphy.c src/sys/dev/nvmm/x86 [ad-namecache]: nvmm_x86_svm.c nvmm_x86_vmx.c src/sys/dev/ofw [ad-namecache]: ofdisk.c ofnet.c src/sys/dev/pad [ad-namecache]: pad.c src/sys/dev/pci [ad-namecache]: auacer.c auich.c auixp.c autri.c auvia.c cmpci.c files.pci gcscaudio.c hifn7751.c ichsmb.c if_age.c if_alc.c if_alcreg.h if_ale.c if_an_pci.c if_aq.c if_bce.c if_bge.c if_bgevar.h if_bnx.c if_bnxvar.h if_cas.c if_casreg.h if_casvar.h if_dge.c if_ena.c if_et.c if_ipw.c if_iwi.c if_iwm.c if_iwn.c if_ixl.c if_ixlvar.h if_jme.c if_kse.c if_lii.c if_mcx.c if_msk.c if_nfe.c if_pcn.c if_re_pci.c if_rge.c if_rtwn.c if_sip.c if_sk.c if_ste.c if_stge.c if_ti.c if_tireg.h if_tl.c if_txp.c if_vge.c if_vioif.c if_vr.c if_vte.c if_vtevar.h if_wm.c if_wpi.c if_xge.c pci.c pciconf.c pcidevs pcidevs.h pcidevs_data.h pcireg.h radeonfb.c yds.c src/sys/dev/pci/bktr [ad-namecache]: bktr_core.c src/sys/dev/pci/cxgb [ad-namecache]: cxgb_main.c src/sys/dev/pci/igma [ad-namecache]: igmafb.c src/sys/dev/pci/ixgbe [ad-namecache]: ix_txrx.c ixgbe.c ixgbe.h ixgbe_common.c ixgbe_netbsd.c ixgbe_vf.c ixgbe_x550.c ixv.c src/sys/dev/pci/qat [ad-namecache]: qat.c src/sys/dev/pckbport [ad-namecache]: alps.c synaptics.c src/sys/dev/pcmcia [ad-namecache]: if_cnw.c if_malo_pcmcia.c if_ray.c if_xi.c src/sys/dev/ppbus [ad-namecache]: if_plip.c src/sys/dev/qbus [ad-namecache]: if_de.c if_dmc.c if_qt.c src/sys/dev/sbus [ad-namecache]: be.c dbri.c qe.c src/sys/dev/scsipi [ad-namecache]: atapi_wdc.c if_se.c scsiconf.c scsipi_base.c src/sys/dev/sdmmc [ad-namecache]: if_bwfm_sdio.c src/sys/dev/tprof [ad-namecache]: tprof_armv7.c src/sys/dev/usb [ad-namecache]: FILES Makefile TODO.usbmp ehci.c files.usb if_athn_usb.c if_atu.c if_aue.c if_axe.c if_axen.c if_bwfm_usb.c if_cdce.c if_cue.c if_kue.c if_mos.c if_mue.c if_otus.c if_rum.c if_run.c if_smsc.c if_udav.c if_umb.c if_upgt.c if_upl.c if_ural.c if_ure.c if_url.c if_urndis.c if_urtw.c if_urtwn.c if_zyd.c motg.c ohci.c u3g.c uatp.c uhci.c uhmodem.c uhso.c umass.c umass_scsipi.c umodeswitch.c usb.c usb_subr.c usbdevices.config usbdevs usbdevs.h usbdevs_data.h usbdi.c usbdi.h usbdi_util.c usbdi_util.h usbdivar.h usbnet.c uvideo.c vhci.c xhci.c src/sys/dev/wsfb [ad-namecache]: genfb.c Added Files: src/sys/dev/acpi [ad-namecache]: genet_acpi.c src/sys/dev/fdt [ad-namecache]: fdt_private.h genet_fdt.c src/sys/dev/i2c [ad-namecache]: pcagpio.c src/sys/dev/ic [ad-namecache]: bcmgenet.c bcmgenetreg.h bcmgenetvar.h src/sys/dev/ppbus [ad-namecache]: ppbusdevices.config src/sys/dev/scsipi [ad-namecache]: scsi_sdt.h src/sys/dev/usb
CVS commit: [ad-namecache] src/sys/external
Module Name:src Committed By: ad Date: Sat Feb 29 20:20:19 UTC 2020 Modified Files: src/sys/external/bsd/common/include/linux [ad-namecache]: kernel.h list.h src/sys/external/bsd/common/linux [ad-namecache]: linux_work.c src/sys/external/bsd/compiler_rt/dist/lib/sanitizer_common [ad-namecache]: sanitizer_interceptors_ioctl_netbsd.inc sanitizer_platform_limits_netbsd.cc src/sys/external/bsd/drm2/amdgpu [ad-namecache]: files.amdgpu src/sys/external/bsd/drm2/dist/drm [ad-namecache]: drm_agpsupport.c drm_atomic.c drm_atomic_helper.c drm_bufs.c drm_context.c drm_crtc.c drm_crtc_helper.c drm_dp_helper.c drm_dp_mst_topology.c drm_drv.c drm_edid.c drm_fb_helper.c drm_flip_work.c drm_gem.c drm_global.c drm_ioctl.c drm_irq.c drm_mm.c drm_modes.c drm_modeset_lock.c drm_plane_helper.c drm_prime.c drm_probe_helper.c src/sys/external/bsd/drm2/dist/drm/amd/amdgpu [ad-namecache]: amdgpu_atom.c amdgpu_atombios.c amdgpu_atombios_crtc.c amdgpu_atombios_dp.c amdgpu_atombios_encoders.c amdgpu_atombios_i2c.c amdgpu_bo_list.c amdgpu_cgs.c amdgpu_ci_dpm.c amdgpu_ci_smc.c amdgpu_cik_ih.c amdgpu_cik_sdma.c amdgpu_cs.c amdgpu_ctx.c amdgpu_cz_dpm.c amdgpu_cz_ih.c amdgpu_cz_smc.c amdgpu_dce_v10_0.c amdgpu_dce_v11_0.c amdgpu_dce_v8_0.c amdgpu_device.c amdgpu_display.c amdgpu_dpm.c amdgpu_fb.c amdgpu_fence.c amdgpu_fiji_dpm.c amdgpu_fiji_smc.c amdgpu_gem.c amdgpu_gfx_v7_0.c amdgpu_gfx_v8_0.c amdgpu_gmc_v7_0.c amdgpu_gmc_v8_0.c amdgpu_i2c.c amdgpu_iceland_dpm.c amdgpu_iceland_ih.c amdgpu_iceland_smc.c amdgpu_ih.c amdgpu_kms.c amdgpu_kv_dpm.c amdgpu_object.c amdgpu_object.h amdgpu_ring.c amdgpu_sdma_v2_4.c amdgpu_sdma_v3_0.c amdgpu_test.c amdgpu_tonga_dpm.c amdgpu_tonga_ih.c amdgpu_tonga_smc.c amdgpu_ttm.c amdgpu_ucode.c amdgpu_uvd.c amdgpu_uvd_v4_2.c amdgpu_uvd_v5_0.c amdgpu_uvd_v6_0.c amdgpu_vce.c amdgpu_vce_v3_0.c amdgpu_vm.c src/sys/external/bsd/drm2/dist/drm/i915 [ad-namecache]: i915_cmd_parser.c i915_debugfs.c i915_dma.c i915_drv.c i915_drv.h i915_gem.c i915_gem_context.c i915_gem_execbuffer.c i915_gem_fence.c i915_gem_gtt.c i915_gem_render_state.c i915_gem_stolen.c i915_gpu_error.c i915_guc_submission.c i915_irq.c i915_params.c intel_audio.c intel_bios.c intel_crt.c intel_csr.c intel_ddi.c intel_display.c intel_dp.c intel_dp_mst.c intel_drv.h intel_dsi.c intel_dvo.c intel_fbc.c intel_fbdev.c intel_fifo_underrun.c intel_guc_loader.c intel_hdmi.c intel_i2c.c intel_lrc.c intel_lvds.c intel_opregion.c intel_overlay.c intel_panel.c intel_pm.c intel_psr.c intel_ringbuffer.c intel_ringbuffer.h intel_runtime_pm.c intel_sdvo.c intel_sideband.c intel_sprite.c intel_tv.c intel_uncore.c src/sys/external/bsd/drm2/dist/drm/nouveau [ad-namecache]: nouveau_abi16.c nouveau_bios.h nouveau_chan.c nouveau_connector.c nouveau_display.c nouveau_drm.c nouveau_fbcon.c nouveau_fence.c nouveau_gem.c nouveau_nv50_display.c nouveau_nv84_fence.c src/sys/external/bsd/drm2/dist/drm/nouveau/dispnv04 [ad-namecache]: nouveau_dispnv04_arb.c nouveau_dispnv04_disp.c nouveau_dispnv04_overlay.c nouveau_dispnv04_tvmodesnv17.c nouveau_dispnv04_tvnv04.c src/sys/external/bsd/drm2/dist/drm/nouveau/include/nvkm/core [ad-namecache]: device.h src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device [ad-namecache]: nouveau_nvkm_engine_device_base.c src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/disp [ad-namecache]: nouveau_nvkm_engine_disp_dport.c nouveau_nvkm_engine_disp_gf119.c nouveau_nvkm_engine_disp_nv50.c src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/gr [ad-namecache]: nouveau_nvkm_engine_gr_gf100.c src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/bios [ad-namecache]: nouveau_nvkm_subdev_bios_pll.c nouveau_nvkm_subdev_bios_shadowpci.c src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/devinit [ad-namecache]: nouveau_nvkm_subdev_devinit_nv04.c src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/i2c [ad-namecache]: nouveau_nvkm_subdev_i2c_aux.c nouveau_nvkm_subdev_i2c_bus.c nouveau_nvkm_subdev_i2c_pad.c src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/instmem [ad-namecache]: nouveau_nvkm_subdev_instmem_base.c nouveau_nvkm_subdev_instmem_nv40.c src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu [ad-namecache]:
CVS commit: [ad-namecache] src/sys/arch
Module Name:src Committed By: ad Date: Sat Feb 29 20:18:34 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64 [ad-namecache]: cpu.c genassym.cf locore.S netbsd32_machdep.c pmap.c trap.c vectors.S src/sys/arch/aarch64/conf [ad-namecache]: files.aarch64 majors.aarch64 src/sys/arch/aarch64/include [ad-namecache]: armreg.h cpu.h machdep.h param.h pmap.h pte.h types.h src/sys/arch/acorn32/podulebus [ad-namecache]: if_ie.c src/sys/arch/algor/conf [ad-namecache]: majors.algor src/sys/arch/alpha/alpha [ad-namecache]: genassym.cf machdep.c prom.c src/sys/arch/alpha/conf [ad-namecache]: majors.alpha src/sys/arch/amd64/amd64 [ad-namecache]: db_interface.c genassym.cf machdep.c src/sys/arch/amd64/conf [ad-namecache]: ALL GENERIC XEN3_DOM0 majors.amd64 src/sys/arch/amd64/include [ad-namecache]: param.h src/sys/arch/amd64/stand/prekern [ad-namecache]: mm.c src/sys/arch/amiga/amiga [ad-namecache]: genassym.cf src/sys/arch/amiga/dev [ad-namecache]: aucc.c if_bah_zbus.c if_es.c if_qn.c toccata.c src/sys/arch/amiga/include [ad-namecache]: vmparam.h src/sys/arch/arm/acpi [ad-namecache]: acpi_iort.c acpi_iort.h acpi_pci_machdep.c acpi_pci_machdep.h acpi_pci_n1sdp.c cpu_acpi.c files.acpi gicv3_acpi.c src/sys/arch/arm/altera [ad-namecache]: cycv_platform.c src/sys/arch/arm/amlogic [ad-namecache]: meson_dwmac.c src/sys/arch/arm/arm [ad-namecache]: arm_cpu_topology.c arm_machdep.c armv6_start.S cpufunc.c fiq.c src/sys/arch/arm/arm32 [ad-namecache]: arm32_boot.c arm32_kvminit.c arm32_machdep.c armv7_generic_space.c bus_dma.c cpu.c cpuswitch.S fault.c genassym.cf pmap.c src/sys/arch/arm/at91 [ad-namecache]: at91emac.c at91pmc.c src/sys/arch/arm/broadcom [ad-namecache]: bcm2835_emmc.c bcm2835_intr.c bcm2835_mbox.c bcm2835_mbox_acpi.c bcm2835reg.h bcm283x_platform.c bcm53xx_eth.c src/sys/arch/arm/conf [ad-namecache]: Makefile.arm files.arm majors.arm32 src/sys/arch/arm/cortex [ad-namecache]: gicv3.c gicv3.h gicv3_its.c src/sys/arch/arm/ep93xx [ad-namecache]: epe.c src/sys/arch/arm/fdt [ad-namecache]: cpu_fdt.c src/sys/arch/arm/footbridge [ad-namecache]: footbridge_pci.c src/sys/arch/arm/gemini [ad-namecache]: gemini_gmac.c if_gmc.c if_gpn.c src/sys/arch/arm/imx [ad-namecache]: if_enet.c src/sys/arch/arm/include [ad-namecache]: cpu.h cpu_topology.h cputypes.h locore.h pci_machdep.h src/sys/arch/arm/include/arm32 [ad-namecache]: machdep.h param.h pmap.h pte.h types.h src/sys/arch/arm/iomd [ad-namecache]: vidcaudio.c src/sys/arch/arm/mainbus [ad-namecache]: cpu_mainbus.c src/sys/arch/arm/nvidia [ad-namecache]: soc_tegra124.c tegra_sdhc.c src/sys/arch/arm/omap [ad-namecache]: if_cpsw.c src/sys/arch/arm/pci [ad-namecache]: pci_msi_machdep.c src/sys/arch/arm/pic [ad-namecache]: pic.c src/sys/arch/arm/rockchip [ad-namecache]: rk_i2s.c src/sys/arch/arm/samsung [ad-namecache]: exynos_platform.c src/sys/arch/arm/sunxi [ad-namecache]: sun4i_emac.c sun8i_crypto.c sunxi_can.c sunxi_codec.c sunxi_emac.c sunxi_i2s.c sunxi_mixer.c sunxi_nmi.c src/sys/arch/arm/ti [ad-namecache]: if_cpsw.c src/sys/arch/arm/vexpress [ad-namecache]: vexpress_platform.c src/sys/arch/arm/xscale [ad-namecache]: ixp425-fw.README ixp425_if_npe.c ixp425reg.h src/sys/arch/atari/atari [ad-namecache]: genassym.cf src/sys/arch/atari/include [ad-namecache]: vmparam.h src/sys/arch/cats/conf [ad-namecache]: GENERIC src/sys/arch/cesfic/cesfic [ad-namecache]: genassym.cf src/sys/arch/cesfic/include [ad-namecache]: vmparam.h src/sys/arch/cobalt/conf [ad-namecache]: majors.cobalt src/sys/arch/dreamcast/dev/g2 [ad-namecache]: aica.c src/sys/arch/emips/ebus [ad-namecache]: ace_ebus.c if_le_ebus.c src/sys/arch/epoc32/conf [ad-namecache]: majors.epoc32 src/sys/arch/evbarm/bcm53xx [ad-namecache]: bcm53xx_machdep.c src/sys/arch/evbarm/beagle [ad-namecache]: beagle_machdep.c src/sys/arch/evbarm/conf [ad-namecache]: GENERIC GENERIC.common GENERIC64 HDL_G HPT5325 MINI2440 MMNET_GENERIC MPCSA_GENERIC POGO RPI RPI2 SHEEVAPLUG SMDK2410 TS7200 TWINTAIL files.fdt files.rpi src/sys/arch/evbarm/fdt [ad-namecache]: fdt_machdep.c fdt_memory.c src/sys/arch/evbarm/gumstix [ad-namecache]: gumstix_machdep.c src/sys/arch/evbarm/imx7 [ad-namecache]: imx7_machdep.c src/sys/arch/evbarm/mini2440 [ad-namecache]: audio_mini2440.c src/sys/arch/evbarm/nitrogen6 [ad-namecache]: nitrogen6_machdep.c
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sun Feb 23 19:14:03 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_vnode.c Log Message: Turns out there's no point adjusting v_holdcnt with atomics. To generate a diff of this commit: cvs rdiff -u -r1.105.2.7 -r1.105.2.8 src/sys/kern/vfs_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sun Feb 23 19:14:03 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_vnode.c Log Message: Turns out there's no point adjusting v_holdcnt with atomics. To generate a diff of this commit: cvs rdiff -u -r1.105.2.7 -r1.105.2.8 src/sys/kern/vfs_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_vnode.c diff -u src/sys/kern/vfs_vnode.c:1.105.2.7 src/sys/kern/vfs_vnode.c:1.105.2.8 --- src/sys/kern/vfs_vnode.c:1.105.2.7 Sat Jan 25 22:38:51 2020 +++ src/sys/kern/vfs_vnode.c Sun Feb 23 19:14:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnode.c,v 1.105.2.7 2020/01/25 22:38:51 ad Exp $ */ +/* $NetBSD: vfs_vnode.c,v 1.105.2.8 2020/02/23 19:14:03 ad Exp $ */ /*- * Copyright (c) 1997-2011, 2019 The NetBSD Foundation, Inc. @@ -142,10 +142,10 @@ * as vput(9), routines. Common points holding references are e.g. * file openings, current working directory, mount points, etc. * - * Note on v_usecount & v_holdcnt and their locking + * Note on v_usecount and its locking * - * At nearly all points it is known that the counts could be zero, - * the vnode_t::v_interlock will be held. To change the counts away + * At nearly all points it is known that v_usecount could be zero, + * the vnode_t::v_interlock will be held. To change the count away * from zero, the interlock must be held. To change from a non-zero * value to zero, again the interlock must be held. * @@ -154,7 +154,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.105.2.7 2020/01/25 22:38:51 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.105.2.8 2020/02/23 19:14:03 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_pax.h" @@ -939,7 +939,7 @@ vholdl(vnode_t *vp) KASSERT(mutex_owned(vp->v_interlock)); - if (atomic_inc_uint_nv(>v_holdcnt) == 1 && vp->v_usecount == 0) + if (vp->v_holdcnt++ == 0 && vp->v_usecount == 0) lru_requeue(vp, lru_which(vp)); } @@ -949,17 +949,6 @@ vholdl(vnode_t *vp) void vhold(vnode_t *vp) { - int hold, next; - - for (hold = vp->v_holdcnt;; hold = next) { - if (__predict_false(hold == 0)) { - break; - } - next = atomic_cas_uint(>v_holdcnt, hold, hold + 1); - if (__predict_true(next == hold)) { - return; - } - } mutex_enter(vp->v_interlock); vholdl(vp); @@ -980,7 +969,8 @@ holdrelel(vnode_t *vp) vnpanic(vp, "%s: holdcnt vp %p", __func__, vp); } - if (atomic_dec_uint_nv(>v_holdcnt) == 0 && vp->v_usecount == 0) + vp->v_holdcnt--; + if (vp->v_holdcnt == 0 && vp->v_usecount == 0) lru_requeue(vp, lru_which(vp)); } @@ -990,18 +980,6 @@ holdrelel(vnode_t *vp) void holdrele(vnode_t *vp) { - int hold, next; - - for (hold = vp->v_holdcnt;; hold = next) { - if (__predict_false(hold == 1)) { - break; - } - KASSERT(hold > 1); - next = atomic_cas_uint(>v_holdcnt, hold, hold - 1); - if (__predict_true(next == hold)) { - return; - } - } mutex_enter(vp->v_interlock); holdrelel(vp);
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sun Feb 16 22:00:53 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: Comments. To generate a diff of this commit: cvs rdiff -u -r1.126.2.11 -r1.126.2.12 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_cache.c diff -u src/sys/kern/vfs_cache.c:1.126.2.11 src/sys/kern/vfs_cache.c:1.126.2.12 --- src/sys/kern/vfs_cache.c:1.126.2.11 Fri Jan 24 16:48:59 2020 +++ src/sys/kern/vfs_cache.c Sun Feb 16 22:00:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.126.2.11 2020/01/24 16:48:59 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.126.2.12 2020/02/16 22:00:53 ad Exp $ */ /*- * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -67,8 +67,9 @@ * reference. It is managed LRU, so frequently used names will hang * around. The cache is indexed by hash value obtained from the name. * - * The name cache (or directory name lookup cache) is the brainchild of - * Robert Elz and made its first appearance in 4.3BSD. + * The name cache is the brainchild of Robert Elz and was introduced in + * 4.3BSD. See "Using gprof to Tune the 4.2BSD Kernel", Marshall Kirk + * McKusick, May 21 1984. * * Data structures: * @@ -81,7 +82,7 @@ * The index is a red-black tree. There are no special concurrency * requirements placed on it, because it's per-directory and protected * by the namecache's per-directory locks. It should therefore not be - * difficult to experiment with other data structures. + * difficult to experiment with other types of index. * * Each cached name is stored in a struct namecache, along with a * pointer to the associated vnode (nc_vp). Names longer than a @@ -170,7 +171,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.11 2020/01/24 16:48:59 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.12 2020/02/16 22:00:53 ad Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT @@ -393,7 +394,7 @@ cache_remove(struct namecache *ncp, cons } /* - * Find a single cache entry and return it. The vnode lock must be held. + * Find a single cache entry and return it. vi_nc_lock must be held. */ static struct namecache * __noinline cache_lookup_entry(struct vnode *dvp, const char *name, size_t namelen, @@ -1239,11 +1240,10 @@ cache_deactivate(void) } /* - * Aim for a 1:1 ratio of active to inactive. It's a bit wet finger - * in the air here, but this is to allow each potential victim a - * reasonable amount of time to cycle through the inactive list in - * order to score a hit and be reactivated, while trying not to - * cause reactivations too frequently. + * Aim for a 1:1 ratio of active to inactive. This is to allow each + * potential victim a reasonable amount of time to cycle through the + * inactive list in order to score a hit and be reactivated, while + * trying not to cause reactivations too frequently. */ if (cache_lru.count[LRU_ACTIVE] < cache_lru.count[LRU_INACTIVE]) { return;
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sun Feb 16 22:00:53 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: Comments. To generate a diff of this commit: cvs rdiff -u -r1.126.2.11 -r1.126.2.12 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sat Jan 25 22:38:53 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64 [ad-namecache]: aarch64_machdep.c cpu.c locore.S start.S src/sys/arch/aarch64/conf [ad-namecache]: files.aarch64 src/sys/arch/aarch64/include [ad-namecache]: asm.h vmparam.h src/sys/arch/acorn32/conf [ad-namecache]: EB7500ATX GENERIC INSTALL LOWMEM_WSCONS NC src/sys/arch/algor/conf [ad-namecache]: P4032 P5064 P6032 src/sys/arch/alpha/alpha [ad-namecache]: pmap.c src/sys/arch/alpha/conf [ad-namecache]: GENERIC INSTALL RAWHIDE src/sys/arch/amd64/conf [ad-namecache]: ALL GENERIC MODULAR XEN3_DOM0 src/sys/arch/amd64/include [ad-namecache]: param.h vmparam.h src/sys/arch/arc/conf [ad-namecache]: ARCTIC GENERIC M403 MIMORI PICA RPC44 src/sys/arch/arm/acpi [ad-namecache]: acpi_machdep.c acpi_pci_machdep.c acpi_simplefb.c acpipchb.c src/sys/arch/arm/arm [ad-namecache]: arm_machdep.c src/sys/arch/arm/arm32 [ad-namecache]: cpu.c pmap.c src/sys/arch/arm/broadcom [ad-namecache]: bcm2835_intr.c bcm2835_vcaudio.c bcm2835_vcaudioreg.h src/sys/arch/arm/conf [ad-namecache]: files.arm src/sys/arch/arm/fdt [ad-namecache]: cpu_fdt.c src/sys/arch/arm/include [ad-namecache]: cpu.h types.h src/sys/arch/arm/include/arm32 [ad-namecache]: param.h pmap.h pte.h src/sys/arch/arm/sunxi [ad-namecache]: sun8i_crypto.c src/sys/arch/bebox/conf [ad-namecache]: GENERIC src/sys/arch/cats/conf [ad-namecache]: GENERIC INSTALL src/sys/arch/cobalt/conf [ad-namecache]: GENERIC INSTALL src/sys/arch/evbarm/bcm53xx [ad-namecache]: bcm53xx_machdep.c src/sys/arch/evbarm/beagle [ad-namecache]: beagle_machdep.c src/sys/arch/evbarm/conf [ad-namecache]: ARMADILLO-IOT-G3 ARMADILLO210 ARMADILLO9 CUBOX CUBOX-I DUOVERO GENERIC GENERIC64 GUMSTIX HDL_G HPT5325 IMX6UL-STARTER IXDP425 IYONIX LUBBOCK MARVELL_NAS MINI2440 MMNET_GENERIC MPCSA_GENERIC MV2120 OPENBLOCKS_A6 OPENBLOCKS_AX3 PEPPER RPI RPI_INSTALL SHEEVAPLUG SMDK2410 SMDK2800 TWINTAIL ZAO425 std.generic src/sys/arch/evbarm/fdt [ad-namecache]: fdt_machdep.c src/sys/arch/evbarm/gumstix [ad-namecache]: gumstix_machdep.c src/sys/arch/evbarm/imx7 [ad-namecache]: imx7_machdep.c src/sys/arch/evbarm/nitrogen6 [ad-namecache]: nitrogen6_machdep.c src/sys/arch/evbmips/conf [ad-namecache]: ADM5120 ADM5120-NB ADM5120-USB ALCHEMY AP30 CI20 DB120 ERLITE LINKITSMART7688 MALTA MERAKI RB153 RB433UAH SBMIPS WGT624V3 XLSATX src/sys/arch/evbppc/conf [ad-namecache]: EXPLORA451 OPENBLOCKS266 OPENBLOCKS266_OPT OPENBLOCKS600 PMPPC WALNUT src/sys/arch/ews4800mips/conf [ad-namecache]: GENERIC RAMDISK src/sys/arch/hpcarm/conf [ad-namecache]: IPAQ JORNADA720 JORNADA820 NETBOOKPRO WZERO3 src/sys/arch/hppa/conf [ad-namecache]: GENERIC src/sys/arch/i386/conf [ad-namecache]: ALL GENERIC GENERIC_PS2TINY GENERIC_TINY INSTALL_FLOPPY INSTALL_TINY NET4501 XEN3PAE_DOM0 src/sys/arch/i386/stand/bootxx/bootxx_msdos [ad-namecache]: Makefile src/sys/arch/i386/stand/efiboot [ad-namecache]: devopen.c src/sys/arch/ia64/conf [ad-namecache]: GENERIC.SKI src/sys/arch/iyonix/conf [ad-namecache]: GENERIC src/sys/arch/landisk/conf [ad-namecache]: GENERIC src/sys/arch/mac68k/conf [ad-namecache]: GENERIC src/sys/arch/macppc/conf [ad-namecache]: GENERIC src/sys/arch/macppc/stand/bootxx [ad-namecache]: bootxx.c src/sys/arch/mips/cavium/dev [ad-namecache]: octeon_gmx.c src/sys/arch/mipsco/conf [ad-namecache]: GENERIC RC3230 src/sys/arch/mmeye/conf [ad-namecache]: GENERIC MMEYE_WLF MMTA MMTAICE MMTAROMNEW src/sys/arch/mvmeppc/conf [ad-namecache]: GENERIC src/sys/arch/news68k/conf [ad-namecache]: GENERIC GENERIC_TINY LIBERO NEWS1200 src/sys/arch/newsmips/conf [ad-namecache]: GENERIC src/sys/arch/pmax/conf [ad-namecache]: GENERIC GENERIC64 INSTALL INSTALL64 src/sys/arch/powerpc/powerpc [ad-namecache]: lock_stubs.S src/sys/arch/prep/conf [ad-namecache]: GENERIC src/sys/arch/rs6000/conf [ad-namecache]: GENERIC src/sys/arch/sbmips/conf [ad-namecache]: GENERIC src/sys/arch/sgimips/conf [ad-namecache]: GENERIC32_IP12 GENERIC32_IP2x GENERIC32_IP3x src/sys/arch/shark/conf [ad-namecache]: GENERIC src/sys/arch/sparc/conf [ad-namecache]: GENERIC INSTALL src/sys/arch/sparc64/conf [ad-namecache]: GENERIC NONPLUS64 src/sys/arch/sparc64/include [ad-namecache]: vmparam.h src/sys/arch/sun3/include [ad-namecache]: pmap.h pmap3.h pmap3x.h
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sat Jan 25 21:45:00 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: kern_rwlock.c kern_synch.c src/sys/rump/include/rump [ad-namecache]: rump_namei.h src/sys/sys [ad-namecache]: rwlock.h Log Message: Remove unintentional differences to base. To generate a diff of this commit: cvs rdiff -u -r1.59.2.4 -r1.59.2.5 src/sys/kern/kern_rwlock.c cvs rdiff -u -r1.334.2.3 -r1.334.2.4 src/sys/kern/kern_synch.c cvs rdiff -u -r1.37.2.3 -r1.37.2.4 src/sys/rump/include/rump/rump_namei.h cvs rdiff -u -r1.12.2.2 -r1.12.2.3 src/sys/sys/rwlock.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_rwlock.c diff -u src/sys/kern/kern_rwlock.c:1.59.2.4 src/sys/kern/kern_rwlock.c:1.59.2.5 --- src/sys/kern/kern_rwlock.c:1.59.2.4 Wed Jan 22 11:40:17 2020 +++ src/sys/kern/kern_rwlock.c Sat Jan 25 21:45:00 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_rwlock.c,v 1.59.2.4 2020/01/22 11:40:17 ad Exp $ */ +/* $NetBSD: kern_rwlock.c,v 1.59.2.5 2020/01/25 21:45:00 ad Exp $ */ /*- * Copyright (c) 2002, 2006, 2007, 2008, 2009, 2019, 2020 @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.59.2.4 2020/01/22 11:40:17 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.59.2.5 2020/01/25 21:45:00 ad Exp $"); #include "opt_lockdebug.h" @@ -206,15 +206,10 @@ void _rw_init(krwlock_t *rw, uintptr_t return_address) { -#ifdef LOCKDEBUG - /* XXX only because the assembly stubs can't handle RW_NODEBUG */ if (LOCKDEBUG_ALLOC(rw, _lockops, return_address)) rw->rw_owner = 0; else rw->rw_owner = RW_NODEBUG; -#else - rw->rw_owner = 0; -#endif } void @@ -650,7 +645,7 @@ rw_downgrade(krwlock_t *rw) RW_ASSERT(rw, (rw->rw_owner & RW_HAS_WAITERS) != 0); newown = owner & RW_NODEBUG; - newown |= RW_READ_INCR | RW_HAS_WAITERS | + newown = RW_READ_INCR | RW_HAS_WAITERS | RW_WRITE_WANTED; next = rw_cas(rw, owner, newown); turnstile_exit(rw); @@ -792,26 +787,3 @@ rw_owner(wchan_t obj) return (void *)(owner & RW_THREAD); } - -/* - * rw_owner_running: - * - * Return true if a RW lock is unheld, or write held and the owner is - * running on a CPU. For the pagedaemon. - */ -bool -rw_owner_running(const krwlock_t *rw) -{ -#ifdef MULTIPROCESSOR - uintptr_t owner; - bool rv; - - kpreempt_disable(); - owner = rw->rw_owner; - rv = (owner & RW_THREAD) == 0 || rw_oncpu(owner); - kpreempt_enable(); - return rv; -#else - return rw_owner(rw) == curlwp; -#endif -} Index: src/sys/kern/kern_synch.c diff -u src/sys/kern/kern_synch.c:1.334.2.3 src/sys/kern/kern_synch.c:1.334.2.4 --- src/sys/kern/kern_synch.c:1.334.2.3 Thu Jan 23 12:17:08 2020 +++ src/sys/kern/kern_synch.c Sat Jan 25 21:45:00 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_synch.c,v 1.334.2.3 2020/01/23 12:17:08 ad Exp $ */ +/* $NetBSD: kern_synch.c,v 1.334.2.4 2020/01/25 21:45:00 ad Exp $ */ /*- * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009, 2019 @@ -69,7 +69,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.334.2.3 2020/01/23 12:17:08 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.334.2.4 2020/01/25 21:45:00 ad Exp $"); #include "opt_kstack.h" #include "opt_dtrace.h" @@ -83,7 +83,6 @@ __KERNEL_RCSID(0, "$NetBSD: kern_synch.c #include #include #include -#include #include #include #include Index: src/sys/rump/include/rump/rump_namei.h diff -u src/sys/rump/include/rump/rump_namei.h:1.37.2.3 src/sys/rump/include/rump/rump_namei.h:1.37.2.4 --- src/sys/rump/include/rump/rump_namei.h:1.37.2.3 Fri Jan 17 21:47:36 2020 +++ src/sys/rump/include/rump/rump_namei.h Sat Jan 25 21:45:00 2020 @@ -1,11 +1,11 @@ -/* $NetBSD: rump_namei.h,v 1.37.2.3 2020/01/17 21:47:36 ad Exp $ */ +/* $NetBSD: rump_namei.h,v 1.37.2.4 2020/01/25 21:45:00 ad Exp $ */ /* * WARNING: GENERATED FILE. DO NOT EDIT * (edit namei.src and run make namei in src/sys/sys) * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp - * from: NetBSD: namei.src,v 1.47.2.3 2020/01/14 11:07:40 ad Exp + * from: NetBSD: namei.src,v 1.48 2020/01/08 12:04:56 ad Exp */ #ifndef _RUMP_RUMP_NAMEI_H_ Index: src/sys/sys/rwlock.h diff -u src/sys/sys/rwlock.h:1.12.2.2 src/sys/sys/rwlock.h:1.12.2.3 --- src/sys/sys/rwlock.h:1.12.2.2 Wed Jan 22 11:40:17 2020 +++ src/sys/sys/rwlock.h Sat Jan 25 21:45:00 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: rwlock.h,v 1.12.2.2 2020/01/22 11:40:17 ad Exp $ */ +/* $NetBSD: rwlock.h,v 1.12.2.3 2020/01/25 21:45:00 ad Exp $ */ /*- * Copyright (c) 2002, 2006, 2007, 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -63,10 +63,10 @@ typedef struct krwlock krwlock_t; * WRITE_LOCKED bit is clear, then the owner field is actually a count of * the number of readers. The rw_owner field is laid out like so: * - * N 543210 - *
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sat Jan 25 21:45:00 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: kern_rwlock.c kern_synch.c src/sys/rump/include/rump [ad-namecache]: rump_namei.h src/sys/sys [ad-namecache]: rwlock.h Log Message: Remove unintentional differences to base. To generate a diff of this commit: cvs rdiff -u -r1.59.2.4 -r1.59.2.5 src/sys/kern/kern_rwlock.c cvs rdiff -u -r1.334.2.3 -r1.334.2.4 src/sys/kern/kern_synch.c cvs rdiff -u -r1.37.2.3 -r1.37.2.4 src/sys/rump/include/rump/rump_namei.h cvs rdiff -u -r1.12.2.2 -r1.12.2.3 src/sys/sys/rwlock.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sat Jan 25 18:42:24 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cwd.c Log Message: Add a missing membar to previous. To generate a diff of this commit: cvs rdiff -u -r1.4.62.1 -r1.4.62.2 src/sys/kern/vfs_cwd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sat Jan 25 18:42:24 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cwd.c Log Message: Add a missing membar to previous. To generate a diff of this commit: cvs rdiff -u -r1.4.62.1 -r1.4.62.2 src/sys/kern/vfs_cwd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_cwd.c diff -u src/sys/kern/vfs_cwd.c:1.4.62.1 src/sys/kern/vfs_cwd.c:1.4.62.2 --- src/sys/kern/vfs_cwd.c:1.4.62.1 Sat Jan 25 15:54:03 2020 +++ src/sys/kern/vfs_cwd.c Sat Jan 25 18:42:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cwd.c,v 1.4.62.1 2020/01/25 15:54:03 ad Exp $ */ +/* $NetBSD: vfs_cwd.c,v 1.4.62.2 2020/01/25 18:42:24 ad Exp $ */ /*- * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cwd.c,v 1.4.62.1 2020/01/25 15:54:03 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cwd.c,v 1.4.62.2 2020/01/25 18:42:24 ad Exp $"); #include #include @@ -183,8 +183,10 @@ cwdenter(krw_t op) * changes while the caller is pondering the cwdinfo. */ kpreempt_disable(); - if (__predict_true(mutex_owner(>cwdi_lock) == NULL)) + if (__predict_true(mutex_owner(>cwdi_lock) == NULL)) { + membar_consumer(); return cwdi; + } kpreempt_enable(); mutex_enter(>cwdi_lock); } else {
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sat Jan 25 15:54:04 UTC 2020 Modified Files: src/sys/compat/netbsd32 [ad-namecache]: netbsd32_fs.c src/sys/kern [ad-namecache]: kern_exec.c kern_proc.c uipc_usrreq.c vfs_cwd.c vfs_getcwd.c vfs_lookup.c vfs_mount.c vfs_subr.c vfs_syscalls.c vfs_vnode.c src/sys/miscfs/procfs [ad-namecache]: procfs_vnops.c src/sys/sys [ad-namecache]: filedesc.h vfs_syscalls.h Log Message: Make cwdinfo use mostly lockless, and largely hide the details in vfs_cwd.c. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.85.2.1 src/sys/compat/netbsd32/netbsd32_fs.c cvs rdiff -u -r1.485.2.1 -r1.485.2.2 src/sys/kern/kern_exec.c cvs rdiff -u -r1.239 -r1.239.2.1 src/sys/kern/kern_proc.c cvs rdiff -u -r1.194 -r1.194.4.1 src/sys/kern/uipc_usrreq.c cvs rdiff -u -r1.4 -r1.4.62.1 src/sys/kern/vfs_cwd.c cvs rdiff -u -r1.53.2.3 -r1.53.2.4 src/sys/kern/vfs_getcwd.c cvs rdiff -u -r1.212.4.8 -r1.212.4.9 src/sys/kern/vfs_lookup.c cvs rdiff -u -r1.73.2.1 -r1.73.2.2 src/sys/kern/vfs_mount.c cvs rdiff -u -r1.478.2.2 -r1.478.2.3 src/sys/kern/vfs_subr.c cvs rdiff -u -r1.539.2.2 -r1.539.2.3 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.105.2.5 -r1.105.2.6 src/sys/kern/vfs_vnode.c cvs rdiff -u -r1.207 -r1.207.2.1 src/sys/miscfs/procfs/procfs_vnops.c cvs rdiff -u -r1.65 -r1.65.2.1 src/sys/sys/filedesc.h cvs rdiff -u -r1.26 -r1.26.2.1 src/sys/sys/vfs_syscalls.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/compat/netbsd32/netbsd32_fs.c diff -u src/sys/compat/netbsd32/netbsd32_fs.c:1.85 src/sys/compat/netbsd32/netbsd32_fs.c:1.85.2.1 --- src/sys/compat/netbsd32/netbsd32_fs.c:1.85 Thu Sep 26 01:32:09 2019 +++ src/sys/compat/netbsd32/netbsd32_fs.c Sat Jan 25 15:54:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: netbsd32_fs.c,v 1.85 2019/09/26 01:32:09 christos Exp $ */ +/* $NetBSD: netbsd32_fs.c,v 1.85.2.1 2020/01/25 15:54:03 ad Exp $ */ /* * Copyright (c) 1998, 2001 Matthew R. Green @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.85 2019/09/26 01:32:09 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.85.2.1 2020/01/25 15:54:03 ad Exp $"); #include #include @@ -740,13 +740,12 @@ netbsd32___getcwd(struct lwp *l, const s syscallarg(char *) bufp; syscallarg(size_t) length; } */ - struct proc *p = l->l_proc; int error; char *path; char *bp, *bend; int len = (int)SCARG(uap, length); int lenused; - struct cwdinfo *cwdi; + struct vnode *dvp; if (len > MAXPATHLEN*4) len = MAXPATHLEN*4; @@ -764,11 +763,10 @@ netbsd32___getcwd(struct lwp *l, const s * limit it to N/2 vnodes for an N byte buffer. */ #define GETCWD_CHECK_ACCESS 0x0001 - cwdi = p->p_cwdi; - rw_enter(>cwdi_lock, RW_READER); - error = getcwd_common (cwdi->cwdi_cdir, NULL, , path, len/2, + dvp = cwdcdir(); + error = getcwd_common (dvp, NULL, , path, len/2, GETCWD_CHECK_ACCESS, l); - rw_exit(>cwdi_lock); + vrele(dvp); if (error) goto out; Index: src/sys/kern/kern_exec.c diff -u src/sys/kern/kern_exec.c:1.485.2.1 src/sys/kern/kern_exec.c:1.485.2.2 --- src/sys/kern/kern_exec.c:1.485.2.1 Fri Jan 17 21:47:35 2020 +++ src/sys/kern/kern_exec.c Sat Jan 25 15:54:03 2020 @@ -1,7 +1,7 @@ -/* $NetBSD: kern_exec.c,v 1.485.2.1 2020/01/17 21:47:35 ad Exp $ */ +/* $NetBSD: kern_exec.c,v 1.485.2.2 2020/01/25 15:54:03 ad Exp $ */ /*- - * Copyright (c) 2008, 2019 The NetBSD Foundation, Inc. + * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. * All rights reserved. * * This code is derived from software contributed to The NetBSD Foundation @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.485.2.1 2020/01/17 21:47:35 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.485.2.2 2020/01/25 15:54:03 ad Exp $"); #include "opt_exec.h" #include "opt_execfmt.h" @@ -664,7 +664,7 @@ exec_makepathbuf(struct lwp *l, const ch char *path, *bp; size_t len, tlen; int error; - struct cwdinfo *cwdi; + struct vnode *dvp; path = PNBUF_GET(); if (seg == UIO_SYSSPACE) { @@ -690,11 +690,10 @@ exec_makepathbuf(struct lwp *l, const ch memmove(bp, path, len); *(--bp) = '/'; - cwdi = l->l_proc->p_cwdi; - rw_enter(>cwdi_lock, RW_READER); - error = getcwd_common(cwdi->cwdi_cdir, NULL, , path, MAXPATHLEN / 2, + dvp = cwdcdir(); + error = getcwd_common(dvp, NULL, , path, MAXPATHLEN / 2, GETCWD_CHECK_ACCESS, l); - rw_exit(>cwdi_lock); + vrele(dvp); if (error) goto err; @@ -,6 +1110,7 @@ static void emulexec(struct lwp *l, struct exec_package *epp) { struct proc *p = l->l_proc; + struct cwdinfo *cwdi; /* The emulation root will usually have been found when we looked * for the elf interpreter (or similar), if not look now. */ @@ -1119,9 +1119,10 @@ emulexec(struct lwp *l, struct exec_pack emul_find_root(l, epp); /* Any
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sat Jan 25 15:54:04 UTC 2020 Modified Files: src/sys/compat/netbsd32 [ad-namecache]: netbsd32_fs.c src/sys/kern [ad-namecache]: kern_exec.c kern_proc.c uipc_usrreq.c vfs_cwd.c vfs_getcwd.c vfs_lookup.c vfs_mount.c vfs_subr.c vfs_syscalls.c vfs_vnode.c src/sys/miscfs/procfs [ad-namecache]: procfs_vnops.c src/sys/sys [ad-namecache]: filedesc.h vfs_syscalls.h Log Message: Make cwdinfo use mostly lockless, and largely hide the details in vfs_cwd.c. To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.85.2.1 src/sys/compat/netbsd32/netbsd32_fs.c cvs rdiff -u -r1.485.2.1 -r1.485.2.2 src/sys/kern/kern_exec.c cvs rdiff -u -r1.239 -r1.239.2.1 src/sys/kern/kern_proc.c cvs rdiff -u -r1.194 -r1.194.4.1 src/sys/kern/uipc_usrreq.c cvs rdiff -u -r1.4 -r1.4.62.1 src/sys/kern/vfs_cwd.c cvs rdiff -u -r1.53.2.3 -r1.53.2.4 src/sys/kern/vfs_getcwd.c cvs rdiff -u -r1.212.4.8 -r1.212.4.9 src/sys/kern/vfs_lookup.c cvs rdiff -u -r1.73.2.1 -r1.73.2.2 src/sys/kern/vfs_mount.c cvs rdiff -u -r1.478.2.2 -r1.478.2.3 src/sys/kern/vfs_subr.c cvs rdiff -u -r1.539.2.2 -r1.539.2.3 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.105.2.5 -r1.105.2.6 src/sys/kern/vfs_vnode.c cvs rdiff -u -r1.207 -r1.207.2.1 src/sys/miscfs/procfs/procfs_vnops.c cvs rdiff -u -r1.65 -r1.65.2.1 src/sys/sys/filedesc.h cvs rdiff -u -r1.26 -r1.26.2.1 src/sys/sys/vfs_syscalls.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/sys
Module Name:src Committed By: ad Date: Fri Jan 24 16:49:12 UTC 2020 Modified Files: src/sys/sys [ad-namecache]: namei.h Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.103.2.4 -r1.103.2.5 src/sys/sys/namei.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/namei.h diff -u src/sys/sys/namei.h:1.103.2.4 src/sys/sys/namei.h:1.103.2.5 --- src/sys/sys/namei.h:1.103.2.4 Sun Jan 19 21:24:01 2020 +++ src/sys/sys/namei.h Fri Jan 24 16:49:12 2020 @@ -1,11 +1,11 @@ -/* $NetBSD: namei.h,v 1.103.2.4 2020/01/19 21:24:01 ad Exp $ */ +/* $NetBSD: namei.h,v 1.103.2.5 2020/01/24 16:49:12 ad Exp $ */ /* * WARNING: GENERATED FILE. DO NOT EDIT * (edit namei.src and run make namei in src/sys/sys) * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp - * from: NetBSD: namei.src,v 1.47.2.5 2020/01/19 21:19:25 ad Exp + * from: NetBSD: namei.src,v 1.47.2.6 2020/01/24 16:48:59 ad Exp */ /* @@ -227,14 +227,13 @@ struct namecache { struct rb_node nc_tree; /* d red-black tree, must be first */ TAILQ_ENTRY(namecache) nc_list; /* v vp's list of cache entries */ TAILQ_ENTRY(namecache) nc_lru; /* l pseudo-lru chain */ - struct nchnode *nc_dnn; /* - nchnode of parent of name */ - struct nchnode *nc_nn; /* - nchnode the name refers to */ + struct vnode *nc_dvp; /* - vnode of parent of name */ struct vnode *nc_vp; /* - vnode the name refers to */ int64_t nc_key; /* - hash key */ int nc_lrulist; /* l which LRU list its on */ short nc_nlen; /* - length of the name */ char nc_whiteout; /* - true if a whiteout */ - char nc_name[33]; /* - segment name */ + char nc_name[41]; /* - segment name */ }; #endif @@ -305,8 +304,7 @@ int cache_revlookup(struct vnode *, stru int cache_diraccess(struct vnode *, int); void cache_enter(struct vnode *, struct vnode *, const char *, size_t, uint32_t); -void cache_set_id(struct vnode *, mode_t, uid_t, gid_t); -void cache_update_id(struct vnode *, mode_t, uid_t, gid_t); +void cache_enter_id(struct vnode *, mode_t, uid_t, gid_t); bool cache_have_id(struct vnode *); void cache_vnode_init(struct vnode * ); void cache_vnode_fini(struct vnode * ); @@ -340,8 +338,6 @@ void namecache_print(struct vnode *, voi type ncs_revhits; /* reverse-cache hits */ \ type ncs_revmiss; /* reverse-cache misses */ \ type ncs_collisions; /* hash value collisions */ \ - type ncs_active; /* active cache entries */ \ - type ncs_inactive; /* inactive cache entries */ \ type ncs_denied; /* access denied */ \ }
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Fri Jan 24 16:48:59 UTC 2020 Modified Files: src/sys/fs/tmpfs [ad-namecache]: tmpfs_subr.c tmpfs_vfsops.c src/sys/kern [ad-namecache]: vfs_cache.c src/sys/sys [ad-namecache]: namei.src src/sys/ufs/ffs [ad-namecache]: ffs_vfsops.c src/sys/ufs/ufs [ad-namecache]: ufs_vnops.c Log Message: - Put all the namecache stuff back into vnode_impl_t. - Tidy vfs_cache.c up, finish the comments. - Finalise how ID information is entered to the cache. - Handle very small/old systems. To generate a diff of this commit: cvs rdiff -u -r1.105.2.1 -r1.105.2.2 src/sys/fs/tmpfs/tmpfs_subr.c cvs rdiff -u -r1.75.2.2 -r1.75.2.3 src/sys/fs/tmpfs/tmpfs_vfsops.c cvs rdiff -u -r1.126.2.10 -r1.126.2.11 src/sys/kern/vfs_cache.c cvs rdiff -u -r1.47.2.5 -r1.47.2.6 src/sys/sys/namei.src cvs rdiff -u -r1.362.4.3 -r1.362.4.4 src/sys/ufs/ffs/ffs_vfsops.c cvs rdiff -u -r1.248.2.1 -r1.248.2.2 src/sys/ufs/ufs/ufs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/sys
Module Name:src Committed By: ad Date: Fri Jan 24 16:49:12 UTC 2020 Modified Files: src/sys/sys [ad-namecache]: namei.h Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.103.2.4 -r1.103.2.5 src/sys/sys/namei.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Fri Jan 24 16:48:59 UTC 2020 Modified Files: src/sys/fs/tmpfs [ad-namecache]: tmpfs_subr.c tmpfs_vfsops.c src/sys/kern [ad-namecache]: vfs_cache.c src/sys/sys [ad-namecache]: namei.src src/sys/ufs/ffs [ad-namecache]: ffs_vfsops.c src/sys/ufs/ufs [ad-namecache]: ufs_vnops.c Log Message: - Put all the namecache stuff back into vnode_impl_t. - Tidy vfs_cache.c up, finish the comments. - Finalise how ID information is entered to the cache. - Handle very small/old systems. To generate a diff of this commit: cvs rdiff -u -r1.105.2.1 -r1.105.2.2 src/sys/fs/tmpfs/tmpfs_subr.c cvs rdiff -u -r1.75.2.2 -r1.75.2.3 src/sys/fs/tmpfs/tmpfs_vfsops.c cvs rdiff -u -r1.126.2.10 -r1.126.2.11 src/sys/kern/vfs_cache.c cvs rdiff -u -r1.47.2.5 -r1.47.2.6 src/sys/sys/namei.src cvs rdiff -u -r1.362.4.3 -r1.362.4.4 src/sys/ufs/ffs/ffs_vfsops.c cvs rdiff -u -r1.248.2.1 -r1.248.2.2 src/sys/ufs/ufs/ufs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/tmpfs/tmpfs_subr.c diff -u src/sys/fs/tmpfs/tmpfs_subr.c:1.105.2.1 src/sys/fs/tmpfs/tmpfs_subr.c:1.105.2.2 --- src/sys/fs/tmpfs/tmpfs_subr.c:1.105.2.1 Fri Jan 17 22:26:25 2020 +++ src/sys/fs/tmpfs/tmpfs_subr.c Fri Jan 24 16:48:58 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: tmpfs_subr.c,v 1.105.2.1 2020/01/17 22:26:25 ad Exp $ */ +/* $NetBSD: tmpfs_subr.c,v 1.105.2.2 2020/01/24 16:48:58 ad Exp $ */ /* * Copyright (c) 2005-2013 The NetBSD Foundation, Inc. @@ -73,7 +73,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.105.2.1 2020/01/17 22:26:25 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.105.2.2 2020/01/24 16:48:58 ad Exp $"); #include #include @@ -148,7 +148,7 @@ tmpfs_init_vnode(struct vnode *vp, tmpfs node->tn_vnode = vp; uvm_vnp_setsize(vp, node->tn_size); KASSERT(node->tn_mode != VNOVAL); - cache_set_id(vp, node->tn_mode, node->tn_uid, node->tn_gid); + cache_enter_id(vp, node->tn_mode, node->tn_uid, node->tn_gid); } /* @@ -1039,7 +1039,7 @@ tmpfs_chmod(vnode_t *vp, mode_t mode, ka node->tn_mode = (mode & ALLPERMS); tmpfs_update(vp, TMPFS_UPDATE_CTIME); VN_KNOTE(vp, NOTE_ATTRIB); - cache_update_id(vp, node->tn_mode, node->tn_uid, node->tn_gid); + cache_enter_id(vp, node->tn_mode, node->tn_uid, node->tn_gid); return 0; } @@ -1084,7 +1084,7 @@ tmpfs_chown(vnode_t *vp, uid_t uid, gid_ node->tn_gid = gid; tmpfs_update(vp, TMPFS_UPDATE_CTIME); VN_KNOTE(vp, NOTE_ATTRIB); - cache_update_id(vp, node->tn_mode, node->tn_uid, node->tn_gid); + cache_enter_id(vp, node->tn_mode, node->tn_uid, node->tn_gid); return 0; } Index: src/sys/fs/tmpfs/tmpfs_vfsops.c diff -u src/sys/fs/tmpfs/tmpfs_vfsops.c:1.75.2.2 src/sys/fs/tmpfs/tmpfs_vfsops.c:1.75.2.3 --- src/sys/fs/tmpfs/tmpfs_vfsops.c:1.75.2.2 Sun Jan 19 21:21:54 2020 +++ src/sys/fs/tmpfs/tmpfs_vfsops.c Fri Jan 24 16:48:58 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: tmpfs_vfsops.c,v 1.75.2.2 2020/01/19 21:21:54 ad Exp $ */ +/* $NetBSD: tmpfs_vfsops.c,v 1.75.2.3 2020/01/24 16:48:58 ad Exp $ */ /* * Copyright (c) 2005, 2006, 2007 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.75.2.2 2020/01/19 21:21:54 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tmpfs_vfsops.c,v 1.75.2.3 2020/01/24 16:48:58 ad Exp $"); #include #include @@ -182,7 +182,8 @@ tmpfs_mount(struct mount *mp, const char mp->mnt_stat.f_namemax = TMPFS_MAXNAMLEN; mp->mnt_fs_bshift = PAGE_SHIFT; mp->mnt_dev_bshift = DEV_BSHIFT; - mp->mnt_iflag |= IMNT_MPSAFE | IMNT_CAN_RWTORO | IMNT_SHRLOOKUP; + mp->mnt_iflag |= IMNT_MPSAFE | IMNT_CAN_RWTORO | IMNT_SHRLOOKUP | + IMNT_NCLOOKUP; vfs_getnewfsid(mp); /* Allocate the tmpfs mount structure and fill it. */ Index: src/sys/kern/vfs_cache.c diff -u src/sys/kern/vfs_cache.c:1.126.2.10 src/sys/kern/vfs_cache.c:1.126.2.11 --- src/sys/kern/vfs_cache.c:1.126.2.10 Thu Jan 23 12:33:18 2020 +++ src/sys/kern/vfs_cache.c Fri Jan 24 16:48:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.126.2.10 2020/01/23 12:33:18 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.126.2.11 2020/01/24 16:48:59 ad Exp $ */ /*- * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -64,45 +64,46 @@ * Name caching: * * Names found by directory scans are retained in a cache for future - * reference. It is managed pseudo-LRU, so frequently used names will - * hang around. The cache is indexed by directory. + * reference. It is managed LRU, so frequently used names will hang + * around. The cache is indexed by hash value obtained from the name. * - * Background: + * The name cache (or directory name lookup cache) is the brainchild of + * Robert Elz and made its first appearance in 4.3BSD. * - * XXX add a bit of history + * Data structures: * - * Data structures - * - * Typically DNLCs use a global hash table for lookup,
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Fri Jan 24 16:05:23 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_subr.c vfs_vnode.c src/sys/miscfs/genfs [ad-namecache]: genfs_vnops.c src/sys/sys [ad-namecache]: vnode.h vnode_impl.h Log Message: vnodes: - Have own v_usecount again, don't share the uvm_object's refcount. - Cluster the members of vnode_t and vnode_impl_t in a cache-concious way. - Go back to having vi_lock directly in vnode_impl_t. - Go back to having v_usecount adjusted with atomics. - Start adjusting v_holdcnt with atomics, too. - Put all the namecache stuff back into vnode_impl_t. To generate a diff of this commit: cvs rdiff -u -r1.478.2.1 -r1.478.2.2 src/sys/kern/vfs_subr.c cvs rdiff -u -r1.105.2.4 -r1.105.2.5 src/sys/kern/vfs_vnode.c cvs rdiff -u -r1.200.2.2 -r1.200.2.3 src/sys/miscfs/genfs/genfs_vnops.c cvs rdiff -u -r1.286 -r1.286.2.1 src/sys/sys/vnode.h cvs rdiff -u -r1.19.2.4 -r1.19.2.5 src/sys/sys/vnode_impl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Fri Jan 24 16:05:37 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_lookup.c Log Message: Add a comment. To generate a diff of this commit: cvs rdiff -u -r1.212.4.7 -r1.212.4.8 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Fri Jan 24 16:05:37 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_lookup.c Log Message: Add a comment. To generate a diff of this commit: cvs rdiff -u -r1.212.4.7 -r1.212.4.8 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.212.4.7 src/sys/kern/vfs_lookup.c:1.212.4.8 --- src/sys/kern/vfs_lookup.c:1.212.4.7 Thu Jan 23 21:23:56 2020 +++ src/sys/kern/vfs_lookup.c Fri Jan 24 16:05:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.212.4.7 2020/01/23 21:23:56 ad Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.212.4.8 2020/01/24 16:05:37 ad Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.212.4.7 2020/01/23 21:23:56 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.212.4.8 2020/01/24 16:05:37 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_magiclinks.h" @@ -1324,6 +1324,7 @@ lookup_fastforward(struct namei_state *s /* Scored a hit. Negative is good too (ENOENT). */ if (foundobj == NULL) { + /* XXXAD need to handle -o union mount. */ error = ENOENT; break; }
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Fri Jan 24 16:05:23 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_subr.c vfs_vnode.c src/sys/miscfs/genfs [ad-namecache]: genfs_vnops.c src/sys/sys [ad-namecache]: vnode.h vnode_impl.h Log Message: vnodes: - Have own v_usecount again, don't share the uvm_object's refcount. - Cluster the members of vnode_t and vnode_impl_t in a cache-concious way. - Go back to having vi_lock directly in vnode_impl_t. - Go back to having v_usecount adjusted with atomics. - Start adjusting v_holdcnt with atomics, too. - Put all the namecache stuff back into vnode_impl_t. To generate a diff of this commit: cvs rdiff -u -r1.478.2.1 -r1.478.2.2 src/sys/kern/vfs_subr.c cvs rdiff -u -r1.105.2.4 -r1.105.2.5 src/sys/kern/vfs_vnode.c cvs rdiff -u -r1.200.2.2 -r1.200.2.3 src/sys/miscfs/genfs/genfs_vnops.c cvs rdiff -u -r1.286 -r1.286.2.1 src/sys/sys/vnode.h cvs rdiff -u -r1.19.2.4 -r1.19.2.5 src/sys/sys/vnode_impl.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_subr.c diff -u src/sys/kern/vfs_subr.c:1.478.2.1 src/sys/kern/vfs_subr.c:1.478.2.2 --- src/sys/kern/vfs_subr.c:1.478.2.1 Fri Jan 17 21:47:35 2020 +++ src/sys/kern/vfs_subr.c Fri Jan 24 16:05:22 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_subr.c,v 1.478.2.1 2020/01/17 21:47:35 ad Exp $ */ +/* $NetBSD: vfs_subr.c,v 1.478.2.2 2020/01/24 16:05:22 ad Exp $ */ /*- * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008, 2019 @@ -69,7 +69,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.478.2.1 2020/01/17 21:47:35 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.478.2.2 2020/01/24 16:05:22 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -,7 +,7 @@ vprint_common(struct vnode *vp, const ch vp->v_usecount, vp->v_writecount, vp->v_holdcnt); (*pr)("%ssize %" PRIx64 " writesize %" PRIx64 " numoutput %d\n", prefix, vp->v_size, vp->v_writesize, vp->v_numoutput); - (*pr)("%sdata %p lock %p\n", prefix, vp->v_data, vip->vi_lock); + (*pr)("%sdata %p lock %p\n", prefix, vp->v_data, >vi_lock); (*pr)("%sstate %s key(%p %zd)", prefix, vstate_name(vip->vi_state), vip->vi_key.vk_mount, vip->vi_key.vk_key_len); @@ -1544,7 +1544,7 @@ vfs_vnode_lock_print(void *vlock, int fu for (mp = _mountlist_next(NULL); mp; mp = _mountlist_next(mp)) { TAILQ_FOREACH(vip, >mnt_vnodelist, vi_mntvnodes) { - if (vip->vi_lock == vlock || + if (>vi_lock == vlock || VIMPL_TO_VNODE(vip)->v_interlock == vlock) vfs_vnode_print(VIMPL_TO_VNODE(vip), full, pr); } Index: src/sys/kern/vfs_vnode.c diff -u src/sys/kern/vfs_vnode.c:1.105.2.4 src/sys/kern/vfs_vnode.c:1.105.2.5 --- src/sys/kern/vfs_vnode.c:1.105.2.4 Thu Jan 23 19:28:39 2020 +++ src/sys/kern/vfs_vnode.c Fri Jan 24 16:05:22 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnode.c,v 1.105.2.4 2020/01/23 19:28:39 ad Exp $ */ +/* $NetBSD: vfs_vnode.c,v 1.105.2.5 2020/01/24 16:05:22 ad Exp $ */ /*- * Copyright (c) 1997-2011, 2019 The NetBSD Foundation, Inc. @@ -142,10 +142,19 @@ * as vput(9), routines. Common points holding references are e.g. * file openings, current working directory, mount points, etc. * + * Note on v_usecount & v_holdcnt and their locking + * + * At nearly all points it is known that the counts could be zero, + * the vnode_t::v_interlock will be held. To change the counts away + * from zero, the interlock must be held. To change from a non-zero + * value to zero, again the interlock must be held. + * + * Changing the usecount from a non-zero value to a non-zero value can + * safely be done using atomic operations, without the interlock held. */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.105.2.4 2020/01/23 19:28:39 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.105.2.5 2020/01/24 16:05:22 ad Exp $"); #include #include @@ -669,6 +678,27 @@ vdrain_thread(void *cookie) } /* + * Try to drop reference on a vnode. Abort if we are releasing the + * last reference. Note: this _must_ succeed if not the last reference. + */ +static bool +vtryrele(vnode_t *vp) +{ + u_int use, next; + + for (use = vp->v_usecount;; use = next) { + if (__predict_false(use == 1)) { + return false; + } + KASSERT(use > 1); + next = atomic_cas_uint(>v_usecount, use, use - 1); + if (__predict_true(next == use)) { + return true; + } + } +} + +/* * vput: unlock and release the reference. */ void @@ -676,7 +706,20 @@ vput(vnode_t *vp) { int lktype; - if ((vp->v_vflag & VV_LOCKSWORK) == 0) { + /* + * Do an unlocked check of v_usecount. If it looks like we're not + * about to drop the last reference, then unlock the vnode and try + * to drop the reference. If it ends up being the last reference + * after all, we dropped the lock when we shouldn't have. vrelel() + * can fix it all up. Most of the time this will all go to plan. + */ + if
CVS commit: [ad-namecache] src/sys/sys
Module Name:src Committed By: ad Date: Thu Jan 23 21:24:54 UTC 2020 Modified Files: src/sys/sys [ad-namecache]: fstypes.h Log Message: Add an IMNT_NCLOOKUP flag to indicate the FS is OK with lookup directly from cache. To generate a diff of this commit: cvs rdiff -u -r1.37.6.1 -r1.37.6.2 src/sys/sys/fstypes.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/fstypes.h diff -u src/sys/sys/fstypes.h:1.37.6.1 src/sys/sys/fstypes.h:1.37.6.2 --- src/sys/sys/fstypes.h:1.37.6.1 Sun Jan 19 21:19:25 2020 +++ src/sys/sys/fstypes.h Thu Jan 23 21:24:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: fstypes.h,v 1.37.6.1 2020/01/19 21:19:25 ad Exp $ */ +/* $NetBSD: fstypes.h,v 1.37.6.2 2020/01/23 21:24:54 ad Exp $ */ /* * Copyright (c) 1989, 1991, 1993 @@ -220,6 +220,7 @@ typedef struct fhandle fhandle_t; #define IMNT_UNMOUNT 0x0002 /* unmount in progress */ #define IMNT_WANTRDWR 0x0004 /* upgrade to read/write requested */ #define IMNT_WANTRDONLY 0x0008 /* upgrade to readonly requested */ +#define IMNT_NCLOOKUP 0x0020 /* can do lookop direct in namecache */ #define IMNT_DTYPE 0x0040 /* returns d_type fields */ #define IMNT_SHRLOOKUP 0x0080 /* can do LK_SHARED lookups */ #define IMNT_MPSAFE 0x0100 /* file system code MP safe */ @@ -274,6 +275,7 @@ typedef struct fhandle fhandle_t; "\11IMNT_MPSAFE" \ "\10IMNT_SHRLOOKUP" \ "\07IMNT_DTYPE" \ + "\06IMNT_NCLOOKUP" \ "\04IMNT_WANTRDONLY" \ "\03IMNT_WANTRDWR" \ "\02IMNT_UNMOUNT" \
CVS commit: [ad-namecache] src/sys/sys
Module Name:src Committed By: ad Date: Thu Jan 23 21:24:54 UTC 2020 Modified Files: src/sys/sys [ad-namecache]: fstypes.h Log Message: Add an IMNT_NCLOOKUP flag to indicate the FS is OK with lookup directly from cache. To generate a diff of this commit: cvs rdiff -u -r1.37.6.1 -r1.37.6.2 src/sys/sys/fstypes.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Thu Jan 23 21:23:56 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_lookup.c Log Message: Improve an assertion. To generate a diff of this commit: cvs rdiff -u -r1.212.4.6 -r1.212.4.7 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.212.4.6 src/sys/kern/vfs_lookup.c:1.212.4.7 --- src/sys/kern/vfs_lookup.c:1.212.4.6 Thu Jan 23 12:21:01 2020 +++ src/sys/kern/vfs_lookup.c Thu Jan 23 21:23:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.212.4.6 2020/01/23 12:21:01 ad Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.212.4.7 2020/01/23 21:23:56 ad Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.212.4.6 2020/01/23 12:21:01 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.212.4.7 2020/01/23 21:23:56 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_magiclinks.h" @@ -1390,7 +1390,7 @@ lookup_fastforward(struct namei_state *s rw_exit(plock); } - KASSERT(foundobj == NULL || error == 0); + KASSERT(error == 0 ? foundobj != NULL : foundobj == NULL); *foundobj_ret = foundobj; return error; }
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Thu Jan 23 21:23:56 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_lookup.c Log Message: Improve an assertion. To generate a diff of this commit: cvs rdiff -u -r1.212.4.6 -r1.212.4.7 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Thu Jan 23 19:28:39 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_vnode.c Log Message: vcache_reclaim(): purge namecache immediately after setting vnode to VS_RECLAIMED. To generate a diff of this commit: cvs rdiff -u -r1.105.2.3 -r1.105.2.4 src/sys/kern/vfs_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_vnode.c diff -u src/sys/kern/vfs_vnode.c:1.105.2.3 src/sys/kern/vfs_vnode.c:1.105.2.4 --- src/sys/kern/vfs_vnode.c:1.105.2.3 Fri Jan 17 21:55:13 2020 +++ src/sys/kern/vfs_vnode.c Thu Jan 23 19:28:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnode.c,v 1.105.2.3 2020/01/17 21:55:13 ad Exp $ */ +/* $NetBSD: vfs_vnode.c,v 1.105.2.4 2020/01/23 19:28:39 ad Exp $ */ /*- * Copyright (c) 1997-2011, 2019 The NetBSD Foundation, Inc. @@ -145,7 +145,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.105.2.3 2020/01/17 21:55:13 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.105.2.4 2020/01/23 19:28:39 ad Exp $"); #include #include @@ -1582,6 +1582,13 @@ vcache_reclaim(vnode_t *vp) vp->v_iflag &= ~(VI_TEXT|VI_EXECMAP); mutex_exit(vp->v_interlock); + /* + * With vnode state set to reclaiming, purge name cache immediately + * to prevent new handles on vnode, and wait for existing threads + * trying to get a handle to notice VS_RECLAIMED status and abort. + */ + cache_purge(vp); + /* Replace the vnode key with a temporary copy. */ if (vip->vi_key.vk_key_len > sizeof(temp_buf)) { temp_key = kmem_alloc(temp_key_len, KM_SLEEP); @@ -1635,9 +1642,6 @@ vcache_reclaim(vnode_t *vp) vp->v_ractx = NULL; } - /* Purge name cache. */ - cache_purge(vp); - if (vip->vi_key.vk_key_len > 0) { /* Remove from vnode cache. */ hash = vcache_hash(>vi_key);
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Thu Jan 23 19:28:39 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_vnode.c Log Message: vcache_reclaim(): purge namecache immediately after setting vnode to VS_RECLAIMED. To generate a diff of this commit: cvs rdiff -u -r1.105.2.3 -r1.105.2.4 src/sys/kern/vfs_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Thu Jan 23 12:33:18 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: Update comments. To generate a diff of this commit: cvs rdiff -u -r1.126.2.9 -r1.126.2.10 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_cache.c diff -u src/sys/kern/vfs_cache.c:1.126.2.9 src/sys/kern/vfs_cache.c:1.126.2.10 --- src/sys/kern/vfs_cache.c:1.126.2.9 Sun Jan 19 21:19:25 2020 +++ src/sys/kern/vfs_cache.c Thu Jan 23 12:33:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.126.2.9 2020/01/19 21:19:25 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.126.2.10 2020/01/23 12:33:18 ad Exp $ */ /*- * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -63,92 +63,104 @@ /* * Name caching: * - * Names found by directory scans are retained in a cache for future - * reference. It is managed pseudo-LRU, so frequently used names will - * hang around. Cache is indexed by directory. - * - * Upon reaching the last segment of a path, if the reference is for - * DELETE, or NOCACHE is set (rewrite), and name is located in the - * cache, it will be dropped. + * Names found by directory scans are retained in a cache for future + * reference. It is managed pseudo-LRU, so frequently used names will + * hang around. The cache is indexed by directory. * * Background: * * XXX add a bit of history * - * Data structures: + * Data structures * - * The original BSD implementation used a global hash table, which - * works very well but can cause difficulties for the CPU cache on - * modern CPUs, and concurrency headaches for the kernel hacker on - * multiprocessor systems. The global hash table is also difficult to - * size dynamically. To try and address these concerns, the focus of - * interest in this implementation is the directory itself: a - * per-directory red-black tree is used to look up names. Other than - * the choice of data structure, it works largely the same way as the - * BSD implementation. + * Typically DNLCs use a global hash table for lookup, which works very + * well but can cause challenges for the CPU cache on modern CPUs, and + * concurrency headaches for the kernel hacker. The focus of interest + * in this implementation is the directory itself: a per-directory data + * structure is used to index names. Currently this is a red-black + * tree. There are no special concurrency requirements placed on the + * index, so it should not be difficult to experiment with other + * structures. + * + * Each cached name is stored in a struct namecache, along with a + * pointer the associated vnode (nc_vp). For simplicity (and economy + * of storage), names longer than a maximum length of NCHNAMLEN are + * allocated with kmem_alloc(); they occur infrequently. Names shorter + * than this are stored directly in struct namecache. If it is a + * "negative" entry, (i.e. for a name that is known NOT to exist) the + * vnode pointer will be NULL. * - * Replacement: - * - * XXX LRU blurb. - * - * Concurrency: - * - * XXX need new blurb here - * - * See definition of "struct namecache" in src/sys/namei.src for the - * particulars. - * - * Per-CPU statistics, and "numcache" are read unlocked, since an - * approximate value is OK. We maintain uintptr_t sized per-CPU - * counters and 64-bit global counters under the theory that uintptr_t - * sized counters are less likely to be hosed by nonatomic increment. - * - * Lock order: - * - * 1) nc_dvp->vi_ncdlock - * 2) nc_dvp->vi_ncvlock - * 3) cache_lru_lock, vp->v_interlock - * - * Ugly ASCII diagram: - * - * XXX replace tabs with spaces, make less ugly + * The nchnode (XXXAD vnode) and namecache structures are connected together thusly + * (the root is at the bottom of the diagram): * * ... * ^ - * | - * -o- - * | VDIR | - * | nchnode | - * --- - * ^ - * |- nd_tree + * |- nn_tree * | - * -o- --- --- + * +o+ +-+ +-+ * | VDIR | | VCHR | | VREG | * | nchnode o-+ | nchnode o-+ | nchnode o--+ - * --- | --- | --- | + * +-+ | +-+ | +-+ | * ^ | ^ | ^ | * |- nc_nn |- nn_list |- nc_nn |- nn_list |- nc_nn| * | | | | | | - * -o- | -o- | -o- | + * +o+
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Thu Jan 23 12:33:18 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: Update comments. To generate a diff of this commit: cvs rdiff -u -r1.126.2.9 -r1.126.2.10 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Thu Jan 23 12:21:01 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_lookup.c Log Message: - Change style of new code slightly to match rest of file. - NFS lookup needs to cross mountpoint too. - Update comments. To generate a diff of this commit: cvs rdiff -u -r1.212.4.5 -r1.212.4.6 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.212.4.5 src/sys/kern/vfs_lookup.c:1.212.4.6 --- src/sys/kern/vfs_lookup.c:1.212.4.5 Wed Jan 22 12:10:46 2020 +++ src/sys/kern/vfs_lookup.c Thu Jan 23 12:21:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.212.4.5 2020/01/22 12:10:46 ad Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.212.4.6 2020/01/23 12:21:01 ad Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.212.4.5 2020/01/22 12:10:46 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.212.4.6 2020/01/23 12:21:01 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_magiclinks.h" @@ -1113,9 +1113,9 @@ lookup_once(struct namei_state *state, /* * If the file system supports VOP_LOOKUP() with a shared lock, and * we are not making any modifications (nameiop LOOKUP) or this is - * not the last component then get a shared lock LK_SHARED. Where - * we can't do fast-forwarded lookups (for example with layered file - * systems) then this is the fallback for reducing lock contention. + * not the last component then get a shared lock. Where we can't do + * fast-forwarded lookups (for example with layered file systems) + * then this is the fallback for reducing lock contention. */ if ((searchdir->v_mount->mnt_iflag & IMNT_SHRLOOKUP) != 0 && (cnp->cn_nameiop == LOOKUP || (cnp->cn_flags & ISLASTCN) == 0)) { @@ -1251,13 +1251,13 @@ done: * final vnode will have its reference count adjusted and lock taken. */ static int -lookup_fastforward(struct namei_state *state, struct vnode **searchdir, - struct vnode **foundobj) +lookup_fastforward(struct namei_state *state, struct vnode **searchdir_ret, + struct vnode **foundobj_ret) { struct componentname *cnp = state->cnp; struct nameidata *ndp = state->ndp; krwlock_t *plock; - struct vnode *vp, *origsearchdir; + struct vnode *foundobj, *searchdir; int error, error2; size_t oldpathlen; const char *oldnameptr; @@ -1268,10 +1268,12 @@ lookup_fastforward(struct namei_state *s * case we can't get vnode references and need to roll back. */ plock = NULL; - origsearchdir = *searchdir; + searchdir = *searchdir_ret; oldnameptr = cnp->cn_nameptr; oldpathlen = ndp->ni_pathlen; for (;;) { + foundobj = NULL; + /* * Get the next component name. There should be no slashes * here, and we shouldn't have looped around if we were @@ -1289,15 +1291,15 @@ lookup_fastforward(struct namei_state *s * that need to be made. Also check for missing mountpoints. */ if ((cnp->cn_flags & ISDOTDOT) != 0 || - (*searchdir)->v_mount == NULL) { + searchdir->v_mount == NULL) { error = EOPNOTSUPP; break; } /* * Can't deal with last component when modifying; this needs - * the directory vnode locked and VOP_LOOKUP() called (which - * can and does modify state, despite the name). + * searchdir locked and VOP_LOOKUP() called (which can and + * does modify state, despite the name). */ if ((cnp->cn_flags & ISLASTCN) != 0) { if (cnp->cn_nameiop != LOOKUP || @@ -1313,16 +1315,15 @@ lookup_fastforward(struct namei_state *s * ownership info for the directory, or if the user doesn't * have permission to look up files in this directory. */ - if (!cache_lookup_linked(*searchdir, cnp->cn_nameptr, - cnp->cn_namelen, , , cnp->cn_cred)) { + if (!cache_lookup_linked(searchdir, cnp->cn_nameptr, + cnp->cn_namelen, , , cnp->cn_cred)) { error = EOPNOTSUPP; break; } KASSERT(plock != NULL && rw_lock_held(plock)); /* Scored a hit. Negative is good too (ENOENT). */ - if (vp == NULL) { - *foundobj = vp; + if (foundobj == NULL) { error = ENOENT; break; } @@ -1335,15 +1336,16 @@ lookup_fastforward(struct namei_state *s * - or encountered a mount point that needs to be crossed. * - or encountered something other than a directory. */ - if ((cnp->cn_flags & ISLASTCN) != 0 || vp->v_type != VDIR || - (vp->v_type == VDIR && vp->v_mountedhere != NULL)) { - mutex_enter(vp->v_interlock); - error = vcache_tryvget(vp); + if ((cnp->cn_flags & ISLASTCN) != 0 || + foundobj->v_type != VDIR || + (foundobj->v_type == VDIR && + foundobj->v_mountedhere != NULL)) { + mutex_enter(foundobj->v_interlock); + error = vcache_tryvget(foundobj); /* v_interlock now released */ - if (error == 0) { -*foundobj =
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Thu Jan 23 12:21:01 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_lookup.c Log Message: - Change style of new code slightly to match rest of file. - NFS lookup needs to cross mountpoint too. - Update comments. To generate a diff of this commit: cvs rdiff -u -r1.212.4.5 -r1.212.4.6 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Thu Jan 23 12:17:08 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: kern_synch.c Log Message: Back out previous. To generate a diff of this commit: cvs rdiff -u -r1.334.2.2 -r1.334.2.3 src/sys/kern/kern_synch.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_synch.c diff -u src/sys/kern/kern_synch.c:1.334.2.2 src/sys/kern/kern_synch.c:1.334.2.3 --- src/sys/kern/kern_synch.c:1.334.2.2 Sun Jan 19 21:08:29 2020 +++ src/sys/kern/kern_synch.c Thu Jan 23 12:17:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_synch.c,v 1.334.2.2 2020/01/19 21:08:29 ad Exp $ */ +/* $NetBSD: kern_synch.c,v 1.334.2.3 2020/01/23 12:17:08 ad Exp $ */ /*- * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009, 2019 @@ -69,7 +69,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.334.2.2 2020/01/19 21:08:29 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.334.2.3 2020/01/23 12:17:08 ad Exp $"); #include "opt_kstack.h" #include "opt_dtrace.h" @@ -658,9 +658,6 @@ mi_switch(lwp_t *l) /* We're down to only one lock, so do debug checks. */ LOCKDEBUG_BARRIER(l->l_mutex, 1); - /* Disable spinning on any R/W locks that we hold. */ - rw_switch(); - /* Count the context switch. */ CPU_COUNT(CPU_COUNT_NSWTCH, 1); l->l_ncsw++;
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Thu Jan 23 12:17:08 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: kern_synch.c Log Message: Back out previous. To generate a diff of this commit: cvs rdiff -u -r1.334.2.2 -r1.334.2.3 src/sys/kern/kern_synch.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Wed Jan 22 12:10:46 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_lookup.c Log Message: Fast-forward through the namecache was stopping one component too soon when there was an obstacle, e.g. a mountpoint. The obstacle should be returned not the parent directory. To generate a diff of this commit: cvs rdiff -u -r1.212.4.4 -r1.212.4.5 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Wed Jan 22 12:10:46 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_lookup.c Log Message: Fast-forward through the namecache was stopping one component too soon when there was an obstacle, e.g. a mountpoint. The obstacle should be returned not the parent directory. To generate a diff of this commit: cvs rdiff -u -r1.212.4.4 -r1.212.4.5 src/sys/kern/vfs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_lookup.c diff -u src/sys/kern/vfs_lookup.c:1.212.4.4 src/sys/kern/vfs_lookup.c:1.212.4.5 --- src/sys/kern/vfs_lookup.c:1.212.4.4 Sun Jan 19 21:19:25 2020 +++ src/sys/kern/vfs_lookup.c Wed Jan 22 12:10:46 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.212.4.4 2020/01/19 21:19:25 ad Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.212.4.5 2020/01/22 12:10:46 ad Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.212.4.4 2020/01/19 21:19:25 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.212.4.5 2020/01/22 12:10:46 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_magiclinks.h" @@ -954,7 +954,11 @@ lookup_crossmount(struct namei_state *st (mp = foundobj->v_mountedhere) != NULL && (cnp->cn_flags & NOCROSSMOUNT) == 0) { KASSERTMSG(searchdir != foundobj, "same vn %p", searchdir); - /* First get the vnode stable. */ + /* + * First get the vnode stable. LK_SHARED works brilliantly + * here because almost nothing else wants to lock the + * covered vnode. + */ error = vn_lock(foundobj, LK_SHARED); if (error != 0) { vrele(foundobj); @@ -962,7 +966,7 @@ lookup_crossmount(struct namei_state *st break; } - /* Then check to see if something is still mounted there. */ + /* Then check to see if something is still mounted on it. */ if ((mp = foundobj->v_mountedhere) == NULL) { VOP_UNLOCK(foundobj); break; @@ -1109,7 +1113,9 @@ lookup_once(struct namei_state *state, /* * If the file system supports VOP_LOOKUP() with a shared lock, and * we are not making any modifications (nameiop LOOKUP) or this is - * not the last component then get a shared lock LK_SHARED. + * not the last component then get a shared lock LK_SHARED. Where + * we can't do fast-forwarded lookups (for example with layered file + * systems) then this is the fallback for reducing lock contention. */ if ((searchdir->v_mount->mnt_iflag & IMNT_SHRLOOKUP) != 0 && (cnp->cn_nameiop == LOOKUP || (cnp->cn_flags & ISLASTCN) == 0)) { @@ -1237,8 +1243,8 @@ done: /* * Parse out the first path name component that we need to to consider. * - * While doing this, attempt to use the name cache to fastforward through as - * many "easy" to find components of the path as possible. + * While doing this, attempt to use the name cache to fast-forward through + * as many "easy" to find components of the path as possible. * * We use the namecache's node locks to form a chain, and avoid as many * vnode references and locks as possible. In the ideal case, only the @@ -1280,8 +1286,7 @@ lookup_fastforward(struct namei_state *s /* * Can't deal with dotdot lookups, because it means lock * order reversal, and there are checks in lookup_once() - * that need to be made. Also check for missing mountpoints - * (XXX racy). + * that need to be made. Also check for missing mountpoints. */ if ((cnp->cn_flags & ISDOTDOT) != 0 || (*searchdir)->v_mount == NULL) { @@ -1322,8 +1327,16 @@ lookup_fastforward(struct namei_state *s break; } - /* Stop if we've reached the last component: get vnode. */ - if (cnp->cn_flags & ISLASTCN) { + /* + * Stop and get a hold on the vnode if there's something + * that can't be handled here: + * + * - we've reached the last component. + * - or encountered a mount point that needs to be crossed. + * - or encountered something other than a directory. + */ + if ((cnp->cn_flags & ISLASTCN) != 0 || vp->v_type != VDIR || + (vp->v_type == VDIR && vp->v_mountedhere != NULL)) { mutex_enter(vp->v_interlock); error = vcache_tryvget(vp); /* v_interlock now released */ @@ -1335,17 +1348,6 @@ lookup_fastforward(struct namei_state *s } /* - * Not the last component. If we found something other than - * a directory, or it's a directory with a filesystem - * mounted on it, bail out. - */ - if (vp->v_type != VDIR || vp->v_mountedhere != NULL) { - error = EOPNOTSUPP; - vp = NULL; - break; - } - - /* * Otherwise, we're still in business. Set the found VDIR * vnode as the search dir for the next component and * continue on to it. @@ -1365,9 +1367,8 @@ lookup_fastforward(struct namei_state *s mutex_enter((*searchdir)->v_interlock); error2 = vcache_tryvget(*searchdir); /* v_interlock now unheld */ - if
CVS commit: [ad-namecache] src/sys/miscfs/nullfs
Module Name:src Committed By: ad Date: Wed Jan 22 12:04:36 UTC 2020 Modified Files: src/sys/miscfs/nullfs [ad-namecache]: null_vfsops.c Log Message: Copy the IMNT_SHRLOOKUP flag from lowerrootvp's mount. To generate a diff of this commit: cvs rdiff -u -r1.96.2.1 -r1.96.2.2 src/sys/miscfs/nullfs/null_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/miscfs/nullfs
Module Name:src Committed By: ad Date: Wed Jan 22 12:04:36 UTC 2020 Modified Files: src/sys/miscfs/nullfs [ad-namecache]: null_vfsops.c Log Message: Copy the IMNT_SHRLOOKUP flag from lowerrootvp's mount. To generate a diff of this commit: cvs rdiff -u -r1.96.2.1 -r1.96.2.2 src/sys/miscfs/nullfs/null_vfsops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/miscfs/nullfs/null_vfsops.c diff -u src/sys/miscfs/nullfs/null_vfsops.c:1.96.2.1 src/sys/miscfs/nullfs/null_vfsops.c:1.96.2.2 --- src/sys/miscfs/nullfs/null_vfsops.c:1.96.2.1 Sun Jan 19 21:21:55 2020 +++ src/sys/miscfs/nullfs/null_vfsops.c Wed Jan 22 12:04:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: null_vfsops.c,v 1.96.2.1 2020/01/19 21:21:55 ad Exp $ */ +/* $NetBSD: null_vfsops.c,v 1.96.2.2 2020/01/22 12:04:36 ad Exp $ */ /* * Copyright (c) 1999 National Aeronautics & Space Administration @@ -76,7 +76,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.96.2.1 2020/01/19 21:21:55 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: null_vfsops.c,v 1.96.2.2 2020/01/22 12:04:36 ad Exp $"); #include #include @@ -140,7 +140,8 @@ nullfs_mount(struct mount *mp, const cha /* Create the mount point. */ nmp = kmem_zalloc(sizeof(struct null_mount), KM_SLEEP); mp->mnt_data = nmp; - mp->mnt_iflag |= IMNT_MPSAFE | IMNT_SHRLOOKUP; + mp->mnt_iflag |= IMNT_MPSAFE; + mp->mnt_iflag |= lowerrootvp->v_mount->mnt_iflag & IMNT_SHRLOOKUP; /* * Make sure that the mount point is sufficiently initialized
CVS commit: [ad-namecache] src/sys/miscfs/genfs
Module Name:src Committed By: ad Date: Wed Jan 22 12:00:18 UTC 2020 Modified Files: src/sys/miscfs/genfs [ad-namecache]: genfs_vnops.c Log Message: Make sure LK_UPGRADE always comes with LK_NOWAIT; dropping the lock in here is unclean and I wonder if it could screw over fstrans. To generate a diff of this commit: cvs rdiff -u -r1.200.2.1 -r1.200.2.2 src/sys/miscfs/genfs/genfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/miscfs/genfs
Module Name:src Committed By: ad Date: Wed Jan 22 12:00:18 UTC 2020 Modified Files: src/sys/miscfs/genfs [ad-namecache]: genfs_vnops.c Log Message: Make sure LK_UPGRADE always comes with LK_NOWAIT; dropping the lock in here is unclean and I wonder if it could screw over fstrans. To generate a diff of this commit: cvs rdiff -u -r1.200.2.1 -r1.200.2.2 src/sys/miscfs/genfs/genfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/miscfs/genfs/genfs_vnops.c diff -u src/sys/miscfs/genfs/genfs_vnops.c:1.200.2.1 src/sys/miscfs/genfs/genfs_vnops.c:1.200.2.2 --- src/sys/miscfs/genfs/genfs_vnops.c:1.200.2.1 Sat Jan 18 17:12:59 2020 +++ src/sys/miscfs/genfs/genfs_vnops.c Wed Jan 22 12:00:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfs_vnops.c,v 1.200.2.1 2020/01/18 17:12:59 ad Exp $ */ +/* $NetBSD: genfs_vnops.c,v 1.200.2.2 2020/01/22 12:00:18 ad Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.200.2.1 2020/01/18 17:12:59 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.200.2.2 2020/01/22 12:00:18 ad Exp $"); #include #include @@ -295,11 +295,9 @@ genfs_deadlock(void *v) if (ISSET(flags, LK_DOWNGRADE)) { rw_downgrade(vip->vi_lock); } else if (ISSET(flags, LK_UPGRADE)) { + KASSERT(ISSET(flags, LK_NOWAIT)); if (!rw_tryupgrade(vip->vi_lock)) { - if (ISSET(flags, LK_NOWAIT)) -return EBUSY; - rw_exit(vip->vi_lock); - rw_enter(vip->vi_lock, RW_WRITER); + return EBUSY; } } else if ((flags & (LK_EXCLUSIVE | LK_SHARED)) != 0) { op = (ISSET(flags, LK_EXCLUSIVE) ? RW_WRITER : RW_READER); @@ -349,11 +347,9 @@ genfs_lock(void *v) if (ISSET(flags, LK_DOWNGRADE)) { rw_downgrade(vip->vi_lock); } else if (ISSET(flags, LK_UPGRADE)) { + KASSERT(ISSET(flags, LK_NOWAIT)); if (!rw_tryupgrade(vip->vi_lock)) { - if (ISSET(flags, LK_NOWAIT)) -return EBUSY; - rw_exit(vip->vi_lock); - rw_enter(vip->vi_lock, RW_WRITER); + return EBUSY; } } else if ((flags & (LK_EXCLUSIVE | LK_SHARED)) != 0) { op = (ISSET(flags, LK_EXCLUSIVE) ? RW_WRITER : RW_READER);
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Wed Jan 22 11:40:17 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [ad-namecache]: genassym.cf lock_stubs.S src/sys/arch/amd64/include [ad-namecache]: rwlock.h src/sys/arch/i386/i386 [ad-namecache]: genassym.cf lock_stubs.S src/sys/arch/x86/include [ad-namecache]: rwlock.h src/sys/kern [ad-namecache]: kern_rwlock.c src/sys/sys [ad-namecache]: lwp.h rwlock.h Log Message: Back out previous. To generate a diff of this commit: cvs rdiff -u -r1.80.2.2 -r1.80.2.3 src/sys/arch/amd64/amd64/genassym.cf cvs rdiff -u -r1.35.2.1 -r1.35.2.2 src/sys/arch/amd64/amd64/lock_stubs.S cvs rdiff -u -r1.2.144.1 -r1.2.144.2 src/sys/arch/amd64/include/rwlock.h cvs rdiff -u -r1.117.2.2 -r1.117.2.3 src/sys/arch/i386/i386/genassym.cf cvs rdiff -u -r1.32.2.1 -r1.32.2.2 src/sys/arch/i386/i386/lock_stubs.S cvs rdiff -u -r1.6.2.1 -r1.6.2.2 src/sys/arch/x86/include/rwlock.h cvs rdiff -u -r1.59.2.3 -r1.59.2.4 src/sys/kern/kern_rwlock.c cvs rdiff -u -r1.192.2.2 -r1.192.2.3 src/sys/sys/lwp.h cvs rdiff -u -r1.12.2.1 -r1.12.2.2 src/sys/sys/rwlock.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Wed Jan 22 11:40:17 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [ad-namecache]: genassym.cf lock_stubs.S src/sys/arch/amd64/include [ad-namecache]: rwlock.h src/sys/arch/i386/i386 [ad-namecache]: genassym.cf lock_stubs.S src/sys/arch/x86/include [ad-namecache]: rwlock.h src/sys/kern [ad-namecache]: kern_rwlock.c src/sys/sys [ad-namecache]: lwp.h rwlock.h Log Message: Back out previous. To generate a diff of this commit: cvs rdiff -u -r1.80.2.2 -r1.80.2.3 src/sys/arch/amd64/amd64/genassym.cf cvs rdiff -u -r1.35.2.1 -r1.35.2.2 src/sys/arch/amd64/amd64/lock_stubs.S cvs rdiff -u -r1.2.144.1 -r1.2.144.2 src/sys/arch/amd64/include/rwlock.h cvs rdiff -u -r1.117.2.2 -r1.117.2.3 src/sys/arch/i386/i386/genassym.cf cvs rdiff -u -r1.32.2.1 -r1.32.2.2 src/sys/arch/i386/i386/lock_stubs.S cvs rdiff -u -r1.6.2.1 -r1.6.2.2 src/sys/arch/x86/include/rwlock.h cvs rdiff -u -r1.59.2.3 -r1.59.2.4 src/sys/kern/kern_rwlock.c cvs rdiff -u -r1.192.2.2 -r1.192.2.3 src/sys/sys/lwp.h cvs rdiff -u -r1.12.2.1 -r1.12.2.2 src/sys/sys/rwlock.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/genassym.cf diff -u src/sys/arch/amd64/amd64/genassym.cf:1.80.2.2 src/sys/arch/amd64/amd64/genassym.cf:1.80.2.3 --- src/sys/arch/amd64/amd64/genassym.cf:1.80.2.2 Sun Jan 19 21:08:29 2020 +++ src/sys/arch/amd64/amd64/genassym.cf Wed Jan 22 11:40:16 2020 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.80.2.2 2020/01/19 21:08:29 ad Exp $ +# $NetBSD: genassym.cf,v 1.80.2.3 2020/01/22 11:40:16 ad Exp $ # # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -78,6 +78,7 @@ include include include include +include include include include @@ -345,6 +346,15 @@ define MTX_IPL offsetof(struct kmutex, define MTX_LOCK offsetof(struct kmutex, u.s.mtxs_lock) define MTX_OWNER offsetof(struct kmutex, u.mtxa_owner) +define RW_OWNER offsetof(struct krwlock, rw_owner) +define RW_WRITE_LOCKED RW_WRITE_LOCKED +define RW_WRITE_WANTED RW_WRITE_WANTED +define RW_READ_INCR RW_READ_INCR +define RW_HAS_WAITERS RW_HAS_WAITERS +define RW_THREAD RW_THREAD +define RW_READER RW_READER +define RW_WRITER RW_WRITER + define EV_COUNT offsetof(struct evcnt, ev_count) define OPTERON_MSR_PASSCODE OPTERON_MSR_PASSCODE Index: src/sys/arch/amd64/amd64/lock_stubs.S diff -u src/sys/arch/amd64/amd64/lock_stubs.S:1.35.2.1 src/sys/arch/amd64/amd64/lock_stubs.S:1.35.2.2 --- src/sys/arch/amd64/amd64/lock_stubs.S:1.35.2.1 Sun Jan 19 21:08:29 2020 +++ src/sys/arch/amd64/amd64/lock_stubs.S Wed Jan 22 11:40:16 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lock_stubs.S,v 1.35.2.1 2020/01/19 21:08:29 ad Exp $ */ +/* $NetBSD: lock_stubs.S,v 1.35.2.2 2020/01/22 11:40:16 ad Exp $ */ /* * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -185,6 +185,126 @@ ENTRY(mutex_spin_exit) END(mutex_spin_exit) +/* + * void rw_enter(krwlock_t *rwl, krw_t op); + * + * Acquire one hold on a RW lock. + */ +ENTRY(rw_enter) + cmpl $RW_READER, %esi + jne 2f + + /* + * Reader: this is the most common case. + */ + movq (%rdi), %rax +0: + testb $(RW_WRITE_LOCKED|RW_WRITE_WANTED), %al + jnz 3f + leaq RW_READ_INCR(%rax), %rdx + LOCK + cmpxchgq %rdx, (%rdi) + jnz 1f + RET +1: + jmp 0b + + /* + * Writer: if the compare-and-set fails, don't bother retrying. + */ +2: movq CPUVAR(CURLWP), %rcx + xorq %rax, %rax + orq $RW_WRITE_LOCKED, %rcx + LOCK + cmpxchgq %rcx, (%rdi) + jnz 3f + RET +3: + jmp _C_LABEL(rw_vector_enter) +END(rw_enter) + +/* + * void rw_exit(krwlock_t *rwl); + * + * Release one hold on a RW lock. + */ +ENTRY(rw_exit) + movq (%rdi), %rax + testb $RW_WRITE_LOCKED, %al + jnz 2f + + /* + * Reader + */ +0: testb $RW_HAS_WAITERS, %al + jnz 3f + cmpq $RW_READ_INCR, %rax + jb 3f + leaq -RW_READ_INCR(%rax), %rdx + LOCK + cmpxchgq %rdx, (%rdi) + jnz 1f + ret +1: + jmp 0b + + /* + * Writer + */ +2: leaq -RW_WRITE_LOCKED(%rax), %rdx + subq CPUVAR(CURLWP), %rdx + jnz 3f + LOCK + cmpxchgq %rdx, (%rdi) + jnz 3f + ret + +3: jmp _C_LABEL(rw_vector_exit) +END(rw_exit) + +/* + * int rw_tryenter(krwlock_t *rwl, krw_t op); + * + * Try to acquire one hold on a RW lock. + */ +ENTRY(rw_tryenter) + cmpl $RW_READER, %esi + jne 2f + + /* + * Reader: this is the most common case. + */ + movq (%rdi), %rax +0: + testb $(RW_WRITE_LOCKED|RW_WRITE_WANTED), %al + jnz 4f + leaq RW_READ_INCR(%rax), %rdx + LOCK + cmpxchgq %rdx, (%rdi) + jnz 1f + movl %edx, %eax /* nonzero */ + RET +1: + jmp 0b + + /* + * Writer: if the compare-and-set fails, don't bother retrying. + */ +2: movq CPUVAR(CURLWP), %rcx + xorq %rax, %rax + orq $RW_WRITE_LOCKED, %rcx + LOCK + cmpxchgq %rcx, (%rdi) + movl $0, %eax + setz %al +3: + RET + ret +4: + xorl %eax, %eax + jmp 3b +END(rw_tryenter) + #endif /* LOCKDEBUG */ /* Index: src/sys/arch/amd64/include/rwlock.h diff -u
CVS commit: [ad-namecache] src/sys/sys
Module Name:src Committed By: ad Date: Sun Jan 19 21:24:01 UTC 2020 Modified Files: src/sys/sys [ad-namecache]: namei.h Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.103.2.3 -r1.103.2.4 src/sys/sys/namei.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/namei.h diff -u src/sys/sys/namei.h:1.103.2.3 src/sys/sys/namei.h:1.103.2.4 --- src/sys/sys/namei.h:1.103.2.3 Fri Jan 17 21:47:37 2020 +++ src/sys/sys/namei.h Sun Jan 19 21:24:01 2020 @@ -1,11 +1,11 @@ -/* $NetBSD: namei.h,v 1.103.2.3 2020/01/17 21:47:37 ad Exp $ */ +/* $NetBSD: namei.h,v 1.103.2.4 2020/01/19 21:24:01 ad Exp $ */ /* * WARNING: GENERATED FILE. DO NOT EDIT * (edit namei.src and run make namei in src/sys/sys) * by: NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp - * from: NetBSD: namei.src,v 1.47.2.3 2020/01/14 11:07:40 ad Exp + * from: NetBSD: namei.src,v 1.47.2.5 2020/01/19 21:19:25 ad Exp */ /* @@ -47,6 +47,7 @@ #ifdef _KERNEL #include +#include /* * Abstraction for a single pathname. @@ -159,13 +160,14 @@ struct nameidata { (pseudo) */ #define EMULROOTSET 0x0080 /* emulation root already in ni_erootdir */ +#define LOCKSHARED 0x0100 /* want shared locks if possible */ #define NOCHROOT 0x0100 /* no chroot on abs path lookups */ -#define MODMASK 0x01fc /* mask of operational modifiers */ +#define MODMASK 0x010001fc /* mask of operational modifiers */ /* * Namei parameter descriptors. */ -#define NOCROSSMOUNT 0x100 /* do not cross mount points */ -#define RDONLY 0x200 /* lookup with read-only semantics */ +#define NOCROSSMOUNT 0x800 /* do not cross mount points */ +#define RDONLY 0x0001000 /* lookup with read-only semantics */ #define ISDOTDOT 0x0002000 /* current component name is .. */ #define MAKEENTRY 0x0004000 /* entry is to be added to name cache */ #define ISLASTCN 0x0008000 /* this is last component of pathname */ @@ -173,7 +175,7 @@ struct nameidata { #define DOWHITEOUT 0x004 /* do whiteouts */ #define REQUIREDIR 0x008 /* must be a directory */ #define CREATEDIR 0x020 /* trailing slashes are ok */ -#define PARAMASK 0x02ee300 /* mask of parameter descriptors */ +#define PARAMASK 0x02ef800 /* mask of parameter descriptors */ /* * Initialization of a nameidata structure. @@ -209,7 +211,8 @@ struct nameidata { * * This structure describes the elements in the cache of recent names looked * up by namei. It's carefully sized to take up 128 bytes on _LP64, to make - * good use of space and the CPU caches. + * good use of space and the CPU caches; nc_name is aligned on an 8-byte + * boundary to make string comparisons cheaper. * * Field markings and their corresponding locks: * @@ -219,16 +222,19 @@ struct nameidata { * l protected by cache_lru_lock * u accesses are unlocked, no serialization applied */ +struct nchnode; struct namecache { - struct rb_node nc_node; /* d red-black tree node */ + struct rb_node nc_tree; /* d red-black tree, must be first */ + TAILQ_ENTRY(namecache) nc_list; /* v vp's list of cache entries */ TAILQ_ENTRY(namecache) nc_lru; /* l pseudo-lru chain */ - TAILQ_ENTRY(namecache) nc_vlist;/* v vp's list of cache entries */ - struct vnode *nc_dvp; /* - vnode of parent of name */ + struct nchnode *nc_dnn; /* - nchnode of parent of name */ + struct nchnode *nc_nn; /* - nchnode the name refers to */ struct vnode *nc_vp; /* - vnode the name refers to */ + int64_t nc_key; /* - hash key */ int nc_lrulist; /* l which LRU list its on */ - u_short nc_nlen; /* - length of name */ - bool nc_whiteout; /* - true if a whiteout */ - char nc_name[49]; /* - segment name */ + short nc_nlen; /* - length of the name */ + char nc_whiteout; /* - true if a whiteout */ + char nc_name[33]; /* - segment name */ }; #endif @@ -292,9 +298,16 @@ bool cache_lookup(struct vnode *, const int *, struct vnode **); bool cache_lookup_raw(struct vnode *, const char *, size_t, uint32_t, int *, struct vnode **); -int cache_revlookup(struct vnode *, struct vnode **, char **, char *); +bool cache_lookup_linked(struct vnode *, const char *, size_t, + struct vnode **, krwlock_t **, kauth_cred_t); +int cache_revlookup(struct vnode *, struct vnode **, char **, char *, + bool, int); +int cache_diraccess(struct vnode *, int); void cache_enter(struct vnode *, struct vnode *, const char *, size_t, uint32_t); +void cache_set_id(struct vnode *, mode_t, uid_t, gid_t); +void cache_update_id(struct vnode *, mode_t, uid_t, gid_t); +bool cache_have_id(struct vnode *); void cache_vnode_init(struct vnode * ); void cache_vnode_fini(struct vnode * ); void cache_cpu_init(struct cpu_info *); @@ -326,6 +339,10 @@ void namecache_print(struct vnode *, voi type ncs_2passes; /* number of times we attempt it (U) */ \
CVS commit: [ad-namecache] src/sys/sys
Module Name:src Committed By: ad Date: Sun Jan 19 21:24:01 UTC 2020 Modified Files: src/sys/sys [ad-namecache]: namei.h Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.103.2.3 -r1.103.2.4 src/sys/sys/namei.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sun Jan 19 21:23:36 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_syscalls.c vfs_vnops.c Log Message: Use LOCKLEAF in the few cases it's useful for ffs/tmpfs/nullfs. Others need to be checked. To generate a diff of this commit: cvs rdiff -u -r1.539.2.1 -r1.539.2.2 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.204.2.1 -r1.204.2.2 src/sys/kern/vfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_syscalls.c diff -u src/sys/kern/vfs_syscalls.c:1.539.2.1 src/sys/kern/vfs_syscalls.c:1.539.2.2 --- src/sys/kern/vfs_syscalls.c:1.539.2.1 Fri Jan 17 21:47:35 2020 +++ src/sys/kern/vfs_syscalls.c Sun Jan 19 21:23:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.539.2.1 2020/01/17 21:47:35 ad Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.539.2.2 2020/01/19 21:23:36 ad Exp $ */ /*- * Copyright (c) 2008, 2009, 2019 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.539.2.1 2020/01/17 21:47:35 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.539.2.2 2020/01/19 21:23:36 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_fileassoc.h" @@ -1532,7 +1532,7 @@ chdir_lookup(const char *path, int where if (error) { return error; } - NDINIT(, LOOKUP, FOLLOW | LOCKLEAF | TRYEMULROOT, pb); + NDINIT(, LOOKUP, FOLLOW | LOCKLEAF | LOCKSHARED | TRYEMULROOT, pb); if ((error = namei()) != 0) { pathbuf_destroy(pb); return error; @@ -2996,7 +2996,7 @@ do_sys_accessat(struct lwp *l, int fdat, return EINVAL; } - nd_flag = FOLLOW | LOCKLEAF | TRYEMULROOT; + nd_flag = FOLLOW | LOCKLEAF | LOCKSHARED | TRYEMULROOT; if (flags & AT_SYMLINK_NOFOLLOW) nd_flag &= ~FOLLOW; @@ -3222,7 +3222,7 @@ do_sys_readlinkat(struct lwp *l, int fda if (error) { return error; } - NDINIT(, LOOKUP, NOFOLLOW | LOCKLEAF | TRYEMULROOT, pb); + NDINIT(, LOOKUP, NOFOLLOW | LOCKLEAF | LOCKSHARED | TRYEMULROOT, pb); if ((error = fd_nameiat(l, fdat, )) != 0) { pathbuf_destroy(pb); return error; Index: src/sys/kern/vfs_vnops.c diff -u src/sys/kern/vfs_vnops.c:1.204.2.1 src/sys/kern/vfs_vnops.c:1.204.2.2 --- src/sys/kern/vfs_vnops.c:1.204.2.1 Fri Jan 17 21:47:35 2020 +++ src/sys/kern/vfs_vnops.c Sun Jan 19 21:23:36 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnops.c,v 1.204.2.1 2020/01/17 21:47:35 ad Exp $ */ +/* $NetBSD: vfs_vnops.c,v 1.204.2.2 2020/01/19 21:23:36 ad Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.204.2.1 2020/01/17 21:47:35 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnops.c,v 1.204.2.2 2020/01/19 21:23:36 ad Exp $"); #include "veriexec.h" @@ -163,7 +163,10 @@ vn_open(struct nameidata *ndp, int fmode ndp->ni_cnd.cn_flags |= FOLLOW; } else { ndp->ni_cnd.cn_nameiop = LOOKUP; - ndp->ni_cnd.cn_flags |= LOCKLEAF; + if ((fmode & O_TRUNC) == 0) /* XXXAD check nfs etc */ + ndp->ni_cnd.cn_flags |= LOCKLEAF | LOCKSHARED; + else + ndp->ni_cnd.cn_flags |= LOCKLEAF; if ((fmode & O_NOFOLLOW) == 0) ndp->ni_cnd.cn_flags |= FOLLOW; }
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sun Jan 19 21:23:36 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_syscalls.c vfs_vnops.c Log Message: Use LOCKLEAF in the few cases it's useful for ffs/tmpfs/nullfs. Others need to be checked. To generate a diff of this commit: cvs rdiff -u -r1.539.2.1 -r1.539.2.2 src/sys/kern/vfs_syscalls.c cvs rdiff -u -r1.204.2.1 -r1.204.2.2 src/sys/kern/vfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sun Jan 19 21:21:56 UTC 2020 Modified Files: src/sys/fs/cd9660 [ad-namecache]: cd9660_lookup.c cd9660_vfsops.c src/sys/fs/msdosfs [ad-namecache]: msdosfs_lookup.c msdosfs_vfsops.c src/sys/fs/tmpfs [ad-namecache]: tmpfs_vfsops.c src/sys/miscfs/genfs [ad-namecache]: layer_vnops.c src/sys/miscfs/nullfs [ad-namecache]: null_vfsops.c src/sys/miscfs/procfs [ad-namecache]: procfs_vfsops.c src/sys/ufs/chfs [ad-namecache]: chfs_vnops.c src/sys/ufs/ext2fs [ad-namecache]: ext2fs_lookup.c ext2fs_vfsops.c src/sys/ufs/ffs [ad-namecache]: ffs_vfsops.c src/sys/ufs/lfs [ad-namecache]: lfs_vfsops.c ulfs_lookup.c src/sys/ufs/ufs [ad-namecache]: ufs_lookup.c Log Message: Set IMNT_SHRLOOKUP and use it for the in-cache case. Need to check what more can be done with tmpfs though, it can probably do the whole lookup. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.30.24.1 src/sys/fs/cd9660/cd9660_lookup.c cvs rdiff -u -r1.93.18.1 -r1.93.18.2 src/sys/fs/cd9660/cd9660_vfsops.c cvs rdiff -u -r1.35 -r1.35.24.1 src/sys/fs/msdosfs/msdosfs_lookup.c cvs rdiff -u -r1.130.6.1 -r1.130.6.2 src/sys/fs/msdosfs/msdosfs_vfsops.c cvs rdiff -u -r1.75.2.1 -r1.75.2.2 src/sys/fs/tmpfs/tmpfs_vfsops.c cvs rdiff -u -r1.67 -r1.67.12.1 src/sys/miscfs/genfs/layer_vnops.c cvs rdiff -u -r1.96 -r1.96.2.1 src/sys/miscfs/nullfs/null_vfsops.c cvs rdiff -u -r1.101.6.1 -r1.101.6.2 src/sys/miscfs/procfs/procfs_vfsops.c cvs rdiff -u -r1.34.4.1 -r1.34.4.2 src/sys/ufs/chfs/chfs_vnops.c cvs rdiff -u -r1.88 -r1.88.22.1 src/sys/ufs/ext2fs/ext2fs_lookup.c cvs rdiff -u -r1.214.4.1 -r1.214.4.2 src/sys/ufs/ext2fs/ext2fs_vfsops.c cvs rdiff -u -r1.362.4.2 -r1.362.4.3 src/sys/ufs/ffs/ffs_vfsops.c cvs rdiff -u -r1.367.2.1 -r1.367.2.2 src/sys/ufs/lfs/lfs_vfsops.c cvs rdiff -u -r1.41 -r1.41.12.1 src/sys/ufs/lfs/ulfs_lookup.c cvs rdiff -u -r1.150 -r1.150.4.1 src/sys/ufs/ufs/ufs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/fs/cd9660/cd9660_lookup.c diff -u src/sys/fs/cd9660/cd9660_lookup.c:1.30 src/sys/fs/cd9660/cd9660_lookup.c:1.30.24.1 --- src/sys/fs/cd9660/cd9660_lookup.c:1.30 Sat Mar 28 19:24:05 2015 +++ src/sys/fs/cd9660/cd9660_lookup.c Sun Jan 19 21:21:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_lookup.c,v 1.30 2015/03/28 19:24:05 maxv Exp $ */ +/* $NetBSD: cd9660_lookup.c,v 1.30.24.1 2020/01/19 21:21:54 ad Exp $ */ /*- * Copyright (c) 1989, 1993, 1994 @@ -39,7 +39,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cd9660_lookup.c,v 1.30 2015/03/28 19:24:05 maxv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cd9660_lookup.c,v 1.30.24.1 2020/01/19 21:21:54 ad Exp $"); #include #include @@ -152,6 +152,9 @@ cd9660_lookup(void *v) cnp->cn_nameiop, cnp->cn_flags, NULL, vpp)) { return *vpp == NULLVP ? ENOENT : 0; } + /* May need to restart the lookup with an exclusive lock. */ + if (VOP_ISLOCKED(vdp) != LK_EXCLUSIVE) + return ENOLCK; len = cnp->cn_namelen; name = cnp->cn_nameptr; Index: src/sys/fs/cd9660/cd9660_vfsops.c diff -u src/sys/fs/cd9660/cd9660_vfsops.c:1.93.18.1 src/sys/fs/cd9660/cd9660_vfsops.c:1.93.18.2 --- src/sys/fs/cd9660/cd9660_vfsops.c:1.93.18.1 Fri Jan 17 21:47:33 2020 +++ src/sys/fs/cd9660/cd9660_vfsops.c Sun Jan 19 21:21:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: cd9660_vfsops.c,v 1.93.18.1 2020/01/17 21:47:33 ad Exp $ */ +/* $NetBSD: cd9660_vfsops.c,v 1.93.18.2 2020/01/19 21:21:54 ad Exp $ */ /*- * Copyright (c) 1994 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.93.18.1 2020/01/17 21:47:33 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cd9660_vfsops.c,v 1.93.18.2 2020/01/19 21:21:54 ad Exp $"); #if defined(_KERNEL_OPT) #include "opt_compat_netbsd.h" @@ -444,7 +444,7 @@ iso_mountfs(struct vnode *devvp, struct mp->mnt_stat.f_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0]; mp->mnt_stat.f_namemax = ISO_MAXNAMLEN; mp->mnt_flag |= MNT_LOCAL; - mp->mnt_iflag |= IMNT_MPSAFE; + mp->mnt_iflag |= IMNT_MPSAFE | IMNT_SHRLOOKUP; mp->mnt_dev_bshift = iso_bsize; mp->mnt_fs_bshift = isomp->im_bshift; isomp->im_mountp = mp; Index: src/sys/fs/msdosfs/msdosfs_lookup.c diff -u src/sys/fs/msdosfs/msdosfs_lookup.c:1.35 src/sys/fs/msdosfs/msdosfs_lookup.c:1.35.24.1 --- src/sys/fs/msdosfs/msdosfs_lookup.c:1.35 Sat Jan 30 09:59:27 2016 +++ src/sys/fs/msdosfs/msdosfs_lookup.c Sun Jan 19 21:21:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_lookup.c,v 1.35 2016/01/30 09:59:27 mlelstv Exp $ */ +/* $NetBSD: msdosfs_lookup.c,v 1.35.24.1 2020/01/19 21:21:54 ad Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -52,7 +52,7 @@ #endif #include -__KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.35 2016/01/30 09:59:27 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_lookup.c,v 1.35.24.1 2020/01/19 21:21:54 ad Exp $"); #include @@ -161,6
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sun Jan 19 21:21:56 UTC 2020 Modified Files: src/sys/fs/cd9660 [ad-namecache]: cd9660_lookup.c cd9660_vfsops.c src/sys/fs/msdosfs [ad-namecache]: msdosfs_lookup.c msdosfs_vfsops.c src/sys/fs/tmpfs [ad-namecache]: tmpfs_vfsops.c src/sys/miscfs/genfs [ad-namecache]: layer_vnops.c src/sys/miscfs/nullfs [ad-namecache]: null_vfsops.c src/sys/miscfs/procfs [ad-namecache]: procfs_vfsops.c src/sys/ufs/chfs [ad-namecache]: chfs_vnops.c src/sys/ufs/ext2fs [ad-namecache]: ext2fs_lookup.c ext2fs_vfsops.c src/sys/ufs/ffs [ad-namecache]: ffs_vfsops.c src/sys/ufs/lfs [ad-namecache]: lfs_vfsops.c ulfs_lookup.c src/sys/ufs/ufs [ad-namecache]: ufs_lookup.c Log Message: Set IMNT_SHRLOOKUP and use it for the in-cache case. Need to check what more can be done with tmpfs though, it can probably do the whole lookup. To generate a diff of this commit: cvs rdiff -u -r1.30 -r1.30.24.1 src/sys/fs/cd9660/cd9660_lookup.c cvs rdiff -u -r1.93.18.1 -r1.93.18.2 src/sys/fs/cd9660/cd9660_vfsops.c cvs rdiff -u -r1.35 -r1.35.24.1 src/sys/fs/msdosfs/msdosfs_lookup.c cvs rdiff -u -r1.130.6.1 -r1.130.6.2 src/sys/fs/msdosfs/msdosfs_vfsops.c cvs rdiff -u -r1.75.2.1 -r1.75.2.2 src/sys/fs/tmpfs/tmpfs_vfsops.c cvs rdiff -u -r1.67 -r1.67.12.1 src/sys/miscfs/genfs/layer_vnops.c cvs rdiff -u -r1.96 -r1.96.2.1 src/sys/miscfs/nullfs/null_vfsops.c cvs rdiff -u -r1.101.6.1 -r1.101.6.2 src/sys/miscfs/procfs/procfs_vfsops.c cvs rdiff -u -r1.34.4.1 -r1.34.4.2 src/sys/ufs/chfs/chfs_vnops.c cvs rdiff -u -r1.88 -r1.88.22.1 src/sys/ufs/ext2fs/ext2fs_lookup.c cvs rdiff -u -r1.214.4.1 -r1.214.4.2 src/sys/ufs/ext2fs/ext2fs_vfsops.c cvs rdiff -u -r1.362.4.2 -r1.362.4.3 src/sys/ufs/ffs/ffs_vfsops.c cvs rdiff -u -r1.367.2.1 -r1.367.2.2 src/sys/ufs/lfs/lfs_vfsops.c cvs rdiff -u -r1.41 -r1.41.12.1 src/sys/ufs/lfs/ulfs_lookup.c cvs rdiff -u -r1.150 -r1.150.4.1 src/sys/ufs/ufs/ufs_lookup.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sun Jan 19 21:19:25 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c vfs_getcwd.c vfs_lookup.c src/sys/sys [ad-namecache]: fstypes.h namei.src Log Message: - Add a LOCKSHARED flag to namei (matching FreeBSD) indicating that we want the leaf locked with LK_SHARED. - Add an IMNT_SHRLOOKUP flag to struct mount indicating that the file system can do VOP_LOOKUP() with an shared lock. If it encounters something tricky, VOP_LOOKUP() is free to return ENOLCK and namei() will retry the lookup with an exclusive lock. If the file system has this flag set, namei() will try with shared locks for all of the "read only" lookups, i.e. nameiop=LOOKUP or !ISLASTCN. - vfs_getcwd: only take vnode locks when really needed, take shared locks if possible, and where the namecache has identify info for the directories, do it all in the namecache. - vfs_lookup: when crossing mountpoints take only a shared lock on the covered vnode; don't need anything else. To generate a diff of this commit: cvs rdiff -u -r1.126.2.8 -r1.126.2.9 src/sys/kern/vfs_cache.c cvs rdiff -u -r1.53.2.2 -r1.53.2.3 src/sys/kern/vfs_getcwd.c cvs rdiff -u -r1.212.4.3 -r1.212.4.4 src/sys/kern/vfs_lookup.c cvs rdiff -u -r1.37 -r1.37.6.1 src/sys/sys/fstypes.h cvs rdiff -u -r1.47.2.4 -r1.47.2.5 src/sys/sys/namei.src Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sun Jan 19 21:19:25 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c vfs_getcwd.c vfs_lookup.c src/sys/sys [ad-namecache]: fstypes.h namei.src Log Message: - Add a LOCKSHARED flag to namei (matching FreeBSD) indicating that we want the leaf locked with LK_SHARED. - Add an IMNT_SHRLOOKUP flag to struct mount indicating that the file system can do VOP_LOOKUP() with an shared lock. If it encounters something tricky, VOP_LOOKUP() is free to return ENOLCK and namei() will retry the lookup with an exclusive lock. If the file system has this flag set, namei() will try with shared locks for all of the "read only" lookups, i.e. nameiop=LOOKUP or !ISLASTCN. - vfs_getcwd: only take vnode locks when really needed, take shared locks if possible, and where the namecache has identify info for the directories, do it all in the namecache. - vfs_lookup: when crossing mountpoints take only a shared lock on the covered vnode; don't need anything else. To generate a diff of this commit: cvs rdiff -u -r1.126.2.8 -r1.126.2.9 src/sys/kern/vfs_cache.c cvs rdiff -u -r1.53.2.2 -r1.53.2.3 src/sys/kern/vfs_getcwd.c cvs rdiff -u -r1.212.4.3 -r1.212.4.4 src/sys/kern/vfs_lookup.c cvs rdiff -u -r1.37 -r1.37.6.1 src/sys/sys/fstypes.h cvs rdiff -u -r1.47.2.4 -r1.47.2.5 src/sys/sys/namei.src Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_cache.c diff -u src/sys/kern/vfs_cache.c:1.126.2.8 src/sys/kern/vfs_cache.c:1.126.2.9 --- src/sys/kern/vfs_cache.c:1.126.2.8 Sat Jan 18 17:16:20 2020 +++ src/sys/kern/vfs_cache.c Sun Jan 19 21:19:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.126.2.8 2020/01/18 17:16:20 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.126.2.9 2020/01/19 21:19:25 ad Exp $ */ /*- * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -148,7 +148,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.8 2020/01/18 17:16:20 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.9 2020/01/19 21:19:25 ad Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT @@ -326,11 +326,15 @@ cache_key(const char *name, size_t nlen) KASSERT(nlen <= USHRT_MAX); key = hash32_buf(name, nlen, HASH32_STR_INIT); - return (key << 16) | nlen; + return (key << 32) | nlen; } /* - * Like memcmp() but tuned for small strings of equal length. + * Like bcmp() but tuned for the use case here which is: + * + * - always of equal length both sides + * - almost always the same string both sides + * - small strings */ static inline int cache_namecmp(struct namecache *nc, const char *name, size_t namelen) @@ -743,7 +747,8 @@ cache_lookup_linked(struct vnode *dvp, c * Returns 0 on success, -1 on cache miss, positive errno on failure. */ int -cache_revlookup(struct vnode *vp, struct vnode **dvpp, char **bpp, char *bufp) +cache_revlookup(struct vnode *vp, struct vnode **dvpp, char **bpp, char *bufp, +bool checkaccess, int perms) { struct nchnode *nn = VNODE_TO_VIMPL(vp)->vi_ncache; struct namecache *nc; @@ -757,6 +762,27 @@ cache_revlookup(struct vnode *vp, struct goto out; rw_enter(>nn_listlock, RW_READER); + if (checkaccess) { + /* + * Check if the user is allowed to see. NOTE: this is + * checking for access on the "wrong" directory. getcwd() + * wants to see that there is access on every component + * along the way, not that there is access to any individual + * component. + */ + KASSERT(nn->nn_mode != VNOVAL && nn->nn_uid != VNOVAL && + nn->nn_gid != VNOVAL); + error = kauth_authorize_vnode(curlwp->l_cred, + KAUTH_ACCESS_ACTION(VEXEC, vp->v_type, nn->nn_mode & + ALLPERMS), vp, NULL, genfs_can_access(vp->v_type, + nn->nn_mode & ALLPERMS, nn->nn_uid, nn->nn_gid, + perms, curlwp->l_cred)); + if (error != 0) { + rw_exit(>nn_listlock); + COUNT(ncs_denied); + return EACCES; + } + } TAILQ_FOREACH(nc, >nn_list, nc_list) { KASSERT(nc->nc_nn == nn); KASSERT(nc->nc_dnn != NULL); @@ -931,12 +957,14 @@ cache_set_id(struct vnode *dvp, mode_t m if (dvp->v_type == VDIR) { rw_enter(>nn_lock, RW_WRITER); + rw_enter(>nn_listlock, RW_WRITER); KASSERT(nn->nn_mode == VNOVAL); KASSERT(nn->nn_uid == VNOVAL); KASSERT(nn->nn_gid == VNOVAL); nn->nn_mode = mode; nn->nn_uid = uid; nn->nn_gid = gid; + rw_exit(>nn_listlock); rw_exit(>nn_lock); } } @@ -953,16 +981,30 @@ cache_update_id(struct vnode *dvp, mode_ if (dvp->v_type == VDIR) { rw_enter(>nn_lock, RW_WRITER); + rw_enter(>nn_listlock, RW_WRITER); if (nn->nn_mode != VNOVAL) { nn->nn_mode = mode; nn->nn_uid = uid; nn->nn_gid = gid; } + rw_exit(>nn_listlock); rw_exit(>nn_lock); } } /* + * Return true if we have identity for the given vnode. + */ +bool +cache_have_id(struct vnode *dvp) +{ + struct nchnode *nn =
CVS commit: [ad-namecache] src/sys/arch
Module Name:src Committed By: ad Date: Sun Jan 19 21:11:00 UTC 2020 Modified Files: src/sys/arch/amd64/include [ad-namecache]: rwlock.h src/sys/arch/i386/include [ad-namecache]: rwlock.h src/sys/arch/x86/include [ad-namecache]: rwlock.h Log Message: empty these; remove later. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.2.144.1 src/sys/arch/amd64/include/rwlock.h cvs rdiff -u -r1.2 -r1.2.144.1 src/sys/arch/i386/include/rwlock.h cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/x86/include/rwlock.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/include/rwlock.h diff -u src/sys/arch/amd64/include/rwlock.h:1.2 src/sys/arch/amd64/include/rwlock.h:1.2.144.1 --- src/sys/arch/amd64/include/rwlock.h:1.2 Fri Feb 9 21:55:01 2007 +++ src/sys/arch/amd64/include/rwlock.h Sun Jan 19 21:11:00 2020 @@ -1,3 +0,0 @@ -/* $NetBSD: rwlock.h,v 1.2 2007/02/09 21:55:01 ad Exp $ */ - -#include Index: src/sys/arch/i386/include/rwlock.h diff -u src/sys/arch/i386/include/rwlock.h:1.2 src/sys/arch/i386/include/rwlock.h:1.2.144.1 --- src/sys/arch/i386/include/rwlock.h:1.2 Fri Feb 9 21:55:05 2007 +++ src/sys/arch/i386/include/rwlock.h Sun Jan 19 21:10:59 2020 @@ -1,3 +0,0 @@ -/* $NetBSD: rwlock.h,v 1.2 2007/02/09 21:55:05 ad Exp $ */ - -#include Index: src/sys/arch/x86/include/rwlock.h diff -u src/sys/arch/x86/include/rwlock.h:1.6 src/sys/arch/x86/include/rwlock.h:1.6.2.1 --- src/sys/arch/x86/include/rwlock.h:1.6 Fri Nov 29 20:04:54 2019 +++ src/sys/arch/x86/include/rwlock.h Sun Jan 19 21:11:00 2020 @@ -1,37 +0,0 @@ -/* $NetBSD: rwlock.h,v 1.6 2019/11/29 20:04:54 riastradh Exp $ */ - -/*- - * Copyright (c) 2002, 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe and Andrew Doran. - * - * 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. - * - * 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. - */ - -#ifndef _X86_RWLOCK_H_ -#define _X86_RWLOCK_H_ - -#define __HAVE_RW_STUBS 1 - -#endif /* _X86_RWLOCK_H_ */
CVS commit: [ad-namecache] src/sys/arch
Module Name:src Committed By: ad Date: Sun Jan 19 21:11:00 UTC 2020 Modified Files: src/sys/arch/amd64/include [ad-namecache]: rwlock.h src/sys/arch/i386/include [ad-namecache]: rwlock.h src/sys/arch/x86/include [ad-namecache]: rwlock.h Log Message: empty these; remove later. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.2.144.1 src/sys/arch/amd64/include/rwlock.h cvs rdiff -u -r1.2 -r1.2.144.1 src/sys/arch/i386/include/rwlock.h cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/x86/include/rwlock.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sun Jan 19 21:08:30 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [ad-namecache]: genassym.cf lock_stubs.S src/sys/arch/i386/i386 [ad-namecache]: genassym.cf lock_stubs.S src/sys/kern [ad-namecache]: kern_rwlock.c kern_synch.c src/sys/sys [ad-namecache]: lwp.h Log Message: Adaptive rwlocks proposed on tech-kern and working well on this branch with vnode locks. To generate a diff of this commit: cvs rdiff -u -r1.80.2.1 -r1.80.2.2 src/sys/arch/amd64/amd64/genassym.cf cvs rdiff -u -r1.35 -r1.35.2.1 src/sys/arch/amd64/amd64/lock_stubs.S cvs rdiff -u -r1.117.2.1 -r1.117.2.2 src/sys/arch/i386/i386/genassym.cf cvs rdiff -u -r1.32 -r1.32.2.1 src/sys/arch/i386/i386/lock_stubs.S cvs rdiff -u -r1.59.2.2 -r1.59.2.3 src/sys/kern/kern_rwlock.c cvs rdiff -u -r1.334.2.1 -r1.334.2.2 src/sys/kern/kern_synch.c cvs rdiff -u -r1.192.2.1 -r1.192.2.2 src/sys/sys/lwp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/amd64/amd64/genassym.cf diff -u src/sys/arch/amd64/amd64/genassym.cf:1.80.2.1 src/sys/arch/amd64/amd64/genassym.cf:1.80.2.2 --- src/sys/arch/amd64/amd64/genassym.cf:1.80.2.1 Fri Jan 17 21:47:22 2020 +++ src/sys/arch/amd64/amd64/genassym.cf Sun Jan 19 21:08:29 2020 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.80.2.1 2020/01/17 21:47:22 ad Exp $ +# $NetBSD: genassym.cf,v 1.80.2.2 2020/01/19 21:08:29 ad Exp $ # # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -78,7 +78,6 @@ include include include include -include include include include @@ -346,15 +345,6 @@ define MTX_IPL offsetof(struct kmutex, define MTX_LOCK offsetof(struct kmutex, u.s.mtxs_lock) define MTX_OWNER offsetof(struct kmutex, u.mtxa_owner) -define RW_OWNER offsetof(struct krwlock, rw_owner) -define RW_WRITE_LOCKED RW_WRITE_LOCKED -define RW_WRITE_WANTED RW_WRITE_WANTED -define RW_READ_INCR RW_READ_INCR -define RW_HAS_WAITERS RW_HAS_WAITERS -define RW_THREAD RW_THREAD -define RW_READER RW_READER -define RW_WRITER RW_WRITER - define EV_COUNT offsetof(struct evcnt, ev_count) define OPTERON_MSR_PASSCODE OPTERON_MSR_PASSCODE Index: src/sys/arch/amd64/amd64/lock_stubs.S diff -u src/sys/arch/amd64/amd64/lock_stubs.S:1.35 src/sys/arch/amd64/amd64/lock_stubs.S:1.35.2.1 --- src/sys/arch/amd64/amd64/lock_stubs.S:1.35 Sun Dec 8 20:00:56 2019 +++ src/sys/arch/amd64/amd64/lock_stubs.S Sun Jan 19 21:08:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lock_stubs.S,v 1.35 2019/12/08 20:00:56 ad Exp $ */ +/* $NetBSD: lock_stubs.S,v 1.35.2.1 2020/01/19 21:08:29 ad Exp $ */ /* * Copyright (c) 2006, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -185,126 +185,6 @@ ENTRY(mutex_spin_exit) END(mutex_spin_exit) -/* - * void rw_enter(krwlock_t *rwl, krw_t op); - * - * Acquire one hold on a RW lock. - */ -ENTRY(rw_enter) - cmpl $RW_READER, %esi - jne 2f - - /* - * Reader: this is the most common case. - */ - movq (%rdi), %rax -0: - testb $(RW_WRITE_LOCKED|RW_WRITE_WANTED), %al - jnz 3f - leaq RW_READ_INCR(%rax), %rdx - LOCK - cmpxchgq %rdx, (%rdi) - jnz 1f - RET -1: - jmp 0b - - /* - * Writer: if the compare-and-set fails, don't bother retrying. - */ -2: movq CPUVAR(CURLWP), %rcx - xorq %rax, %rax - orq $RW_WRITE_LOCKED, %rcx - LOCK - cmpxchgq %rcx, (%rdi) - jnz 3f - RET -3: - jmp _C_LABEL(rw_vector_enter) -END(rw_enter) - -/* - * void rw_exit(krwlock_t *rwl); - * - * Release one hold on a RW lock. - */ -ENTRY(rw_exit) - movq (%rdi), %rax - testb $RW_WRITE_LOCKED, %al - jnz 2f - - /* - * Reader - */ -0: testb $RW_HAS_WAITERS, %al - jnz 3f - cmpq $RW_READ_INCR, %rax - jb 3f - leaq -RW_READ_INCR(%rax), %rdx - LOCK - cmpxchgq %rdx, (%rdi) - jnz 1f - ret -1: - jmp 0b - - /* - * Writer - */ -2: leaq -RW_WRITE_LOCKED(%rax), %rdx - subq CPUVAR(CURLWP), %rdx - jnz 3f - LOCK - cmpxchgq %rdx, (%rdi) - jnz 3f - ret - -3: jmp _C_LABEL(rw_vector_exit) -END(rw_exit) - -/* - * int rw_tryenter(krwlock_t *rwl, krw_t op); - * - * Try to acquire one hold on a RW lock. - */ -ENTRY(rw_tryenter) - cmpl $RW_READER, %esi - jne 2f - - /* - * Reader: this is the most common case. - */ - movq (%rdi), %rax -0: - testb $(RW_WRITE_LOCKED|RW_WRITE_WANTED), %al - jnz 4f - leaq RW_READ_INCR(%rax), %rdx - LOCK - cmpxchgq %rdx, (%rdi) - jnz 1f - movl %edx, %eax /* nonzero */ - RET -1: - jmp 0b - - /* - * Writer: if the compare-and-set fails, don't bother retrying. - */ -2: movq CPUVAR(CURLWP), %rcx - xorq %rax, %rax - orq $RW_WRITE_LOCKED, %rcx - LOCK - cmpxchgq %rcx, (%rdi) - movl $0, %eax - setz %al -3: - RET - ret -4: - xorl %eax, %eax - jmp 3b -END(rw_tryenter) - #endif /* LOCKDEBUG */ /* Index: src/sys/arch/i386/i386/genassym.cf diff -u src/sys/arch/i386/i386/genassym.cf:1.117.2.1 src/sys/arch/i386/i386/genassym.cf:1.117.2.2 --- src/sys/arch/i386/i386/genassym.cf:1.117.2.1 Fri Jan 17 21:47:25 2020 +++ src/sys/arch/i386/i386/genassym.cf Sun
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sun Jan 19 21:08:30 UTC 2020 Modified Files: src/sys/arch/amd64/amd64 [ad-namecache]: genassym.cf lock_stubs.S src/sys/arch/i386/i386 [ad-namecache]: genassym.cf lock_stubs.S src/sys/kern [ad-namecache]: kern_rwlock.c kern_synch.c src/sys/sys [ad-namecache]: lwp.h Log Message: Adaptive rwlocks proposed on tech-kern and working well on this branch with vnode locks. To generate a diff of this commit: cvs rdiff -u -r1.80.2.1 -r1.80.2.2 src/sys/arch/amd64/amd64/genassym.cf cvs rdiff -u -r1.35 -r1.35.2.1 src/sys/arch/amd64/amd64/lock_stubs.S cvs rdiff -u -r1.117.2.1 -r1.117.2.2 src/sys/arch/i386/i386/genassym.cf cvs rdiff -u -r1.32 -r1.32.2.1 src/sys/arch/i386/i386/lock_stubs.S cvs rdiff -u -r1.59.2.2 -r1.59.2.3 src/sys/kern/kern_rwlock.c cvs rdiff -u -r1.334.2.1 -r1.334.2.2 src/sys/kern/kern_synch.c cvs rdiff -u -r1.192.2.1 -r1.192.2.2 src/sys/sys/lwp.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sun Jan 19 19:44:34 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: kern_rwlock.c src/sys/sys [ad-namecache]: rwlock.h Log Message: Sync with head. To generate a diff of this commit: cvs rdiff -u -r1.59.2.1 -r1.59.2.2 src/sys/kern/kern_rwlock.c cvs rdiff -u -r1.12 -r1.12.2.1 src/sys/sys/rwlock.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/kern_rwlock.c diff -u src/sys/kern/kern_rwlock.c:1.59.2.1 src/sys/kern/kern_rwlock.c:1.59.2.2 --- src/sys/kern/kern_rwlock.c:1.59.2.1 Fri Jan 17 21:47:35 2020 +++ src/sys/kern/kern_rwlock.c Sun Jan 19 19:44:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_rwlock.c,v 1.59.2.1 2020/01/17 21:47:35 ad Exp $ */ +/* $NetBSD: kern_rwlock.c,v 1.59.2.2 2020/01/19 19:44:34 ad Exp $ */ /*- * Copyright (c) 2002, 2006, 2007, 2008, 2009, 2019, 2020 @@ -39,7 +39,9 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.59.2.1 2020/01/17 21:47:35 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_rwlock.c,v 1.59.2.2 2020/01/19 19:44:34 ad Exp $"); + +#include "opt_lockdebug.h" #define __RWLOCK_PRIVATE @@ -63,58 +65,32 @@ __KERNEL_RCSID(0, "$NetBSD: kern_rwlock. * LOCKDEBUG */ -#if defined(LOCKDEBUG) - -#define RW_WANTLOCK(rw, op) \ - LOCKDEBUG_WANTLOCK(RW_DEBUG_P(rw), (rw), \ - (uintptr_t)__builtin_return_address(0), op == RW_READER); -#define RW_LOCKED(rw, op) \ - LOCKDEBUG_LOCKED(RW_DEBUG_P(rw), (rw), NULL, \ - (uintptr_t)__builtin_return_address(0), op == RW_READER); -#define RW_UNLOCKED(rw, op) \ - LOCKDEBUG_UNLOCKED(RW_DEBUG_P(rw), (rw), \ - (uintptr_t)__builtin_return_address(0), op == RW_READER); -#define RW_DASSERT(rw, cond) \ -do { \ - if (__predict_false(!(cond))) \ - rw_abort(__func__, __LINE__, rw, "assertion failed: " #cond);\ -} while (/* CONSTCOND */ 0); - -#else /* LOCKDEBUG */ - -#define RW_WANTLOCK(rw, op) /* nothing */ -#define RW_LOCKED(rw, op) /* nothing */ -#define RW_UNLOCKED(rw, op) /* nothing */ -#define RW_DASSERT(rw, cond) /* nothing */ +#define RW_DEBUG_P(rw) (((rw)->rw_owner & RW_NODEBUG) == 0) -#endif /* LOCKDEBUG */ +#define RW_WANTLOCK(rw, op) \ +LOCKDEBUG_WANTLOCK(RW_DEBUG_P(rw), (rw), \ +(uintptr_t)__builtin_return_address(0), op == RW_READER); +#define RW_LOCKED(rw, op) \ +LOCKDEBUG_LOCKED(RW_DEBUG_P(rw), (rw), NULL, \ +(uintptr_t)__builtin_return_address(0), op == RW_READER); +#define RW_UNLOCKED(rw, op) \ +LOCKDEBUG_UNLOCKED(RW_DEBUG_P(rw), (rw), \ +(uintptr_t)__builtin_return_address(0), op == RW_READER); /* * DIAGNOSTIC */ #if defined(DIAGNOSTIC) - -#define RW_ASSERT(rw, cond) \ -do { \ - if (__predict_false(!(cond))) \ +#define RW_ASSERT(rw, cond) \ +do { \ + if (__predict_false(!(cond))) \ rw_abort(__func__, __LINE__, rw, "assertion failed: " #cond);\ } while (/* CONSTCOND */ 0) - #else - #define RW_ASSERT(rw, cond) /* nothing */ - #endif /* DIAGNOSTIC */ -#define RW_SETDEBUG(rw, on) ((rw)->rw_owner |= (on) ? 0 : RW_NODEBUG) -#define RW_DEBUG_P(rw) (((rw)->rw_owner & RW_NODEBUG) == 0) -#if defined(LOCKDEBUG) -#define RW_INHERITDEBUG(n, o) (n) |= (o) & RW_NODEBUG -#else /* defined(LOCKDEBUG) */ -#define RW_INHERITDEBUG(n, o) /* nothing */ -#endif /* defined(LOCKDEBUG) */ - /* * Memory barriers. */ @@ -128,29 +104,6 @@ do { \ #define RW_MEMBAR_PRODUCER() membar_producer() #endif -static void rw_abort(const char *, size_t, krwlock_t *, const char *); -static void rw_dump(const volatile void *, lockop_printer_t); -static lwp_t *rw_owner(wchan_t); - -static inline uintptr_t -rw_cas(krwlock_t *rw, uintptr_t o, uintptr_t n) -{ - - RW_INHERITDEBUG(n, o); - return (uintptr_t)atomic_cas_ptr((volatile void *)>rw_owner, - (void *)o, (void *)n); -} - -static inline void -rw_swap(krwlock_t *rw, uintptr_t o, uintptr_t n) -{ - - RW_INHERITDEBUG(n, o); - n = (uintptr_t)atomic_swap_ptr((volatile void *)>rw_owner, - (void *)n); - RW_DASSERT(rw, n == o); -} - /* * For platforms that do not provide stubs, or for the LOCKDEBUG case. */ @@ -164,6 +117,10 @@ __strong_alias(rw_exit,rw_vector_exit); __strong_alias(rw_tryenter,rw_vector_tryenter); #endif +static void rw_abort(const char *, size_t, krwlock_t *, const char *); +static void rw_dump(const volatile void *, lockop_printer_t); +static lwp_t *rw_owner(wchan_t); + lockops_t rwlock_lockops = { .lo_name = "Reader / writer lock", .lo_type = LOCKOPS_SLEEP, @@ -179,6 +136,37 @@ syncobj_t rw_syncobj = { }; /* + * rw_cas: + * + * Do an atomic compare-and-swap on the lock word. + */ +static inline uintptr_t +rw_cas(krwlock_t *rw, uintptr_t o, uintptr_t n) +{ + + return (uintptr_t)atomic_cas_ptr((volatile void *)>rw_owner, + (void *)o, (void *)n); +} + +/* + * rw_swap: + * + * Do an atomic swap of the lock word. This is used only when it's + *
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sun Jan 19 19:44:34 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: kern_rwlock.c src/sys/sys [ad-namecache]: rwlock.h Log Message: Sync with head. To generate a diff of this commit: cvs rdiff -u -r1.59.2.1 -r1.59.2.2 src/sys/kern/kern_rwlock.c cvs rdiff -u -r1.12 -r1.12.2.1 src/sys/sys/rwlock.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sat Jan 18 17:16:20 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: Fix namecache_print(). To generate a diff of this commit: cvs rdiff -u -r1.126.2.7 -r1.126.2.8 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_cache.c diff -u src/sys/kern/vfs_cache.c:1.126.2.7 src/sys/kern/vfs_cache.c:1.126.2.8 --- src/sys/kern/vfs_cache.c:1.126.2.7 Sat Jan 18 15:42:02 2020 +++ src/sys/kern/vfs_cache.c Sat Jan 18 17:16:20 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.126.2.7 2020/01/18 15:42:02 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.126.2.8 2020/01/18 17:16:20 ad Exp $ */ /*- * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -148,7 +148,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.7 2020/01/18 15:42:02 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.8 2020/01/18 17:16:20 ad Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT @@ -1388,7 +1388,6 @@ cache_stat_sysctl(SYSCTLFN_ARGS) void namecache_print(struct vnode *vp, void (*pr)(const char *, ...)) { - struct vnode *dvp = NULL; struct namecache *nc; struct nchnode *dnn; enum cache_lru_id id; @@ -1402,7 +1401,7 @@ namecache_print(struct vnode *vp, void ( } } } - if (dvp == NULL) { + if (dnn == NULL) { (*pr)("name not found\n"); return; }
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sat Jan 18 17:16:20 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: Fix namecache_print(). To generate a diff of this commit: cvs rdiff -u -r1.126.2.7 -r1.126.2.8 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/sys
Module Name:src Committed By: ad Date: Sat Jan 18 17:14:35 UTC 2020 Modified Files: src/sys/sys [ad-namecache]: vnode_if.h Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.103.2.1 src/sys/sys/vnode_if.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/sys/vnode_if.h diff -u src/sys/sys/vnode_if.h:1.103 src/sys/sys/vnode_if.h:1.103.2.1 --- src/sys/sys/vnode_if.h:1.103 Sun Dec 1 13:58:53 2019 +++ src/sys/sys/vnode_if.h Sat Jan 18 17:14:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vnode_if.h,v 1.103 2019/12/01 13:58:53 ad Exp $ */ +/* $NetBSD: vnode_if.h,v 1.103.2.1 2020/01/18 17:14:35 ad Exp $ */ /* * Warning: DO NOT EDIT! This file is automatically generated! @@ -7,7 +7,7 @@ * Created from the file: * NetBSD: vnode_if.src,v 1.78 2019/10/11 08:04:52 hannken Exp * by the script: - * NetBSD: vnode_if.sh,v 1.68 2019/12/01 13:56:29 ad Exp + * NetBSD: vnode_if.sh,v 1.68.2.1 2020/01/18 17:12:59 ad Exp */ /*
CVS commit: [ad-namecache] src/sys/sys
Module Name:src Committed By: ad Date: Sat Jan 18 17:14:35 UTC 2020 Modified Files: src/sys/sys [ad-namecache]: vnode_if.h Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.103 -r1.103.2.1 src/sys/sys/vnode_if.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sat Jan 18 17:14:13 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vnode_if.c Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.109 -r1.109.2.1 src/sys/kern/vnode_if.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sat Jan 18 17:14:13 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vnode_if.c Log Message: Regen. To generate a diff of this commit: cvs rdiff -u -r1.109 -r1.109.2.1 src/sys/kern/vnode_if.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vnode_if.c diff -u src/sys/kern/vnode_if.c:1.109 src/sys/kern/vnode_if.c:1.109.2.1 --- src/sys/kern/vnode_if.c:1.109 Sun Dec 1 13:58:52 2019 +++ src/sys/kern/vnode_if.c Sat Jan 18 17:14:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vnode_if.c,v 1.109 2019/12/01 13:58:52 ad Exp $ */ +/* $NetBSD: vnode_if.c,v 1.109.2.1 2020/01/18 17:14:13 ad Exp $ */ /* * Warning: DO NOT EDIT! This file is automatically generated! @@ -7,7 +7,7 @@ * Created from the file: * NetBSD: vnode_if.src,v 1.78 2019/10/11 08:04:52 hannken Exp * by the script: - * NetBSD: vnode_if.sh,v 1.68 2019/12/01 13:56:29 ad Exp + * NetBSD: vnode_if.sh,v 1.68.2.1 2020/01/18 17:12:59 ad Exp */ /* @@ -40,7 +40,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.109 2019/12/01 13:58:52 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vnode_if.c,v 1.109.2.1 2020/01/18 17:14:13 ad Exp $"); #include #include @@ -1280,7 +1280,7 @@ VOP_LOCK(struct vnode *vp, a.a_desc = VDESC(vop_lock); a.a_vp = vp; a.a_flags = flags; - error = vop_pre(vp, , , (flags & (LK_UPGRADE|LK_DOWNGRADE) ? FST_NO : (flags & LK_NOWAIT ? FST_TRY : FST_YES))); + error = vop_pre(vp, , , (!(flags & (LK_SHARED|LK_EXCLUSIVE)) ? FST_NO : (flags & LK_NOWAIT ? FST_TRY : FST_YES))); if (error) return error; error = (VCALL(vp, VOFFSET(vop_lock), ));
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sat Jan 18 17:12:59 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vnode_if.sh src/sys/miscfs/genfs [ad-namecache]: genfs_vnops.c Log Message: Allow VOP_LOCK(LK_NONE). To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.68.2.1 src/sys/kern/vnode_if.sh cvs rdiff -u -r1.200 -r1.200.2.1 src/sys/miscfs/genfs/genfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vnode_if.sh diff -u src/sys/kern/vnode_if.sh:1.68 src/sys/kern/vnode_if.sh:1.68.2.1 --- src/sys/kern/vnode_if.sh:1.68 Sun Dec 1 13:56:29 2019 +++ src/sys/kern/vnode_if.sh Sat Jan 18 17:12:59 2020 @@ -29,7 +29,7 @@ copyright="\ * SUCH DAMAGE. */ " -SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.68 2019/12/01 13:56:29 ad Exp $' +SCRIPT_ID='$NetBSD: vnode_if.sh,v 1.68.2.1 2020/01/18 17:12:59 ad Exp $' # Script to produce VFS front-end sugar. # @@ -481,7 +481,7 @@ function bodynorm() { } if (fstrans == "LOCK") printf("\terror = vop_pre(%s, , , %s);\n", - argname[0], "(flags & (LK_UPGRADE|LK_DOWNGRADE) ? FST_NO : (flags & LK_NOWAIT ? FST_TRY : FST_YES))"); + argname[0], "(!(flags & (LK_SHARED|LK_EXCLUSIVE)) ? FST_NO : (flags & LK_NOWAIT ? FST_TRY : FST_YES))"); else if (fstrans == "UNLOCK") printf("\terror = vop_pre(%s, , , FST_%s);\n", argname[0], "NO"); Index: src/sys/miscfs/genfs/genfs_vnops.c diff -u src/sys/miscfs/genfs/genfs_vnops.c:1.200 src/sys/miscfs/genfs/genfs_vnops.c:1.200.2.1 --- src/sys/miscfs/genfs/genfs_vnops.c:1.200 Sun Dec 1 13:56:29 2019 +++ src/sys/miscfs/genfs/genfs_vnops.c Sat Jan 18 17:12:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: genfs_vnops.c,v 1.200 2019/12/01 13:56:29 ad Exp $ */ +/* $NetBSD: genfs_vnops.c,v 1.200.2.1 2020/01/18 17:12:59 ad Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -57,7 +57,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.200 2019/12/01 13:56:29 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: genfs_vnops.c,v 1.200.2.1 2020/01/18 17:12:59 ad Exp $"); #include #include @@ -301,7 +301,7 @@ genfs_deadlock(void *v) rw_exit(vip->vi_lock); rw_enter(vip->vi_lock, RW_WRITER); } - } else { + } else if ((flags & (LK_EXCLUSIVE | LK_SHARED)) != 0) { op = (ISSET(flags, LK_EXCLUSIVE) ? RW_WRITER : RW_READER); if (ISSET(flags, LK_NOWAIT)) { if (!rw_tryenter(vip->vi_lock, op)) @@ -355,7 +355,7 @@ genfs_lock(void *v) rw_exit(vip->vi_lock); rw_enter(vip->vi_lock, RW_WRITER); } - } else { + } else if ((flags & (LK_EXCLUSIVE | LK_SHARED)) != 0) { op = (ISSET(flags, LK_EXCLUSIVE) ? RW_WRITER : RW_READER); if (ISSET(flags, LK_NOWAIT)) { if (!rw_tryenter(vip->vi_lock, op))
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Sat Jan 18 17:12:59 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vnode_if.sh src/sys/miscfs/genfs [ad-namecache]: genfs_vnops.c Log Message: Allow VOP_LOCK(LK_NONE). To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.68.2.1 src/sys/kern/vnode_if.sh cvs rdiff -u -r1.200 -r1.200.2.1 src/sys/miscfs/genfs/genfs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sat Jan 18 15:42:02 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: - Adjust comments & assertions. - Ditch memcmp(). To generate a diff of this commit: cvs rdiff -u -r1.126.2.6 -r1.126.2.7 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Sat Jan 18 15:42:02 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_cache.c Log Message: - Adjust comments & assertions. - Ditch memcmp(). To generate a diff of this commit: cvs rdiff -u -r1.126.2.6 -r1.126.2.7 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_cache.c diff -u src/sys/kern/vfs_cache.c:1.126.2.6 src/sys/kern/vfs_cache.c:1.126.2.7 --- src/sys/kern/vfs_cache.c:1.126.2.6 Fri Jan 17 22:26:25 2020 +++ src/sys/kern/vfs_cache.c Sat Jan 18 15:42:02 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.126.2.6 2020/01/17 22:26:25 ad Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.126.2.7 2020/01/18 15:42:02 ad Exp $ */ /*- * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -148,7 +148,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.6 2020/01/17 22:26:25 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.126.2.7 2020/01/18 15:42:02 ad Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT @@ -330,6 +330,22 @@ cache_key(const char *name, size_t nlen) } /* + * Like memcmp() but tuned for small strings of equal length. + */ +static inline int +cache_namecmp(struct namecache *nc, const char *name, size_t namelen) +{ + size_t i; + int d; + + KASSERT(nc->nc_nlen == namelen); + for (d = 0, i = 0; i < namelen; i++) { + d |= (nc->nc_name[i] ^ name[i]); + } + return d; +} + +/* * Remove an entry from the cache. The directory lock must be held, and if * "dir2node" is true, then we're locking in the conventional direction and * the list lock will be acquired when removing the entry from the vnode @@ -378,11 +394,10 @@ cache_remove(struct namecache *nc, const } /* - * Find a single cache entry and return it locked. The directory lock must - * be held. + * Find a single cache entry and return it. The nchnode lock must be held. * * Marked __noinline, and with everything unnecessary excluded, the compiler - * (gcc 8.3.0 x86_64) does a great job on this. + * (gcc 8.3.0 x86_64) does a good job on this. */ static struct namecache * __noinline cache_lookup_entry(struct nchnode *dnn, const char *name, size_t namelen, @@ -394,12 +409,12 @@ cache_lookup_entry(struct nchnode *dnn, KASSERT(rw_lock_held(>nn_lock)); /* - * Search the RB tree for the key. This is one of the most - * performance sensitive code paths in the system, so here is an - * inlined version of rb_tree_find_node() tailored for exactly - * what's needed here (64-bit key and so on). Elsewhere during - * entry/removal the generic functions are used as it doesn't - * matter so much there. + * Search the RB tree for the key. File lookup is very performance + * sensitive, so here is an inlined lookup tailored for exactly + * what's needed here (64-bit key and so on) that is much faster + * than using rb_tree_find_node(). Elsewhere during entry/removal + * the generic functions are used as it doesn't matter so much + * there. */ for (;;) { if (__predict_false(RB_SENTINEL_P(node))) { @@ -415,8 +430,7 @@ cache_lookup_entry(struct nchnode *dnn, } /* Exclude collisions. */ - KASSERT(nc->nc_nlen == namelen); - if (__predict_false(memcmp(nc->nc_name, name, namelen) != 0)) { + if (__predict_false(cache_namecmp(nc, name, namelen))) { return NULL; } @@ -666,7 +680,7 @@ cache_lookup_linked(struct vnode *dvp, c rw_exit(*plock); } *plock = >nn_lock; - } else { + } else if (*plock == NULL) { KASSERT(dvp->v_usecount > 0); } @@ -674,6 +688,8 @@ cache_lookup_linked(struct vnode *dvp, c * First up check if the user is allowed to look up files in this * directory. */ + KASSERT(dnn->nn_mode != VNOVAL && dnn->nn_uid != VNOVAL && + dnn->nn_gid != VNOVAL); error = kauth_authorize_vnode(cred, KAUTH_ACCESS_ACTION(VEXEC, dvp->v_type, dnn->nn_mode & ALLPERMS), dvp, NULL, genfs_can_access(dvp->v_type, dnn->nn_mode & ALLPERMS, @@ -857,7 +873,7 @@ cache_enter(struct vnode *dvp, struct vn onc = rb_tree_find_node(>nn_tree, >nc_key); if (onc) { KASSERT(onc->nc_nlen == nc->nc_nlen); - if (memcmp(onc->nc_name, nc->nc_name, nc->nc_nlen) != 0) { + if (cache_namecmp(onc, name, namelen)) { COUNT(ncs_collisions); } cache_remove(onc, true);
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Fri Jan 17 22:26:26 UTC 2020 Modified Files: src/sys/fs/tmpfs [ad-namecache]: tmpfs_subr.c src/sys/kern [ad-namecache]: vfs_cache.c vfs_lookup.c src/sys/sys [ad-namecache]: namei.src vnode_impl.h src/sys/ufs/ffs [ad-namecache]: ffs_vfsops.c src/sys/ufs/ufs [ad-namecache]: ufs_vnops.c Log Message: vfs_lookup: - Do the easy component name lookups directly in the namecache without taking vnode locks nor vnode references (between the start and the leaf / parent), which seems to largely solve the lock contention problem with namei(). It needs support from the file system, which has to tell the name cache about directory permissions (only ffs and tmpfs tried so far), and I'm not sure how or if it can work with layered file systems yet. Work in progress. vfs_cache: - Make the rbtree operations more efficient: inline the lookup, and key on a 64-bit hash value (32 bits plus 16 bits length) rather than names. - Take namecache stuff out of vnode_impl, and take the rwlocks, and put them all together an an nchnode struct which is mapped 1:1: with vnodes. Saves memory and nicer cache profile. - Add a routine to help vfs_lookup do its easy component name lookups. - Report some more stats. - Tidy up the file a bit. To generate a diff of this commit: cvs rdiff -u -r1.105 -r1.105.2.1 src/sys/fs/tmpfs/tmpfs_subr.c cvs rdiff -u -r1.126.2.5 -r1.126.2.6 src/sys/kern/vfs_cache.c cvs rdiff -u -r1.212.4.2 -r1.212.4.3 src/sys/kern/vfs_lookup.c cvs rdiff -u -r1.47.2.3 -r1.47.2.4 src/sys/sys/namei.src cvs rdiff -u -r1.19.2.3 -r1.19.2.4 src/sys/sys/vnode_impl.h cvs rdiff -u -r1.362.4.1 -r1.362.4.2 src/sys/ufs/ffs/ffs_vfsops.c cvs rdiff -u -r1.248 -r1.248.2.1 src/sys/ufs/ufs/ufs_vnops.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Fri Jan 17 21:55:13 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_vnode.c Log Message: vrelel: don't change the vnode state to VS_BLOCKED for VOP_INACTIVE(), it's not needed (at least not for the usual case). Will revist before merge. To generate a diff of this commit: cvs rdiff -u -r1.105.2.2 -r1.105.2.3 src/sys/kern/vfs_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Fri Jan 17 21:54:27 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_getcwd.c Log Message: - Get shared locks on the directories, except for VOP_GETATTR() which unfortunately still needs LK_EXCLUSIVE due to itimes handling in UFS. - vnode locks are not needed to traverse the namecache. To generate a diff of this commit: cvs rdiff -u -r1.53.2.1 -r1.53.2.2 src/sys/kern/vfs_getcwd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Fri Jan 17 21:54:27 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_getcwd.c Log Message: - Get shared locks on the directories, except for VOP_GETATTR() which unfortunately still needs LK_EXCLUSIVE due to itimes handling in UFS. - vnode locks are not needed to traverse the namecache. To generate a diff of this commit: cvs rdiff -u -r1.53.2.1 -r1.53.2.2 src/sys/kern/vfs_getcwd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_getcwd.c diff -u src/sys/kern/vfs_getcwd.c:1.53.2.1 src/sys/kern/vfs_getcwd.c:1.53.2.2 --- src/sys/kern/vfs_getcwd.c:1.53.2.1 Fri Jan 17 21:47:35 2020 +++ src/sys/kern/vfs_getcwd.c Fri Jan 17 21:54:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_getcwd.c,v 1.53.2.1 2020/01/17 21:47:35 ad Exp $ */ +/* $NetBSD: vfs_getcwd.c,v 1.53.2.2 2020/01/17 21:54:27 ad Exp $ */ /*- * Copyright (c) 1999 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_getcwd.c,v 1.53.2.1 2020/01/17 21:47:35 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_getcwd.c,v 1.53.2.2 2020/01/17 21:54:27 ad Exp $"); #include #include @@ -107,6 +107,9 @@ getcwd_scandir(struct vnode **lvpp, stru int len, reclen; tries = 0; + /* Upgrade to exclusive for UFS VOP_GETATTR (itimes) & VOP_LOOKUP. */ + vn_lock(lvp, LK_UPGRADE | LK_RETRY); + /* * If we want the filename, get some info we need while the * current directory is still locked. @@ -142,7 +145,7 @@ getcwd_scandir(struct vnode **lvpp, stru } uvp = *uvpp; /* Now lvp is unlocked, try to lock uvp */ - error = vn_lock(uvp, LK_EXCLUSIVE); + error = vn_lock(uvp, LK_SHARED); if (error) { *lvpp = NULL; *uvpp = NULL; @@ -254,7 +257,7 @@ unionread: vput(tvp); vref(uvp); *uvpp = uvp; - vn_lock(uvp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(uvp, LK_SHARED | LK_RETRY); goto unionread; } #endif @@ -310,7 +313,7 @@ getcwd_getcache(struct vnode **lvpp, str */ VOP_UNLOCK(lvp); - vn_lock(uvp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(uvp, LK_SHARED | LK_RETRY); vrele(lvp); *lvpp = NULL; @@ -349,7 +352,7 @@ getcwd_common(struct vnode *lvp, struct * uvp is either NULL, or locked and held. */ - vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(lvp, LK_SHARED | LK_RETRY); if (bufp) bp = *bpp; @@ -396,7 +399,7 @@ getcwd_common(struct vnode *lvp, struct goto out; } vref(lvp); - error = vn_lock(lvp, LK_EXCLUSIVE | LK_RETRY); + error = vn_lock(lvp, LK_SHARED | LK_RETRY); if (error != 0) { vrele(lvp); lvp = NULL; @@ -557,11 +560,7 @@ vnode_to_path(char *path, size_t len, st bp = bend = [len]; *(--bp) = '\0'; - error = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - if (error != 0) - return error; error = cache_revlookup(vp, , , path); - VOP_UNLOCK(vp); if (error != 0) return (error == -1 ? ENOENT : error);
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Fri Jan 17 21:55:13 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: vfs_vnode.c Log Message: vrelel: don't change the vnode state to VS_BLOCKED for VOP_INACTIVE(), it's not needed (at least not for the usual case). Will revist before merge. To generate a diff of this commit: cvs rdiff -u -r1.105.2.2 -r1.105.2.3 src/sys/kern/vfs_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_vnode.c diff -u src/sys/kern/vfs_vnode.c:1.105.2.2 src/sys/kern/vfs_vnode.c:1.105.2.3 --- src/sys/kern/vfs_vnode.c:1.105.2.2 Fri Jan 17 21:47:35 2020 +++ src/sys/kern/vfs_vnode.c Fri Jan 17 21:55:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_vnode.c,v 1.105.2.2 2020/01/17 21:47:35 ad Exp $ */ +/* $NetBSD: vfs_vnode.c,v 1.105.2.3 2020/01/17 21:55:13 ad Exp $ */ /*- * Copyright (c) 1997-2011, 2019 The NetBSD Foundation, Inc. @@ -119,8 +119,7 @@ * Vnode finished disassociation from underlying file * system in vcache_reclaim(). * LOADED -> BLOCKED - * Either vcache_rekey*() is changing the vnode key or - * vrelel() is about to call VOP_INACTIVE(). + * vcache_rekey*() is changing the vnode key. * BLOCKED -> LOADED * The block condition is over. * LOADING -> RECLAIMED @@ -146,7 +145,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.105.2.2 2020/01/17 21:47:35 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.105.2.3 2020/01/17 21:55:13 ad Exp $"); #include #include @@ -777,24 +776,22 @@ vrelel(vnode_t *vp, int flags, int lktyp if (VSTATE_GET(vp) == VS_RECLAIMED) { VOP_UNLOCK(vp); } else { - VSTATE_CHANGE(vp, VS_LOADED, VS_BLOCKED); - mutex_exit(vp->v_interlock); - /* - * The vnode must not gain another reference while being - * deactivated. If VOP_INACTIVE() indicates that - * the described file has been deleted, then recycle - * the vnode. + * If VOP_INACTIVE() indicates that the described file has + * been deleted, then recycle the vnode. Note that + * VOP_INACTIVE() will not drop the vnode lock. * - * Note that VOP_INACTIVE() will not drop the vnode lock. + * If the file has been deleted, this is a lingering + * reference and there is no need to worry about new + * references looking to do real work with the vnode (as it + * will have been purged from directories, caches, etc). */ recycle = false; + mutex_exit(vp->v_interlock); VOP_INACTIVE(vp, ); - if (!recycle) - VOP_UNLOCK(vp); mutex_enter(vp->v_interlock); - VSTATE_CHANGE(vp, VS_BLOCKED, VS_LOADED); if (!recycle) { + VOP_UNLOCK(vp); if (vp->v_usecount > 1) { vp->v_usecount--; mutex_exit(vp->v_interlock);
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Fri Jan 17 21:53:01 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: exec_script.c Log Message: LK_SHARED for VOP_ACCESS(). To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.80.2.1 src/sys/kern/exec_script.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/exec_script.c diff -u src/sys/kern/exec_script.c:1.80 src/sys/kern/exec_script.c:1.80.2.1 --- src/sys/kern/exec_script.c:1.80 Sun Sep 15 20:21:12 2019 +++ src/sys/kern/exec_script.c Fri Jan 17 21:53:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: exec_script.c,v 1.80 2019/09/15 20:21:12 christos Exp $ */ +/* $NetBSD: exec_script.c,v 1.80.2.1 2020/01/17 21:53:01 ad Exp $ */ /* * Copyright (c) 1993, 1994, 1996 Christopher G. Demetriou @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.80 2019/09/15 20:21:12 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exec_script.c,v 1.80.2.1 2020/01/17 21:53:01 ad Exp $"); #ifdef _KERNEL_OPT #include "opt_script.h" @@ -216,7 +216,7 @@ check_shell: * close all open fd's when the start. That kills this * method of implementing "safe" set-id and x-only scripts. */ - vn_lock(epp->ep_vp, LK_EXCLUSIVE | LK_RETRY); + vn_lock(epp->ep_vp, LK_SHARED | LK_RETRY); error = VOP_ACCESS(epp->ep_vp, VREAD, l->l_cred); VOP_UNLOCK(epp->ep_vp); if (error == EACCES
CVS commit: [ad-namecache] src/sys/kern
Module Name:src Committed By: ad Date: Fri Jan 17 21:53:01 UTC 2020 Modified Files: src/sys/kern [ad-namecache]: exec_script.c Log Message: LK_SHARED for VOP_ACCESS(). To generate a diff of this commit: cvs rdiff -u -r1.80 -r1.80.2.1 src/sys/kern/exec_script.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [ad-namecache] src/sys
Module Name:src Committed By: ad Date: Fri Jan 17 21:47:38 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64 [ad-namecache]: bus_space_asm_generic.S cpu.c cpufunc.c cpuswitch.S fault.c genassym.cf locore.S pmap.c src/sys/arch/aarch64/conf [ad-namecache]: files.aarch64 src/sys/arch/aarch64/include [ad-namecache]: cpu.h cpufunc.h src/sys/arch/alpha/alpha [ad-namecache]: locore.s src/sys/arch/amd64/amd64 [ad-namecache]: genassym.cf locore.S machdep.c spl.S src/sys/arch/amd64/conf [ad-namecache]: ALL GENERIC files.amd64 kern.ldscript src/sys/arch/amd64/include [ad-namecache]: param.h proc.h ptrace.h src/sys/arch/arm/acpi [ad-namecache]: acpi_pci_machdep.c acpi_pci_machdep.h acpipchb.c files.acpi gicv3_acpi.c src/sys/arch/arm/arm32 [ad-namecache]: arm32_boot.c cpu.c cpuswitch.S genassym.cf pmap.c src/sys/arch/arm/conf [ad-namecache]: files.arm src/sys/arch/arm/cortex [ad-namecache]: gicv3_its.c src/sys/arch/arm/fdt [ad-namecache]: acpi_fdt.c cpu_fdt.c src/sys/arch/arm/imx [ad-namecache]: if_enet.c if_enet_imx6.c if_enet_imx7.c if_enetvar.h imx6_board.c imx6_pcie.c imx6_usdhc.c imx7_usdhc.c imxgpio.c imxgpiovar.h imxuart.c src/sys/arch/arm/imx/fdt [ad-namecache]: files.imx6 if_enet_imx.c imx6_com.c imx6_gpio.c imx6_i2c.c imx6_iomux.c imx6_sdhc.c src/sys/arch/arm/include [ad-namecache]: cpu.h types.h src/sys/arch/arm/include/arm32 [ad-namecache]: pmap.h vmparam.h src/sys/arch/arm/sunxi [ad-namecache]: sun8i_crypto.c sunxi_twi.c src/sys/arch/emips/emips [ad-namecache]: locore_machdep.S machdep.c src/sys/arch/evbarm/conf [ad-namecache]: GENERIC64 POGO files.generic64 src/sys/arch/evbarm/netwalker [ad-namecache]: netwalker_lcd.c netwalker_spi.c netwalker_usb.c src/sys/arch/hppa/hppa [ad-namecache]: genassym.cf locore.S src/sys/arch/i386/conf [ad-namecache]: ALL src/sys/arch/i386/i386 [ad-namecache]: genassym.cf locore.S spl.S src/sys/arch/i386/include [ad-namecache]: proc.h ptrace.h src/sys/arch/ia64/stand/ia64/ski [ad-namecache]: ssc.c src/sys/arch/m68k/m68k [ad-namecache]: switch_subr.s src/sys/arch/macppc/conf [ad-namecache]: GENERIC INSTALL files.macppc src/sys/arch/macppc/dev [ad-namecache]: ki2c.c src/sys/arch/macppc/macppc [ad-namecache]: cpu.c src/sys/arch/mips/mips [ad-namecache]: cpu_subr.c genassym.cf locore.S mips_softint.c src/sys/arch/powerpc/powerpc [ad-namecache]: genassym.cf locore_subr.S softint_machdep.c src/sys/arch/riscv/riscv [ad-namecache]: genassym.cf locore.S src/sys/arch/sh3/sh3 [ad-namecache]: locore_subr.S src/sys/arch/sparc/sparc [ad-namecache]: locore.s src/sys/arch/sparc64/sparc64 [ad-namecache]: genassym.cf locore.s src/sys/arch/vax/vax [ad-namecache]: genassym.cf pmap.c subr.S src/sys/arch/x68k/stand/boot [ad-namecache]: boot.c src/sys/arch/x68k/stand/boot_ufs [ad-namecache]: Makefile boot.S boot_ufs.h version src/sys/arch/x68k/stand/boot_ustar [ad-namecache]: Makefile boot_ustar.S version src/sys/arch/x68k/stand/xxboot [ad-namecache]: Makefile.xxboot boot.S src/sys/arch/x86/include [ad-namecache]: cpu.h pmap.h pmap_pv.h src/sys/arch/x86/x86 [ad-namecache]: cpu.c cpu_topology.c mpacpi.c pmap.c procfs_machdep.c vm_machdep.c x86_tlb.c src/sys/arch/xen/x86 [ad-namecache]: cpu.c src/sys/arch/xen/xen [ad-namecache]: xbdback_xenbus.c src/sys/arch/zaurus/conf [ad-namecache]: Makefile.zaurus.inc src/sys/coda [ad-namecache]: coda_vfsops.c coda_vfsops.h coda_vnops.c src/sys/compat/common [ad-namecache]: vfs_syscalls_20.c vfs_syscalls_30.c src/sys/compat/linux/arch/amd64 [ad-namecache]: linux_exec_machdep.c src/sys/compat/linux/common [ad-namecache]: linux_exec_elf32.c src/sys/compat/netbsd32 [ad-namecache]: netbsd32_compat_30.c src/sys/conf [ad-namecache]: files src/sys/ddb [ad-namecache]: db_proc.c src/sys/dev [ad-namecache]: DEVNAMES cgd.c vnd.c src/sys/dev/acpi [ad-namecache]: acpi.c acpi_pci.c acpi_pci.h acpi_pci_link.c acpivar.h src/sys/dev/acpi/acpica [ad-namecache]: OsdHardware.c src/sys/dev/ata [ad-namecache]: ld_ataraid.c wd.c src/sys/dev/audio [ad-namecache]: alaw.c audio.c audiovar.h linear.c mulaw.c src/sys/dev/dm [ad-namecache]: device-mapper.c src/sys/dev/fdt [ad-namecache]: dwc3_fdt.c fdtbus.c src/sys/dev/hid [ad-namecache]: hidkbdmap.c src/sys/dev/i2c [ad-namecache]: at24cxx.c files.i2c gttwsi_core.c gttwsireg.h gttwsivar.h ihidev.c ihidev.h tsl256x.c