From owner-svn-src-user@freebsd.org  Sun Dec 17 04:16:58 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 BB000EA05E5
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Sun, 17 Dec 2017 04:16:58 +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 860D41BF6;
 Sun, 17 Dec 2017 04:16:58 +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 vBH4GvpU073822;
 Sun, 17 Dec 2017 04:16:57 GMT (envelope-from jeff@FreeBSD.org)
Received: (from jeff@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBH4GvE9073820;
 Sun, 17 Dec 2017 04:16:57 GMT (envelope-from jeff@FreeBSD.org)
Message-Id: <201712170416.vBH4GvE9073820@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jeff set sender to
 jeff@FreeBSD.org using -f
From: Jeff Roberson <jeff@FreeBSD.org>
Date: Sun, 17 Dec 2017 04:16:57 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r326915 - user/jeff/numa/sys/kern
X-SVN-Group: user
X-SVN-Commit-Author: jeff
X-SVN-Commit-Paths: user/jeff/numa/sys/kern
X-SVN-Commit-Revision: 326915
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 17 Dec 2017 04:16:58 -0000

Author: jeff
Date: Sun Dec 17 04:16:57 2017
New Revision: 326915
URL: https://svnweb.freebsd.org/changeset/base/326915

Log:
  Correct some simple compile errors.

Modified:
  user/jeff/numa/sys/kern/kern_thread.c
  user/jeff/numa/sys/kern/sched_4bsd.c

Modified: user/jeff/numa/sys/kern/kern_thread.c
==============================================================================
--- user/jeff/numa/sys/kern/kern_thread.c	Sat Dec 16 21:33:21 2017	(r326914)
+++ user/jeff/numa/sys/kern/kern_thread.c	Sun Dec 17 04:16:57 2017	(r326915)
@@ -98,13 +98,13 @@ _Static_assert(offsetof(struct proc, p_emuldata) == 0x
     "struct proc KBI p_emuldata");
 #endif
 #ifdef __i386__
-_Static_assert(offsetof(struct thread, td_flags) == 0x100,
+_Static_assert(offsetof(struct thread, td_flags) == 0x98,
     "struct thread KBI td_flags");
-_Static_assert(offsetof(struct thread, td_pflags) == 0xa8,
+_Static_assert(offsetof(struct thread, td_pflags) == 0xa0,
     "struct thread KBI td_pflags");
-_Static_assert(offsetof(struct thread, td_frame) == 0x2f0,
+_Static_assert(offsetof(struct thread, td_frame) == 0x2e4,
     "struct thread KBI td_frame");
-_Static_assert(offsetof(struct thread, td_emuldata) == 0x33c,
+_Static_assert(offsetof(struct thread, td_emuldata) == 0x330,
     "struct thread KBI td_emuldata");
 _Static_assert(offsetof(struct proc, p_flag) == 0x68,
     "struct proc KBI p_flag");

Modified: user/jeff/numa/sys/kern/sched_4bsd.c
==============================================================================
--- user/jeff/numa/sys/kern/sched_4bsd.c	Sat Dec 16 21:33:21 2017	(r326914)
+++ user/jeff/numa/sys/kern/sched_4bsd.c	Sun Dec 17 04:16:57 2017	(r326915)
@@ -781,7 +781,7 @@ sched_fork_thread(struct thread *td, struct thread *ch
 	childtd->td_lastcpu = NOCPU;
 	childtd->td_lock = &sched_lock;
 	childtd->td_cpuset = cpuset_ref(td->td_cpuset);
-	child->td_domain.dr_policy = td->td_cpuset->cs_domain;
+	childtd->td_domain.dr_policy = td->td_cpuset->cs_domain;
 	childtd->td_priority = childtd->td_base_pri;
 	ts = td_get_sched(childtd);
 	bzero(ts, sizeof(*ts));

From owner-svn-src-user@freebsd.org  Sun Dec 17 04:17:37 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 836D6EA0615
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Sun, 17 Dec 2017 04:17:37 +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 4EDC11CD8;
 Sun, 17 Dec 2017 04:17:37 +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 vBH4HaUD073887;
 Sun, 17 Dec 2017 04:17:36 GMT (envelope-from jeff@FreeBSD.org)
Received: (from jeff@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBH4Ha01073886;
 Sun, 17 Dec 2017 04:17:36 GMT (envelope-from jeff@FreeBSD.org)
Message-Id: <201712170417.vBH4Ha01073886@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jeff set sender to
 jeff@FreeBSD.org using -f
From: Jeff Roberson <jeff@FreeBSD.org>
Date: Sun, 17 Dec 2017 04:17:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r326916 - 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: 326916
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 17 Dec 2017 04:17:37 -0000

Author: jeff
Date: Sun Dec 17 04:17:36 2017
New Revision: 326916
URL: https://svnweb.freebsd.org/changeset/base/326916

Log:
  Correct a format string so it works on every arch.

Modified:
  user/jeff/numa/sys/vm/vm_init.c

Modified: user/jeff/numa/sys/vm/vm_init.c
==============================================================================
--- user/jeff/numa/sys/vm/vm_init.c	Sun Dec 17 04:16:57 2017	(r326915)
+++ user/jeff/numa/sys/vm/vm_init.c	Sun Dec 17 04:17:36 2017	(r326916)
@@ -118,8 +118,8 @@ kva_import(void *unused, vmem_size_t size, int flags, 
 	int result;
 
 	KASSERT((size % KVA_QUANTUM) == 0,
-	    ("kva_import: Size %jd is not a multiple of %u",
-	    (intmax_t)size, KVA_QUANTUM));
+	    ("kva_import: Size %jd is not a multiple of %d",
+	    (intmax_t)size, (int)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);

From owner-svn-src-user@freebsd.org  Sun Dec 17 04:19:20 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 690E5EA06A4
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Sun, 17 Dec 2017 04:19:20 +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 344D01DD1;
 Sun, 17 Dec 2017 04:19:20 +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 vBH4JJHH073983;
 Sun, 17 Dec 2017 04:19:19 GMT (envelope-from jeff@FreeBSD.org)
Received: (from jeff@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBH4JJ1l073982;
 Sun, 17 Dec 2017 04:19:19 GMT (envelope-from jeff@FreeBSD.org)
Message-Id: <201712170419.vBH4JJ1l073982@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jeff set sender to
 jeff@FreeBSD.org using -f
From: Jeff Roberson <jeff@FreeBSD.org>
Date: Sun, 17 Dec 2017 04:19:19 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r326917 - user/jeff/numa/sys/kern
X-SVN-Group: user
X-SVN-Commit-Author: jeff
X-SVN-Commit-Paths: user/jeff/numa/sys/kern
X-SVN-Commit-Revision: 326917
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 17 Dec 2017 04:19:20 -0000

Author: jeff
Date: Sun Dec 17 04:19:19 2017
New Revision: 326917
URL: https://svnweb.freebsd.org/changeset/base/326917

Log:
  Use the correct KVA domain when allocating vmem boundary tags so that we
  don't end up mixing super-page and non-super-page allocations.

Modified:
  user/jeff/numa/sys/kern/subr_vmem.c

Modified: user/jeff/numa/sys/kern/subr_vmem.c
==============================================================================
--- user/jeff/numa/sys/kern/subr_vmem.c	Sun Dec 17 04:17:36 2017	(r326916)
+++ user/jeff/numa/sys/kern/subr_vmem.c	Sun Dec 17 04:19:19 2017	(r326917)
@@ -625,15 +625,15 @@ vmem_bt_alloc(uma_zone_t zone, vm_size_t bytes, int do
 	 * and memory are added in one atomic operation.
 	 */
 	mtx_lock(&vmem_bt_lock);
-	if (vmem_xalloc(kernel_arena, bytes, 0, 0, 0, VMEM_ADDR_MIN,
-	    VMEM_ADDR_MAX, M_NOWAIT | M_NOVM | M_USE_RESERVE | M_BESTFIT,
-	    &addr) == 0) {
+	if (vmem_xalloc(vm_dom[domain].vmd_kernel_arena, bytes, 0, 0, 0,
+	    VMEM_ADDR_MIN, VMEM_ADDR_MAX,
+	    M_NOWAIT | M_NOVM | M_USE_RESERVE | M_BESTFIT, &addr) == 0) {
 		if (kmem_back_domain(domain, kernel_object, addr, bytes,
 		    M_NOWAIT | M_USE_RESERVE) == 0) {
 			mtx_unlock(&vmem_bt_lock);
 			return ((void *)addr);
 		}
-		vmem_xfree(kernel_arena, addr, bytes);
+		vmem_xfree(vm_dom[domain].vmd_kernel_arena, addr, bytes);
 		mtx_unlock(&vmem_bt_lock);
 		/*
 		 * Out of memory, not address space.  This may not even be

From owner-svn-src-user@freebsd.org  Tue Dec 19 09:47:17 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 E3D5CE9AF4A
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Tue, 19 Dec 2017 09:47:17 +0000 (UTC) (envelope-from pho@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 B02886FFE1;
 Tue, 19 Dec 2017 09:47:17 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBJ9lGBS028812;
 Tue, 19 Dec 2017 09:47:16 GMT (envelope-from pho@FreeBSD.org)
Received: (from pho@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBJ9lGq9028811;
 Tue, 19 Dec 2017 09:47:16 GMT (envelope-from pho@FreeBSD.org)
Message-Id: <201712190947.vBJ9lGq9028811@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org
 using -f
From: Peter Holm <pho@FreeBSD.org>
Date: Tue, 19 Dec 2017 09:47:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r326965 - user/pho/stress2/misc
X-SVN-Group: user
X-SVN-Commit-Author: pho
X-SVN-Commit-Paths: user/pho/stress2/misc
X-SVN-Commit-Revision: 326965
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Dec 2017 09:47:18 -0000

Author: pho
Date: Tue Dec 19 09:47:16 2017
New Revision: 326965
URL: https://svnweb.freebsd.org/changeset/base/326965

Log:
  Kill verbose console logging and added a file system check.
  
  Sponsored by:	Dell EMC Isilon

Modified:
  user/pho/stress2/misc/graid1.sh

Modified: user/pho/stress2/misc/graid1.sh
==============================================================================
--- user/pho/stress2/misc/graid1.sh	Tue Dec 19 04:13:22 2017	(r326964)
+++ user/pho/stress2/misc/graid1.sh	Tue Dec 19 09:47:16 2017	(r326965)
@@ -49,6 +49,9 @@ for u in $md1 $md2 $md3; do
 done
 
 gmirror load > /dev/null 2>&1 && unload=1
+old=`sysctl -n kern.geom.mirror.debug`
+sysctl kern.geom.mirror.debug=-1 | grep -q -- -1 ||
+    sysctl kern.geom.mirror.debug=$old > /dev/null
 gmirror label -v -b split -s 2048 data /dev/md$md1 /dev/md$md2 \
     /dev/md$md3 > /dev/null || exit 1
 [ -c /dev/mirror/data ] || exit 1
@@ -63,7 +66,8 @@ su $testuser -c 'cd ..; ./run.sh marcus.cfg'
 while mount | grep $mntpoint | grep -q /mirror/; do
 	umount $mntpoint || sleep 1
 done
-gmirror stop data || s=1
+checkfs /dev/mirror/data || s=1
+gmirror stop data || s=2
 gmirror destroy data 2>/dev/null
 [ $unload ] && gmirror unload
 

From owner-svn-src-user@freebsd.org  Tue Dec 19 09:48:40 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 92B07E9B084
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Tue, 19 Dec 2017 09:48:40 +0000 (UTC) (envelope-from pho@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 5F5AD70101;
 Tue, 19 Dec 2017 09:48:40 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBJ9mdGi028900;
 Tue, 19 Dec 2017 09:48:39 GMT (envelope-from pho@FreeBSD.org)
Received: (from pho@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBJ9mdwO028899;
 Tue, 19 Dec 2017 09:48:39 GMT (envelope-from pho@FreeBSD.org)
Message-Id: <201712190948.vBJ9mdwO028899@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org
 using -f
From: Peter Holm <pho@FreeBSD.org>
Date: Tue, 19 Dec 2017 09:48:39 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r326966 - user/pho/stress2/misc
X-SVN-Group: user
X-SVN-Commit-Author: pho
X-SVN-Commit-Paths: user/pho/stress2/misc
X-SVN-Commit-Revision: 326966
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Dec 2017 09:48:40 -0000

Author: pho
Date: Tue Dec 19 09:48:39 2017
New Revision: 326966
URL: https://svnweb.freebsd.org/changeset/base/326966

Log:
  Fix typo and fix cleanup.
  
  Sponsored by:	Dell EMC Isilon

Modified:
  user/pho/stress2/misc/graid1_2.sh

Modified: user/pho/stress2/misc/graid1_2.sh
==============================================================================
--- user/pho/stress2/misc/graid1_2.sh	Tue Dec 19 09:47:16 2017	(r326965)
+++ user/pho/stress2/misc/graid1_2.sh	Tue Dec 19 09:48:39 2017	(r326966)
@@ -95,10 +95,10 @@ done
 gmirror stop test || s=2
 [ $unload ] && gmirror unload
 
-for u in $md3 $md2 $md1; do
+for u in $md2 $md1; do
 	mdconfig -d -u $u || s=4
 done
-rm -d /tmp/graid1_2 /tmp/graid1_2_di?
+rm -f /tmp/graid1_2 /tmp/graid1_2_di*
 exit $s
 EOF
 /* Write last sector on disk */

From owner-svn-src-user@freebsd.org  Tue Dec 19 09:50:00 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 E8375E9B226
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Tue, 19 Dec 2017 09:50:00 +0000 (UTC) (envelope-from pho@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 B5BD670299;
 Tue, 19 Dec 2017 09:50:00 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBJ9nx0L028985;
 Tue, 19 Dec 2017 09:49:59 GMT (envelope-from pho@FreeBSD.org)
Received: (from pho@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBJ9nxpF028984;
 Tue, 19 Dec 2017 09:49:59 GMT (envelope-from pho@FreeBSD.org)
Message-Id: <201712190949.vBJ9nxpF028984@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org
 using -f
From: Peter Holm <pho@FreeBSD.org>
Date: Tue, 19 Dec 2017 09:49:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r326967 - user/pho/stress2/misc
X-SVN-Group: user
X-SVN-Commit-Author: pho
X-SVN-Commit-Paths: user/pho/stress2/misc
X-SVN-Commit-Revision: 326967
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Dec 2017 09:50:01 -0000

Author: pho
Date: Tue Dec 19 09:49:59 2017
New Revision: 326967
URL: https://svnweb.freebsd.org/changeset/base/326967

Log:
  Fix cut and paste error.
  
  Sponsored by:	Dell EMC Isilon

Modified:
  user/pho/stress2/misc/graid1_4.sh

Modified: user/pho/stress2/misc/graid1_4.sh
==============================================================================
--- user/pho/stress2/misc/graid1_4.sh	Tue Dec 19 09:48:39 2017	(r326966)
+++ user/pho/stress2/misc/graid1_4.sh	Tue Dec 19 09:49:59 2017	(r326967)
@@ -91,7 +91,7 @@ gmirror stop test || s=1
 gmirror destroy test 2>/dev/null
 [ $unload ] && gmirror unload
 
-for u in $md3 $md2 $md1; do
+for u in $md2 $md1; do
 	mdconfig -d -u $u || s=3
 done
 rm -f $diskimage*

From owner-svn-src-user@freebsd.org  Tue Dec 19 09:50:59 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 6B0E7E9B2DD
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Tue, 19 Dec 2017 09:50:59 +0000 (UTC) (envelope-from pho@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 39319703CE;
 Tue, 19 Dec 2017 09:50:59 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBJ9owOX029842;
 Tue, 19 Dec 2017 09:50:58 GMT (envelope-from pho@FreeBSD.org)
Received: (from pho@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBJ9ow7h029841;
 Tue, 19 Dec 2017 09:50:58 GMT (envelope-from pho@FreeBSD.org)
Message-Id: <201712190950.vBJ9ow7h029841@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org
 using -f
From: Peter Holm <pho@FreeBSD.org>
Date: Tue, 19 Dec 2017 09:50:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r326968 - user/pho/stress2/misc
X-SVN-Group: user
X-SVN-Commit-Author: pho
X-SVN-Commit-Paths: user/pho/stress2/misc
X-SVN-Commit-Revision: 326968
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Dec 2017 09:50:59 -0000

Author: pho
Date: Tue Dec 19 09:50:58 2017
New Revision: 326968
URL: https://svnweb.freebsd.org/changeset/base/326968

Log:
  Fix cut and paste error.
  
  Sponsored by:	Dell EMC Isilon

Modified:
  user/pho/stress2/misc/graid1_6.sh

Modified: user/pho/stress2/misc/graid1_6.sh
==============================================================================
--- user/pho/stress2/misc/graid1_6.sh	Tue Dec 19 09:49:59 2017	(r326967)
+++ user/pho/stress2/misc/graid1_6.sh	Tue Dec 19 09:50:58 2017	(r326968)
@@ -84,7 +84,7 @@ gmirror stop -f test ||s=1
 gmirror destroy test 2>/dev/null
 [ $unload ] && gmirror unload
 
-for u in $md3 $md2 $md1; do
+for u in $md2 $md1; do
 	mdconfig -d -u $u || s=3
 done
 rm -f $diskimage*

From owner-svn-src-user@freebsd.org  Tue Dec 19 09:53:50 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 2DCD8E9B700
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Tue, 19 Dec 2017 09:53:50 +0000 (UTC) (envelope-from pho@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 EE20370746;
 Tue, 19 Dec 2017 09:53:49 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBJ9rnSX032830;
 Tue, 19 Dec 2017 09:53:49 GMT (envelope-from pho@FreeBSD.org)
Received: (from pho@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBJ9rnhl032829;
 Tue, 19 Dec 2017 09:53:49 GMT (envelope-from pho@FreeBSD.org)
Message-Id: <201712190953.vBJ9rnhl032829@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org
 using -f
From: Peter Holm <pho@FreeBSD.org>
Date: Tue, 19 Dec 2017 09:53:49 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r326969 - user/pho/stress2/misc
X-SVN-Group: user
X-SVN-Commit-Author: pho
X-SVN-Commit-Paths: user/pho/stress2/misc
X-SVN-Commit-Revision: 326969
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Dec 2017 09:53:50 -0000

Author: pho
Date: Tue Dec 19 09:53:48 2017
New Revision: 326969
URL: https://svnweb.freebsd.org/changeset/base/326969

Log:
  Added finding.
  
  Sponsored by:	Dell EMC Isilon

Modified:
  user/pho/stress2/misc/devfs.sh

Modified: user/pho/stress2/misc/devfs.sh
==============================================================================
--- user/pho/stress2/misc/devfs.sh	Tue Dec 19 09:50:58 2017	(r326968)
+++ user/pho/stress2/misc/devfs.sh	Tue Dec 19 09:53:48 2017	(r326969)
@@ -28,6 +28,10 @@
 # $FreeBSD$
 #
 
+# Page fault seen:
+# https://people.freebsd.org/~pho/stress/log/devfs.txt
+# Fixed by r326851.
+
 [ `id -u ` -ne 0 ] && echo "Must be root!" && exit 1
 
 . ../default.cfg

From owner-svn-src-user@freebsd.org  Tue Dec 19 09:58:43 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 2FDCAE9BB5D
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Tue, 19 Dec 2017 09:58:43 +0000 (UTC) (envelope-from pho@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 F1481709C5;
 Tue, 19 Dec 2017 09:58:42 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBJ9wfGQ033042;
 Tue, 19 Dec 2017 09:58:41 GMT (envelope-from pho@FreeBSD.org)
Received: (from pho@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBJ9wf1d033041;
 Tue, 19 Dec 2017 09:58:41 GMT (envelope-from pho@FreeBSD.org)
Message-Id: <201712190958.vBJ9wf1d033041@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org
 using -f
From: Peter Holm <pho@FreeBSD.org>
Date: Tue, 19 Dec 2017 09:58:41 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r326970 - user/pho/stress2/misc
X-SVN-Group: user
X-SVN-Commit-Author: pho
X-SVN-Commit-Paths: user/pho/stress2/misc
X-SVN-Commit-Revision: 326970
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Dec 2017 09:58:43 -0000

Author: pho
Date: Tue Dec 19 09:58:41 2017
New Revision: 326970
URL: https://svnweb.freebsd.org/changeset/base/326970

Log:
  Added error handling to switch.
  
  Sponsored by:	Dell EMC Isilon

Modified:
  user/pho/stress2/misc/mmap32.sh

Modified: user/pho/stress2/misc/mmap32.sh
==============================================================================
--- user/pho/stress2/misc/mmap32.sh	Tue Dec 19 09:53:48 2017	(r326969)
+++ user/pho/stress2/misc/mmap32.sh	Tue Dec 19 09:58:41 2017	(r326970)
@@ -126,6 +126,8 @@ fuzz(int arg, void *addr, size_t len, int prot, int fl
 			prot = makearg();
 			flags = makearg();
 			break;
+		default:
+			errx(1, "Bad argument %d to %s", arg, __func__);
 		}
 		vp = mmap(addr, len, prot, flags, fd, offset);
 		if (vp != MAP_FAILED) {

From owner-svn-src-user@freebsd.org  Tue Dec 19 10:02:11 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 3101EE9C2B1
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Tue, 19 Dec 2017 10:02:11 +0000 (UTC) (envelope-from pho@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 B54A270F77;
 Tue, 19 Dec 2017 10:02:10 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBJA29fX036416;
 Tue, 19 Dec 2017 10:02:09 GMT (envelope-from pho@FreeBSD.org)
Received: (from pho@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBJA29fB036415;
 Tue, 19 Dec 2017 10:02:09 GMT (envelope-from pho@FreeBSD.org)
Message-Id: <201712191002.vBJA29fB036415@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org
 using -f
From: Peter Holm <pho@FreeBSD.org>
Date: Tue, 19 Dec 2017 10:02:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r326972 - user/pho/stress2/misc
X-SVN-Group: user
X-SVN-Commit-Author: pho
X-SVN-Commit-Paths: user/pho/stress2/misc
X-SVN-Commit-Revision: 326972
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 19 Dec 2017 10:02:11 -0000

Author: pho
Date: Tue Dec 19 10:02:09 2017
New Revision: 326972
URL: https://svnweb.freebsd.org/changeset/base/326972

Log:
  Double disk size and make test less verbose.
  
  Sponsored by:	Dell EMC Isilon

Modified:
  user/pho/stress2/misc/sendfile12.sh

Modified: user/pho/stress2/misc/sendfile12.sh
==============================================================================
--- user/pho/stress2/misc/sendfile12.sh	Tue Dec 19 09:59:20 2017	(r326971)
+++ user/pho/stress2/misc/sendfile12.sh	Tue Dec 19 10:02:09 2017	(r326972)
@@ -47,7 +47,7 @@ rm -f sendfile12.c
 set -e
 mount | grep $mntpoint | grep -q /dev/md && umount -f $mntpoint
 [ -c /dev/md$mdstart ] &&  mdconfig -d -u $mdstart
-mdconfig -a -t swap -s 1g -u $mdstart
+mdconfig -a -t swap -s 2g -u $mdstart
 newfs $newfs_flags /dev/md$mdstart > /dev/null
 
 mount /dev/md${mdstart} $mntpoint
@@ -55,8 +55,8 @@ chmod 777 $mntpoint
 set +e
 
 cd $mntpoint
-dd if=/dev/zero of=file bs=1m count=512
-(cd $odir/../testcases/swap; ./swap -t 5m -i 20 -h -l 100) &
+dd if=/dev/zero of=file bs=1m count=512 2>&1 | egrep -v "records|transferred"
+(cd $odir/../testcases/swap; ./swap -t 5m -i 20 -h -l 100) > /dev/null &
 sleep 5
 /tmp/sendfile12 file output 12345; s=$?
 cd $odir
@@ -77,11 +77,13 @@ EOF
 #include <sys/mman.h>
 #include <sys/socket.h>
 #include <sys/stat.h>
+#include <sys/wait.h>
 
+#include <netinet/in.h>
+
 #include <err.h>
 #include <fcntl.h>
 #include <netdb.h>
-#include <netinet/in.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>

From owner-svn-src-user@freebsd.org  Wed Dec 20 00:48:29 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 C81B9E86BC2
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Wed, 20 Dec 2017 00:48:29 +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 9548B73B4A;
 Wed, 20 Dec 2017 00:48:29 +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 vBK0mSxC017738;
 Wed, 20 Dec 2017 00:48:28 GMT (envelope-from jeff@FreeBSD.org)
Received: (from jeff@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBK0mSe8017737;
 Wed, 20 Dec 2017 00:48:28 GMT (envelope-from jeff@FreeBSD.org)
Message-Id: <201712200048.vBK0mSe8017737@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jeff set sender to
 jeff@FreeBSD.org using -f
From: Jeff Roberson <jeff@FreeBSD.org>
Date: Wed, 20 Dec 2017 00:48:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r327011 - user/jeff/numa/usr.bin/cpuset
X-SVN-Group: user
X-SVN-Commit-Author: jeff
X-SVN-Commit-Paths: user/jeff/numa/usr.bin/cpuset
X-SVN-Commit-Revision: 327011
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 20 Dec 2017 00:48:29 -0000

Author: jeff
Date: Wed Dec 20 00:48:28 2017
New Revision: 327011
URL: https://svnweb.freebsd.org/changeset/base/327011

Log:
  Fix a minor output bug.

Modified:
  user/jeff/numa/usr.bin/cpuset/cpuset.c

Modified: user/jeff/numa/usr.bin/cpuset/cpuset.c
==============================================================================
--- user/jeff/numa/usr.bin/cpuset/cpuset.c	Wed Dec 20 00:30:31 2017	(r327010)
+++ user/jeff/numa/usr.bin/cpuset/cpuset.c	Wed Dec 20 00:48:28 2017	(r327011)
@@ -248,12 +248,12 @@ printaffinity(void)
 		err(EXIT_FAILURE, "getaffinity");
 	printf("%s %jd%s mask: ", whichnames[which], (intmax_t)id,
 	    levelnames[level]);
+	printset((struct bitset *)&mask, CPU_SETSIZE);
 	if (dflag)
 		goto out;
 	if (cpuset_getdomain(level, which, id, sizeof(domain), &domain,
 	    &policy) != 0)
 		err(EXIT_FAILURE, "getdomain");
-	printset((struct bitset *)&mask, CPU_SETSIZE);
 	printf("%s %jd%s domain policy: %s mask: ", whichnames[which],
 	    (intmax_t)id, levelnames[level], policynames[policy]);
 	printset((struct bitset *)&domain, DOMAINSET_SETSIZE);

From owner-svn-src-user@freebsd.org  Wed Dec 20 00:49:09 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 DCB77E86C5B
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Wed, 20 Dec 2017 00:49:09 +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 AA2AD73C37;
 Wed, 20 Dec 2017 00:49:09 +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 vBK0n8Vb017806;
 Wed, 20 Dec 2017 00:49:08 GMT (envelope-from jeff@FreeBSD.org)
Received: (from jeff@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBK0n8Tw017805;
 Wed, 20 Dec 2017 00:49:08 GMT (envelope-from jeff@FreeBSD.org)
Message-Id: <201712200049.vBK0n8Tw017805@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jeff set sender to
 jeff@FreeBSD.org using -f
From: Jeff Roberson <jeff@FreeBSD.org>
Date: Wed, 20 Dec 2017 00:49:08 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r327012 - user/jeff/numa/sys/kern
X-SVN-Group: user
X-SVN-Commit-Author: jeff
X-SVN-Commit-Paths: user/jeff/numa/sys/kern
X-SVN-Commit-Revision: 327012
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 20 Dec 2017 00:49:10 -0000

Author: jeff
Date: Wed Dec 20 00:49:08 2017
New Revision: 327012
URL: https://svnweb.freebsd.org/changeset/base/327012

Log:
  Fix a compile error on x86.

Modified:
  user/jeff/numa/sys/kern/subr_vmem.c

Modified: user/jeff/numa/sys/kern/subr_vmem.c
==============================================================================
--- user/jeff/numa/sys/kern/subr_vmem.c	Wed Dec 20 00:48:28 2017	(r327011)
+++ user/jeff/numa/sys/kern/subr_vmem.c	Wed Dec 20 00:49:08 2017	(r327012)
@@ -70,6 +70,7 @@ __FBSDID("$FreeBSD$");
 #include <vm/vm_kern.h>
 #include <vm/vm_extern.h>
 #include <vm/vm_param.h>
+#include <vm/vm_page.h>
 #include <vm/vm_pageout.h>
 
 #define	VMEM_OPTORDER		5

From owner-svn-src-user@freebsd.org  Wed Dec 20 04:03:00 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 E6349E9150B
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Wed, 20 Dec 2017 04:03:00 +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 BA52B7B282;
 Wed, 20 Dec 2017 04:02:59 +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 vBK42wNZ000328;
 Wed, 20 Dec 2017 04:02:58 GMT (envelope-from jeff@FreeBSD.org)
Received: (from jeff@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBK42wst000324;
 Wed, 20 Dec 2017 04:02:58 GMT (envelope-from jeff@FreeBSD.org)
Message-Id: <201712200402.vBK42wst000324@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jeff set sender to
 jeff@FreeBSD.org using -f
From: Jeff Roberson <jeff@FreeBSD.org>
Date: Wed, 20 Dec 2017 04:02:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r327014 - in user/jeff/numa/sys: kern sys vm
X-SVN-Group: user
X-SVN-Commit-Author: jeff
X-SVN-Commit-Paths: in user/jeff/numa/sys: kern sys vm
X-SVN-Commit-Revision: 327014
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 20 Dec 2017 04:03:01 -0000

Author: jeff
Date: Wed Dec 20 04:02:58 2017
New Revision: 327014
URL: https://svnweb.freebsd.org/changeset/base/327014

Log:
  Add domain specific malloc functions.

Modified:
  user/jeff/numa/sys/kern/kern_malloc.c
  user/jeff/numa/sys/sys/malloc.h
  user/jeff/numa/sys/vm/uma_core.c
  user/jeff/numa/sys/vm/uma_int.h

Modified: user/jeff/numa/sys/kern/kern_malloc.c
==============================================================================
--- user/jeff/numa/sys/kern/kern_malloc.c	Wed Dec 20 01:03:34 2017	(r327013)
+++ user/jeff/numa/sys/kern/kern_malloc.c	Wed Dec 20 04:02:58 2017	(r327014)
@@ -95,6 +95,11 @@ __FBSDID("$FreeBSD$");
 dtrace_malloc_probe_func_t	dtrace_malloc_probe;
 #endif
 
+#if defined(INVARIANTS) || defined(MALLOC_MAKE_FAILURES) ||		\
+    defined(DEBUG_MEMGUARD) || defined(DEBUG_REDZONE)
+#define	MALLOC_DEBUG	1
+#endif
+
 /*
  * When realloc() is called, if the new size is sufficiently smaller than
  * the old size, realloc() will allocate a new, smaller block to avoid
@@ -416,6 +421,20 @@ contigmalloc(unsigned long size, struct malloc_type *t
 	return (ret);
 }
 
+void *
+contigmalloc_domain(unsigned long size, struct malloc_type *type,
+    int domain, int flags, vm_paddr_t low, vm_paddr_t high,
+    unsigned long alignment, vm_paddr_t boundary)
+{
+	void *ret;
+
+	ret = (void *)kmem_alloc_contig_domain(domain, size, flags, low, high,
+	    alignment, boundary, VM_MEMATTR_DEFAULT);
+	if (ret != NULL)
+		malloc_type_allocated(type, round_page(size));
+	return (ret);
+}
+
 /*
  *	contigfree:
  *
@@ -431,26 +450,14 @@ contigfree(void *addr, unsigned long size, struct mall
 	malloc_type_freed(type, round_page(size));
 }
 
-/*
- *	malloc:
- *
- *	Allocate a block of memory.
- *
- *	If M_NOWAIT is set, this routine will not block and return NULL if
- *	the allocation fails.
- */
-void *
-malloc(unsigned long size, struct malloc_type *mtp, int flags)
+#ifdef MALLOC_DEBUG
+static int
+malloc_dbg(caddr_t *vap, unsigned long *sizep, struct malloc_type *mtp,
+    int flags)
 {
+#ifdef INVARIANTS
 	int indx;
-	struct malloc_type_internal *mtip;
-	caddr_t va;
-	uma_zone_t zone;
-#if defined(DIAGNOSTIC) || defined(DEBUG_REDZONE)
-	unsigned long osize = size;
-#endif
 
-#ifdef INVARIANTS
 	KASSERT(mtp->ks_magic == M_MAGIC, ("malloc: bad malloc type magic"));
 	/*
 	 * Check that exactly one of M_WAITOK or M_NOWAIT is specified.
@@ -473,7 +480,8 @@ malloc(unsigned long size, struct malloc_type *mtp, in
 		if ((malloc_nowait_count % malloc_failure_rate) == 0) {
 			atomic_add_int(&malloc_failure_count, 1);
 			t_malloc_fail = time_uptime;
-			return (NULL);
+			*vap = NULL;
+			return (EJUSTRETURN);
 		}
 	}
 #endif
@@ -486,16 +494,46 @@ malloc(unsigned long size, struct malloc_type *mtp, in
 #ifdef DEBUG_MEMGUARD
 	if (memguard_cmp_mtp(mtp, size)) {
 		va = memguard_alloc(size, flags);
-		if (va != NULL)
-			return (va);
+		if (va != NULL) {
+			*vap = va;
+			return (EJUSTRETURN);
+		}
 		/* This is unfortunate but should not be fatal. */
 	}
 #endif
 
 #ifdef DEBUG_REDZONE
-	size = redzone_size_ntor(size);
+	*sizep = redzone_size_ntor(*sizep);
 #endif
 
+	return (0);
+}
+#endif
+
+/*
+ *	malloc:
+ *
+ *	Allocate a block of memory.
+ *
+ *	If M_NOWAIT is set, this routine will not block and return NULL if
+ *	the allocation fails.
+ */
+void *
+malloc(unsigned long size, struct malloc_type *mtp, int flags)
+{
+	int indx;
+	struct malloc_type_internal *mtip;
+	caddr_t va;
+	uma_zone_t zone;
+#if defined(DIAGNOSTIC) || defined(DEBUG_REDZONE)
+	unsigned long osize = size;
+#endif
+
+#ifdef MALLOC_DEBUG
+	if (malloc_dbg(&va, &size, mtp, flags) != 0)
+		return (va);
+#endif
+
 	if (size <= kmem_zmax) {
 		mtip = mtp->ks_handle;
 		if (size & KMEM_ZMASK)
@@ -522,11 +560,55 @@ malloc(unsigned long size, struct malloc_type *mtp, in
 		KASSERT(va != NULL, ("malloc(M_WAITOK) returned NULL"));
 	else if (va == NULL)
 		t_malloc_fail = time_uptime;
-#ifdef DIAGNOSTIC
-	if (va != NULL && !(flags & M_ZERO)) {
-		memset(va, 0x70, osize);
-	}
+#ifdef DEBUG_REDZONE
+	if (va != NULL)
+		va = redzone_setup(va, osize);
 #endif
+	return ((void *) va);
+}
+
+void *
+malloc_domain(unsigned long size, struct malloc_type *mtp, int domain,
+    int flags)
+{
+	int indx;
+	struct malloc_type_internal *mtip;
+	caddr_t va;
+	uma_zone_t zone;
+#if defined(DIAGNOSTIC) || defined(DEBUG_REDZONE)
+	unsigned long osize = size;
+#endif
+
+#ifdef MALLOC_DEBUG
+	if (malloc_dbg(&va, &size, mtp, flags) != 0)
+		return (va);
+#endif
+	if (size <= kmem_zmax) {
+		mtip = mtp->ks_handle;
+		if (size & KMEM_ZMASK)
+			size = (size & ~KMEM_ZMASK) + KMEM_ZBASE;
+		indx = kmemsize[size >> KMEM_ZSHIFT];
+		KASSERT(mtip->mti_zone < numzones,
+		    ("mti_zone %u out of range %d",
+		    mtip->mti_zone, numzones));
+		zone = kmemzones[indx].kz_zone[mtip->mti_zone];
+#ifdef MALLOC_PROFILE
+		krequests[size >> KMEM_ZSHIFT]++;
+#endif
+		va = uma_zalloc_domain(zone, NULL, domain, flags);
+		if (va != NULL)
+			size = zone->uz_size;
+		malloc_type_zone_allocated(mtp, va == NULL ? 0 : size, indx);
+	} else {
+		size = roundup(size, PAGE_SIZE);
+		zone = NULL;
+		va = uma_large_malloc_domain(size, domain, flags);
+		malloc_type_allocated(mtp, va == NULL ? 0 : size);
+	}
+	if (flags & M_WAITOK)
+		KASSERT(va != NULL, ("malloc(M_WAITOK) returned NULL"));
+	else if (va == NULL)
+		t_malloc_fail = time_uptime;
 #ifdef DEBUG_REDZONE
 	if (va != NULL)
 		va = redzone_setup(va, osize);
@@ -534,66 +616,124 @@ malloc(unsigned long size, struct malloc_type *mtp, in
 	return ((void *) va);
 }
 
-/*
- *	free:
- *
- *	Free a block of memory allocated by malloc.
- *
- *	This routine may not block.
- */
-void
-free(void *addr, struct malloc_type *mtp)
+#ifdef INVARIANTS
+static void
+free_save_type(void *addr, struct malloc_type *mtp, u_long size)
 {
-	uma_slab_t slab;
-	u_long size;
+	struct malloc_type **mtpp = addr;
 
+	/*
+	 * Cache a pointer to the malloc_type that most recently freed
+	 * this memory here.  This way we know who is most likely to
+	 * have stepped on it later.
+	 *
+	 * This code assumes that size is a multiple of 8 bytes for
+	 * 64 bit machines
+	 */
+	mtpp = (struct malloc_type **) ((unsigned long)mtpp & ~UMA_ALIGN_PTR);
+	mtpp += (size - sizeof(struct malloc_type *)) /
+	    sizeof(struct malloc_type *);
+	*mtpp = mtp;
+}
+#endif
+
+#ifdef MALLOC_DEBUG
+static int
+free_dbg(void **addrp, struct malloc_type *mtp)
+{
+	void *addr;
+
+	addr = *addrp;
 	KASSERT(mtp->ks_magic == M_MAGIC, ("free: bad malloc type magic"));
 	KASSERT(curthread->td_critnest == 0 || SCHEDULER_STOPPED(),
 	    ("free: called with spinlock or critical section held"));
 
 	/* free(NULL, ...) does nothing */
 	if (addr == NULL)
-		return;
+		return (EJUSTRETURN);
 
 #ifdef DEBUG_MEMGUARD
 	if (is_memguard_addr(addr)) {
 		memguard_free(addr);
-		return;
+		return (EJUSTRETURN);
 	}
 #endif
 
 #ifdef DEBUG_REDZONE
 	redzone_check(addr);
-	addr = redzone_addr_ntor(addr);
+	*addrp = redzone_addr_ntor(addr);
 #endif
 
-	slab = vtoslab((vm_offset_t)addr & (~UMA_SLAB_MASK));
+	return (0);
+}
+#endif
 
+/*
+ *	free:
+ *
+ *	Free a block of memory allocated by malloc.
+ *
+ *	This routine may not block.
+ */
+void
+free(void *addr, struct malloc_type *mtp)
+{
+	uma_slab_t slab;
+	u_long size;
+
+#ifdef MALLOC_DEBUG
+	if (free_dbg(&addr, mtp) != 0)
+		return;
+#endif
+	/* free(NULL, ...) does nothing */
+	if (addr == NULL)
+		return;
+
+	slab = vtoslab((vm_offset_t)addr & (~UMA_SLAB_MASK));
 	if (slab == NULL)
 		panic("free: address %p(%p) has not been allocated.\n",
 		    addr, (void *)((u_long)addr & (~UMA_SLAB_MASK)));
 
 	if (!(slab->us_flags & UMA_SLAB_MALLOC)) {
+		size = slab->us_keg->uk_size;
 #ifdef INVARIANTS
-		struct malloc_type **mtpp = addr;
+		free_save_type(addr, mtp, size);
 #endif
+		uma_zfree_arg(LIST_FIRST(&slab->us_keg->uk_zones), addr, slab);
+	} else {
+		size = slab->us_size;
+		uma_large_free(slab);
+	}
+	malloc_type_freed(mtp, size);
+}
+
+void
+free_domain(void *addr, struct malloc_type *mtp)
+{
+	uma_slab_t slab;
+	u_long size;
+
+#ifdef MALLOC_DEBUG
+	if (free_dbg(&addr, mtp) != 0)
+		return;
+#endif
+
+	/* free(NULL, ...) does nothing */
+	if (addr == NULL)
+		return;
+
+	slab = vtoslab((vm_offset_t)addr & (~UMA_SLAB_MASK));
+	if (slab == NULL)
+		panic("free_domain: address %p(%p) has not been allocated.\n",
+		    addr, (void *)((u_long)addr & (~UMA_SLAB_MASK)));
+
+	if (!(slab->us_flags & UMA_SLAB_MALLOC)) {
 		size = slab->us_keg->uk_size;
 #ifdef INVARIANTS
-		/*
-		 * Cache a pointer to the malloc_type that most recently freed
-		 * this memory here.  This way we know who is most likely to
-		 * have stepped on it later.
-		 *
-		 * This code assumes that size is a multiple of 8 bytes for
-		 * 64 bit machines
-		 */
-		mtpp = (struct malloc_type **)
-		    ((unsigned long)mtpp & ~UMA_ALIGN_PTR);
-		mtpp += (size - sizeof(struct malloc_type *)) /
-		    sizeof(struct malloc_type *);
-		*mtpp = mtp;
+		free_save_type(addr, mtp, size);
 #endif
-		uma_zfree_arg(LIST_FIRST(&slab->us_keg->uk_zones), addr, slab);
+		uma_zfree_domain(LIST_FIRST(&slab->us_keg->uk_zones),
+		    addr, slab);
 	} else {
 		size = slab->us_size;
 		uma_large_free(slab);

Modified: user/jeff/numa/sys/sys/malloc.h
==============================================================================
--- user/jeff/numa/sys/sys/malloc.h	Wed Dec 20 01:03:34 2017	(r327013)
+++ user/jeff/numa/sys/sys/malloc.h	Wed Dec 20 04:02:58 2017	(r327014)
@@ -174,8 +174,16 @@ void	*contigmalloc(unsigned long size, struct malloc_t
 	    vm_paddr_t low, vm_paddr_t high, unsigned long alignment,
 	    vm_paddr_t boundary) __malloc_like __result_use_check
 	    __alloc_size(1) __alloc_align(6);
+void	*contigmalloc_domain(unsigned long size, struct malloc_type *type,
+	    int domain, int flags, vm_paddr_t low, vm_paddr_t high,
+	    unsigned long alignment, vm_paddr_t boundary)
+	    __malloc_like __result_use_check __alloc_size(1) __alloc_align(6);
 void	free(void *addr, struct malloc_type *type);
+void	free_domain(void *addr, struct malloc_type *type);
 void	*malloc(unsigned long size, struct malloc_type *type, int flags)
+	    __malloc_like __result_use_check __alloc_size(1);
+void	*malloc_domain(unsigned long size, struct malloc_type *type,
+	    int domain, int flags)
 	    __malloc_like __result_use_check __alloc_size(1);
 void	malloc_init(void *);
 int	malloc_last_fail(void);

Modified: user/jeff/numa/sys/vm/uma_core.c
==============================================================================
--- user/jeff/numa/sys/vm/uma_core.c	Wed Dec 20 01:03:34 2017	(r327013)
+++ user/jeff/numa/sys/vm/uma_core.c	Wed Dec 20 04:02:58 2017	(r327014)
@@ -221,6 +221,8 @@ struct uma_bucket_zone bucket_zones[] = {
  */
 enum zfreeskip { SKIP_NONE = 0, SKIP_DTOR, SKIP_FINI };
 
+#define	UMA_ANYDOMAIN	-1	/* Special value for domain search. */
+
 /* Prototypes.. */
 
 static void *noobj_alloc(uma_zone_t, vm_size_t, int, uint8_t *, int);
@@ -564,8 +566,8 @@ hash_alloc(struct uma_hash *hash)
 		    M_UMAHASH, M_NOWAIT);
 	} else {
 		alloc = sizeof(hash->uh_slab_hash[0]) * UMA_HASH_SIZE_INIT;
-		hash->uh_slab_hash = zone_alloc_item(hashzone, NULL, 0,
-		    M_WAITOK);
+		hash->uh_slab_hash = zone_alloc_item(hashzone, NULL,
+		    UMA_ANYDOMAIN, M_WAITOK);
 		hash->uh_hashsize = UMA_HASH_SIZE_INIT;
 	}
 	if (hash->uh_slab_hash) {
@@ -1878,7 +1880,7 @@ uma_kcreate(uma_zone_t zone, size_t size, uma_init umi
 	args.align = (align == UMA_ALIGN_CACHE) ? uma_align_cache : align;
 	args.flags = flags;
 	args.zone = zone;
-	return (zone_alloc_item(kegs, &args, 0, M_WAITOK));
+	return (zone_alloc_item(kegs, &args, UMA_ANYDOMAIN, M_WAITOK));
 }
 
 /* See uma.h */
@@ -1935,7 +1937,7 @@ uma_zcreate(const char *name, size_t size, uma_ctor ct
 		sx_slock(&uma_drain_lock);
 		locked = true;
 	}
-	res = zone_alloc_item(zones, &args, 0, M_WAITOK);
+	res = zone_alloc_item(zones, &args, UMA_ANYDOMAIN, M_WAITOK);
 	if (locked)
 		sx_sunlock(&uma_drain_lock);
 	return (res);
@@ -1970,7 +1972,7 @@ uma_zsecond_create(char *name, uma_ctor ctor, uma_dtor
 		locked = true;
 	}
 	/* XXX Attaches only one keg of potentially many. */
-	res = zone_alloc_item(zones, &args, 0, M_WAITOK);
+	res = zone_alloc_item(zones, &args, UMA_ANYDOMAIN, M_WAITOK);
 	if (locked)
 		sx_sunlock(&uma_drain_lock);
 	return (res);
@@ -1997,7 +1999,7 @@ uma_zcache_create(char *name, int size, uma_ctor ctor,
 	args.align = 0;
 	args.flags = flags;
 
-	return (zone_alloc_item(zones, &args, 0, M_WAITOK));
+	return (zone_alloc_item(zones, &args, UMA_ANYDOMAIN, M_WAITOK));
 }
 
 static void
@@ -2206,7 +2208,7 @@ zalloc_start:
 	if (zone->uz_flags & UMA_ZONE_NUMA)
 		domain = PCPU_GET(domain);
 	else
-		domain = 0;
+		domain = UMA_ANYDOMAIN;
 
 	/* Short-circuit for zones without buckets and low memory. */
 	if (zone->uz_count == 0 || bucketdisable)
@@ -2248,7 +2250,10 @@ zalloc_start:
 	/*
 	 * Check the zone's cache of buckets.
 	 */
-	zdom = &zone->uz_domain[domain];
+	if (domain == UMA_ANYDOMAIN)
+		zdom = &zone->uz_domain[0];
+	else
+		zdom = &zone->uz_domain[domain];
 	if ((bucket = LIST_FIRST(&zdom->uzd_buckets)) != NULL) {
 		KASSERT(bucket->ub_cnt != 0,
 		    ("uma_zalloc_arg: Returning an empty bucket."));
@@ -2306,6 +2311,28 @@ zalloc_item:
 	return (item);
 }
 
+void *
+uma_zalloc_domain(uma_zone_t zone, void *udata, int domain, int flags)
+{
+
+	/* Enable entropy collection for RANDOM_ENABLE_UMA kernel option */
+	random_harvest_fast_uma(&zone, sizeof(zone), 1, RANDOM_UMA);
+
+	/* This is the fast path allocation */
+	CTR5(KTR_UMA,
+	    "uma_zalloc_domain thread %x zone %s(%p) domain %d flags %d",
+	    curthread, zone->uz_name, zone, domain, flags);
+
+	if (flags & M_WAITOK) {
+		WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
+		    "uma_zalloc_domain: zone \"%s\"", zone->uz_name);
+	}
+	KASSERT(curthread->td_critnest == 0 || SCHEDULER_STOPPED(),
+	    ("uma_zalloc_domain: called with spinlock or critical section held"));
+
+	return (zone_alloc_item(zone, udata, domain, flags));
+}
+
 /*
  * Find a slab with some space.  Prefer slabs that are partially used over those
  * that are totally full.  This helps to reduce fragmentation.
@@ -2360,7 +2387,9 @@ keg_fetch_slab(uma_keg_t keg, uma_zone_t zone, int rdo
 	 * Round-robin for non first-touch zones when there is more than one
 	 * domain.
 	 */
-	rr = (zone->uz_flags & UMA_ZONE_NUMA) == 0 && vm_ndomains != 1;
+	if (vm_ndomains == 1)
+		rdomain = 0;
+	rr = rdomain == UMA_ANYDOMAIN;
 	if (rr) {
 		keg->uk_cursor = (keg->uk_cursor + 1) % vm_ndomains;
 		domain = start = keg->uk_cursor;
@@ -2665,6 +2694,7 @@ zone_alloc_bucket(uma_zone_t zone, void *udata, int do
  * Arguments
  *	zone   The zone to alloc for.
  *	udata  The data to be passed to the constructor.
+ *	domain The domain to allocate from or UMA_ANYDOMAIN.
  *	flags  M_WAITOK, M_NOWAIT, M_ZERO.
  *
  * Returns
@@ -2896,6 +2926,25 @@ zfree_item:
 	return;
 }
 
+void
+uma_zfree_domain(uma_zone_t zone, void *item, void *udata)
+{
+
+	/* Enable entropy collection for RANDOM_ENABLE_UMA kernel option */
+	random_harvest_fast_uma(&zone, sizeof(zone), 1, RANDOM_UMA);
+
+	CTR2(KTR_UMA, "uma_zfree_domain thread %x zone %s", curthread,
+	    zone->uz_name);
+
+	KASSERT(curthread->td_critnest == 0 || SCHEDULER_STOPPED(),
+	    ("uma_zfree_domain: called with spinlock or critical section held"));
+
+        /* uma_zfree(..., NULL) does nothing, to match free(9). */
+        if (item == NULL)
+                return;
+	zone_free_item(zone, item, udata, SKIP_NONE);
+}
+
 static void
 slab_free_item(uma_keg_t keg, uma_slab_t slab, void *item)
 {
@@ -3342,15 +3391,18 @@ uma_zone_exhausted_nolock(uma_zone_t zone)
 }
 
 void *
-uma_large_malloc(vm_size_t size, int wait)
+uma_large_malloc_domain(vm_size_t size, int domain, int wait)
 {
 	vm_offset_t addr;
 	uma_slab_t slab;
 
-	slab = zone_alloc_item(slabzone, NULL, 0, wait);
+	slab = zone_alloc_item(slabzone, NULL, domain, wait);
 	if (slab == NULL)
 		return (NULL);
-	addr = kmem_malloc(kernel_arena, size, wait);
+	if (domain == UMA_ANYDOMAIN)
+		addr = kmem_malloc(kernel_arena, size, wait);
+	else
+		addr = kmem_malloc_domain(domain, size, wait);
 	if (addr != 0) {
 		vsetslab(addr, slab);
 		slab->us_data = (void *)addr;
@@ -3364,6 +3416,13 @@ uma_large_malloc(vm_size_t size, int wait)
 	}
 
 	return ((void *)addr);
+}
+
+void *
+uma_large_malloc(vm_size_t size, int wait)
+{
+
+	return uma_large_malloc_domain(size, UMA_ANYDOMAIN, wait);
 }
 
 void

Modified: user/jeff/numa/sys/vm/uma_int.h
==============================================================================
--- user/jeff/numa/sys/vm/uma_int.h	Wed Dec 20 01:03:34 2017	(r327013)
+++ user/jeff/numa/sys/vm/uma_int.h	Wed Dec 20 04:02:58 2017	(r327014)
@@ -386,6 +386,7 @@ zone_first_keg(uma_zone_t zone)
 /* Internal prototypes */
 static __inline uma_slab_t hash_sfind(struct uma_hash *hash, uint8_t *data);
 void *uma_large_malloc(vm_size_t size, int wait);
+void *uma_large_malloc_domain(vm_size_t size, int domain, int wait);
 void uma_large_free(uma_slab_t slab);
 
 /* Lock Macros */

From owner-svn-src-user@freebsd.org  Wed Dec 20 04:03:43 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 C76E4E9155A
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Wed, 20 Dec 2017 04:03:43 +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 8F4967B3CF;
 Wed, 20 Dec 2017 04:03:43 +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 vBK43g3Z000396;
 Wed, 20 Dec 2017 04:03:42 GMT (envelope-from jeff@FreeBSD.org)
Received: (from jeff@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBK43gi8000395;
 Wed, 20 Dec 2017 04:03:42 GMT (envelope-from jeff@FreeBSD.org)
Message-Id: <201712200403.vBK43gi8000395@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jeff set sender to
 jeff@FreeBSD.org using -f
From: Jeff Roberson <jeff@FreeBSD.org>
Date: Wed, 20 Dec 2017 04:03:42 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r327015 - 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: 327015
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 20 Dec 2017 04:03:43 -0000

Author: jeff
Date: Wed Dec 20 04:03:42 2017
New Revision: 327015
URL: https://svnweb.freebsd.org/changeset/base/327015

Log:
  Add domain specific uma allocation functions.

Modified:
  user/jeff/numa/sys/vm/uma.h

Modified: user/jeff/numa/sys/vm/uma.h
==============================================================================
--- user/jeff/numa/sys/vm/uma.h	Wed Dec 20 04:02:58 2017	(r327014)
+++ user/jeff/numa/sys/vm/uma.h	Wed Dec 20 04:03:42 2017	(r327015)
@@ -332,6 +332,19 @@ void uma_zdestroy(uma_zone_t zone);
 void *uma_zalloc_arg(uma_zone_t zone, void *arg, int flags);
 
 /*
+ * Allocate an item from a specific NUMA domain.  This uses a slow path in
+ * the allocator but is guaranteed to allocate memory from the requested
+ * domain if M_WAITOK is set.
+ *
+ * Arguments:
+ *	zone  The zone we are allocating from
+ *	arg   This data is passed to the ctor function
+ *	domain The domain to allocate from.
+ *	flags See sys/malloc.h for available flags.
+ */
+void *uma_zalloc_domain(uma_zone_t zone, void *arg, int domain, int flags);
+
+/*
  * Allocates an item out of a zone without supplying an argument
  *
  * This is just a wrapper for uma_zalloc_arg for convenience.
@@ -358,6 +371,16 @@ uma_zalloc(uma_zone_t zone, int flags)
  */
 
 void uma_zfree_arg(uma_zone_t zone, void *item, void *arg);
+
+/*
+ * Frees an item back to the specified zone's domain specific pool.
+ *
+ * Arguments:
+ *	zone  The zone the item was originally allocated out of.
+ *	item  The memory to be freed.
+ *	arg   Argument passed to the destructor
+ */
+void uma_zfree_domain(uma_zone_t zone, void *item, void *arg);
 
 /*
  * Frees an item back to a zone without supplying an argument

From owner-svn-src-user@freebsd.org  Wed Dec 20 04:08:03 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 3FD94E91921
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Wed, 20 Dec 2017 04:08:03 +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 E4BE77B6CF;
 Wed, 20 Dec 2017 04:08:02 +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 vBK482w8000590;
 Wed, 20 Dec 2017 04:08:02 GMT (envelope-from jeff@FreeBSD.org)
Received: (from jeff@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBK480vp000577;
 Wed, 20 Dec 2017 04:08:00 GMT (envelope-from jeff@FreeBSD.org)
Message-Id: <201712200408.vBK480vp000577@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: jeff set sender to
 jeff@FreeBSD.org using -f
From: Jeff Roberson <jeff@FreeBSD.org>
Date: Wed, 20 Dec 2017 04:08:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r327016 - in user/jeff/numa/sys: arm/arm arm64/arm64
 dev/acpica mips/mips powerpc/powerpc sys vm x86/include x86/iommu x86/x86
X-SVN-Group: user
X-SVN-Commit-Author: jeff
X-SVN-Commit-Paths: in user/jeff/numa/sys: arm/arm arm64/arm64 dev/acpica
 mips/mips powerpc/powerpc sys vm x86/include x86/iommu x86/x86
X-SVN-Commit-Revision: 327016
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 20 Dec 2017 04:08:03 -0000

Author: jeff
Date: Wed Dec 20 04:08:00 2017
New Revision: 327016
URL: https://svnweb.freebsd.org/changeset/base/327016

Log:
  Add a domain constraint to busdma tags so that bus_dmamem can come from the
  domain local to the device.

Modified:
  user/jeff/numa/sys/arm/arm/busdma_machdep-v4.c
  user/jeff/numa/sys/arm/arm/busdma_machdep-v6.c
  user/jeff/numa/sys/arm64/arm64/busdma_machdep.c
  user/jeff/numa/sys/dev/acpica/acpi_pcib_acpi.c
  user/jeff/numa/sys/mips/mips/busdma_machdep.c
  user/jeff/numa/sys/powerpc/powerpc/busdma_machdep.c
  user/jeff/numa/sys/sys/bus_dma.h
  user/jeff/numa/sys/vm/vm_phys.c
  user/jeff/numa/sys/vm/vm_phys.h
  user/jeff/numa/sys/x86/include/busdma_impl.h
  user/jeff/numa/sys/x86/iommu/busdma_dmar.c
  user/jeff/numa/sys/x86/x86/busdma_bounce.c
  user/jeff/numa/sys/x86/x86/busdma_machdep.c

Modified: user/jeff/numa/sys/arm/arm/busdma_machdep-v4.c
==============================================================================
--- user/jeff/numa/sys/arm/arm/busdma_machdep-v4.c	Wed Dec 20 04:03:42 2017	(r327015)
+++ user/jeff/numa/sys/arm/arm/busdma_machdep-v4.c	Wed Dec 20 04:08:00 2017	(r327016)
@@ -500,6 +500,13 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al
 }
 
 int
+bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain)
+{
+
+	return (0);
+}
+
+int
 bus_dma_tag_destroy(bus_dma_tag_t dmat)
 {
 	bus_dma_tag_t dmat_copy;

Modified: user/jeff/numa/sys/arm/arm/busdma_machdep-v6.c
==============================================================================
--- user/jeff/numa/sys/arm/arm/busdma_machdep-v6.c	Wed Dec 20 04:03:42 2017	(r327015)
+++ user/jeff/numa/sys/arm/arm/busdma_machdep-v6.c	Wed Dec 20 04:08:00 2017	(r327016)
@@ -563,6 +563,13 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al
 }
 
 int
+bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain)
+{
+
+	return (0);
+}
+
+int
 bus_dma_tag_destroy(bus_dma_tag_t dmat)
 {
 	bus_dma_tag_t dmat_copy;

Modified: user/jeff/numa/sys/arm64/arm64/busdma_machdep.c
==============================================================================
--- user/jeff/numa/sys/arm64/arm64/busdma_machdep.c	Wed Dec 20 04:03:42 2017	(r327015)
+++ user/jeff/numa/sys/arm64/arm64/busdma_machdep.c	Wed Dec 20 04:08:00 2017	(r327016)
@@ -223,3 +223,9 @@ bus_dma_tag_destroy(bus_dma_tag_t dmat)
 	return (tc->impl->tag_destroy(dmat));
 }
 
+int
+bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain)
+{
+
+	return (0);
+}

Modified: user/jeff/numa/sys/dev/acpica/acpi_pcib_acpi.c
==============================================================================
--- user/jeff/numa/sys/dev/acpica/acpi_pcib_acpi.c	Wed Dec 20 04:03:42 2017	(r327015)
+++ user/jeff/numa/sys/dev/acpica/acpi_pcib_acpi.c	Wed Dec 20 04:08:00 2017	(r327016)
@@ -60,6 +60,7 @@ ACPI_MODULE_NAME("PCI_ACPI")
 struct acpi_hpcib_softc {
     device_t		ap_dev;
     ACPI_HANDLE		ap_handle;
+    bus_dma_tag_t	ap_dma_tag;
     int			ap_flags;
     uint32_t		ap_osc_ctl;
 
@@ -108,6 +109,7 @@ static int		acpi_pcib_acpi_release_resource(device_t d
 #endif
 static int		acpi_pcib_request_feature(device_t pcib, device_t dev,
 			    enum pci_feature feature);
+static bus_dma_tag_t	acpi_pcib_get_dma_tag(device_t bus, device_t child);
 
 static device_method_t acpi_pcib_acpi_methods[] = {
     /* Device interface */
@@ -136,6 +138,7 @@ static device_method_t acpi_pcib_acpi_methods[] = {
     DEVMETHOD(bus_setup_intr,		bus_generic_setup_intr),
     DEVMETHOD(bus_teardown_intr,	bus_generic_teardown_intr),
     DEVMETHOD(bus_get_cpus,		acpi_pcib_get_cpus),
+    DEVMETHOD(bus_get_dma_tag,		acpi_pcib_get_dma_tag),
 
     /* pcib interface */
     DEVMETHOD(pcib_maxslots,		pcib_maxslots),
@@ -366,6 +369,7 @@ acpi_pcib_acpi_attach(device_t dev)
     rman_res_t start;
     int rid;
 #endif
+    int error, domain;
     uint8_t busno;
 
     ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__);
@@ -537,15 +541,31 @@ acpi_pcib_acpi_attach(device_t dev)
 
     acpi_pcib_fetch_prt(dev, &sc->ap_prt);
 
+    error = bus_dma_tag_create(bus_get_dma_tag(dev), 1,
+	PCI_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR,
+	NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED,
+	BUS_SPACE_MAXSIZE, 0, NULL, NULL, &sc->ap_dma_tag);
+    if (error != 0)
+	goto errout;
+    error = bus_get_domain(dev, &domain);
+    if (error == 0)
+	error = bus_dma_tag_set_domain(sc->ap_dma_tag, domain);
+    /* Don't fail to attach if the domain can't be queried or set. */
+    error = 0;
+
     bus_generic_probe(dev);
     if (device_add_child(dev, "pci", -1) == NULL) {
-	device_printf(device_get_parent(dev), "couldn't attach pci bus\n");
-#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
-	pcib_host_res_free(dev, &sc->ap_host_res);
-#endif
-	return (ENXIO);
+	error = ENXIO;
+	goto errout;
     }
     return (bus_generic_attach(dev));
+
+errout:
+    device_printf(device_get_parent(dev), "couldn't attach pci bus\n");
+#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
+    pcib_host_res_free(dev, &sc->ap_host_res);
+#endif
+    return (error);
 }
 
 /*
@@ -752,4 +772,14 @@ acpi_pcib_request_feature(device_t pcib, device_t dev,
 	}
 
 	return (acpi_pcib_osc(sc, osc_ctl));
+}
+
+static bus_dma_tag_t
+acpi_pcib_get_dma_tag(device_t bus, device_t child)
+{
+	struct acpi_hpcib_softc *sc;
+
+	sc = device_get_softc(bus);
+
+	return (sc->ap_dma_tag);
 }

Modified: user/jeff/numa/sys/mips/mips/busdma_machdep.c
==============================================================================
--- user/jeff/numa/sys/mips/mips/busdma_machdep.c	Wed Dec 20 04:03:42 2017	(r327015)
+++ user/jeff/numa/sys/mips/mips/busdma_machdep.c	Wed Dec 20 04:08:00 2017	(r327016)
@@ -481,6 +481,13 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al
 }
 
 int
+bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain)
+{
+
+	return (0);
+}
+
+int
 bus_dma_tag_destroy(bus_dma_tag_t dmat)
 {
 #ifdef KTR

Modified: user/jeff/numa/sys/powerpc/powerpc/busdma_machdep.c
==============================================================================
--- user/jeff/numa/sys/powerpc/powerpc/busdma_machdep.c	Wed Dec 20 04:03:42 2017	(r327015)
+++ user/jeff/numa/sys/powerpc/powerpc/busdma_machdep.c	Wed Dec 20 04:08:00 2017	(r327016)
@@ -341,6 +341,13 @@ bus_dma_tag_create(bus_dma_tag_t parent, bus_size_t al
 }
 
 int
+bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain)
+{
+
+	return (0);
+}
+
+int
 bus_dma_tag_destroy(bus_dma_tag_t dmat)
 {
 	bus_dma_tag_t dmat_copy;

Modified: user/jeff/numa/sys/sys/bus_dma.h
==============================================================================
--- user/jeff/numa/sys/sys/bus_dma.h	Wed Dec 20 04:03:42 2017	(r327015)
+++ user/jeff/numa/sys/sys/bus_dma.h	Wed Dec 20 04:08:00 2017	(r327016)
@@ -176,6 +176,14 @@ int bus_dma_tag_create(bus_dma_tag_t parent, bus_size_
 		       bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc,
 		       void *lockfuncarg, bus_dma_tag_t *dmat);
 
+/*
+ * Set the memory domain to be used for allocations.
+ * 
+ * Automatic for PCI devices.  Must be set prior to creating maps or
+ * allocating memory.
+ */
+int bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain);
+
 int bus_dma_tag_destroy(bus_dma_tag_t dmat);
 
 /*

Modified: user/jeff/numa/sys/vm/vm_phys.c
==============================================================================
--- user/jeff/numa/sys/vm/vm_phys.c	Wed Dec 20 04:03:42 2017	(r327015)
+++ user/jeff/numa/sys/vm/vm_phys.c	Wed Dec 20 04:08:00 2017	(r327016)
@@ -198,20 +198,25 @@ vm_phys_fictitious_cmp(struct vm_phys_fictitious_seg *
 	    (uintmax_t)p1->end, (uintmax_t)p2->start, (uintmax_t)p2->end);
 }
 
-boolean_t
-vm_phys_domain_intersects(long mask, vm_paddr_t low, vm_paddr_t high)
+int
+vm_phys_domain_match(int prefer, vm_paddr_t low, vm_paddr_t high)
 {
-	struct vm_phys_seg *s;
-	int idx;
+	domainset_t mask;
+	int i;
 
-	while ((idx = ffsl(mask)) != 0) {
-		idx--;	/* ffsl counts from 1 */
-		mask &= ~(1UL << idx);
-		s = &vm_phys_segs[idx];
-		if (low < s->end && high > s->start)
-			return (TRUE);
-	}
-	return (FALSE);
+	DOMAINSET_ZERO(&mask);
+	/*
+	 * Check for any memory that overlaps low, high.
+	 */
+	for (i = 0; i < vm_ndomains; i++)
+		if (mem_affinity[i].start <= high &&
+		    mem_affinity[i].end >= low)
+			DOMAINSET_SET(mem_affinity[i].domain, &mask);
+	if (prefer != -1 && DOMAINSET_ISSET(prefer, &mask))
+		return (prefer);
+	if (DOMAINSET_EMPTY(&mask))
+		panic("vm_phys_domain_match:  Impossible constraint");
+	return (DOMAINSET_FFS(&mask));
 }
 
 /*

Modified: user/jeff/numa/sys/vm/vm_phys.h
==============================================================================
--- user/jeff/numa/sys/vm/vm_phys.h	Wed Dec 20 04:03:42 2017	(r327015)
+++ user/jeff/numa/sys/vm/vm_phys.h	Wed Dec 20 04:08:00 2017	(r327016)
@@ -77,7 +77,7 @@ vm_page_t vm_phys_alloc_contig(int domain, u_long npag
 vm_page_t vm_phys_alloc_freelist_pages(int domain, int freelist, int pool,
     int order);
 vm_page_t vm_phys_alloc_pages(int domain, int pool, int order);
-boolean_t vm_phys_domain_intersects(long mask, vm_paddr_t low, vm_paddr_t high);
+int vm_phys_domain_match(int prefer, vm_paddr_t low, vm_paddr_t high);
 int vm_phys_fictitious_reg_range(vm_paddr_t start, vm_paddr_t end,
     vm_memattr_t memattr);
 void vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end);

Modified: user/jeff/numa/sys/x86/include/busdma_impl.h
==============================================================================
--- user/jeff/numa/sys/x86/include/busdma_impl.h	Wed Dec 20 04:03:42 2017	(r327015)
+++ user/jeff/numa/sys/x86/include/busdma_impl.h	Wed Dec 20 04:08:00 2017	(r327016)
@@ -50,6 +50,7 @@ struct bus_dma_tag_common {
 	bus_dma_lock_t	 *lockfunc;
 	void		 *lockfuncarg;
 	int		  ref_count;
+	int		  domain;
 };
 
 struct bus_dma_impl {
@@ -60,6 +61,7 @@ struct bus_dma_impl {
 	    bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc,
 	    void *lockfuncarg, bus_dma_tag_t *dmat);
 	int (*tag_destroy)(bus_dma_tag_t dmat);
+	int (*tag_set_domain)(bus_dma_tag_t);
 	int (*map_create)(bus_dma_tag_t dmat, int flags, bus_dmamap_t *mapp);
 	int (*map_destroy)(bus_dma_tag_t dmat, bus_dmamap_t map);
 	int (*mem_alloc)(bus_dma_tag_t dmat, void** vaddr, int flags,

Modified: user/jeff/numa/sys/x86/iommu/busdma_dmar.c
==============================================================================
--- user/jeff/numa/sys/x86/iommu/busdma_dmar.c	Wed Dec 20 04:03:42 2017	(r327015)
+++ user/jeff/numa/sys/x86/iommu/busdma_dmar.c	Wed Dec 20 04:08:00 2017	(r327016)
@@ -326,6 +326,13 @@ out:
 }
 
 static int
+dmar_bus_dma_tag_set_domain(bus_dma_tag_t dmat)
+{
+
+	return (0);
+}
+
+static int
 dmar_bus_dma_tag_destroy(bus_dma_tag_t dmat1)
 {
 	struct bus_dma_tag_dmar *dmat, *dmat_copy, *parent;
@@ -345,7 +352,7 @@ dmar_bus_dma_tag_destroy(bus_dma_tag_t dmat1)
 			    1) {
 				if (dmat == &dmat->ctx->ctx_tag)
 					dmar_free_ctx(dmat->ctx);
-				free(dmat->segments, M_DMAR_DMAMAP);
+				free_domain(dmat->segments, M_DMAR_DMAMAP);
 				free(dmat, M_DEVBUF);
 				dmat = parent;
 			} else
@@ -366,16 +373,18 @@ dmar_bus_dmamap_create(bus_dma_tag_t dmat, int flags, 
 	WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, "%s", __func__);
 
 	tag = (struct bus_dma_tag_dmar *)dmat;
-	map = malloc(sizeof(*map), M_DMAR_DMAMAP, M_NOWAIT | M_ZERO);
+	map = malloc_domain(sizeof(*map), M_DMAR_DMAMAP,
+	    tag->common.domain, M_NOWAIT | M_ZERO);
 	if (map == NULL) {
 		*mapp = NULL;
 		return (ENOMEM);
 	}
 	if (tag->segments == NULL) {
-		tag->segments = malloc(sizeof(bus_dma_segment_t) *
-		    tag->common.nsegments, M_DMAR_DMAMAP, M_NOWAIT);
+		tag->segments = malloc_domain(sizeof(bus_dma_segment_t) *
+		    tag->common.nsegments, M_DMAR_DMAMAP,
+		    tag->common.domain, M_NOWAIT);
 		if (tag->segments == NULL) {
-			free(map, M_DMAR_DMAMAP);
+			free_domain(map, M_DMAR_DMAMAP);
 			*mapp = NULL;
 			return (ENOMEM);
 		}
@@ -407,7 +416,7 @@ dmar_bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmamap
 			return (EBUSY);
 		}
 		DMAR_DOMAIN_UNLOCK(domain);
-		free(map, M_DMAR_DMAMAP);
+		free_domain(map, M_DMAR_DMAMAP);
 	}
 	tag->map_count--;
 	return (0);
@@ -438,10 +447,11 @@ dmar_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr
 	if (tag->common.maxsize < PAGE_SIZE &&
 	    tag->common.alignment <= tag->common.maxsize &&
 	    attr == VM_MEMATTR_DEFAULT) {
-		*vaddr = malloc(tag->common.maxsize, M_DEVBUF, mflags);
+		*vaddr = malloc_domain(tag->common.maxsize, M_DEVBUF,
+		    tag->common.domain, mflags);
 		map->flags |= BUS_DMAMAP_DMAR_MALLOC;
 	} else {
-		*vaddr = (void *)kmem_alloc_attr(kernel_arena,
+		*vaddr = (void *)kmem_alloc_attr_domain(tag->common.domain,
 		    tag->common.maxsize, mflags, 0ul, BUS_SPACE_MAXADDR,
 		    attr);
 		map->flags |= BUS_DMAMAP_DMAR_KMEM_ALLOC;
@@ -464,7 +474,7 @@ dmar_bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, 
 	map = (struct bus_dmamap_dmar *)map1;
 
 	if ((map->flags & BUS_DMAMAP_DMAR_MALLOC) != 0) {
-		free(vaddr, M_DEVBUF);
+		free_domain(vaddr, M_DEVBUF);
 		map->flags &= ~BUS_DMAMAP_DMAR_MALLOC;
 	} else {
 		KASSERT((map->flags & BUS_DMAMAP_DMAR_KMEM_ALLOC) != 0,
@@ -832,6 +842,7 @@ dmar_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t 
 struct bus_dma_impl bus_dma_dmar_impl = {
 	.tag_create = dmar_bus_dma_tag_create,
 	.tag_destroy = dmar_bus_dma_tag_destroy,
+	.tag_set_domain = dmar_bus_dma_tag_set_domain,
 	.map_create = dmar_bus_dmamap_create,
 	.map_destroy = dmar_bus_dmamap_destroy,
 	.mem_alloc = dmar_bus_dmamem_alloc,
@@ -842,7 +853,7 @@ struct bus_dma_impl bus_dma_dmar_impl = {
 	.map_waitok = dmar_bus_dmamap_waitok,
 	.map_complete = dmar_bus_dmamap_complete,
 	.map_unload = dmar_bus_dmamap_unload,
-	.map_sync = dmar_bus_dmamap_sync
+	.map_sync = dmar_bus_dmamap_sync,
 };
 
 static void

Modified: user/jeff/numa/sys/x86/x86/busdma_bounce.c
==============================================================================
--- user/jeff/numa/sys/x86/x86/busdma_bounce.c	Wed Dec 20 04:03:42 2017	(r327015)
+++ user/jeff/numa/sys/x86/x86/busdma_bounce.c	Wed Dec 20 04:08:00 2017	(r327016)
@@ -99,6 +99,7 @@ struct bounce_zone {
 	int		total_bounced;
 	int		total_deferred;
 	int		map_count;
+	int		domain;
 	bus_size_t	alignment;
 	bus_addr_t	lowaddr;
 	char		zoneid[8];
@@ -150,6 +151,32 @@ static void _bus_dmamap_count_phys(bus_dma_tag_t dmat,
 static int _bus_dmamap_reserve_pages(bus_dma_tag_t dmat, bus_dmamap_t map,
 				     int flags);
 
+static int
+bounce_bus_dma_zone_setup(bus_dma_tag_t dmat)
+{
+	struct bounce_zone *bz;
+	int error;
+
+	/* Must bounce */
+	if ((error = alloc_bounce_zone(dmat)) != 0)
+		return (error);
+	bz = dmat->bounce_zone;
+
+	if (ptoa(bz->total_bpages) < dmat->common.maxsize) {
+		int pages;
+
+		pages = atop(dmat->common.maxsize) - bz->total_bpages;
+
+		/* Add pages to our bounce pool */
+		if (alloc_bounce_pages(dmat, pages) < pages)
+			return (ENOMEM);
+	}
+	/* Performed initial allocation */
+	dmat->bounce_flags |= BUS_DMA_MIN_ALLOC_COMP;
+
+	return (0);
+}
+
 /*
  * Allocate a device specific dma_tag.
  */
@@ -184,28 +211,9 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_si
 		newtag->bounce_flags |= BUS_DMA_COULD_BOUNCE;
 
 	if (((newtag->bounce_flags & BUS_DMA_COULD_BOUNCE) != 0) &&
-	    (flags & BUS_DMA_ALLOCNOW) != 0) {
-		struct bounce_zone *bz;
-
-		/* Must bounce */
-		if ((error = alloc_bounce_zone(newtag)) != 0) {
-			free(newtag, M_DEVBUF);
-			return (error);
-		}
-		bz = newtag->bounce_zone;
-
-		if (ptoa(bz->total_bpages) < maxsize) {
-			int pages;
-
-			pages = atop(maxsize) - bz->total_bpages;
-
-			/* Add pages to our bounce pool */
-			if (alloc_bounce_pages(newtag, pages) < pages)
-				error = ENOMEM;
-		}
-		/* Performed initial allocation */
-		newtag->bounce_flags |= BUS_DMA_MIN_ALLOC_COMP;
-	} else
+	    (flags & BUS_DMA_ALLOCNOW) != 0)
+		error = bounce_bus_dma_zone_setup(newtag);
+	else
 		error = 0;
 	
 	if (error != 0)
@@ -218,7 +226,24 @@ bounce_bus_dma_tag_create(bus_dma_tag_t parent, bus_si
 	return (error);
 }
 
+/*
+ * Update the domain for the tag.  We may need to reallocate the zone and
+ * bounce pages.
+ */ 
 static int
+bounce_bus_dma_tag_set_domain(bus_dma_tag_t dmat)
+{
+
+	KASSERT(dmat->map_count == 0,
+	    ("bounce_bus_dma_tag_set_domain:  Domain set after use.\n"));
+	if ((dmat->bounce_flags & BUS_DMA_COULD_BOUNCE) == 0 ||
+	    dmat->bounce_zone == NULL)
+		return (0);
+	dmat->bounce_flags &= ~BUS_DMA_MIN_ALLOC_COMP;
+	return (bounce_bus_dma_zone_setup(dmat));
+}
+
+static int
 bounce_bus_dma_tag_destroy(bus_dma_tag_t dmat)
 {
 	bus_dma_tag_t dmat_copy, parent;
@@ -237,7 +262,7 @@ bounce_bus_dma_tag_destroy(bus_dma_tag_t dmat)
 			atomic_subtract_int(&dmat->common.ref_count, 1);
 			if (dmat->common.ref_count == 0) {
 				if (dmat->segments != NULL)
-					free(dmat->segments, M_DEVBUF);
+					free_domain(dmat->segments, M_DEVBUF);
 				free(dmat, M_DEVBUF);
 				/*
 				 * Last reference count, so
@@ -269,9 +294,9 @@ bounce_bus_dmamap_create(bus_dma_tag_t dmat, int flags
 	error = 0;
 
 	if (dmat->segments == NULL) {
-		dmat->segments = (bus_dma_segment_t *)malloc(
+		dmat->segments = (bus_dma_segment_t *)malloc_domain(
 		    sizeof(bus_dma_segment_t) * dmat->common.nsegments,
-		    M_DEVBUF, M_NOWAIT);
+		    M_DEVBUF, dmat->common.domain, M_NOWAIT);
 		if (dmat->segments == NULL) {
 			CTR3(KTR_BUSDMA, "%s: tag %p error %d",
 			    __func__, dmat, ENOMEM);
@@ -292,8 +317,8 @@ bounce_bus_dmamap_create(bus_dma_tag_t dmat, int flags
 		}
 		bz = dmat->bounce_zone;
 
-		*mapp = (bus_dmamap_t)malloc(sizeof(**mapp), M_DEVBUF,
-		    M_NOWAIT | M_ZERO);
+		*mapp = (bus_dmamap_t)malloc_domain(sizeof(**mapp), M_DEVBUF,
+		    dmat->common.domain, M_NOWAIT | M_ZERO);
 		if (*mapp == NULL) {
 			CTR3(KTR_BUSDMA, "%s: tag %p error %d",
 			    __func__, dmat, ENOMEM);
@@ -355,7 +380,7 @@ bounce_bus_dmamap_destroy(bus_dma_tag_t dmat, bus_dmam
 		}
 		if (dmat->bounce_zone)
 			dmat->bounce_zone->map_count--;
-		free(map, M_DEVBUF);
+		free_domain(map, M_DEVBUF);
 	}
 	dmat->map_count--;
 	CTR2(KTR_BUSDMA, "%s: tag %p error 0", __func__, dmat);
@@ -386,9 +411,9 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vad
 	*mapp = NULL;
 
 	if (dmat->segments == NULL) {
-		dmat->segments = (bus_dma_segment_t *)malloc(
+		dmat->segments = (bus_dma_segment_t *)malloc_domain(
 		    sizeof(bus_dma_segment_t) * dmat->common.nsegments,
-		    M_DEVBUF, mflags);
+		    M_DEVBUF, dmat->common.domain, mflags);
 		if (dmat->segments == NULL) {
 			CTR4(KTR_BUSDMA, "%s: tag %p tag flags 0x%x error %d",
 			    __func__, dmat, dmat->common.flags, ENOMEM);
@@ -427,18 +452,19 @@ bounce_bus_dmamem_alloc(bus_dma_tag_t dmat, void** vad
 	   (dmat->common.alignment <= dmat->common.maxsize) &&
 	    dmat->common.lowaddr >= ptoa((vm_paddr_t)Maxmem) &&
 	    attr == VM_MEMATTR_DEFAULT) {
-		*vaddr = malloc(dmat->common.maxsize, M_DEVBUF, mflags);
+		*vaddr = malloc_domain(dmat->common.maxsize, M_DEVBUF,
+		    dmat->common.domain, mflags);
 	} else if (dmat->common.nsegments >=
 	    howmany(dmat->common.maxsize, MIN(dmat->common.maxsegsz, PAGE_SIZE)) &&
 	    dmat->common.alignment <= PAGE_SIZE &&
 	    (dmat->common.boundary % PAGE_SIZE) == 0) {
 		/* Page-based multi-segment allocations allowed */
-		*vaddr = (void *)kmem_alloc_attr(kernel_arena,
+		*vaddr = (void *)kmem_alloc_attr_domain(dmat->common.domain,
 		    dmat->common.maxsize, mflags, 0ul, dmat->common.lowaddr,
 		    attr);
 		dmat->bounce_flags |= BUS_DMA_KMEM_ALLOC;
 	} else {
-		*vaddr = (void *)kmem_alloc_contig(kernel_arena,
+		*vaddr = (void *)kmem_alloc_contig_domain(dmat->common.domain,
 		    dmat->common.maxsize, mflags, 0ul, dmat->common.lowaddr,
 		    dmat->common.alignment != 0 ? dmat->common.alignment : 1ul,
 		    dmat->common.boundary, attr);
@@ -471,7 +497,7 @@ bounce_bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr
 	if (map != NULL)
 		panic("bus_dmamem_free: Invalid map freed\n");
 	if ((dmat->bounce_flags & BUS_DMA_KMEM_ALLOC) == 0)
-		free(vaddr, M_DEVBUF);
+		free_domain(vaddr, M_DEVBUF);
 	else
 		kmem_free(kernel_arena, (vm_offset_t)vaddr,
 		    dmat->common.maxsize);
@@ -1041,7 +1067,8 @@ alloc_bounce_zone(bus_dma_tag_t dmat)
 	/* Check to see if we already have a suitable zone */
 	STAILQ_FOREACH(bz, &bounce_zone_list, links) {
 		if ((dmat->common.alignment <= bz->alignment) &&
-		    (dmat->common.lowaddr >= bz->lowaddr)) {
+		    (dmat->common.lowaddr >= bz->lowaddr) &&
+		    (dmat->common.domain == bz->domain)) {
 			dmat->bounce_zone = bz;
 			return (0);
 		}
@@ -1058,6 +1085,7 @@ alloc_bounce_zone(bus_dma_tag_t dmat)
 	bz->lowaddr = dmat->common.lowaddr;
 	bz->alignment = MAX(dmat->common.alignment, PAGE_SIZE);
 	bz->map_count = 0;
+	bz->domain = dmat->common.domain;
 	snprintf(bz->zoneid, 8, "zone%d", busdma_zonecount);
 	busdma_zonecount++;
 	snprintf(bz->lowaddrid, 18, "%#jx", (uintmax_t)bz->lowaddr);
@@ -1103,6 +1131,10 @@ alloc_bounce_zone(bus_dma_tag_t dmat)
 	SYSCTL_ADD_UAUTO(busdma_sysctl_tree(bz),
 	    SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO,
 	    "alignment", CTLFLAG_RD, &bz->alignment, "");
+	SYSCTL_ADD_INT(busdma_sysctl_tree(bz),
+	    SYSCTL_CHILDREN(busdma_sysctl_tree_top(bz)), OID_AUTO,
+	    "domain", CTLFLAG_RD, &bz->domain, 0,
+	    "memory domain");
 
 	return (0);
 }
@@ -1118,18 +1150,16 @@ alloc_bounce_pages(bus_dma_tag_t dmat, u_int numpages)
 	while (numpages > 0) {
 		struct bounce_page *bpage;
 
-		bpage = (struct bounce_page *)malloc(sizeof(*bpage), M_DEVBUF,
-						     M_NOWAIT | M_ZERO);
+		bpage = (struct bounce_page *)malloc_domain(sizeof(*bpage),
+		    M_DEVBUF, dmat->common.domain, M_NOWAIT | M_ZERO);
 
 		if (bpage == NULL)
 			break;
-		bpage->vaddr = (vm_offset_t)contigmalloc(PAGE_SIZE, M_DEVBUF,
-							 M_NOWAIT, 0ul,
-							 bz->lowaddr,
-							 PAGE_SIZE,
-							 0);
+		bpage->vaddr = (vm_offset_t)contigmalloc_domain(PAGE_SIZE,
+		    M_DEVBUF, dmat->common.domain, M_NOWAIT, 0ul,
+		    bz->lowaddr, PAGE_SIZE, 0);
 		if (bpage->vaddr == 0) {
-			free(bpage, M_DEVBUF);
+			free_domain(bpage, M_DEVBUF);
 			break;
 		}
 		bpage->busaddr = pmap_kextract(bpage->vaddr);
@@ -1271,6 +1301,7 @@ busdma_swi(void)
 struct bus_dma_impl bus_dma_bounce_impl = {
 	.tag_create = bounce_bus_dma_tag_create,
 	.tag_destroy = bounce_bus_dma_tag_destroy,
+	.tag_set_domain = bounce_bus_dma_tag_set_domain,
 	.map_create = bounce_bus_dmamap_create,
 	.map_destroy = bounce_bus_dmamap_destroy,
 	.mem_alloc = bounce_bus_dmamem_alloc,
@@ -1281,5 +1312,5 @@ struct bus_dma_impl bus_dma_bounce_impl = {
 	.map_waitok = bounce_bus_dmamap_waitok,
 	.map_complete = bounce_bus_dmamap_complete,
 	.map_unload = bounce_bus_dmamap_unload,
-	.map_sync = bounce_bus_dmamap_sync
+	.map_sync = bounce_bus_dmamap_sync,
 };

Modified: user/jeff/numa/sys/x86/x86/busdma_machdep.c
==============================================================================
--- user/jeff/numa/sys/x86/x86/busdma_machdep.c	Wed Dec 20 04:03:42 2017	(r327015)
+++ user/jeff/numa/sys/x86/x86/busdma_machdep.c	Wed Dec 20 04:08:00 2017	(r327016)
@@ -43,8 +43,12 @@ __FBSDID("$FreeBSD$");
 #include <sys/memdesc.h>
 #include <sys/mutex.h>
 #include <sys/uio.h>
+#include <sys/vmmeter.h>
 #include <vm/vm.h>
 #include <vm/vm_extern.h>
+#include <vm/vm_param.h>
+#include <vm/vm_page.h>
+#include <vm/vm_phys.h>
 #include <vm/pmap.h>
 #include <machine/bus.h>
 #include <x86/include/busdma_impl.h>
@@ -180,10 +184,27 @@ common_bus_dma_tag_create(struct bus_dma_tag_common *p
 			common->filterarg = parent->filterarg;
 			common->parent = parent->parent;
 		}
+		common->domain = parent->domain;
 		atomic_add_int(&parent->ref_count, 1);
 	}
+	common->domain = vm_phys_domain_match(common->domain, 0ul,
+	    common->lowaddr);
 	*dmat = common;
 	return (0);
+}
+
+int
+bus_dma_tag_set_domain(bus_dma_tag_t dmat, int domain)
+{
+	struct bus_dma_tag_common *tc;
+
+	tc = (struct bus_dma_tag_common *)dmat;
+	domain = vm_phys_domain_match(domain, 0ul, tc->lowaddr);
+	/* Only call the callback if it changes. */
+	if (domain == tc->domain)
+		return (0);
+	tc->domain = domain;
+	return (tc->impl->tag_set_domain(dmat));
 }
 
 /*

From owner-svn-src-user@freebsd.org  Sat Dec 23 13:10:37 2017
Return-Path: <owner-svn-src-user@freebsd.org>
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 7F7C3EA5646
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Sat, 23 Dec 2017 13:10:37 +0000 (UTC) (envelope-from pho@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 4CC8935E4;
 Sat, 23 Dec 2017 13:10:37 +0000 (UTC) (envelope-from pho@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id vBNDAaAV069362;
 Sat, 23 Dec 2017 13:10:36 GMT (envelope-from pho@FreeBSD.org)
Received: (from pho@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id vBNDAaVp069361;
 Sat, 23 Dec 2017 13:10:36 GMT (envelope-from pho@FreeBSD.org)
Message-Id: <201712231310.vBNDAaVp069361@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: pho set sender to pho@FreeBSD.org
 using -f
From: Peter Holm <pho@FreeBSD.org>
Date: Sat, 23 Dec 2017 13:10:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r327105 - user/pho/stress2/misc
X-SVN-Group: user
X-SVN-Commit-Author: pho
X-SVN-Commit-Paths: user/pho/stress2/misc
X-SVN-Commit-Revision: 327105
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 &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 23 Dec 2017 13:10:37 -0000

Author: pho
Date: Sat Dec 23 13:10:36 2017
New Revision: 327105
URL: https://svnweb.freebsd.org/changeset/base/327105

Log:
  kldunload was never executed. Fix this.
  
  Sponsored by:	Dell EMC Isilon

Modified:
  user/pho/stress2/misc/crossmp7.sh

Modified: user/pho/stress2/misc/crossmp7.sh
==============================================================================
--- user/pho/stress2/misc/crossmp7.sh	Sat Dec 23 12:44:24 2017	(r327104)
+++ user/pho/stress2/misc/crossmp7.sh	Sat Dec 23 13:10:36 2017	(r327105)
@@ -75,6 +75,7 @@ if [ $# -eq 0 ]; then
 	wait
 
 	zpool destroy stress2_tank
+	[ -n "$loaded" ] && kldunload zfs.ko
 	mdconfig -d -u $u1
 	mdconfig -d -u $u2
 	mdconfig -d -u $u3
@@ -94,4 +95,3 @@ else
 		rm -f /tmp/crossmp7.continue
 	fi
 fi
-[ -n "$loaded" ] && kldunload zfs.ko