From owner-svn-src-user@freebsd.org Mon Nov 20 02:26:22 2017 Return-Path: Delivered-To: svn-src-user@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 414CCDDE242 for ; Mon, 20 Nov 2017 02:26:22 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B3A56C3AE; Mon, 20 Nov 2017 02:26:22 +0000 (UTC) (envelope-from jeff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vAK2QLMo092027; Mon, 20 Nov 2017 02:26:21 GMT (envelope-from jeff@FreeBSD.org) Received: (from jeff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id vAK2QKET092022; Mon, 20 Nov 2017 02:26:20 GMT (envelope-from jeff@FreeBSD.org) Message-Id: <201711200226.vAK2QKET092022@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jeff set sender to jeff@FreeBSD.org using -f From: Jeff Roberson Date: Mon, 20 Nov 2017 02:26:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r326002 - user/jeff/numa/sys/vm X-SVN-Group: user X-SVN-Commit-Author: jeff X-SVN-Commit-Paths: user/jeff/numa/sys/vm X-SVN-Commit-Revision: 326002 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Nov 2017 02:26:22 -0000 Author: jeff Date: Mon Nov 20 02:26:20 2017 New Revision: 326002 URL: https://svnweb.freebsd.org/changeset/base/326002 Log: Update for r325992 Not all files that include vm_phys.h include opt_vm.h, this gives different definitions for vm_phys_domain(). Add some asserts to guarantee that we're getting the domain we expect in a few cases that can cause crashes later. Modified: user/jeff/numa/sys/vm/vm_init.c user/jeff/numa/sys/vm/vm_kern.c user/jeff/numa/sys/vm/vm_phys.h user/jeff/numa/sys/vm/vm_reserv.c Modified: user/jeff/numa/sys/vm/vm_init.c ============================================================================== --- user/jeff/numa/sys/vm/vm_init.c Sun Nov 19 20:18:21 2017 (r326001) +++ user/jeff/numa/sys/vm/vm_init.c Mon Nov 20 02:26:20 2017 (r326002) @@ -93,10 +93,10 @@ __FBSDID("$FreeBSD$"); #if VM_NRESERVLEVEL > 0 -#define KVA_QUANTUM 1 << (VM_LEVEL_0_ORDER + PAGE_SHIFT) +#define KVA_QUANTUM (1 << (VM_LEVEL_0_ORDER + PAGE_SHIFT)) #else /* On non-superpage architectures want large import sizes. */ -#define KVA_QUANTUM PAGE_SIZE * 1024 +#define KVA_QUANTUM (PAGE_SIZE * 1024) #endif long physmem; @@ -114,7 +114,10 @@ kva_import(void *unused, vmem_size_t size, int flags, { vm_offset_t addr; int result; - + + KASSERT((size % KVA_QUANTUM) == 0, + ("kva_import: Size %jd is not a multiple of %u", + size, KVA_QUANTUM)); addr = vm_map_min(kernel_map); result = vm_map_find(kernel_map, NULL, 0, &addr, size, 0, VMFS_SUPER_SPACE, VM_PROT_ALL, VM_PROT_ALL, MAP_NOFAULT); Modified: user/jeff/numa/sys/vm/vm_kern.c ============================================================================== --- user/jeff/numa/sys/vm/vm_kern.c Sun Nov 19 20:18:21 2017 (r326001) +++ user/jeff/numa/sys/vm/vm_kern.c Mon Nov 20 02:26:20 2017 (r326002) @@ -65,6 +65,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_vm.h" + #include #include #include /* for ticks and hz */ @@ -464,6 +466,9 @@ retry: kmem_unback(object, addr, i); return (KERN_NO_SPACE); } + KASSERT(vm_phys_domidx(m) == domain, + ("kmem_back_domain: Domain mismatch %d != %d", + vm_phys_domidx(m), domain)); if (flags & M_ZERO && (m->flags & PG_ZERO) == 0) pmap_zero_page(m); KASSERT((m->oflags & VPO_UNMANAGED) != 0, Modified: user/jeff/numa/sys/vm/vm_phys.h ============================================================================== --- user/jeff/numa/sys/vm/vm_phys.h Sun Nov 19 20:18:21 2017 (r326001) +++ user/jeff/numa/sys/vm/vm_phys.h Mon Nov 20 02:26:20 2017 (r326002) @@ -100,7 +100,6 @@ int vm_phys_mem_affinity(int f, int t); static inline int vm_phys_domidx(vm_page_t m) { -#ifdef VM_NUMA_ALLOC int domn, segind; /* XXXKIB try to assert that the page is managed */ @@ -109,9 +108,6 @@ vm_phys_domidx(vm_page_t m) domn = vm_phys_segs[segind].domain; KASSERT(domn < vm_ndomains, ("domain %d m %p", domn, m)); return (domn); -#else - return (0); -#endif } /* Modified: user/jeff/numa/sys/vm/vm_reserv.c ============================================================================== --- user/jeff/numa/sys/vm/vm_reserv.c Sun Nov 19 20:18:21 2017 (r326001) +++ user/jeff/numa/sys/vm/vm_reserv.c Mon Nov 20 02:26:20 2017 (r326002) @@ -713,7 +713,7 @@ vm_reserv_alloc_page(vm_object_t object, vm_pindex_t p LIST_INSERT_HEAD(&object->rvq, rv, objq); rv->object = object; rv->pindex = first; - rv->domain = vm_phys_domidx(m); + rv->domain = domain; KASSERT(rv->popcnt == 0, ("vm_reserv_alloc_page: reserv %p's popcnt is corrupted", rv)); KASSERT(!rv->inpartpopq, @@ -732,6 +732,8 @@ vm_reserv_alloc_page(vm_object_t object, vm_pindex_t p found: index = VM_RESERV_INDEX(object, pindex); m = &rv->pages[index]; + KASSERT(object != kernel_object || vm_phys_domidx(m) == domain, + ("vm_reserv_alloc_page: Domain mismatch from reservation.")); /* Handle vm_page_rename(m, new_object, ...). */ if (popmap_is_set(rv->popmap, index)) return (NULL);