CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Apr 18 12:16:23 UTC 2024 Modified Files: src/sys/uvm/pmap: pmap.c pmap.h Log Message: Fix types in pmap_page_clear_attributes so that the top bits of the u_long mdpg_attrs aren't dropped giving atomic_cas_ulong no chance of completing if any of the top bits is set. Update pmap_page_set_attributes for consistency. An ATF test run completed for me with this fix. port-riscv/58006: ATF tests no longer complete on riscv-riscv64 To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/uvm/pmap/pmap.c cvs rdiff -u -r1.26 -r1.27 src/sys/uvm/pmap/pmap.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/uvm/pmap/pmap.c diff -u src/sys/uvm/pmap/pmap.c:1.77 src/sys/uvm/pmap/pmap.c:1.78 --- src/sys/uvm/pmap/pmap.c:1.77 Sat Mar 23 08:31:15 2024 +++ src/sys/uvm/pmap/pmap.c Thu Apr 18 12:16:23 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.77 2024/03/23 08:31:15 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.78 2024/04/18 12:16:23 skrll Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.77 2024/03/23 08:31:15 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.78 2024/04/18 12:16:23 skrll Exp $"); /* * Manages physical address maps. @@ -415,21 +415,21 @@ pmap_addr_range_check(pmap_t pmap, vaddr */ bool -pmap_page_clear_attributes(struct vm_page_md *mdpg, u_int clear_attributes) +pmap_page_clear_attributes(struct vm_page_md *mdpg, u_long clear_attributes) { - volatile unsigned long * const attrp = >mdpg_attrs; + volatile u_long * const attrp = >mdpg_attrs; #ifdef MULTIPROCESSOR for (;;) { - u_int old_attr = *attrp; + u_long old_attr = *attrp; if ((old_attr & clear_attributes) == 0) return false; - u_int new_attr = old_attr & ~clear_attributes; + u_long new_attr = old_attr & ~clear_attributes; if (old_attr == atomic_cas_ulong(attrp, old_attr, new_attr)) return true; } #else - unsigned long old_attr = *attrp; + u_long old_attr = *attrp; if ((old_attr & clear_attributes) == 0) return false; *attrp &= ~clear_attributes; @@ -438,7 +438,7 @@ pmap_page_clear_attributes(struct vm_pag } void -pmap_page_set_attributes(struct vm_page_md *mdpg, u_int set_attributes) +pmap_page_set_attributes(struct vm_page_md *mdpg, u_long set_attributes) { #ifdef MULTIPROCESSOR atomic_or_ulong(>mdpg_attrs, set_attributes); Index: src/sys/uvm/pmap/pmap.h diff -u src/sys/uvm/pmap/pmap.h:1.26 src/sys/uvm/pmap/pmap.h:1.27 --- src/sys/uvm/pmap/pmap.h:1.26 Thu Nov 3 18:55:07 2022 +++ src/sys/uvm/pmap/pmap.h Thu Apr 18 12:16:23 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.26 2022/11/03 18:55:07 skrll Exp $ */ +/* $NetBSD: pmap.h,v 1.27 2024/04/18 12:16:23 skrll Exp $ */ /* * Copyright (c) 1992, 1993 @@ -296,8 +296,8 @@ extern pmap_segtab_t pmap_kern_segtab; bool pmap_remove_all(pmap_t); void pmap_set_modified(paddr_t); -bool pmap_page_clear_attributes(struct vm_page_md *, u_int); -void pmap_page_set_attributes(struct vm_page_md *, u_int); +bool pmap_page_clear_attributes(struct vm_page_md *, u_long); +void pmap_page_set_attributes(struct vm_page_md *, u_long); void pmap_pvlist_lock_init(size_t); #ifdef PMAP_VIRTUAL_CACHE_ALIASES void pmap_page_cache(struct vm_page_md *, bool);
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Apr 18 12:16:23 UTC 2024 Modified Files: src/sys/uvm/pmap: pmap.c pmap.h Log Message: Fix types in pmap_page_clear_attributes so that the top bits of the u_long mdpg_attrs aren't dropped giving atomic_cas_ulong no chance of completing if any of the top bits is set. Update pmap_page_set_attributes for consistency. An ATF test run completed for me with this fix. port-riscv/58006: ATF tests no longer complete on riscv-riscv64 To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/uvm/pmap/pmap.c cvs rdiff -u -r1.26 -r1.27 src/sys/uvm/pmap/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Sat Mar 23 08:31:15 UTC 2024 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: Default pmap_stealdebug to false To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/uvm/pmap/pmap.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/uvm/pmap/pmap.c diff -u src/sys/uvm/pmap/pmap.c:1.76 src/sys/uvm/pmap/pmap.c:1.77 --- src/sys/uvm/pmap/pmap.c:1.76 Tue Mar 5 13:16:29 2024 +++ src/sys/uvm/pmap/pmap.c Sat Mar 23 08:31:15 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.76 2024/03/05 13:16:29 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.77 2024/03/23 08:31:15 skrll Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.76 2024/03/05 13:16:29 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.77 2024/03/23 08:31:15 skrll Exp $"); /* * Manages physical address maps. @@ -367,7 +367,7 @@ kmutex_t pmap_pvlist_mutex __cacheline_a #ifdef DEBUG -bool pmap_stealdebug = true; +bool pmap_stealdebug = false; #define DPRINTF(...) \ do { if (pmap_stealdebug) { printf(__VA_ARGS__); } } while (false)
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Sat Mar 23 08:31:15 UTC 2024 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: Default pmap_stealdebug to false To generate a diff of this commit: cvs rdiff -u -r1.76 -r1.77 src/sys/uvm/pmap/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: andvar Date: Fri Mar 15 22:15:21 UTC 2024 Modified Files: src/sys/uvm: uvm_swap.h Log Message: "retval = 0" should be "*retval = 0", should fix the broken build. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/uvm/uvm_swap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: andvar Date: Fri Mar 15 22:15:21 UTC 2024 Modified Files: src/sys/uvm: uvm_swap.h Log Message: "retval = 0" should be "*retval = 0", should fix the broken build. To generate a diff of this commit: cvs rdiff -u -r1.28 -r1.29 src/sys/uvm/uvm_swap.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/uvm/uvm_swap.h diff -u src/sys/uvm/uvm_swap.h:1.28 src/sys/uvm/uvm_swap.h:1.29 --- src/sys/uvm/uvm_swap.h:1.28 Fri Mar 15 20:09:31 2024 +++ src/sys/uvm/uvm_swap.h Fri Mar 15 22:15:21 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_swap.h,v 1.28 2024/03/15 20:09:31 andvar Exp $ */ +/* $NetBSD: uvm_swap.h,v 1.29 2024/03/15 22:15:21 andvar Exp $ */ /* * Copyright (c) 1997 Matthew R. Green @@ -65,7 +65,7 @@ uvm_swap_stats(char *c, int l, void (*f) size_t count, register_t *retval) { - retval = 0; + *retval = 0; return ENOSYS; }
CVS commit: src/sys/uvm
Module Name:src Committed By: andvar Date: Fri Mar 15 20:09:31 UTC 2024 Modified Files: src/sys/uvm: uvm_swap.h Log Message: Rewrite !VMSWAP uvm_swap_stats() macro as a static function. NFCI. >From riastradh To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/uvm/uvm_swap.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/uvm/uvm_swap.h diff -u src/sys/uvm/uvm_swap.h:1.27 src/sys/uvm/uvm_swap.h:1.28 --- src/sys/uvm/uvm_swap.h:1.27 Fri Mar 15 07:09:37 2024 +++ src/sys/uvm/uvm_swap.h Fri Mar 15 20:09:31 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_swap.h,v 1.27 2024/03/15 07:09:37 andvar Exp $ */ +/* $NetBSD: uvm_swap.h,v 1.28 2024/03/15 20:09:31 andvar Exp $ */ /* * Copyright (c) 1997 Matthew R. Green @@ -39,10 +39,10 @@ #endif struct lwp; +struct swapent; #if defined(VMSWAP) -struct swapent; struct vm_page; int uvm_swap_get(struct vm_page *, int, int); @@ -57,8 +57,18 @@ int uvm_swap_stats(char *, int, void (*)(void *, const struct swapent *), size_t, register_t *); #else /* defined(VMSWAP) */ + #define uvm_swapisfull() true -#define uvm_swap_stats(c, l, f, count, retval) (void)(f), (*retval = 0, ENOSYS) + +static inline int +uvm_swap_stats(char *c, int l, void (*f)(void *, const struct swapent *), +size_t count, register_t *retval) +{ + + retval = 0; + return ENOSYS; +} + #endif /* defined(VMSWAP) */ void uvm_swap_shutdown(struct lwp *);
CVS commit: src/sys/uvm
Module Name:src Committed By: andvar Date: Fri Mar 15 20:09:31 UTC 2024 Modified Files: src/sys/uvm: uvm_swap.h Log Message: Rewrite !VMSWAP uvm_swap_stats() macro as a static function. NFCI. >From riastradh To generate a diff of this commit: cvs rdiff -u -r1.27 -r1.28 src/sys/uvm/uvm_swap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: andvar Date: Fri Mar 15 07:09:37 UTC 2024 Modified Files: src/sys/uvm: uvm_fault.c uvm_pager.c uvm_swap.h uvm_swapstub.c Log Message: Fix !VMSWAP build: Added __unused for few local variables, which are used in VMSWAP block only. Adjust !VMSWAP uvm_swap_stats() definition to make it build with compat code. Copied "int (*uvm_swap_stats50)(...)" definition from uvm_swap to uvm_swapstub to avoid missing uvm_swap_stats50 reference on linking. Fixes INSTALL_CPMBR1400, INSTALL_ZYXELKX evbmips kernel configs as a result. Reviewed by simon and phone in IRC (thanks). To generate a diff of this commit: cvs rdiff -u -r1.236 -r1.237 src/sys/uvm/uvm_fault.c cvs rdiff -u -r1.130 -r1.131 src/sys/uvm/uvm_pager.c cvs rdiff -u -r1.26 -r1.27 src/sys/uvm/uvm_swap.h cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/uvm_swapstub.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/uvm/uvm_fault.c diff -u src/sys/uvm/uvm_fault.c:1.236 src/sys/uvm/uvm_fault.c:1.237 --- src/sys/uvm/uvm_fault.c:1.236 Tue Sep 19 22:14:25 2023 +++ src/sys/uvm/uvm_fault.c Fri Mar 15 07:09:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_fault.c,v 1.236 2023/09/19 22:14:25 ad Exp $ */ +/* $NetBSD: uvm_fault.c,v 1.237 2024/03/15 07:09:37 andvar Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.236 2023/09/19 22:14:25 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.237 2024/03/15 07:09:37 andvar Exp $"); #include "opt_uvmhist.h" @@ -273,7 +273,7 @@ uvmfault_anonget(struct uvm_faultinfo *u { struct vm_page *pg; krw_t lock_type; - int error; + int error __unused; /* used for VMSWAP */ UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist); KASSERT(rw_lock_held(anon->an_lock)); Index: src/sys/uvm/uvm_pager.c diff -u src/sys/uvm/uvm_pager.c:1.130 src/sys/uvm/uvm_pager.c:1.131 --- src/sys/uvm/uvm_pager.c:1.130 Sun Oct 18 18:22:29 2020 +++ src/sys/uvm/uvm_pager.c Fri Mar 15 07:09:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_pager.c,v 1.130 2020/10/18 18:22:29 chs Exp $ */ +/* $NetBSD: uvm_pager.c,v 1.131 2024/03/15 07:09:37 andvar Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.130 2020/10/18 18:22:29 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.131 2024/03/15 07:09:37 andvar Exp $"); #include "opt_uvmhist.h" #include "opt_readahead.h" @@ -330,7 +330,7 @@ uvm_aio_aiodone_pages(struct vm_page **p struct vm_page *pg; krwlock_t *slock; int pageout_done; /* number of PG_PAGEOUT pages processed */ - int swslot; + int swslot __unused; /* used for VMSWAP */ int i; bool swap; UVMHIST_FUNC(__func__); UVMHIST_CALLED(ubchist); @@ -405,7 +405,7 @@ uvm_aio_aiodone_pages(struct vm_page **p */ if (error) { - int slot; + int slot __unused; /* used for VMSWAP */ if (!write) { pg->flags |= PG_RELEASED; continue; Index: src/sys/uvm/uvm_swap.h diff -u src/sys/uvm/uvm_swap.h:1.26 src/sys/uvm/uvm_swap.h:1.27 --- src/sys/uvm/uvm_swap.h:1.26 Sat Sep 5 16:30:13 2020 +++ src/sys/uvm/uvm_swap.h Fri Mar 15 07:09:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_swap.h,v 1.26 2020/09/05 16:30:13 riastradh Exp $ */ +/* $NetBSD: uvm_swap.h,v 1.27 2024/03/15 07:09:37 andvar Exp $ */ /* * Copyright (c) 1997 Matthew R. Green @@ -58,7 +58,7 @@ int uvm_swap_stats(char *, int, #else /* defined(VMSWAP) */ #define uvm_swapisfull() true -#define uvm_swap_stats(c, l, f, count, retval) (__used f, *retval = 0, ENOSYS) +#define uvm_swap_stats(c, l, f, count, retval) (void)(f), (*retval = 0, ENOSYS) #endif /* defined(VMSWAP) */ void uvm_swap_shutdown(struct lwp *); Index: src/sys/uvm/uvm_swapstub.c diff -u src/sys/uvm/uvm_swapstub.c:1.8 src/sys/uvm/uvm_swapstub.c:1.9 --- src/sys/uvm/uvm_swapstub.c:1.8 Tue Feb 18 06:18:13 2014 +++ src/sys/uvm/uvm_swapstub.c Fri Mar 15 07:09:37 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_swapstub.c,v 1.8 2014/02/18 06:18:13 pooka Exp $ */ +/* $NetBSD: uvm_swapstub.c,v 1.9 2024/03/15 07:09:37 andvar Exp $ */ /*- * Copyright (c)2005 YAMAMOTO Takashi, @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_swapstub.c,v 1.8 2014/02/18 06:18:13 pooka Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_swapstub.c,v 1.9 2024/03/15 07:09:37 andvar Exp $"); #include #include @@ -40,6 +40,9 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_swapstub #include +int (*uvm_swap_stats50)(const struct sys_swapctl_args *, register_t *) = +(void *)enosys; + void uvm_swap_init(void) {
CVS commit: src/sys/uvm
Module Name:src Committed By: andvar Date: Fri Mar 15 07:09:37 UTC 2024 Modified Files: src/sys/uvm: uvm_fault.c uvm_pager.c uvm_swap.h uvm_swapstub.c Log Message: Fix !VMSWAP build: Added __unused for few local variables, which are used in VMSWAP block only. Adjust !VMSWAP uvm_swap_stats() definition to make it build with compat code. Copied "int (*uvm_swap_stats50)(...)" definition from uvm_swap to uvm_swapstub to avoid missing uvm_swap_stats50 reference on linking. Fixes INSTALL_CPMBR1400, INSTALL_ZYXELKX evbmips kernel configs as a result. Reviewed by simon and phone in IRC (thanks). To generate a diff of this commit: cvs rdiff -u -r1.236 -r1.237 src/sys/uvm/uvm_fault.c cvs rdiff -u -r1.130 -r1.131 src/sys/uvm/uvm_pager.c cvs rdiff -u -r1.26 -r1.27 src/sys/uvm/uvm_swap.h cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/uvm_swapstub.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: thorpej Date: Tue Mar 5 14:33:50 UTC 2024 Modified Files: src/sys/uvm: uvm_page.c Log Message: Rename the local "boot_cpu" variable to "uvm_boot_cpu". To generate a diff of this commit: cvs rdiff -u -r1.255 -r1.256 src/sys/uvm/uvm_page.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: thorpej Date: Tue Mar 5 14:33:50 UTC 2024 Modified Files: src/sys/uvm: uvm_page.c Log Message: Rename the local "boot_cpu" variable to "uvm_boot_cpu". To generate a diff of this commit: cvs rdiff -u -r1.255 -r1.256 src/sys/uvm/uvm_page.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/uvm/uvm_page.c diff -u src/sys/uvm/uvm_page.c:1.255 src/sys/uvm/uvm_page.c:1.256 --- src/sys/uvm/uvm_page.c:1.255 Sat Feb 10 09:24:18 2024 +++ src/sys/uvm/uvm_page.c Tue Mar 5 14:33:50 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_page.c,v 1.255 2024/02/10 09:24:18 andvar Exp $ */ +/* $NetBSD: uvm_page.c,v 1.256 2024/03/05 14:33:50 thorpej Exp $ */ /*- * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc. @@ -95,7 +95,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.255 2024/02/10 09:24:18 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.256 2024/03/05 14:33:50 thorpej Exp $"); #include "opt_ddb.h" #include "opt_uvm.h" @@ -328,7 +328,7 @@ uvm_page_init_bucket(struct pgfreelist * void uvm_page_init(vaddr_t *kvm_startp, vaddr_t *kvm_endp) { - static struct uvm_cpu boot_cpu __cacheline_aligned; + static struct uvm_cpu uvm_boot_cpu __cacheline_aligned; psize_t freepages, pagecount, bucketsize, n; struct pgflbucket *pgb; struct vm_page *pagearray; @@ -344,7 +344,7 @@ uvm_page_init(vaddr_t *kvm_startp, vaddr * structures). */ - curcpu()->ci_data.cpu_uvm = _cpu; + curcpu()->ci_data.cpu_uvm = _boot_cpu; uvmpdpol_init(); for (b = 0; b < __arraycount(uvm_freelist_locks); b++) { mutex_init(_freelist_locks[b].lock, MUTEX_DEFAULT, IPL_VM);
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Tue Mar 5 13:16:29 UTC 2024 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: Change the PMAP_STEAL_MEMORY debug output from aprint_debug. The new printfs are conditional on pmap_stealdebug and the DEBUG compile option. The former defaults to true, but can be changed at a boot -d ddb prompt. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/uvm/pmap/pmap.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/uvm/pmap/pmap.c diff -u src/sys/uvm/pmap/pmap.c:1.75 src/sys/uvm/pmap/pmap.c:1.76 --- src/sys/uvm/pmap/pmap.c:1.75 Sun Feb 26 07:13:55 2023 +++ src/sys/uvm/pmap/pmap.c Tue Mar 5 13:16:29 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.75 2023/02/26 07:13:55 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.76 2024/03/05 13:16:29 skrll Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.75 2023/02/26 07:13:55 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.76 2024/03/05 13:16:29 skrll Exp $"); /* * Manages physical address maps. @@ -366,6 +366,12 @@ kmutex_t pmap_pvlist_mutex __cacheline_a */ #ifdef DEBUG + +bool pmap_stealdebug = true; + +#define DPRINTF(...) \ +do { if (pmap_stealdebug) { printf(__VA_ARGS__); } } while (false) + static inline void pmap_asid_check(pmap_t pm, const char *func) { @@ -378,6 +384,10 @@ pmap_asid_check(pmap_t pm, const char *f panic("%s: inconsistency for active TLB update: %u <-> %u", func, asid, pai->pai_asid); } +#else + +#define DPRINTF(...) __nothing + #endif static void @@ -564,7 +574,7 @@ pmap_steal_memory(vsize_t size, vaddr_t size = round_page(size); npgs = atop(size); - aprint_debug("%s: need %zu pages\n", __func__, npgs); + DPRINTF("%s: need %zu pages\n", __func__, npgs); for (uvm_physseg_t bank = uvm_physseg_get_first(); uvm_physseg_valid_p(bank); @@ -573,19 +583,19 @@ pmap_steal_memory(vsize_t size, vaddr_t if (uvm.page_init_done == true) panic("pmap_steal_memory: called _after_ bootstrap"); - aprint_debug("%s: seg %"PRIxPHYSSEG": %#"PRIxPADDR" %#"PRIxPADDR" %#"PRIxPADDR" %#"PRIxPADDR"\n", + DPRINTF("%s: seg %"PRIxPHYSSEG": %#"PRIxPADDR" %#"PRIxPADDR" %#"PRIxPADDR" %#"PRIxPADDR"\n", __func__, bank, uvm_physseg_get_avail_start(bank), uvm_physseg_get_start(bank), uvm_physseg_get_avail_end(bank), uvm_physseg_get_end(bank)); if (uvm_physseg_get_avail_start(bank) != uvm_physseg_get_start(bank) || uvm_physseg_get_avail_start(bank) >= uvm_physseg_get_avail_end(bank)) { - aprint_debug("%s: seg %"PRIxPHYSSEG": bad start\n", __func__, bank); + DPRINTF("%s: seg %"PRIxPHYSSEG": bad start\n", __func__, bank); continue; } if (uvm_physseg_get_avail_end(bank) - uvm_physseg_get_avail_start(bank) < npgs) { - aprint_debug("%s: seg %"PRIxPHYSSEG": too small for %zu pages\n", + DPRINTF("%s: seg %"PRIxPHYSSEG": too small for %zu pages\n", __func__, bank, npgs); continue; } @@ -614,7 +624,7 @@ pmap_steal_memory(vsize_t size, vaddr_t pa = ptoa(uvm_physseg_get_start(bank)); uvm_physseg_unplug(atop(pa), npgs); - aprint_debug("%s: seg %"PRIxPHYSSEG": %zu pages stolen (%#"PRIxPADDR" left)\n", + DPRINTF("%s: seg %"PRIxPHYSSEG": %zu pages stolen (%#"PRIxPADDR" left)\n", __func__, bank, npgs, VM_PHYSMEM_SPACE(bank)); va = pmap_md_map_poolpage(pa, size);
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Tue Mar 5 13:16:29 UTC 2024 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: Change the PMAP_STEAL_MEMORY debug output from aprint_debug. The new printfs are conditional on pmap_stealdebug and the DEBUG compile option. The former defaults to true, but can be changed at a boot -d ddb prompt. To generate a diff of this commit: cvs rdiff -u -r1.75 -r1.76 src/sys/uvm/pmap/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: tnn Date: Sun Jan 14 10:38:47 UTC 2024 Modified Files: src/sys/uvm: uvm_pglist.c Log Message: fix DEBUG build To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/sys/uvm/uvm_pglist.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/uvm/uvm_pglist.c diff -u src/sys/uvm/uvm_pglist.c:1.91 src/sys/uvm/uvm_pglist.c:1.92 --- src/sys/uvm/uvm_pglist.c:1.91 Sat Jan 13 09:44:42 2024 +++ src/sys/uvm/uvm_pglist.c Sun Jan 14 10:38:47 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_pglist.c,v 1.91 2024/01/13 09:44:42 tnn Exp $ */ +/* $NetBSD: uvm_pglist.c,v 1.92 2024/01/14 10:38:47 tnn Exp $ */ /*- * Copyright (c) 1997, 2019 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.91 2024/01/13 09:44:42 tnn Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.92 2024/01/14 10:38:47 tnn Exp $"); #include #include @@ -577,7 +577,7 @@ again: candidate, bank, psi); KDASSERTMSG(cidx == candidate - uvm_physseg_get_start(psi), "uvm_physseg_find(%#lx): %#"PRIxPADDR" != off %"PRIxPADDR, - candidate, cidx, candidate - uvm_physseg_get_start(psi)); + candidate, cidx, (paddr_t)candidate - uvm_physseg_get_start(psi)); } #endif if (VM_PAGE_IS_FREE(pg) == 0)
CVS commit: src/sys/uvm
Module Name:src Committed By: tnn Date: Sun Jan 14 10:38:47 UTC 2024 Modified Files: src/sys/uvm: uvm_pglist.c Log Message: fix DEBUG build To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/sys/uvm/uvm_pglist.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: tnn Date: Sat Jan 13 09:44:42 UTC 2024 Modified Files: src/sys/uvm: uvm_pglist.c uvm_physseg.c uvm_physseg.h Log Message: uvm: change type of uvm_physseg.start_hint from u_int to u_long Avoids assertion failure in uvm_pglistalloc_s_ps() with large paddrs. PR kern/57683. To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 src/sys/uvm/uvm_pglist.c cvs rdiff -u -r1.19 -r1.20 src/sys/uvm/uvm_physseg.c cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/uvm_physseg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: tnn Date: Sat Jan 13 09:44:42 UTC 2024 Modified Files: src/sys/uvm: uvm_pglist.c uvm_physseg.c uvm_physseg.h Log Message: uvm: change type of uvm_physseg.start_hint from u_int to u_long Avoids assertion failure in uvm_pglistalloc_s_ps() with large paddrs. PR kern/57683. To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 src/sys/uvm/uvm_pglist.c cvs rdiff -u -r1.19 -r1.20 src/sys/uvm/uvm_physseg.c cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/uvm_physseg.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/uvm/uvm_pglist.c diff -u src/sys/uvm/uvm_pglist.c:1.90 src/sys/uvm/uvm_pglist.c:1.91 --- src/sys/uvm/uvm_pglist.c:1.90 Tue Dec 21 08:27:49 2021 +++ src/sys/uvm/uvm_pglist.c Sat Jan 13 09:44:42 2024 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_pglist.c,v 1.90 2021/12/21 08:27:49 skrll Exp $ */ +/* $NetBSD: uvm_pglist.c,v 1.91 2024/01/13 09:44:42 tnn Exp $ */ /*- * Copyright (c) 1997, 2019 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.90 2021/12/21 08:27:49 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_pglist.c,v 1.91 2024/01/13 09:44:42 tnn Exp $"); #include #include @@ -112,8 +112,9 @@ static int uvm_pglistalloc_c_ps(uvm_physseg_t psi, int num, paddr_t low, paddr_t high, paddr_t alignment, paddr_t boundary, struct pglist *rlist) { - signed int candidate, limit, candidateidx, end, idx, skip; - int pagemask; + long candidate, limit, candidateidx, end, idx; + int skip; + long pagemask; bool second_pass; #ifdef DEBUG paddr_t idxpa, lastidxpa; @@ -138,9 +139,9 @@ uvm_pglistalloc_c_ps(uvm_physseg_t psi, * succeeded. */ alignment = atop(alignment); - candidate = roundup2(uimax(low, uvm_physseg_get_avail_start(psi) + + candidate = roundup2(ulmax(low, uvm_physseg_get_avail_start(psi) + uvm_physseg_get_start_hint(psi)), alignment); - limit = uimin(high, uvm_physseg_get_avail_end(psi)); + limit = ulmin(high, uvm_physseg_get_avail_end(psi)); pagemask = ~((boundary >> PAGE_SHIFT) - 1); skip = 0; second_pass = false; @@ -162,8 +163,8 @@ uvm_pglistalloc_c_ps(uvm_physseg_t psi, * is were we started. */ second_pass = true; - candidate = roundup2(uimax(low, uvm_physseg_get_avail_start(psi)), alignment); - limit = uimin(limit, uvm_physseg_get_avail_start(psi) + + candidate = roundup2(ulmax(low, uvm_physseg_get_avail_start(psi)), alignment); + limit = ulmin(limit, uvm_physseg_get_avail_start(psi) + uvm_physseg_get_start_hint(psi)); skip = 0; continue; @@ -200,7 +201,7 @@ uvm_pglistalloc_c_ps(uvm_physseg_t psi, * Found a suitable starting page. See if the range is free. */ #ifdef PGALLOC_VERBOSE - printf("%s: psi=%d candidate=%#x end=%#x skip=%#x, align=%#"PRIxPADDR, + printf("%s: psi=%d candidate=%#lx end=%#lx skip=%#x, align=%#"PRIxPADDR, __func__, psi, candidateidx, end, skip, alignment); #endif /* @@ -283,7 +284,7 @@ uvm_pglistalloc_c_ps(uvm_physseg_t psi, uvm_physseg_get_avail_start(psi)); KASSERTMSG(uvm_physseg_get_start_hint(psi) <= uvm_physseg_get_avail_end(psi) - uvm_physseg_get_avail_start(psi), - "%x %u (%#x) <= %#"PRIxPADDR" - %#"PRIxPADDR" (%#"PRIxPADDR")", + "%lx %lu (%#lx) <= %#"PRIxPADDR" - %#"PRIxPADDR" (%#"PRIxPADDR")", candidate + num, uvm_physseg_get_start_hint(psi), uvm_physseg_get_start_hint(psi), uvm_physseg_get_avail_end(psi), uvm_physseg_get_avail_start(psi), @@ -523,7 +524,8 @@ static int uvm_pglistalloc_s_ps(uvm_physseg_t psi, int num, paddr_t low, paddr_t high, struct pglist *rlist) { - int todo, limit, candidate; + int todo; + long limit, candidate; struct vm_page *pg; bool second_pass; #ifdef PGALLOC_VERBOSE @@ -546,9 +548,9 @@ uvm_pglistalloc_s_ps(uvm_physseg_t psi, return -1; todo = num; - candidate = uimax(low, uvm_physseg_get_avail_start(psi) + + candidate = ulmax(low, uvm_physseg_get_avail_start(psi) + uvm_physseg_get_start_hint(psi)); - limit = uimin(high, uvm_physseg_get_avail_end(psi)); + limit = ulmin(high, uvm_physseg_get_avail_end(psi)); pg = uvm_physseg_get_pg(psi, candidate - uvm_physseg_get_start(psi)); second_pass = false; @@ -560,8 +562,8 @@ again: break; } second_pass = true; - candidate = uimax(low, uvm_physseg_get_avail_start(psi)); - limit = uimin(limit, uvm_physseg_get_avail_start(psi) + + candidate = ulmax(low, uvm_physseg_get_avail_start(psi)); + limit = ulmin(limit, uvm_physseg_get_avail_start(psi) + uvm_physseg_get_start_hint(psi)); pg = uvm_physseg_get_pg(psi, candidate - uvm_physseg_get_start(psi)); goto again; @@ -571,10 +573,10 @@ again: paddr_t cidx = 0; const uvm_physseg_t bank = uvm_physseg_find(candidate, ); KDASSERTMSG(bank == psi, - "uvm_physseg_find(%#x) (%"PRIxPHYSSEG ") != psi %"PRIxPHYSSEG, + "uvm_physseg_find(%#lx)
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Mon Jan 1 16:56:30 UTC 2024 Modified Files: src/sys/uvm/pmap: pmap_tlb.c Log Message: Appease KASSERTs for zero ASID CPUs (I mean harts) To generate a diff of this commit: cvs rdiff -u -r1.61 -r1.62 src/sys/uvm/pmap/pmap_tlb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Fri Oct 6 08:48:16 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_tlb.c pmap_tlb.h Log Message: Support CPUs that might not have ASIDs in the common pmap. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/uvm/pmap/pmap_tlb.c cvs rdiff -u -r1.16 -r1.17 src/sys/uvm/pmap/pmap_tlb.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Fri Oct 6 08:48:16 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_tlb.c pmap_tlb.h Log Message: Support CPUs that might not have ASIDs in the common pmap. To generate a diff of this commit: cvs rdiff -u -r1.60 -r1.61 src/sys/uvm/pmap/pmap_tlb.c cvs rdiff -u -r1.16 -r1.17 src/sys/uvm/pmap/pmap_tlb.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/uvm/pmap/pmap_tlb.c diff -u src/sys/uvm/pmap/pmap_tlb.c:1.60 src/sys/uvm/pmap/pmap_tlb.c:1.61 --- src/sys/uvm/pmap/pmap_tlb.c:1.60 Tue Aug 1 08:17:26 2023 +++ src/sys/uvm/pmap/pmap_tlb.c Fri Oct 6 08:48:16 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_tlb.c,v 1.60 2023/08/01 08:17:26 skrll Exp $ */ +/* $NetBSD: pmap_tlb.c,v 1.61 2023/10/06 08:48:16 skrll Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.60 2023/08/01 08:17:26 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.61 2023/10/06 08:48:16 skrll Exp $"); /* * Manages address spaces in a TLB. @@ -830,6 +830,22 @@ pmap_tlb_asid_alloc(struct pmap_tlb_info KASSERT(ti->ti_asids_free > 0); KASSERT(ti->ti_asid_hint > KERNEL_PID); + if (__predict_false(!tlbinfo_asids_p(ti))) { +#if defined(MULTIPROCESSOR) + /* + * Mark that we are active for all CPUs sharing this TLB. + * The bits in pm_active belonging to this TLB can only + * be changed while this TLBs lock is held. + */ +#if PMAP_TLB_MAX == 1 + kcpuset_copy(pm->pm_active, kcpuset_running); +#else + kcpuset_merge(pm->pm_active, ti->ti_kcpuset); +#endif +#endif + return; + } + /* * If the last ASID allocated was the maximum ASID, then the * hint will be out of range. Reset the hint to first @@ -937,7 +953,7 @@ pmap_tlb_asid_acquire(pmap_t pm, struct /* * If we've run out ASIDs, reinitialize the ASID space. */ - if (__predict_false(tlbinfo_noasids_p(ti))) { + if (__predict_false(tlbinfo_asids_p(ti) && tlbinfo_noasids_p(ti))) { KASSERT(l == curlwp); UVMHIST_LOG(maphist, " asid reinit", 0, 0, 0, 0); pmap_tlb_asid_reinitialize(ti, TLBINV_NOBODY); Index: src/sys/uvm/pmap/pmap_tlb.h diff -u src/sys/uvm/pmap/pmap_tlb.h:1.16 src/sys/uvm/pmap/pmap_tlb.h:1.17 --- src/sys/uvm/pmap/pmap_tlb.h:1.16 Wed Oct 26 07:35:20 2022 +++ src/sys/uvm/pmap/pmap_tlb.h Fri Oct 6 08:48:16 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_tlb.h,v 1.16 2022/10/26 07:35:20 skrll Exp $ */ +/* $NetBSD: pmap_tlb.h,v 1.17 2023/10/06 08:48:16 skrll Exp $ */ /* * Copyright (c) 1992, 1993 @@ -86,6 +86,10 @@ # endif #endif +#if !defined(PMAP_TLB_ALWAYS_ASIDS) +#define PMAP_TLB_ALWAYS_ASIDS true +#endif + /* * Per TLB (normally same as CPU) asid info */ @@ -97,7 +101,7 @@ struct pmap_asid_info { #define TLBINFO_LOCK(ti) mutex_spin_enter((ti)->ti_lock) #define TLBINFO_UNLOCK(ti) mutex_spin_exit((ti)->ti_lock) #define TLBINFO_OWNED(ti) mutex_owned((ti)->ti_lock) -#define PMAP_PAI_ASIDVALID_P(pai, ti) ((pai)->pai_asid != 0) +#define PMAP_PAI_ASIDVALID_P(pai, ti) (!tlbinfo_asids_p(ti) || (pai)->pai_asid != 0) #define PMAP_PAI(pmap, ti) (&(pmap)->pm_pai[tlbinfo_index(ti)]) #define PAI_PMAP(pai, ti) \ ((pmap_t)((intptr_t)(pai) \ @@ -188,5 +192,11 @@ void pmap_tlb_asid_check(void); /* for ddb */ void pmap_db_tlb_print(struct pmap *, void (*)(const char *, ...) __printflike(1, 2)); +static inline bool +tlbinfo_asids_p(struct pmap_tlb_info *ti) +{ + return PMAP_TLB_ALWAYS_ASIDS || (ti)->ti_asid_max != 0; +} + #endif /* _KERNEL */ #endif /* _UVM_PMAP_PMAP_TLB_H_ */
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Wed Oct 4 20:34:19 UTC 2023 Modified Files: src/sys/uvm: uvm_glue.c Log Message: Remove unneeded test of ci->ci_want_resched. To generate a diff of this commit: cvs rdiff -u -r1.181 -r1.182 src/sys/uvm/uvm_glue.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/uvm/uvm_glue.c diff -u src/sys/uvm/uvm_glue.c:1.181 src/sys/uvm/uvm_glue.c:1.182 --- src/sys/uvm/uvm_glue.c:1.181 Sun Jun 14 21:41:42 2020 +++ src/sys/uvm/uvm_glue.c Wed Oct 4 20:34:19 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_glue.c,v 1.181 2020/06/14 21:41:42 ad Exp $ */ +/* $NetBSD: uvm_glue.c,v 1.182 2023/10/04 20:34:19 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -62,7 +62,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.181 2020/06/14 21:41:42 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.182 2023/10/04 20:34:19 ad Exp $"); #include "opt_kgdb.h" #include "opt_kstack.h" @@ -529,6 +529,5 @@ uvm_idle(void) KASSERT(kpreempt_disabled()); - if (!ci->ci_want_resched) - uvmpdpol_idle(ucpu); + uvmpdpol_idle(ucpu); }
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Wed Oct 4 20:34:19 UTC 2023 Modified Files: src/sys/uvm: uvm_glue.c Log Message: Remove unneeded test of ci->ci_want_resched. To generate a diff of this commit: cvs rdiff -u -r1.181 -r1.182 src/sys/uvm/uvm_glue.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sat Sep 23 18:20:20 UTC 2023 Modified Files: src/sys/uvm: uvm_page.c uvm_physseg.c Log Message: uvm_phys_to_vm_page() turns out to be a fairly central routine due to the way that some of the pmaps work, so try to optimise it a little. To generate a diff of this commit: cvs rdiff -u -r1.253 -r1.254 src/sys/uvm/uvm_page.c cvs rdiff -u -r1.18 -r1.19 src/sys/uvm/uvm_physseg.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/uvm/uvm_page.c diff -u src/sys/uvm/uvm_page.c:1.253 src/sys/uvm/uvm_page.c:1.254 --- src/sys/uvm/uvm_page.c:1.253 Mon Jul 17 12:55:37 2023 +++ src/sys/uvm/uvm_page.c Sat Sep 23 18:20:20 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_page.c,v 1.253 2023/07/17 12:55:37 riastradh Exp $ */ +/* $NetBSD: uvm_page.c,v 1.254 2023/09/23 18:20:20 ad Exp $ */ /*- * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc. @@ -95,7 +95,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.253 2023/07/17 12:55:37 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.254 2023/09/23 18:20:20 ad Exp $"); #include "opt_ddb.h" #include "opt_uvm.h" @@ -671,23 +671,6 @@ uvm_page_physget(paddr_t *paddrp) } #endif /* PMAP_STEAL_MEMORY */ -/* - * PHYS_TO_VM_PAGE: find vm_page for a PA. used by MI code to get vm_pages - * back from an I/O mapping (ugh!). used in some MD code as well. - */ -struct vm_page * -uvm_phys_to_vm_page(paddr_t pa) -{ - paddr_t pf = atop(pa); - paddr_t off; - uvm_physseg_t upm; - - upm = uvm_physseg_find(pf, ); - if (upm != UVM_PHYSSEG_TYPE_INVALID) - return uvm_physseg_get_pg(upm, off); - return(NULL); -} - paddr_t uvm_vm_page_to_phys(const struct vm_page *pg) { Index: src/sys/uvm/uvm_physseg.c diff -u src/sys/uvm/uvm_physseg.c:1.18 src/sys/uvm/uvm_physseg.c:1.19 --- src/sys/uvm/uvm_physseg.c:1.18 Sun Apr 9 09:00:56 2023 +++ src/sys/uvm/uvm_physseg.c Sat Sep 23 18:20:20 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_physseg.c,v 1.18 2023/04/09 09:00:56 riastradh Exp $ */ +/* $NetBSD: uvm_physseg.c,v 1.19 2023/09/23 18:20:20 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -88,7 +88,9 @@ */ struct uvm_physseg { /* used during RB tree lookup for PHYS_TO_VM_PAGE(). */ +#if defined(UVM_HOTPLUG) struct rb_node rb_node; /* tree information */ +#endif paddr_t start; /* PF# of first page in segment */ paddr_t end; /* (PF# of last page in segment) + 1 */ struct vm_page *pgs; /* vm_page structures (from start) */ @@ -561,8 +563,10 @@ uvm_physseg_find(paddr_t pframe, psize_t #define HANDLE_TO_PHYSSEG_NODE(h) (VM_PHYSMEM_PTR((int)h)) #define PHYSSEG_NODE_TO_HANDLE(u) ((int)((vsize_t) (u - vm_physmem) / sizeof(struct uvm_physseg))) -static struct uvm_physseg vm_physmem[VM_PHYSSEG_MAX]; /* XXXCDC: uvm.physmem */ -static int vm_nphysseg = 0;/* XXXCDC: uvm.nphysseg */ +/* XXXCDC: uvm.physmem */ +static struct uvm_physseg vm_physmem[VM_PHYSSEG_MAX] __read_mostly; +/* XXXCDC: uvm.nphysseg */ +static int vm_nphysseg __read_mostly = 0; #define vm_nphysmem vm_nphysseg void @@ -851,7 +855,7 @@ static inline int vm_physseg_find_linear /* * vm_physseg_find: find vm_physseg structure that belongs to a PA */ -int +inline int uvm_physseg_find(paddr_t pframe, psize_t *offp) { @@ -943,6 +947,40 @@ vm_physseg_find_linear(struct uvm_physse #endif #endif /* UVM_HOTPLUG */ +/* + * PHYS_TO_VM_PAGE: find vm_page for a PA. used by MI code to get vm_pages + * back from an I/O mapping (ugh!). used in some MD code as well. it can + * be prominent in flamegraphs, so optimise it and try to make it easy for + * the compiler by including next to the inline lookup routines. + */ +struct vm_page * +uvm_phys_to_vm_page(paddr_t pa) +{ +#if VM_PHYSSEG_STRAT != VM_PSTRAT_BSEARCH + /* 'contig' and linear cases */ + KASSERT(vm_nphysseg > 0); + struct uvm_physseg *ps = _physmem[0]; + struct uvm_physseg *end = _physmem[vm_nphysseg]; + paddr_t pframe = atop(pa); + do { + if (pframe >= ps->start && pframe < ps->end) { + return >pgs[pframe - ps->start]; + } + } while (VM_PHYSSEG_MAX > 1 && __predict_false(++ps < end)); + return NULL; +#else + /* binary search for it */ + paddr_t pf = atop(pa); + paddr_t off; + uvm_physseg_t upm; + + upm = uvm_physseg_find(pf, ); + if (upm != UVM_PHYSSEG_TYPE_INVALID) + return uvm_physseg_get_pg(upm, off); + return(NULL); +#endif +} + bool uvm_physseg_valid_p(uvm_physseg_t upm) { @@ -1047,7 +1085,7 @@ uvm_physseg_get_avail_end(uvm_physseg_t return HANDLE_TO_PHYSSEG_NODE(upm)->avail_end; } -struct vm_page * +inline struct vm_page * uvm_physseg_get_pg(uvm_physseg_t upm, paddr_t idx) { KASSERT(uvm_physseg_valid_p(upm));
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sat Sep 23 18:20:20 UTC 2023 Modified Files: src/sys/uvm: uvm_page.c uvm_physseg.c Log Message: uvm_phys_to_vm_page() turns out to be a fairly central routine due to the way that some of the pmaps work, so try to optimise it a little. To generate a diff of this commit: cvs rdiff -u -r1.253 -r1.254 src/sys/uvm/uvm_page.c cvs rdiff -u -r1.18 -r1.19 src/sys/uvm/uvm_physseg.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Tue Sep 19 22:14:25 UTC 2023 Modified Files: src/sys/uvm: uvm_fault.c Log Message: Don't needlessly bump a couple of fault counters if upgrading the rwlock failed. To generate a diff of this commit: cvs rdiff -u -r1.235 -r1.236 src/sys/uvm/uvm_fault.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/uvm/uvm_fault.c diff -u src/sys/uvm/uvm_fault.c:1.235 src/sys/uvm/uvm_fault.c:1.236 --- src/sys/uvm/uvm_fault.c:1.235 Fri Sep 1 10:57:20 2023 +++ src/sys/uvm/uvm_fault.c Tue Sep 19 22:14:25 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_fault.c,v 1.235 2023/09/01 10:57:20 andvar Exp $ */ +/* $NetBSD: uvm_fault.c,v 1.236 2023/09/19 22:14:25 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.235 2023/09/01 10:57:20 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.236 2023/09/19 22:14:25 ad Exp $"); #include "opt_uvmhist.h" @@ -1605,7 +1605,6 @@ uvm_fault_upper_promote( UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist); UVMHIST_LOG(maphist, " case 1B: COW fault",0,0,0,0); - cpu_count(CPU_COUNT_FLT_ACOW, 1); /* promoting requires a write lock. */ error = uvm_fault_upper_upgrade(ufi, flt, amap, NULL); @@ -1614,6 +1613,8 @@ uvm_fault_upper_promote( } KASSERT(rw_write_held(amap->am_lock)); + cpu_count(CPU_COUNT_FLT_ACOW, 1); + error = uvmfault_promote(ufi, oanon, PGO_DONTCARE, , >anon_spare); switch (error) { @@ -2127,9 +2128,6 @@ uvm_fault_lower_io( int advice; UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist); - /* update rusage counters */ - curlwp->l_ru.ru_majflt++; - /* grab everything we need from the entry before we unlock */ uoff = (ufi->orig_rvaddr - ufi->entry->start) + ufi->entry->offset; access_type = flt->access_type & MASK(ufi->entry); @@ -2145,6 +2143,9 @@ uvm_fault_lower_io( } uvmfault_unlockall(ufi, amap, NULL); + /* update rusage counters */ + curlwp->l_ru.ru_majflt++; + /* Locked: uobj(write) */ KASSERT(rw_write_held(uobj->vmobjlock));
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Tue Sep 19 22:14:25 UTC 2023 Modified Files: src/sys/uvm: uvm_fault.c Log Message: Don't needlessly bump a couple of fault counters if upgrading the rwlock failed. To generate a diff of this commit: cvs rdiff -u -r1.235 -r1.236 src/sys/uvm/uvm_fault.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Sep 10 15:01:11 UTC 2023 Modified Files: src/sys/uvm: uvm_pdaemon.c Log Message: uvmpd_trylockowner(): release pg->interlock before calling rw_obj_free() since it can call back into the VM system. To generate a diff of this commit: cvs rdiff -u -r1.133 -r1.134 src/sys/uvm/uvm_pdaemon.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Sep 10 15:01:11 UTC 2023 Modified Files: src/sys/uvm: uvm_pdaemon.c Log Message: uvmpd_trylockowner(): release pg->interlock before calling rw_obj_free() since it can call back into the VM system. To generate a diff of this commit: cvs rdiff -u -r1.133 -r1.134 src/sys/uvm/uvm_pdaemon.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/uvm/uvm_pdaemon.c diff -u src/sys/uvm/uvm_pdaemon.c:1.133 src/sys/uvm/uvm_pdaemon.c:1.134 --- src/sys/uvm/uvm_pdaemon.c:1.133 Sat Apr 17 21:37:21 2021 +++ src/sys/uvm/uvm_pdaemon.c Sun Sep 10 15:01:11 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_pdaemon.c,v 1.133 2021/04/17 21:37:21 mrg Exp $ */ +/* $NetBSD: uvm_pdaemon.c,v 1.134 2023/09/10 15:01:11 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.133 2021/04/17 21:37:21 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_pdaemon.c,v 1.134 2023/09/10 15:01:11 ad Exp $"); #include "opt_uvmhist.h" #include "opt_readahead.h" @@ -416,7 +416,7 @@ uvmpd_page_owner_lock(struct vm_page *pg krwlock_t * uvmpd_trylockowner(struct vm_page *pg) { - krwlock_t *slock, *heldslock; + krwlock_t *slock, *heldslock = NULL; KASSERT(mutex_owned(>interlock)); @@ -453,9 +453,7 @@ uvmpd_trylockowner(struct vm_page *pg) if (heldslock != slock) { rw_exit(heldslock); slock = NULL; - } - rw_obj_free(heldslock); - if (slock != NULL) { + } else { success: /* * Set PG_ANON if it isn't set already. @@ -468,6 +466,9 @@ success: } } mutex_exit(>interlock); + if (heldslock != NULL) { + rw_obj_free(heldslock); + } return slock; }
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Sep 10 14:54:34 UTC 2023 Modified Files: src/sys/uvm: uvm_amap.c Log Message: Align uvm_amap to COHERENCY_UNIT. To generate a diff of this commit: cvs rdiff -u -r1.128 -r1.129 src/sys/uvm/uvm_amap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: ad Date: Sun Sep 10 14:54:34 UTC 2023 Modified Files: src/sys/uvm: uvm_amap.c Log Message: Align uvm_amap to COHERENCY_UNIT. To generate a diff of this commit: cvs rdiff -u -r1.128 -r1.129 src/sys/uvm/uvm_amap.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/uvm/uvm_amap.c diff -u src/sys/uvm/uvm_amap.c:1.128 src/sys/uvm/uvm_amap.c:1.129 --- src/sys/uvm/uvm_amap.c:1.128 Mon Jun 19 08:23:35 2023 +++ src/sys/uvm/uvm_amap.c Sun Sep 10 14:54:34 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_amap.c,v 1.128 2023/06/19 08:23:35 msaitoh Exp $ */ +/* $NetBSD: uvm_amap.c,v 1.129 2023/09/10 14:54:34 ad Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.128 2023/06/19 08:23:35 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.129 2023/09/10 14:54:34 ad Exp $"); #include "opt_uvmhist.h" @@ -305,9 +305,9 @@ uvm_amap_init(void) mutex_init(_list_lock, MUTEX_DEFAULT, IPL_NONE); - pool_cache_bootstrap(_amap_cache, sizeof(struct vm_amap), 0, 0, - PR_LARGECACHE, "amappl", NULL, IPL_NONE, amap_ctor, amap_dtor, - NULL); + pool_cache_bootstrap(_amap_cache, sizeof(struct vm_amap), + COHERENCY_UNIT, 0, 0, "amappl", NULL, IPL_NONE, + amap_ctor, amap_dtor, NULL); } /*
CVS commit: src/sys/uvm
Module Name:src Committed By: andvar Date: Fri Sep 1 10:57:20 UTC 2023 Modified Files: src/sys/uvm: uvm_fault.c Log Message: s/unnmapped/unmapped/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.234 -r1.235 src/sys/uvm/uvm_fault.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: andvar Date: Fri Sep 1 10:57:20 UTC 2023 Modified Files: src/sys/uvm: uvm_fault.c Log Message: s/unnmapped/unmapped/ in comment. To generate a diff of this commit: cvs rdiff -u -r1.234 -r1.235 src/sys/uvm/uvm_fault.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/uvm/uvm_fault.c diff -u src/sys/uvm/uvm_fault.c:1.234 src/sys/uvm/uvm_fault.c:1.235 --- src/sys/uvm/uvm_fault.c:1.234 Sun Aug 13 23:06:07 2023 +++ src/sys/uvm/uvm_fault.c Fri Sep 1 10:57:20 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_fault.c,v 1.234 2023/08/13 23:06:07 chs Exp $ */ +/* $NetBSD: uvm_fault.c,v 1.235 2023/09/01 10:57:20 andvar Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.234 2023/08/13 23:06:07 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.235 2023/09/01 10:57:20 andvar Exp $"); #include "opt_uvmhist.h" @@ -1843,7 +1843,7 @@ uvm_fault_lower_upgrade(struct uvm_fault * * 1. check uobj * 1.1. if null, ZFOD. - * 1.2. if not null, look up unnmapped neighbor pages. + * 1.2. if not null, look up unmapped neighbor pages. * 2. for center page, check if promote. * 2.1. ZFOD always needs promotion. * 2.2. other uobjs, when entry is marked COW (usually MAP_PRIVATE vnode).
CVS commit: src/sys/uvm
Module Name:src Committed By: chs Date: Sun Aug 13 23:06:07 UTC 2023 Modified Files: src/sys/uvm: uvm_fault.c Log Message: uvm: prevent TLB invalidation races during COW resolution When a thread takes a page fault which results in COW resolution, other threads in the same process can be concurrently accessing that same mapping on other CPUs. When the faulting thread updates the pmap entry at the end of COW processing, the resulting TLB invalidations to other CPUs are not done atomically, so another thread can write to the new writable page and then a third thread might still read from the old read-only page, resulting in inconsistent views of the page by the latter two threads. Fix this by removing the pmap entry entirely for the original page before we install the new pmap entry for the new page, so that the new page can only be modified after the old page is no longer accessible. This fixes PR 56535 as well as the netbsd versions of problems described in various bug trackers: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225584 https://reviews.freebsd.org/D14347 https://github.com/golang/go/issues/34988 To generate a diff of this commit: cvs rdiff -u -r1.233 -r1.234 src/sys/uvm/uvm_fault.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: chs Date: Sun Aug 13 23:06:07 UTC 2023 Modified Files: src/sys/uvm: uvm_fault.c Log Message: uvm: prevent TLB invalidation races during COW resolution When a thread takes a page fault which results in COW resolution, other threads in the same process can be concurrently accessing that same mapping on other CPUs. When the faulting thread updates the pmap entry at the end of COW processing, the resulting TLB invalidations to other CPUs are not done atomically, so another thread can write to the new writable page and then a third thread might still read from the old read-only page, resulting in inconsistent views of the page by the latter two threads. Fix this by removing the pmap entry entirely for the original page before we install the new pmap entry for the new page, so that the new page can only be modified after the old page is no longer accessible. This fixes PR 56535 as well as the netbsd versions of problems described in various bug trackers: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225584 https://reviews.freebsd.org/D14347 https://github.com/golang/go/issues/34988 To generate a diff of this commit: cvs rdiff -u -r1.233 -r1.234 src/sys/uvm/uvm_fault.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/uvm/uvm_fault.c diff -u src/sys/uvm/uvm_fault.c:1.233 src/sys/uvm/uvm_fault.c:1.234 --- src/sys/uvm/uvm_fault.c:1.233 Mon Jul 17 12:55:37 2023 +++ src/sys/uvm/uvm_fault.c Sun Aug 13 23:06:07 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_fault.c,v 1.233 2023/07/17 12:55:37 riastradh Exp $ */ +/* $NetBSD: uvm_fault.c,v 1.234 2023/08/13 23:06:07 chs Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.233 2023/07/17 12:55:37 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.234 2023/08/13 23:06:07 chs Exp $"); #include "opt_uvmhist.h" @@ -634,8 +634,17 @@ uvmfault_promote(struct uvm_faultinfo *u goto done; } - /* copy page [pg now dirty] */ + /* + * copy the page [pg now dirty] + * + * Remove the pmap entry now for the old page at this address + * so that no thread can modify the new page while any thread + * might still see the old page. + */ if (opg) { + pmap_remove(vm_map_pmap(ufi->orig_map), ufi->orig_rvaddr, + ufi->orig_rvaddr + PAGE_SIZE); + pmap_update(vm_map_pmap(ufi->orig_map)); uvm_pagecopy(opg, pg); } KASSERT(uvm_pagegetdirty(pg) == UVM_PAGE_STATUS_DIRTY);
CVS commit: src/sys/uvm
Module Name:src Committed By: rin Date: Thu Aug 3 03:15:48 UTC 2023 Modified Files: src/sys/uvm: uvm_map.c Log Message: uvm_findspace(): For sh3, convert a KASSERTMSG(9) into printf(9) XXX Work around for PR kern/51254 until it gets fixed. With this change, landisk survives full ATF with DIAGNOSTIC enabled. To generate a diff of this commit: cvs rdiff -u -r1.406 -r1.407 src/sys/uvm/uvm_map.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/uvm/uvm_map.c diff -u src/sys/uvm/uvm_map.c:1.406 src/sys/uvm/uvm_map.c:1.407 --- src/sys/uvm/uvm_map.c:1.406 Mon May 15 01:42:42 2023 +++ src/sys/uvm/uvm_map.c Thu Aug 3 03:15:48 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_map.c,v 1.406 2023/05/15 01:42:42 chs Exp $ */ +/* $NetBSD: uvm_map.c,v 1.407 2023/08/03 03:15:48 rin Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.406 2023/05/15 01:42:42 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.407 2023/08/03 03:15:48 rin Exp $"); #include "opt_ddb.h" #include "opt_pax.h" @@ -1792,7 +1792,12 @@ uvm_findspace_invariants(struct vm_map * map, hint, orig_hint, length, uobj, (unsigned long long)uoffset, align, flags, entry, line); +#ifndef __sh3__ /* XXXRO: kern/51254 */ KASSERTMSG(!topdown || hint <= orig_hint, +#else + if (__predict_false(!(!topdown || hint <= orig_hint))) + printf( +#endif "map=%p hint=%#"PRIxVADDR" orig_hint=%#"PRIxVADDR " length=%#"PRIxVSIZE" uobj=%p uoffset=%#llx align=%"PRIxVSIZE " flags=%#x entry=%p (uvm_map_findspace line %d)",
CVS commit: src/sys/uvm
Module Name:src Committed By: rin Date: Thu Aug 3 03:15:48 UTC 2023 Modified Files: src/sys/uvm: uvm_map.c Log Message: uvm_findspace(): For sh3, convert a KASSERTMSG(9) into printf(9) XXX Work around for PR kern/51254 until it gets fixed. With this change, landisk survives full ATF with DIAGNOSTIC enabled. To generate a diff of this commit: cvs rdiff -u -r1.406 -r1.407 src/sys/uvm/uvm_map.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Tue Aug 1 08:17:26 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_tlb.c Log Message: Improve debug To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/uvm/pmap/pmap_tlb.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/uvm/pmap/pmap_tlb.c diff -u src/sys/uvm/pmap/pmap_tlb.c:1.59 src/sys/uvm/pmap/pmap_tlb.c:1.60 --- src/sys/uvm/pmap/pmap_tlb.c:1.59 Mon Jun 12 06:47:17 2023 +++ src/sys/uvm/pmap/pmap_tlb.c Tue Aug 1 08:17:26 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_tlb.c,v 1.59 2023/06/12 06:47:17 skrll Exp $ */ +/* $NetBSD: pmap_tlb.c,v 1.60 2023/08/01 08:17:26 skrll Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.59 2023/06/12 06:47:17 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.60 2023/08/01 08:17:26 skrll Exp $"); /* * Manages address spaces in a TLB. @@ -568,7 +568,7 @@ pmap_tlb_shootdown_process(void) struct pmap_asid_info * const pai = PMAP_PAI(ti->ti_victim, ti); KASSERT(ti->ti_victim != pmap_kernel()); if (pmap_tlb_intersecting_onproc_p(ti->ti_victim, ti)) { - UVMHIST_LOG(maphist, "pmap_tlb_intersecting_onproc_p", 0, 0, 0, 0); + UVMHIST_LOG(maphist, "... onproc asid %jd", pai->pai_asid, 0, 0, 0); /* * The victim is an active pmap so we will just * invalidate its TLB entries. @@ -578,7 +578,7 @@ pmap_tlb_shootdown_process(void) tlb_invalidate_asids(pai->pai_asid, pai->pai_asid); pmap_tlb_asid_check(); } else if (pai->pai_asid) { - UVMHIST_LOG(maphist, "asid %jd", pai->pai_asid, 0, 0, 0); + UVMHIST_LOG(maphist, "... not active asid %jd", pai->pai_asid, 0, 0, 0); /* * The victim is no longer an active pmap for this TLB. * So simply clear its ASID and when pmap_activate is
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Tue Aug 1 08:17:26 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_tlb.c Log Message: Improve debug To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.60 src/sys/uvm/pmap/pmap_tlb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Sun Jul 23 07:25:36 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_segtab.c Log Message: KASSERT -> KASSERTMSG To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/uvm/pmap/pmap_segtab.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Sun Jul 23 07:25:36 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_segtab.c Log Message: KASSERT -> KASSERTMSG To generate a diff of this commit: cvs rdiff -u -r1.32 -r1.33 src/sys/uvm/pmap/pmap_segtab.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/uvm/pmap/pmap_segtab.c diff -u src/sys/uvm/pmap/pmap_segtab.c:1.32 src/sys/uvm/pmap/pmap_segtab.c:1.33 --- src/sys/uvm/pmap/pmap_segtab.c:1.32 Sat Jul 1 07:10:13 2023 +++ src/sys/uvm/pmap/pmap_segtab.c Sun Jul 23 07:25:36 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_segtab.c,v 1.32 2023/07/01 07:10:13 skrll Exp $ */ +/* $NetBSD: pmap_segtab.c,v 1.33 2023/07/23 07:25:36 skrll Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.32 2023/07/01 07:10:13 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.33 2023/07/23 07:25:36 skrll Exp $"); /* * Manages physical address maps. @@ -282,7 +282,10 @@ pmap_ptpage(struct pmap *pmap, vaddr_t v // UVMHIST_LOG(pmaphist, "pm_pdetab %#jx", ptb, 0, 0, 0); - KASSERT(pmap != pmap_kernel() || !pmap_md_direct_mapped_vaddr_p(va)); + KASSERTMSG(pmap != pmap_kernel() || !pmap_md_direct_mapped_vaddr_p(va), + "pmap_kernel: %s, va %#" PRIxVADDR, + pmap == pmap_kernel() ? "true" : "false", + pmap == pmap_kernel() ? va : 0); #ifdef _LP64 for (size_t segshift = XSEGSHIFT;
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Mon Jul 17 12:55:38 UTC 2023 Modified Files: src/sys/uvm: uvm.h uvm_fault.c uvm_init.c uvm_page.c Added Files: src/sys/uvm: uvm_rndsource.h Log Message: uvm(9): One rndsource for faults -- not one per CPU. All relevant state is per-CPU anyway; the only substantive difference this makes is how many entries appear in `rndctl -l' output and what they are called -- formerly the somewhat confusing `cpuN', meaning `page faults on cpuN', and now just `uvmfault'. I don't think there's any real value in being able to enable or disable measurement or counting of page faults on one CPU vs others, so although this could be a minor compatibility change, it's hard to imagine it matters much. XXX kernel ABI change in struct cpu_info To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/uvm/uvm.h cvs rdiff -u -r1.232 -r1.233 src/sys/uvm/uvm_fault.c cvs rdiff -u -r1.55 -r1.56 src/sys/uvm/uvm_init.c cvs rdiff -u -r1.252 -r1.253 src/sys/uvm/uvm_page.c cvs rdiff -u -r0 -r1.1 src/sys/uvm/uvm_rndsource.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/uvm/uvm.h diff -u src/sys/uvm/uvm.h:1.77 src/sys/uvm/uvm.h:1.78 --- src/sys/uvm/uvm.h:1.77 Sun May 17 15:11:57 2020 +++ src/sys/uvm/uvm.h Mon Jul 17 12:55:37 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm.h,v 1.77 2020/05/17 15:11:57 ad Exp $ */ +/* $NetBSD: uvm.h,v 1.78 2023/07/17 12:55:37 riastradh Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -63,7 +63,6 @@ #ifdef _KERNEL #include -#include /* * pull in VM_NFREELIST @@ -85,9 +84,6 @@ struct uvm_cpu { u_int pgflcolor; /* next color to allocate */ u_int pgflbucket; /* where to send our pages */ - /* entropy */ - krndsource_t rs; /* entropy source */ - /* uvmpdpol: queue of intended page status changes. */ struct vm_page **pdq; /* queue entries */ u_int pdqhead; /* current queue head */ Index: src/sys/uvm/uvm_fault.c diff -u src/sys/uvm/uvm_fault.c:1.232 src/sys/uvm/uvm_fault.c:1.233 --- src/sys/uvm/uvm_fault.c:1.232 Sun Apr 9 09:00:56 2023 +++ src/sys/uvm/uvm_fault.c Mon Jul 17 12:55:37 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_fault.c,v 1.232 2023/04/09 09:00:56 riastradh Exp $ */ +/* $NetBSD: uvm_fault.c,v 1.233 2023/07/17 12:55:37 riastradh Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.232 2023/04/09 09:00:56 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.233 2023/07/17 12:55:37 riastradh Exp $"); #include "opt_uvmhist.h" @@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_fault.c, #include #include +#include /* * @@ -865,7 +866,7 @@ uvm_fault_internal(struct vm_map *orig_m /* Don't flood RNG subsystem with samples. */ if (++(ci->ci_faultrng) == 503) { ci->ci_faultrng = 0; - rnd_add_uint32(()->ci_data.cpu_uvm->rs, + rnd_add_uint32(_fault_rndsource, sizeof(vaddr_t) == sizeof(uint32_t) ? (uint32_t)vaddr : sizeof(vaddr_t) == sizeof(uint64_t) ? Index: src/sys/uvm/uvm_init.c diff -u src/sys/uvm/uvm_init.c:1.55 src/sys/uvm/uvm_init.c:1.56 --- src/sys/uvm/uvm_init.c:1.55 Wed Nov 4 01:30:19 2020 +++ src/sys/uvm/uvm_init.c Mon Jul 17 12:55:37 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_init.c,v 1.55 2020/11/04 01:30:19 chs Exp $ */ +/* $NetBSD: uvm_init.c,v 1.56 2023/07/17 12:55:37 riastradh Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_init.c,v 1.55 2020/11/04 01:30:19 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_init.c,v 1.56 2023/07/17 12:55:37 riastradh Exp $"); #include #include @@ -43,11 +43,13 @@ __KERNEL_RCSID(0, "$NetBSD: uvm_init.c,v #include #include #include +#include #include #include #include #include +#include /* * struct uvm: we store most global vars in this structure to make them @@ -66,6 +68,8 @@ const int * const uvmexp_pageshift = kmutex_t uvm_kentry_lock __cacheline_aligned; +struct krndsource uvm_fault_rndsource; + /* * uvm_md_init: Init dependant on the MD boot context. * called from MD code. @@ -189,4 +193,12 @@ uvm_init(void) */ uvm_ra_init(); + + /* + * Initialize random source for page fault events. + */ + + rnd_attach_source(_fault_rndsource, "uvmfault", RND_TYPE_VM, + RND_FLAG_COLLECT_TIME|RND_FLAG_COLLECT_VALUE| + RND_FLAG_ESTIMATE_VALUE); } Index: src/sys/uvm/uvm_page.c diff -u src/sys/uvm/uvm_page.c:1.252 src/sys/uvm/uvm_page.c:1.253 --- src/sys/uvm/uvm_page.c:1.252 Sun Apr 9 09:00:56 2023 +++ src/sys/uvm/uvm_page.c Mon Jul 17 12:55:37 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_page.c,v 1.252 2023/04/09 09:00:56 riastradh Exp $ */ +/* $NetBSD: uvm_page.c,v 1.253 2023/07/17 12:55:37 riastradh Exp $ */
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Mon Jul 17 12:55:38 UTC 2023 Modified Files: src/sys/uvm: uvm.h uvm_fault.c uvm_init.c uvm_page.c Added Files: src/sys/uvm: uvm_rndsource.h Log Message: uvm(9): One rndsource for faults -- not one per CPU. All relevant state is per-CPU anyway; the only substantive difference this makes is how many entries appear in `rndctl -l' output and what they are called -- formerly the somewhat confusing `cpuN', meaning `page faults on cpuN', and now just `uvmfault'. I don't think there's any real value in being able to enable or disable measurement or counting of page faults on one CPU vs others, so although this could be a minor compatibility change, it's hard to imagine it matters much. XXX kernel ABI change in struct cpu_info To generate a diff of this commit: cvs rdiff -u -r1.77 -r1.78 src/sys/uvm/uvm.h cvs rdiff -u -r1.232 -r1.233 src/sys/uvm/uvm_fault.c cvs rdiff -u -r1.55 -r1.56 src/sys/uvm/uvm_init.c cvs rdiff -u -r1.252 -r1.253 src/sys/uvm/uvm_page.c cvs rdiff -u -r0 -r1.1 src/sys/uvm/uvm_rndsource.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Sat Jul 1 07:10:13 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_segtab.c Log Message: Fix build when KERNHIST defined, but not UVMHIST To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/uvm/pmap/pmap_segtab.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/uvm/pmap/pmap_segtab.c diff -u src/sys/uvm/pmap/pmap_segtab.c:1.31 src/sys/uvm/pmap/pmap_segtab.c:1.32 --- src/sys/uvm/pmap/pmap_segtab.c:1.31 Wed Dec 21 11:39:46 2022 +++ src/sys/uvm/pmap/pmap_segtab.c Sat Jul 1 07:10:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_segtab.c,v 1.31 2022/12/21 11:39:46 skrll Exp $ */ +/* $NetBSD: pmap_segtab.c,v 1.32 2023/07/01 07:10:13 skrll Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.31 2022/12/21 11:39:46 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.32 2023/07/01 07:10:13 skrll Exp $"); /* * Manages physical address maps. @@ -557,7 +557,7 @@ pmap_pdetab_alloc(struct pmap *pmap) UVMHIST_CALLARGS(pmapxtabhist, "pm %#jx", (uintptr_t)pmap, 0, 0, 0); pmap_pdetab_t *ptb; -#ifdef KERNHIST +#ifdef UVMHIST bool found_on_freelist = false; #endif @@ -573,7 +573,7 @@ pmap_pdetab_alloc(struct pmap *pmap) PDETAB_ADD(nget, 1); ptb->pde_next = NULL; -#ifdef KERNHIST +#ifdef UVMHIST found_on_freelist = true; #endif }
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Sat Jul 1 07:10:13 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_segtab.c Log Message: Fix build when KERNHIST defined, but not UVMHIST To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/sys/uvm/pmap/pmap_segtab.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: msaitoh Date: Mon Jun 19 08:23:35 UTC 2023 Modified Files: src/sys/uvm: uvm_amap.c Log Message: s/value value/value/ in comment. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.127 -r1.128 src/sys/uvm/uvm_amap.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/uvm/uvm_amap.c diff -u src/sys/uvm/uvm_amap.c:1.127 src/sys/uvm/uvm_amap.c:1.128 --- src/sys/uvm/uvm_amap.c:1.127 Sun Apr 9 09:00:56 2023 +++ src/sys/uvm/uvm_amap.c Mon Jun 19 08:23:35 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_amap.c,v 1.127 2023/04/09 09:00:56 riastradh Exp $ */ +/* $NetBSD: uvm_amap.c,v 1.128 2023/06/19 08:23:35 msaitoh Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.127 2023/04/09 09:00:56 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.128 2023/06/19 08:23:35 msaitoh Exp $"); #include "opt_uvmhist.h" @@ -893,7 +893,7 @@ amap_copy(struct vm_map *map, struct vm_ * First check and see if we are the only map entry referencing * he amap we currently have. If so, then just take it over instead * of copying it. Note that we are reading am_ref without lock held - * as the value value can only be one if we have the only reference + * as the value can only be one if we have the only reference * to the amap (via our locked map). If the value is greater than * one, then allocate amap and re-check the value. */
CVS commit: src/sys/uvm
Module Name:src Committed By: msaitoh Date: Mon Jun 19 08:23:35 UTC 2023 Modified Files: src/sys/uvm: uvm_amap.c Log Message: s/value value/value/ in comment. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.127 -r1.128 src/sys/uvm/uvm_amap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Mon Jun 12 06:47:17 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_tlb.c Log Message: Fix compile for non-MULTIPROCESSOR and PMAP_TLB_MAX > 1 builds To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/uvm/pmap/pmap_tlb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Mon Jun 12 06:47:17 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_tlb.c Log Message: Fix compile for non-MULTIPROCESSOR and PMAP_TLB_MAX > 1 builds To generate a diff of this commit: cvs rdiff -u -r1.58 -r1.59 src/sys/uvm/pmap/pmap_tlb.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/uvm/pmap/pmap_tlb.c diff -u src/sys/uvm/pmap/pmap_tlb.c:1.58 src/sys/uvm/pmap/pmap_tlb.c:1.59 --- src/sys/uvm/pmap/pmap_tlb.c:1.58 Mon Jun 12 06:36:28 2023 +++ src/sys/uvm/pmap/pmap_tlb.c Mon Jun 12 06:47:17 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_tlb.c,v 1.58 2023/06/12 06:36:28 skrll Exp $ */ +/* $NetBSD: pmap_tlb.c,v 1.59 2023/06/12 06:47:17 skrll Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.58 2023/06/12 06:36:28 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.59 2023/06/12 06:47:17 skrll Exp $"); /* * Manages address spaces in a TLB. @@ -1114,7 +1114,7 @@ void pmap_db_tlb_print(struct pmap *pm, void (*pr)(const char *, ...) __printflike(1, 2)) { -#if PMAP_TLB_MAX == 1 +#if !defined(MULTIPROCESSOR) || PMAP_TLB_MAX == 1 pr(" asid %5u\n", pm->pm_pai[0].pai_asid); #else for (size_t i = 0; i < (PMAP_TLB_MAX > 1 ? pmap_ntlbs : 1); i++) {
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Mon Jun 12 06:36:28 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_tlb.c Log Message: Fixup UVMHIST builds To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/uvm/pmap/pmap_tlb.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/uvm/pmap/pmap_tlb.c diff -u src/sys/uvm/pmap/pmap_tlb.c:1.57 src/sys/uvm/pmap/pmap_tlb.c:1.58 --- src/sys/uvm/pmap/pmap_tlb.c:1.57 Sat Apr 22 10:22:43 2023 +++ src/sys/uvm/pmap/pmap_tlb.c Mon Jun 12 06:36:28 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_tlb.c,v 1.57 2023/04/22 10:22:43 skrll Exp $ */ +/* $NetBSD: pmap_tlb.c,v 1.58 2023/06/12 06:36:28 skrll Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.57 2023/04/22 10:22:43 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.58 2023/06/12 06:36:28 skrll Exp $"); /* * Manages address spaces in a TLB. @@ -557,14 +557,14 @@ pmap_tlb_shootdown_process(void) __func__, ci->ci_cpl, IPL_SCHED); TLBINFO_LOCK(ti); - UVMHIST_LOG(maphist, "ti %#jx", ti, 0, 0, 0); + UVMHIST_LOG(maphist, "ti %#jx", (uintptr_t)ti, 0, 0, 0); switch (ti->ti_tlbinvop) { case TLBINV_ONE: { /* * We only need to invalidate one user ASID. */ - UVMHIST_LOG(maphist, "TLBINV_ONE ti->ti_victim %#jx", ti->ti_victim, 0, 0, 0); + UVMHIST_LOG(maphist, "TLBINV_ONE ti->ti_victim %#jx", (uintptr_t)ti->ti_victim, 0, 0, 0); struct pmap_asid_info * const pai = PMAP_PAI(ti->ti_victim, ti); KASSERT(ti->ti_victim != pmap_kernel()); if (pmap_tlb_intersecting_onproc_p(ti->ti_victim, ti)) { @@ -674,7 +674,7 @@ pmap_tlb_shootdown_bystanders(pmap_t pm) KASSERT(i < pmap_ntlbs); struct pmap_tlb_info * const ti = pmap_tlbs[i]; KASSERT(tlbinfo_index(ti) == i); - UVMHIST_LOG(maphist, "ti %#jx", ti, 0, 0, 0); + UVMHIST_LOG(maphist, "ti %#jx", (uintptr_t)ti, 0, 0, 0); /* * Skip this TLB if there are no active mappings for it. */
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Mon Jun 12 06:36:28 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_tlb.c Log Message: Fixup UVMHIST builds To generate a diff of this commit: cvs rdiff -u -r1.57 -r1.58 src/sys/uvm/pmap/pmap_tlb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: chs Date: Mon May 15 01:42:42 UTC 2023 Modified Files: src/sys/uvm: uvm_map.c Log Message: uvm: avoid a deadlock in uvm_map_clean() The locking order between map locks and page "busy" locks is that the page "busy" lock comes first, but uvm_map_clean() breaks this rule by holding a map locked (as reader) while waiting for page "busy" locks. If another thread is in the page-fault path holding a page "busy" lock while waiting for the map lock (as a reader) and at the same time a third thread is blocked waiting for the map lock as a writer (which blocks the page-fault thread), then these three threads will all deadlock with each other. Fix this by marking the map "busy" (to block any modifications) and unlocking the map lock before possibly waiting for any page "busy" locks. Martin Pieuchot reported that the same problem existed in OpenBSD he applied this fix there after several people tested it. fixes PR 56952 To generate a diff of this commit: cvs rdiff -u -r1.405 -r1.406 src/sys/uvm/uvm_map.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Apr 27 06:23:31 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_devmap.c Log Message: Correct a type. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/uvm/pmap/pmap_devmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Apr 27 06:23:31 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_devmap.c Log Message: Correct a type. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/sys/uvm/pmap/pmap_devmap.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/uvm/pmap/pmap_devmap.c diff -u src/sys/uvm/pmap/pmap_devmap.c:1.1 src/sys/uvm/pmap/pmap_devmap.c:1.2 --- src/sys/uvm/pmap/pmap_devmap.c:1.1 Thu Apr 20 08:28:02 2023 +++ src/sys/uvm/pmap/pmap_devmap.c Thu Apr 27 06:23:31 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_devmap.c,v 1.1 2023/04/20 08:28:02 skrll Exp $ */ +/* $NetBSD: pmap_devmap.c,v 1.2 2023/04/27 06:23:31 skrll Exp $ */ /*- * Copyright (c) 2022 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: pmap_devmap.c,v 1.1 2023/04/20 08:28:02 skrll Exp $"); +__RCSID("$NetBSD: pmap_devmap.c,v 1.2 2023/04/27 06:23:31 skrll Exp $"); #include @@ -91,7 +91,7 @@ pmap_devmap_bootstrap(vaddr_t root, cons for (size_t i = 0; table[i].pd_size != 0; i++) { const struct pmap_devmap * const pdp = [i]; const vaddr_t vmax = __type_max_u(vaddr_t); - const vaddr_t pmax = __type_max_u(paddr_t); + const paddr_t pmax = __type_max_u(paddr_t); KASSERT(pdp->pd_size != 0); KASSERTMSG(vmax - pdp->pd_va >= pdp->pd_size - 1,
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Sat Apr 22 10:22:43 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_tlb.c Log Message: KASSERT(kpreempt_disabled()) before accessing curcpu() To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/uvm/pmap/pmap_tlb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Sat Apr 22 10:22:43 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_tlb.c Log Message: KASSERT(kpreempt_disabled()) before accessing curcpu() To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.57 src/sys/uvm/pmap/pmap_tlb.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/uvm/pmap/pmap_tlb.c diff -u src/sys/uvm/pmap/pmap_tlb.c:1.56 src/sys/uvm/pmap/pmap_tlb.c:1.57 --- src/sys/uvm/pmap/pmap_tlb.c:1.56 Sun Feb 19 07:20:44 2023 +++ src/sys/uvm/pmap/pmap_tlb.c Sat Apr 22 10:22:43 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_tlb.c,v 1.56 2023/02/19 07:20:44 skrll Exp $ */ +/* $NetBSD: pmap_tlb.c,v 1.57 2023/04/22 10:22:43 skrll Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.56 2023/02/19 07:20:44 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.57 2023/04/22 10:22:43 skrll Exp $"); /* * Manages address spaces in a TLB. @@ -655,7 +655,10 @@ pmap_tlb_shootdown_bystanders(pmap_t pm) UVMHIST_FUNC(__func__); UVMHIST_CALLARGS(maphist, "pm %#jx", (uintptr_t)pm, 0, 0, 0); + KASSERT(kpreempt_disabled()); + const struct cpu_info * const ci = curcpu(); + kcpuset_t *pm_active = ci->ci_shootdowncpus; kcpuset_copy(pm_active, pm->pm_active); kcpuset_remove(pm_active, cpu_tlb_info(curcpu())->ti_kcpuset); @@ -745,6 +748,8 @@ pmap_tlb_shootdown_bystanders(pmap_t pm) int pmap_tlb_update_addr(pmap_t pm, vaddr_t va, pt_entry_t pte, u_int flags) { + KASSERT(kpreempt_disabled()); + struct pmap_tlb_info * const ti = cpu_tlb_info(curcpu()); struct pmap_asid_info * const pai = PMAP_PAI(pm, ti); int rv = -1; @@ -753,8 +758,6 @@ pmap_tlb_update_addr(pmap_t pm, vaddr_t UVMHIST_CALLARGS(maphist, " (pm=%#jx va=%#jx, pte=%#jx flags=%#jx)", (uintptr_t)pm, va, pte_value(pte), flags); - KASSERT(kpreempt_disabled()); - KASSERTMSG(pte_valid_p(pte), "va %#"PRIxVADDR" %#"PRIxPTE, va, pte_value(pte)); @@ -785,6 +788,8 @@ pmap_tlb_update_addr(pmap_t pm, vaddr_t void pmap_tlb_invalidate_addr(pmap_t pm, vaddr_t va) { + KASSERT(kpreempt_disabled()); + struct pmap_tlb_info * const ti = cpu_tlb_info(curcpu()); struct pmap_asid_info * const pai = PMAP_PAI(pm, ti); @@ -792,8 +797,6 @@ pmap_tlb_invalidate_addr(pmap_t pm, vadd UVMHIST_CALLARGS(maphist, " (pm=%#jx va=%#jx) ti=%#jx asid=%#jx", (uintptr_t)pm, va, (uintptr_t)ti, pai->pai_asid); - KASSERT(kpreempt_disabled()); - TLBINFO_LOCK(ti); if (pm == pmap_kernel() || PMAP_PAI_ASIDVALID_P(pai, ti)) { pmap_tlb_asid_check(); @@ -908,6 +911,8 @@ pmap_tlb_asid_alloc(struct pmap_tlb_info void pmap_tlb_asid_acquire(pmap_t pm, struct lwp *l) { + KASSERT(kpreempt_disabled()); + struct cpu_info * const ci = l->l_cpu; struct pmap_tlb_info * const ti = cpu_tlb_info(ci); struct pmap_asid_info * const pai = PMAP_PAI(pm, ti); @@ -916,8 +921,6 @@ pmap_tlb_asid_acquire(pmap_t pm, struct UVMHIST_CALLARGS(maphist, "(pm=%#jx, l=%#jx, ti=%#jx)", (uintptr_t)pm, (uintptr_t)l, (uintptr_t)ti, 0); - KASSERT(kpreempt_disabled()); - /* * Kernels use a fixed ASID and thus doesn't need to acquire one. */
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Sun Apr 9 12:37:12 UTC 2023 Modified Files: src/sys/uvm: uvm_vnode.c Log Message: uvm: Simplify assertion in uvn_get. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.119 -r1.120 src/sys/uvm/uvm_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/uvm/uvm_vnode.c diff -u src/sys/uvm/uvm_vnode.c:1.119 src/sys/uvm/uvm_vnode.c:1.120 --- src/sys/uvm/uvm_vnode.c:1.119 Sun Apr 9 09:00:56 2023 +++ src/sys/uvm/uvm_vnode.c Sun Apr 9 12:37:12 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_vnode.c,v 1.119 2023/04/09 09:00:56 riastradh Exp $ */ +/* $NetBSD: uvm_vnode.c,v 1.120 2023/04/09 12:37:12 riastradh Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.119 2023/04/09 09:00:56 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_vnode.c,v 1.120 2023/04/09 12:37:12 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_uvmhist.h" @@ -189,8 +189,8 @@ uvn_get(struct uvm_object *uobj, voff_t error = VOP_GETPAGES(vp, offset, pps, npagesp, centeridx, access_type, advice, flags); - KASSERT(((flags & PGO_LOCKED) != 0 && rw_lock_held(uobj->vmobjlock)) || - (flags & PGO_LOCKED) == 0); + if (flags & PGO_LOCKED) + KASSERT(rw_lock_held(uobj->vmobjlock)); return error; }
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Sun Apr 9 12:37:12 UTC 2023 Modified Files: src/sys/uvm: uvm_vnode.c Log Message: uvm: Simplify assertion in uvn_get. No functional change intended. To generate a diff of this commit: cvs rdiff -u -r1.119 -r1.120 src/sys/uvm/uvm_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Sun Apr 9 09:00:56 UTC 2023 Modified Files: src/sys/uvm: uvm_amap.c uvm_bio.c uvm_fault.c uvm_km.c uvm_page.c uvm_physseg.c uvm_swap.c uvm_vnode.c Log Message: uvm(9): KASSERT(A && B) -> KASSERT(A); KASSERT(B) To generate a diff of this commit: cvs rdiff -u -r1.126 -r1.127 src/sys/uvm/uvm_amap.c cvs rdiff -u -r1.127 -r1.128 src/sys/uvm/uvm_bio.c cvs rdiff -u -r1.231 -r1.232 src/sys/uvm/uvm_fault.c cvs rdiff -u -r1.164 -r1.165 src/sys/uvm/uvm_km.c cvs rdiff -u -r1.251 -r1.252 src/sys/uvm/uvm_page.c cvs rdiff -u -r1.17 -r1.18 src/sys/uvm/uvm_physseg.c cvs rdiff -u -r1.207 -r1.208 src/sys/uvm/uvm_swap.c cvs rdiff -u -r1.118 -r1.119 src/sys/uvm/uvm_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/uvm/uvm_amap.c diff -u src/sys/uvm/uvm_amap.c:1.126 src/sys/uvm/uvm_amap.c:1.127 --- src/sys/uvm/uvm_amap.c:1.126 Sat Mar 13 15:29:55 2021 +++ src/sys/uvm/uvm_amap.c Sun Apr 9 09:00:56 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_amap.c,v 1.126 2021/03/13 15:29:55 skrll Exp $ */ +/* $NetBSD: uvm_amap.c,v 1.127 2023/04/09 09:00:56 riastradh Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.126 2021/03/13 15:29:55 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_amap.c,v 1.127 2023/04/09 09:00:56 riastradh Exp $"); #include "opt_uvmhist.h" @@ -323,7 +323,8 @@ amap_free(struct vm_amap *amap) UVMHIST_FUNC(__func__); UVMHIST_CALLED(maphist); - KASSERT(amap->am_ref == 0 && amap->am_nused == 0); + KASSERT(amap->am_ref == 0); + KASSERT(amap->am_nused == 0); KASSERT((amap->am_flags & AMAP_SWAPOFF) == 0); slots = amap->am_maxslot; kmem_free(amap->am_slots, slots * sizeof(*amap->am_slots)); @@ -774,7 +775,8 @@ amap_wipeout(struct vm_amap *amap) slot = amap->am_slots[lcv]; anon = amap->am_anon[slot]; - KASSERT(anon != NULL && anon->an_ref != 0); + KASSERT(anon != NULL); + KASSERT(anon->an_ref != 0); KASSERT(anon->an_lock == amap->am_lock); UVMHIST_LOG(maphist," processing anon %#jx, ref=%jd", @@ -1069,7 +1071,8 @@ ReStart: if (pg->loan_count != 0) { continue; } - KASSERT(pg->uanon == anon && pg->uobject == NULL); + KASSERT(pg->uanon == anon); + KASSERT(pg->uobject == NULL); /* * If the page is busy, then we have to unlock, wait for Index: src/sys/uvm/uvm_bio.c diff -u src/sys/uvm/uvm_bio.c:1.127 src/sys/uvm/uvm_bio.c:1.128 --- src/sys/uvm/uvm_bio.c:1.127 Sun Feb 12 16:28:32 2023 +++ src/sys/uvm/uvm_bio.c Sun Apr 9 09:00:56 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_bio.c,v 1.127 2023/02/12 16:28:32 andvar Exp $ */ +/* $NetBSD: uvm_bio.c,v 1.128 2023/04/09 09:00:56 riastradh Exp $ */ /* * Copyright (c) 1998 Chuck Silvers. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.127 2023/02/12 16:28:32 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.128 2023/04/09 09:00:56 riastradh Exp $"); #include "opt_uvmhist.h" #include "opt_ubc.h" @@ -555,7 +555,9 @@ again: } if (flags & UBC_WRITE) { - KASSERTMSG(umap->writeoff == 0 && umap->writelen == 0, + KASSERTMSG(umap->writeoff == 0, + "ubc_alloc: concurrent writes to uobj %p", uobj); + KASSERTMSG(umap->writelen == 0, "ubc_alloc: concurrent writes to uobj %p", uobj); umap->writeoff = slot_offset; umap->writelen = *lenp; Index: src/sys/uvm/uvm_fault.c diff -u src/sys/uvm/uvm_fault.c:1.231 src/sys/uvm/uvm_fault.c:1.232 --- src/sys/uvm/uvm_fault.c:1.231 Wed Oct 26 23:27:32 2022 +++ src/sys/uvm/uvm_fault.c Sun Apr 9 09:00:56 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_fault.c,v 1.231 2022/10/26 23:27:32 riastradh Exp $ */ +/* $NetBSD: uvm_fault.c,v 1.232 2023/04/09 09:00:56 riastradh Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.231 2022/10/26 23:27:32 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.232 2023/04/09 09:00:56 riastradh Exp $"); #include "opt_uvmhist.h" @@ -2670,7 +2670,8 @@ uvm_fault_unwire_locked(struct vm_map *m * find the beginning map entry for the region. */ - KASSERT(start >= vm_map_min(map) && end <= vm_map_max(map)); + KASSERT(start >= vm_map_min(map)); + KASSERT(end <= vm_map_max(map)); if (uvm_map_lookup_entry(map, start, ) == false) panic("uvm_fault_unwire_locked: address not in map"); @@ -2683,8 +2684,8 @@ uvm_fault_unwire_locked(struct vm_map *m KASSERT(va >= entry->start); while (va >= entry->end) { - KASSERT(entry->next != >header && -entry->next->start <= entry->end); + KASSERT(entry->next != >header); + KASSERT(entry->next->start <= entry->end); entry = entry->next; } Index: src/sys/uvm/uvm_km.c diff -u src/sys/uvm/uvm_km.c:1.164 src/sys/uvm/uvm_km.c:1.165 ---
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Sun Apr 9 09:00:56 UTC 2023 Modified Files: src/sys/uvm: uvm_amap.c uvm_bio.c uvm_fault.c uvm_km.c uvm_page.c uvm_physseg.c uvm_swap.c uvm_vnode.c Log Message: uvm(9): KASSERT(A && B) -> KASSERT(A); KASSERT(B) To generate a diff of this commit: cvs rdiff -u -r1.126 -r1.127 src/sys/uvm/uvm_amap.c cvs rdiff -u -r1.127 -r1.128 src/sys/uvm/uvm_bio.c cvs rdiff -u -r1.231 -r1.232 src/sys/uvm/uvm_fault.c cvs rdiff -u -r1.164 -r1.165 src/sys/uvm/uvm_km.c cvs rdiff -u -r1.251 -r1.252 src/sys/uvm/uvm_page.c cvs rdiff -u -r1.17 -r1.18 src/sys/uvm/uvm_physseg.c cvs rdiff -u -r1.207 -r1.208 src/sys/uvm/uvm_swap.c cvs rdiff -u -r1.118 -r1.119 src/sys/uvm/uvm_vnode.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: skrll Date: Fri Mar 24 07:26:21 UTC 2023 Modified Files: src/sys/uvm: uvm_map.c Log Message: Unwrap. NFCI. To generate a diff of this commit: cvs rdiff -u -r1.404 -r1.405 src/sys/uvm/uvm_map.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/uvm/uvm_map.c diff -u src/sys/uvm/uvm_map.c:1.404 src/sys/uvm/uvm_map.c:1.405 --- src/sys/uvm/uvm_map.c:1.404 Mon Feb 27 16:24:45 2023 +++ src/sys/uvm/uvm_map.c Fri Mar 24 07:26:21 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_map.c,v 1.404 2023/02/27 16:24:45 riastradh Exp $ */ +/* $NetBSD: uvm_map.c,v 1.405 2023/03/24 07:26:21 skrll Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.404 2023/02/27 16:24:45 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.405 2023/03/24 07:26:21 skrll Exp $"); #include "opt_ddb.h" #include "opt_pax.h" @@ -2384,8 +2384,7 @@ uvm_unmap_remove(struct vm_map *map, vad } if (VM_MAP_IS_KERNEL(map) && (flags & UVM_FLAG_NOWAIT) == 0) { - uvm_km_check_empty(map, entry->start, - entry->end); + uvm_km_check_empty(map, entry->start, entry->end); } #endif /* defined(UVMDEBUG) */
CVS commit: src/sys/uvm
Module Name:src Committed By: skrll Date: Fri Mar 24 07:26:21 UTC 2023 Modified Files: src/sys/uvm: uvm_map.c Log Message: Unwrap. NFCI. To generate a diff of this commit: cvs rdiff -u -r1.404 -r1.405 src/sys/uvm/uvm_map.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Mon Feb 27 16:24:46 UTC 2023 Modified Files: src/sys/uvm: uvm_map.c Log Message: uvm(9): KASSERT(A && B) -> KASSERT(A); KASSERT(B) While here, print some of the inputs with KASSERTMSG. To generate a diff of this commit: cvs rdiff -u -r1.403 -r1.404 src/sys/uvm/uvm_map.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/uvm/uvm_map.c diff -u src/sys/uvm/uvm_map.c:1.403 src/sys/uvm/uvm_map.c:1.404 --- src/sys/uvm/uvm_map.c:1.403 Wed Nov 23 23:53:53 2022 +++ src/sys/uvm/uvm_map.c Mon Feb 27 16:24:45 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_map.c,v 1.403 2022/11/23 23:53:53 riastradh Exp $ */ +/* $NetBSD: uvm_map.c,v 1.404 2023/02/27 16:24:45 riastradh Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.403 2022/11/23 23:53:53 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.404 2023/02/27 16:24:45 riastradh Exp $"); #include "opt_ddb.h" #include "opt_pax.h" @@ -2123,7 +2123,10 @@ nextgap: else tmp = RIGHT_ENTRY(prev); for (;;) { - KASSERT(tmp && tmp->maxgap >= length); + KASSERT(tmp); + KASSERTMSG(tmp->maxgap >= length, + "tmp->maxgap=0x%"PRIxVSIZE" length=0x%"PRIxVSIZE, + tmp->maxgap, length); if (topdown) child = RIGHT_ENTRY(tmp); else @@ -2685,7 +2688,8 @@ uvm_map_extract(struct vm_map *srcmap, v * REMOVE. */ - KASSERT((start & PAGE_MASK) == 0 && (len & PAGE_MASK) == 0); + KASSERTMSG((start & PAGE_MASK) == 0, "start=0x%"PRIxVADDR, start); + KASSERTMSG((len & PAGE_MASK) == 0, "len=0x%"PRIxVADDR, len); KASSERT((flags & UVM_EXTRACT_REMOVE) == 0 || (flags & (UVM_EXTRACT_CONTIG|UVM_EXTRACT_QREF)) == 0);
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Mon Feb 27 16:24:46 UTC 2023 Modified Files: src/sys/uvm: uvm_map.c Log Message: uvm(9): KASSERT(A && B) -> KASSERT(A); KASSERT(B) While here, print some of the inputs with KASSERTMSG. To generate a diff of this commit: cvs rdiff -u -r1.403 -r1.404 src/sys/uvm/uvm_map.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Fri Feb 24 11:03:13 UTC 2023 Modified Files: src/sys/uvm: uvm_aobj.c Log Message: uvm: Eliminate __HAVE_ATOMIC_AS_MEMBAR conditionals. Discussed on tech-kern: https://mail-index.netbsd.org/tech-kern/2023/02/23/msg028729.html To generate a diff of this commit: cvs rdiff -u -r1.156 -r1.157 src/sys/uvm/uvm_aobj.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/uvm/uvm_aobj.c diff -u src/sys/uvm/uvm_aobj.c:1.156 src/sys/uvm/uvm_aobj.c:1.157 --- src/sys/uvm/uvm_aobj.c:1.156 Tue May 31 08:43:16 2022 +++ src/sys/uvm/uvm_aobj.c Fri Feb 24 11:03:13 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_aobj.c,v 1.156 2022/05/31 08:43:16 andvar Exp $ */ +/* $NetBSD: uvm_aobj.c,v 1.157 2023/02/24 11:03:13 riastradh Exp $ */ /* * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.156 2022/05/31 08:43:16 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_aobj.c,v 1.157 2023/02/24 11:03:13 riastradh Exp $"); #ifdef _KERNEL_OPT #include "opt_uvmhist.h" @@ -604,16 +604,12 @@ uao_detach(struct uvm_object *uobj) KASSERT(uobj->uo_refs > 0); UVMHIST_LOG(maphist," (uobj=%#jx) ref=%jd", (uintptr_t)uobj, uobj->uo_refs, 0, 0); -#ifndef __HAVE_ATOMIC_AS_MEMBAR membar_release(); -#endif if (atomic_dec_uint_nv(>uo_refs) > 0) { UVMHIST_LOG(maphist, "<- done (rc>0)", 0,0,0,0); return; } -#ifndef __HAVE_ATOMIC_AS_MEMBAR membar_acquire(); -#endif /* * Remove the aobj from the global list.
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Fri Feb 24 11:03:13 UTC 2023 Modified Files: src/sys/uvm: uvm_aobj.c Log Message: uvm: Eliminate __HAVE_ATOMIC_AS_MEMBAR conditionals. Discussed on tech-kern: https://mail-index.netbsd.org/tech-kern/2023/02/23/msg028729.html To generate a diff of this commit: cvs rdiff -u -r1.156 -r1.157 src/sys/uvm/uvm_aobj.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Sun Feb 19 07:20:44 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_tlb.c Log Message: Spaces to TABs. NFCI. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/uvm/pmap/pmap_tlb.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/uvm/pmap/pmap_tlb.c diff -u src/sys/uvm/pmap/pmap_tlb.c:1.55 src/sys/uvm/pmap/pmap_tlb.c:1.56 --- src/sys/uvm/pmap/pmap_tlb.c:1.55 Mon Nov 7 07:28:04 2022 +++ src/sys/uvm/pmap/pmap_tlb.c Sun Feb 19 07:20:44 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_tlb.c,v 1.55 2022/11/07 07:28:04 skrll Exp $ */ +/* $NetBSD: pmap_tlb.c,v 1.56 2023/02/19 07:20:44 skrll Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.55 2022/11/07 07:28:04 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.56 2023/02/19 07:20:44 skrll Exp $"); /* * Manages address spaces in a TLB. @@ -1114,9 +1114,9 @@ pmap_db_tlb_print(struct pmap *pm, #if PMAP_TLB_MAX == 1 pr(" asid %5u\n", pm->pm_pai[0].pai_asid); #else -for (size_t i = 0; i < (PMAP_TLB_MAX > 1 ? pmap_ntlbs : 1); i++) { -pr(" tlb %zu asid %5u\n", i, pm->pm_pai[i].pai_asid); -} + for (size_t i = 0; i < (PMAP_TLB_MAX > 1 ? pmap_ntlbs : 1); i++) { + pr(" tlb %zu asid %5u\n", i, pm->pm_pai[i].pai_asid); + } #endif } #endif /* DDB */
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Sun Feb 19 07:20:44 UTC 2023 Modified Files: src/sys/uvm/pmap: pmap_tlb.c Log Message: Spaces to TABs. NFCI. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/uvm/pmap/pmap_tlb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: chs Date: Wed Dec 21 02:28:06 UTC 2022 Modified Files: src/sys/uvm: uvm_swap.c Log Message: swap: disallow user opens of swap block device the swap/drum block device was never intended to allow user opens, but when the internal VOP_OPEN() in uvm_swap_init() was added back in rev 1.135, the d_open method was changed from always-fail to always-succeed in order to allow the new initial internal open. this had the side effect of incorrectly allowing user opens too. fix this by replacing the swap_bdevsw d_open with one that succeeds for the first call but fails for all subsequent calls. Reported-by: syzbot+90a23d2f19e5a0a30...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.206 -r1.207 src/sys/uvm/uvm_swap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: chs Date: Wed Dec 21 02:28:06 UTC 2022 Modified Files: src/sys/uvm: uvm_swap.c Log Message: swap: disallow user opens of swap block device the swap/drum block device was never intended to allow user opens, but when the internal VOP_OPEN() in uvm_swap_init() was added back in rev 1.135, the d_open method was changed from always-fail to always-succeed in order to allow the new initial internal open. this had the side effect of incorrectly allowing user opens too. fix this by replacing the swap_bdevsw d_open with one that succeeds for the first call but fails for all subsequent calls. Reported-by: syzbot+90a23d2f19e5a0a30...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.206 -r1.207 src/sys/uvm/uvm_swap.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/uvm/uvm_swap.c diff -u src/sys/uvm/uvm_swap.c:1.206 src/sys/uvm/uvm_swap.c:1.207 --- src/sys/uvm/uvm_swap.c:1.206 Mon Aug 23 13:08:18 2021 +++ src/sys/uvm/uvm_swap.c Wed Dec 21 02:28:06 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_swap.c,v 1.206 2021/08/23 13:08:18 hannken Exp $ */ +/* $NetBSD: uvm_swap.c,v 1.207 2022/12/21 02:28:06 chs Exp $ */ /* * Copyright (c) 1995, 1996, 1997, 2009 Matthew R. Green @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.206 2021/08/23 13:08:18 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_swap.c,v 1.207 2022/12/21 02:28:06 chs Exp $"); #include "opt_uvmhist.h" #include "opt_compat_netbsd.h" @@ -1190,6 +1190,22 @@ again: */ /* + * swopen: allow the initial open from uvm_swap_init() and reject all others. + */ + +static int +swopen(dev_t dev, int flag, int mode, struct lwp *l) +{ + static bool inited = false; + + if (!inited) { + inited = true; + return 0; + } + return ENODEV; +} + +/* * swstrategy: perform I/O on the drum * * => we must map the i/o request from the drum to the correct swapdev. @@ -1308,8 +1324,8 @@ swwrite(dev_t dev, struct uio *uio, int } const struct bdevsw swap_bdevsw = { - .d_open = nullopen, - .d_close = nullclose, + .d_open = swopen, + .d_close = noclose, .d_strategy = swstrategy, .d_ioctl = noioctl, .d_dump = nodump,
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Wed Nov 23 23:53:53 UTC 2022 Modified Files: src/sys/uvm: uvm_map.c Log Message: mmap(2): Avoid arithmetic overflow in search for free space. PR kern/56900 Reported-by: syzbot+3833ae1d38037a263...@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=e542bcf59b2564cca1cb38c12f076fb08dcac37e To generate a diff of this commit: cvs rdiff -u -r1.402 -r1.403 src/sys/uvm/uvm_map.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/uvm/uvm_map.c diff -u src/sys/uvm/uvm_map.c:1.402 src/sys/uvm/uvm_map.c:1.403 --- src/sys/uvm/uvm_map.c:1.402 Wed Jun 8 16:55:00 2022 +++ src/sys/uvm/uvm_map.c Wed Nov 23 23:53:53 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_map.c,v 1.402 2022/06/08 16:55:00 macallan Exp $ */ +/* $NetBSD: uvm_map.c,v 1.403 2022/11/23 23:53:53 riastradh Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.402 2022/06/08 16:55:00 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.403 2022/11/23 23:53:53 riastradh Exp $"); #include "opt_ddb.h" #include "opt_pax.h" @@ -1994,7 +1994,20 @@ uvm_map_findspace(struct vm_map *map, va /* Try to find the space in the red-black tree */ /* Check slot before any entry */ - hint = topdown ? entry->next->start - length : entry->end; + if (topdown) { + KASSERTMSG(entry->next->start >= vm_map_min(map), + "map=%p entry=%p entry->next=%p" + " entry->next->start=0x%"PRIxVADDR" min=0x%"PRIxVADDR, + map, entry, entry->next, + entry->next->start, vm_map_min(map)); + if (length > entry->next->start - vm_map_min(map)) + hint = vm_map_min(map); /* XXX goto wraparound? */ + else + hint = entry->next->start - length; + KASSERT(hint >= vm_map_min(map)); + } else { + hint = entry->end; + } INVARIANTS(); avail = uvm_map_space_avail(, length, uoffset, align, flags, topdown, entry);
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Wed Nov 23 23:53:53 UTC 2022 Modified Files: src/sys/uvm: uvm_map.c Log Message: mmap(2): Avoid arithmetic overflow in search for free space. PR kern/56900 Reported-by: syzbot+3833ae1d38037a263...@syzkaller.appspotmail.com https://syzkaller.appspot.com/bug?id=e542bcf59b2564cca1cb38c12f076fb08dcac37e To generate a diff of this commit: cvs rdiff -u -r1.402 -r1.403 src/sys/uvm/uvm_map.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Mon Nov 7 07:28:04 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap_tlb.c Log Message: Fix UVMHIST build To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/uvm/pmap/pmap_tlb.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/uvm/pmap/pmap_tlb.c diff -u src/sys/uvm/pmap/pmap_tlb.c:1.54 src/sys/uvm/pmap/pmap_tlb.c:1.55 --- src/sys/uvm/pmap/pmap_tlb.c:1.54 Wed Oct 26 07:35:20 2022 +++ src/sys/uvm/pmap/pmap_tlb.c Mon Nov 7 07:28:04 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_tlb.c,v 1.54 2022/10/26 07:35:20 skrll Exp $ */ +/* $NetBSD: pmap_tlb.c,v 1.55 2022/11/07 07:28:04 skrll Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.54 2022/10/26 07:35:20 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.55 2022/11/07 07:28:04 skrll Exp $"); /* * Manages address spaces in a TLB. @@ -1078,19 +1078,19 @@ void pmap_tlb_asid_check(void) { UVMHIST_FUNC(__func__); - UVMHIST_CALLED(pmaphist); + UVMHIST_CALLED(maphist); #ifdef DEBUG kpreempt_disable(); const tlb_asid_t asid __debugused = tlb_get_asid(); - UVMHIST_LOG(pmaphist, " asid %u vs pmap_cur_asid %u", asid, + UVMHIST_LOG(maphist, " asid %u vs pmap_cur_asid %u", asid, curcpu()->ci_pmap_asid_cur, 0, 0); KDASSERTMSG(asid == curcpu()->ci_pmap_asid_cur, "%s: asid (%#x) != current asid (%#x)", __func__, asid, curcpu()->ci_pmap_asid_cur); kpreempt_enable(); #endif - UVMHIST_LOG(pmaphist, " <-- done", 0, 0, 0, 0); + UVMHIST_LOG(maphist, " <-- done", 0, 0, 0, 0); } #ifdef DEBUG
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Mon Nov 7 07:28:04 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap_tlb.c Log Message: Fix UVMHIST build To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/uvm/pmap/pmap_tlb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Nov 3 18:55:07 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.h Log Message: _KERNEL_OPT protection To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/uvm/pmap/pmap.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/uvm/pmap/pmap.h diff -u src/sys/uvm/pmap/pmap.h:1.25 src/sys/uvm/pmap/pmap.h:1.26 --- src/sys/uvm/pmap/pmap.h:1.25 Thu Nov 3 09:04:57 2022 +++ src/sys/uvm/pmap/pmap.h Thu Nov 3 18:55:07 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.25 2022/11/03 09:04:57 skrll Exp $ */ +/* $NetBSD: pmap.h,v 1.26 2022/11/03 18:55:07 skrll Exp $ */ /* * Copyright (c) 1992, 1993 @@ -71,7 +71,9 @@ * @(#)pmap.h 8.1 (Berkeley) 6/10/93 */ +#ifdef _KERNEL_OPT #include "opt_efi.h" +#endif #ifndef _UVM_PMAP_PMAP_H_ #define _UVM_PMAP_PMAP_H_
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Nov 3 18:55:07 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.h Log Message: _KERNEL_OPT protection To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/uvm/pmap/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Wed Nov 2 08:05:17 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: KNF To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/uvm/pmap/pmap.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/uvm/pmap/pmap.c diff -u src/sys/uvm/pmap/pmap.c:1.72 src/sys/uvm/pmap/pmap.c:1.73 --- src/sys/uvm/pmap/pmap.c:1.72 Fri Oct 28 07:16:34 2022 +++ src/sys/uvm/pmap/pmap.c Wed Nov 2 08:05:17 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.72 2022/10/28 07:16:34 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.73 2022/11/02 08:05:17 skrll Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.72 2022/10/28 07:16:34 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.73 2022/11/02 08:05:17 skrll Exp $"); /* * Manages physical address maps. @@ -880,7 +880,7 @@ pmap_page_remove(struct vm_page_md *mdpg } #ifdef PMAP_VIRTUAL_CACHE_ALIASES - pmap_page_clear_attributes(mdpg, VM_PAGEMD_EXECPAGE|VM_PAGEMD_UNCACHED); + pmap_page_clear_attributes(mdpg, VM_PAGEMD_EXECPAGE | VM_PAGEMD_UNCACHED); #else pmap_page_clear_attributes(mdpg, VM_PAGEMD_EXECPAGE); #endif @@ -1166,13 +1166,13 @@ pmap_page_protect(struct vm_page *pg, vm PMAP_COUNT(page_protect); switch (prot) { - case VM_PROT_READ|VM_PROT_WRITE: + case VM_PROT_READ | VM_PROT_WRITE: case VM_PROT_ALL: break; /* copy_on_write */ case VM_PROT_READ: - case VM_PROT_READ|VM_PROT_EXECUTE: + case VM_PROT_READ | VM_PROT_EXECUTE: pv = >mdpg_first; kpreempt_disable(); VM_PAGEMD_PVLIST_READLOCK(mdpg); @@ -1415,7 +1415,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd if (mdpg) { /* Set page referenced/modified status based on flags */ if (flags & VM_PROT_WRITE) { - pmap_page_set_attributes(mdpg, VM_PAGEMD_MODIFIED|VM_PAGEMD_REFERENCED); + pmap_page_set_attributes(mdpg, VM_PAGEMD_MODIFIED | VM_PAGEMD_REFERENCED); } else if (flags & VM_PROT_ALL) { pmap_page_set_attributes(mdpg, VM_PAGEMD_REFERENCED); } @@ -1941,7 +1941,7 @@ pmap_set_modified(paddr_t pa) { struct vm_page * const pg = PHYS_TO_VM_PAGE(pa); struct vm_page_md * const mdpg = VM_PAGE_TO_MD(pg); - pmap_page_set_attributes(mdpg, VM_PAGEMD_MODIFIED|VM_PAGEMD_REFERENCED); + pmap_page_set_attributes(mdpg, VM_PAGEMD_MODIFIED | VM_PAGEMD_REFERENCED); } / pv_entry management /
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Wed Nov 2 08:05:17 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: KNF To generate a diff of this commit: cvs rdiff -u -r1.72 -r1.73 src/sys/uvm/pmap/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Oct 27 06:49:51 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap_segtab.c Log Message: In pmap_pte_reserve ensure we're atomically swapping out an invalid entry otherwise concurrent updates might both think they've updated the entry. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/uvm/pmap/pmap_segtab.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/uvm/pmap/pmap_segtab.c diff -u src/sys/uvm/pmap/pmap_segtab.c:1.29 src/sys/uvm/pmap/pmap_segtab.c:1.30 --- src/sys/uvm/pmap/pmap_segtab.c:1.29 Wed Oct 26 07:35:20 2022 +++ src/sys/uvm/pmap/pmap_segtab.c Thu Oct 27 06:49:51 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_segtab.c,v 1.29 2022/10/26 07:35:20 skrll Exp $ */ +/* $NetBSD: pmap_segtab.c,v 1.30 2022/10/27 06:49:51 skrll Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.29 2022/10/26 07:35:20 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_segtab.c,v 1.30 2022/10/27 06:49:51 skrll Exp $"); /* * Manages physical address maps. @@ -1161,8 +1161,7 @@ pmap_pte_reserve(pmap_t pmap, vaddr_t va pd_entry_t npde = pte_pde_ptpage(pa, pmap == pmap_kernel()); #endif #if defined(PMAP_HWPAGEWALKER) && defined(PMAP_MAP_PDETABPAGE) - pd_entry_t opde = *pde_p; - opde = pte_pde_cas(pde_p, opde, npde); + pd_entry_t opde = pte_pde_cas(pde_p, pte_invalid_pde(), npde); if (__predict_false(pte_pde_valid_p(opde))) { pmap_ptpage_free(pmap, ppg, __func__); ppg = pmap_pde_to_ptpage(opde);
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Oct 27 06:49:51 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap_segtab.c Log Message: In pmap_pte_reserve ensure we're atomically swapping out an invalid entry otherwise concurrent updates might both think they've updated the entry. To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.30 src/sys/uvm/pmap/pmap_segtab.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Oct 27 06:20:41 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: No need to hold the pmap_tlb_miss_lock when calling pmap_segtab_destroy To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/uvm/pmap/pmap.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/uvm/pmap/pmap.c diff -u src/sys/uvm/pmap/pmap.c:1.70 src/sys/uvm/pmap/pmap.c:1.71 --- src/sys/uvm/pmap/pmap.c:1.70 Thu Oct 27 06:19:56 2022 +++ src/sys/uvm/pmap/pmap.c Thu Oct 27 06:20:41 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.70 2022/10/27 06:19:56 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.71 2022/10/27 06:20:41 skrll Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.70 2022/10/27 06:19:56 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.71 2022/10/27 06:20:41 skrll Exp $"); /* * Manages physical address maps. @@ -764,8 +764,8 @@ pmap_destroy(pmap_t pmap) kpreempt_disable(); pmap_tlb_miss_lock_enter(); pmap_tlb_asid_release_all(pmap); - pmap_segtab_destroy(pmap, NULL, 0); pmap_tlb_miss_lock_exit(); + pmap_segtab_destroy(pmap, NULL, 0); KASSERT(TAILQ_EMPTY(>pm_ppg_list));
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Oct 27 06:20:41 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: No need to hold the pmap_tlb_miss_lock when calling pmap_segtab_destroy To generate a diff of this commit: cvs rdiff -u -r1.70 -r1.71 src/sys/uvm/pmap/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Oct 27 06:19:56 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.c pmap.h Log Message: Rename pm_count to pm_refcnt To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/uvm/pmap/pmap.c cvs rdiff -u -r1.23 -r1.24 src/sys/uvm/pmap/pmap.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/uvm/pmap/pmap.c diff -u src/sys/uvm/pmap/pmap.c:1.69 src/sys/uvm/pmap/pmap.c:1.70 --- src/sys/uvm/pmap/pmap.c:1.69 Wed Oct 26 07:35:20 2022 +++ src/sys/uvm/pmap/pmap.c Thu Oct 27 06:19:56 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.69 2022/10/26 07:35:20 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.70 2022/10/27 06:19:56 skrll Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.69 2022/10/26 07:35:20 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.70 2022/10/27 06:19:56 skrll Exp $"); /* * Manages physical address maps. @@ -223,7 +223,7 @@ pmap_segtab_t pmap_kern_segtab PMAP_SEGT struct pmap_kernel kernel_pmap_store = { .kernel_pmap = { - .pm_count = 1, + .pm_refcnt = 1, #ifdef PMAP_HWPAGEWALKER .pm_pdetab = PMAP_INVALID_PDETAB_ADDRESS, #endif @@ -707,7 +707,7 @@ pmap_create(void) KASSERT(pmap->pm_pai[0].pai_link.le_prev == NULL); - pmap->pm_count = 1; + pmap->pm_refcnt = 1; pmap->pm_minaddr = VM_MIN_ADDRESS; pmap->pm_maxaddr = VM_MAXUSER_ADDRESS; @@ -751,7 +751,7 @@ pmap_destroy(pmap_t pmap) UVMHIST_CALLARGS(pmapxtabhist, "(pmap=%#jx)", (uintptr_t)pmap, 0, 0, 0); membar_release(); - if (atomic_dec_uint_nv(>pm_count) > 0) { + if (atomic_dec_uint_nv(>pm_refcnt) > 0) { PMAP_COUNT(dereference); UVMHIST_LOG(pmaphist, " <-- done (deref)", 0, 0, 0, 0); UVMHIST_LOG(pmapxtabhist, " <-- done (deref)", 0, 0, 0, 0); @@ -760,7 +760,7 @@ pmap_destroy(pmap_t pmap) membar_acquire(); PMAP_COUNT(destroy); - KASSERT(pmap->pm_count == 0); + KASSERT(pmap->pm_refcnt == 0); kpreempt_disable(); pmap_tlb_miss_lock_enter(); pmap_tlb_asid_release_all(pmap); @@ -807,7 +807,7 @@ pmap_reference(pmap_t pmap) PMAP_COUNT(reference); if (pmap != NULL) { - atomic_inc_uint(>pm_count); + atomic_inc_uint(>pm_refcnt); } UVMHIST_LOG(pmaphist, " <-- done", 0, 0, 0, 0); Index: src/sys/uvm/pmap/pmap.h diff -u src/sys/uvm/pmap/pmap.h:1.23 src/sys/uvm/pmap/pmap.h:1.24 --- src/sys/uvm/pmap/pmap.h:1.23 Thu Oct 27 05:33:37 2022 +++ src/sys/uvm/pmap/pmap.h Thu Oct 27 06:19:56 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.23 2022/10/27 05:33:37 skrll Exp $ */ +/* $NetBSD: pmap.h,v 1.24 2022/10/27 06:19:56 skrll Exp $ */ /* * Copyright (c) 1992, 1993 @@ -189,7 +189,7 @@ extern kmutex_t pmap_segtab_lock; */ struct pmap { struct uvm_object pm_uobject; -#define pm_count pm_uobject.uo_refs /* pmap reference count */ +#define pm_refcnt pm_uobject.uo_refs /* pmap reference count */ #define pm_pvp_list pm_uobject.memq krwlock_t pm_obj_lock; /* lock for pm_uobject */
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Oct 27 06:19:56 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.c pmap.h Log Message: Rename pm_count to pm_refcnt To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/uvm/pmap/pmap.c cvs rdiff -u -r1.23 -r1.24 src/sys/uvm/pmap/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Oct 27 05:33:37 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.h Log Message: Fix the crash(1) build for mips platforms To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/uvm/pmap/pmap.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/uvm/pmap/pmap.h diff -u src/sys/uvm/pmap/pmap.h:1.22 src/sys/uvm/pmap/pmap.h:1.23 --- src/sys/uvm/pmap/pmap.h:1.22 Wed Oct 26 07:35:20 2022 +++ src/sys/uvm/pmap/pmap.h Thu Oct 27 05:33:37 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.22 2022/10/26 07:35:20 skrll Exp $ */ +/* $NetBSD: pmap.h,v 1.23 2022/10/27 05:33:37 skrll Exp $ */ /* * Copyright (c) 1992, 1993 @@ -225,6 +225,8 @@ struct pmap { struct pmap_asid_info pm_pai[1]; }; + +#ifdef _KERNEL static inline void pmap_lock(struct pmap *pm) { @@ -239,7 +241,6 @@ pmap_unlock(struct pmap *pm) rw_exit(pm->pm_lock); } -#ifdef _KERNEL struct pmap_kernel { struct pmap kernel_pmap; #if defined(MULTIPROCESSOR) && PMAP_TLB_MAX > 1
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Oct 27 05:33:37 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.h Log Message: Fix the crash(1) build for mips platforms To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/sys/uvm/pmap/pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Sun Oct 23 06:37:15 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: Correct the pmap_kstart_segtab entry in pmap_kern_segtab To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/uvm/pmap/pmap.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/uvm/pmap/pmap.c diff -u src/sys/uvm/pmap/pmap.c:1.67 src/sys/uvm/pmap/pmap.c:1.68 --- src/sys/uvm/pmap/pmap.c:1.67 Thu Sep 15 06:44:18 2022 +++ src/sys/uvm/pmap/pmap.c Sun Oct 23 06:37:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.67 2022/09/15 06:44:18 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.68 2022/10/23 06:37:15 skrll Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.67 2022/09/15 06:44:18 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.68 2022/10/23 06:37:15 skrll Exp $"); /* * Manages physical address maps. @@ -202,7 +202,7 @@ pmap_segtab_t pmap_kstart_segtab PMAP_SE #endif pmap_segtab_t pmap_kern_segtab PMAP_SEGTAB_ALIGN = { /* top level segtab for kernel */ #ifdef _LP64 - .seg_seg[(VM_MIN_KERNEL_ADDRESS & XSEGOFSET) >> SEGSHIFT] = _kstart_segtab, + .seg_seg[(VM_MIN_KERNEL_ADDRESS >> XSEGSHIFT) & (NSEGPG - 1)] = _kstart_segtab, #endif };
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Sun Oct 23 06:37:15 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: Correct the pmap_kstart_segtab entry in pmap_kern_segtab To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/uvm/pmap/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Oct 20 06:24:51 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap_tlb.c Log Message: Add a KASSERT to check that tlb_asid_t is a large enough type. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/uvm/pmap/pmap_tlb.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/uvm/pmap/pmap_tlb.c diff -u src/sys/uvm/pmap/pmap_tlb.c:1.52 src/sys/uvm/pmap/pmap_tlb.c:1.53 --- src/sys/uvm/pmap/pmap_tlb.c:1.52 Fri Mar 4 08:11:48 2022 +++ src/sys/uvm/pmap/pmap_tlb.c Thu Oct 20 06:24:51 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap_tlb.c,v 1.52 2022/03/04 08:11:48 skrll Exp $ */ +/* $NetBSD: pmap_tlb.c,v 1.53 2022/10/20 06:24:51 skrll Exp $ */ /*- * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.52 2022/03/04 08:11:48 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap_tlb.c,v 1.53 2022/10/20 06:24:51 skrll Exp $"); /* * Manages address spaces in a TLB. @@ -384,6 +384,7 @@ pmap_tlb_info_init(struct pmap_tlb_info ti->ti_asids_free = TLBINFO_ASID_INITIAL_FREE(ti->ti_asid_max); } + KASSERT(__type_fit(tlb_asid_t, ti->ti_asid_max + 1)); KASSERT(ti->ti_asid_max < PMAP_TLB_BITMAP_LENGTH); }
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Oct 20 06:24:51 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap_tlb.c Log Message: Add a KASSERT to check that tlb_asid_t is a large enough type. To generate a diff of this commit: cvs rdiff -u -r1.52 -r1.53 src/sys/uvm/pmap/pmap_tlb.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Sep 15 06:44:18 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: whitespace - remove spaces before tabs To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/uvm/pmap/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Thu Sep 15 06:44:18 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: whitespace - remove spaces before tabs To generate a diff of this commit: cvs rdiff -u -r1.66 -r1.67 src/sys/uvm/pmap/pmap.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/uvm/pmap/pmap.c diff -u src/sys/uvm/pmap/pmap.c:1.66 src/sys/uvm/pmap/pmap.c:1.67 --- src/sys/uvm/pmap/pmap.c:1.66 Mon Sep 12 07:38:32 2022 +++ src/sys/uvm/pmap/pmap.c Thu Sep 15 06:44:18 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.66 2022/09/12 07:38:32 skrll Exp $ */ +/* $NetBSD: pmap.c,v 1.67 2022/09/15 06:44:18 skrll Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.66 2022/09/12 07:38:32 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.67 2022/09/15 06:44:18 skrll Exp $"); /* * Manages physical address maps. @@ -253,7 +253,7 @@ u_int pmap_page_colormask; #define PAGE_IS_MANAGED(pa) (pmap_initialized && uvm_pageismanaged(pa)) #define PMAP_IS_ACTIVE(pm) \ - ((pm) == pmap_kernel() || \ + ((pm) == pmap_kernel() || \ (pm) == curlwp->l_proc->p_vmspace->vm_map.pmap) /* Forward function declarations */ @@ -290,7 +290,7 @@ struct pool_allocator pmap_pv_page_alloc #define pmap_tlb_miss_lock_enter() pmap_md_tlb_miss_lock_enter() #define pmap_tlb_miss_lock_exit() pmap_md_tlb_miss_lock_exit() #else -kmutex_t pmap_tlb_miss_lock __cacheline_aligned; +kmutex_t pmap_tlb_miss_lock __cacheline_aligned; static void pmap_tlb_miss_lock_init(void) @@ -1369,7 +1369,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd if (resident) { if (pte_to_paddr(opte) != pa) { KASSERT(!is_kernel_pmap_p); - const pt_entry_t rpte = pte_nv_entry(false); + const pt_entry_t rpte = pte_nv_entry(false); pmap_addr_range_check(pmap, va, va + NBPG, __func__); pmap_pte_process(pmap, va, va + NBPG, pmap_pte_remove, @@ -1870,7 +1870,7 @@ pmap_pvlist_check(struct vm_page_md *mdp colors, VM_PAGEMD_UNCACHED_P(mdpg)); #endif } else { - KASSERT(pv->pv_next == NULL); + KASSERT(pv->pv_next == NULL); } #endif /* DEBUG */ }
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Mon Sep 12 07:38:32 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: A simplification and some minor whitespace To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/uvm/pmap/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm/pmap
Module Name:src Committed By: skrll Date: Mon Sep 12 07:38:32 UTC 2022 Modified Files: src/sys/uvm/pmap: pmap.c Log Message: A simplification and some minor whitespace To generate a diff of this commit: cvs rdiff -u -r1.65 -r1.66 src/sys/uvm/pmap/pmap.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/uvm/pmap/pmap.c diff -u src/sys/uvm/pmap/pmap.c:1.65 src/sys/uvm/pmap/pmap.c:1.66 --- src/sys/uvm/pmap/pmap.c:1.65 Sat May 7 06:53:16 2022 +++ src/sys/uvm/pmap/pmap.c Mon Sep 12 07:38:32 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.65 2022/05/07 06:53:16 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.66 2022/09/12 07:38:32 skrll Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.65 2022/05/07 06:53:16 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.66 2022/09/12 07:38:32 skrll Exp $"); /* * Manages physical address maps. @@ -984,14 +984,14 @@ pmap_update(struct pmap *pmap) static bool pmap_pte_remove(pmap_t pmap, vaddr_t sva, vaddr_t eva, pt_entry_t *ptep, - uintptr_t flags) +uintptr_t flags) { const pt_entry_t npte = flags; const bool is_kernel_pmap_p = (pmap == pmap_kernel()); UVMHIST_FUNC(__func__); UVMHIST_CALLARGS(pmaphist, "(pmap=%#jx kernel=%jd va=%#jx..%#jx)", - (uintptr_t)pmap, (pmap == pmap_kernel() ? 1 : 0), sva, eva); + (uintptr_t)pmap, (is_kernel_pmap_p ? 1 : 0), sva, eva); UVMHIST_LOG(pmaphist, "ptep=%#jx, flags(npte)=%#jx)", (uintptr_t)ptep, flags, 0, 0); @@ -1626,7 +1626,7 @@ pmap_unwire(pmap_t pmap, vaddr_t va) pmap, va); pt_entry_t pte = *ptep; KASSERTMSG(pte_valid_p(pte), - "pmap %p va %#"PRIxVADDR" invalid PTE %#"PRIxPTE" @ %p", + "pmap %p va %#" PRIxVADDR " invalid PTE %#" PRIxPTE " @ %p", pmap, va, pte_value(pte), ptep); if (pte_wired_p(pte)) {
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Sat Aug 20 23:26:02 UTC 2022 Modified Files: src/sys/uvm: uvm_pdpolicy.h Log Message: uvm_pdpolicy.h: Fix missing forward declarations and includes. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/uvm_pdpolicy.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/uvm/uvm_pdpolicy.h diff -u src/sys/uvm/uvm_pdpolicy.h:1.8 src/sys/uvm/uvm_pdpolicy.h:1.9 --- src/sys/uvm/uvm_pdpolicy.h:1.8 Sun May 17 19:38:17 2020 +++ src/sys/uvm/uvm_pdpolicy.h Sat Aug 20 23:26:02 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_pdpolicy.h,v 1.8 2020/05/17 19:38:17 ad Exp $ */ +/* $NetBSD: uvm_pdpolicy.h,v 1.9 2022/08/20 23:26:02 riastradh Exp $ */ /*- * Copyright (c)2005, 2006 YAMAMOTO Takashi, @@ -29,8 +29,15 @@ #ifndef _UVM_PDPOLICY_H_ #define _UVM_PDPOLICY_H_ -struct vm_page; +#include +#include + +#include + +struct krwlock; +struct uvm_cpu; struct vm_anon; +struct vm_page; /* * these API is for uvm internal use only. @@ -56,7 +63,7 @@ void uvmpdpol_anfree(struct vm_anon *); void uvmpdpol_tune(void); void uvmpdpol_scaninit(void); void uvmpdpol_scanfini(void); -struct vm_page *uvmpdpol_selectvictim(krwlock_t **lock); +struct vm_page *uvmpdpol_selectvictim(struct krwlock **); void uvmpdpol_balancequeue(int); void uvmpdpol_sysctlsetup(void);
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Sat Aug 20 23:26:02 UTC 2022 Modified Files: src/sys/uvm: uvm_pdpolicy.h Log Message: uvm_pdpolicy.h: Fix missing forward declarations and includes. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/uvm_pdpolicy.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Sat Aug 20 23:08:54 UTC 2022 Modified Files: src/sys/uvm: uvm_pmap.h Log Message: uvm/uvm_pmap.h: Fix missing types and forward declarations. - Need sys/types.h for vaddr_t, paddr_t, u_int, - Forward-declare struct vm_page so we don't have to rely on machine/pmap.h to do so. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/uvm/uvm_pmap.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/uvm/uvm_pmap.h diff -u src/sys/uvm/uvm_pmap.h:1.42 src/sys/uvm/uvm_pmap.h:1.43 --- src/sys/uvm/uvm_pmap.h:1.42 Wed Feb 16 20:13:58 2022 +++ src/sys/uvm/uvm_pmap.h Sat Aug 20 23:08:53 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_pmap.h,v 1.42 2022/02/16 20:13:58 riastradh Exp $ */ +/* $NetBSD: uvm_pmap.h,v 1.43 2022/08/20 23:08:53 riastradh Exp $ */ /* * Copyright (c) 1991, 1993 @@ -68,7 +68,12 @@ #ifndef _PMAP_VM_ #define _PMAP_VM_ +#include + +#include + struct lwp; /* for pmap_activate()/pmap_deactivate() proto */ +struct vm_page; struct pmap; typedef struct pmap *pmap_t;
CVS commit: src/sys/uvm
Module Name:src Committed By: riastradh Date: Sat Aug 20 23:08:54 UTC 2022 Modified Files: src/sys/uvm: uvm_pmap.h Log Message: uvm/uvm_pmap.h: Fix missing types and forward declarations. - Need sys/types.h for vaddr_t, paddr_t, u_int, - Forward-declare struct vm_page so we don't have to rely on machine/pmap.h to do so. To generate a diff of this commit: cvs rdiff -u -r1.42 -r1.43 src/sys/uvm/uvm_pmap.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: chs Date: Sat Aug 6 05:55:37 UTC 2022 Modified Files: src/sys/uvm: uvm_km.c Log Message: allow KMSAN to work again by restoring the limiting of kva even with NKMEMPAGES_MAX_UNLIMITED. we used to limit kva to 1/8 of physmem but limiting to 1/4 should be enough, and 1/4 still gives the kernel enough kva to map all of the RAM that KMSAN has not stolen. Reported-by: syzbot+ca3710b4c40cdd61a...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.161 -r1.162 src/sys/uvm/uvm_km.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/uvm
Module Name:src Committed By: chs Date: Sat Aug 6 05:55:37 UTC 2022 Modified Files: src/sys/uvm: uvm_km.c Log Message: allow KMSAN to work again by restoring the limiting of kva even with NKMEMPAGES_MAX_UNLIMITED. we used to limit kva to 1/8 of physmem but limiting to 1/4 should be enough, and 1/4 still gives the kernel enough kva to map all of the RAM that KMSAN has not stolen. Reported-by: syzbot+ca3710b4c40cdd61a...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.161 -r1.162 src/sys/uvm/uvm_km.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/uvm/uvm_km.c diff -u src/sys/uvm/uvm_km.c:1.161 src/sys/uvm/uvm_km.c:1.162 --- src/sys/uvm/uvm_km.c:1.161 Wed Aug 3 01:52:11 2022 +++ src/sys/uvm/uvm_km.c Sat Aug 6 05:55:37 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: uvm_km.c,v 1.161 2022/08/03 01:52:11 chs Exp $ */ +/* $NetBSD: uvm_km.c,v 1.162 2022/08/06 05:55:37 chs Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -152,7 +152,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.161 2022/08/03 01:52:11 chs Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uvm_km.c,v 1.162 2022/08/06 05:55:37 chs Exp $"); #include "opt_uvmhist.h" @@ -226,22 +226,25 @@ kmeminit_nkmempages(void) return; } -#ifdef NKMEMPAGES_MAX_UNLIMITED +#if defined(NKMEMPAGES_MAX_UNLIMITED) && !defined(KMSAN) npages = physmem; #else #if defined(KMSAN) - npages = (physmem / 8); + npages = (physmem / 4); #elif defined(PMAP_MAP_POOLPAGE) npages = (physmem / 4); #else npages = (physmem / 3) * 2; #endif /* defined(PMAP_MAP_POOLPAGE) */ +#if !defined(NKMEMPAGES_MAX_UNLIMITED) if (npages > NKMEMPAGES_MAX) npages = NKMEMPAGES_MAX; #endif +#endif + if (npages < NKMEMPAGES_MIN) npages = NKMEMPAGES_MIN;