CVS commit: src/sys/net

2018-12-26 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Dec 27 07:56:12 UTC 2018

Modified Files:
src/sys/net: if_l2tp.c

Log Message:
l2tp(4): fix output bytes counter. Pointed by k-goda@IIJ, thanks.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/net/if_l2tp.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_l2tp.c
diff -u src/sys/net/if_l2tp.c:1.32 src/sys/net/if_l2tp.c:1.33
--- src/sys/net/if_l2tp.c:1.32	Sat Dec 22 14:28:56 2018
+++ src/sys/net/if_l2tp.c	Thu Dec 27 07:56:11 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_l2tp.c,v 1.32 2018/12/22 14:28:56 maxv Exp $	*/
+/*	$NetBSD: if_l2tp.c,v 1.33 2018/12/27 07:56:11 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.32 2018/12/22 14:28:56 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_l2tp.c,v 1.33 2018/12/27 07:56:11 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -426,9 +426,12 @@ l2tpintr(struct l2tp_variant *var)
 	}
 
 	for (;;) {
+		int len;
+
 		IFQ_DEQUEUE(>if_snd, m);
 		if (m == NULL)
 			break;
+		len = m->m_pkthdr.len;
 		m->m_flags &= ~(M_BCAST|M_MCAST);
 		bpf_mtap(ifp, m, BPF_D_OUT);
 		switch (var->lv_psrc->sa_family) {
@@ -452,13 +455,9 @@ l2tpintr(struct l2tp_variant *var)
 			ifp->if_oerrors++;
 		else {
 			ifp->if_opackets++;
-			/*
-			 * obytes is incremented at ether_output() or
-			 * bridge_enqueue().
-			 */
+			ifp->if_obytes += len;
 		}
 	}
-
 }
 
 void
@@ -570,6 +569,7 @@ int
 l2tp_transmit(struct ifnet *ifp, struct mbuf *m)
 {
 	int error;
+	int len;
 	struct psref psref;
 	struct l2tp_variant *var;
 	struct l2tp_softc *sc = container_of(ifp, struct l2tp_softc,
@@ -587,6 +587,7 @@ l2tp_transmit(struct ifnet *ifp, struct 
 		goto out;
 	}
 
+	len = m->m_pkthdr.len;
 	m->m_flags &= ~(M_BCAST|M_MCAST);
 	bpf_mtap(ifp, m, BPF_D_OUT);
 	switch (var->lv_psrc->sa_family) {
@@ -610,9 +611,7 @@ l2tp_transmit(struct ifnet *ifp, struct 
 		ifp->if_oerrors++;
 	else {
 		ifp->if_opackets++;
-		/*
-		 * obytes is incremented at ether_output() or bridge_enqueue().
-		 */
+		ifp->if_obytes += len;
 	}
 
 out:



CVS commit: src

2018-12-26 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Thu Dec 27 07:22:31 UTC 2018

Modified Files:
src/lib/libnvmm: libnvmm.3 libnvmm.c libnvmm_x86.c nvmm.h
src/tests/lib/libnvmm: h_mem_assist.c h_mem_assist_asm.S

Log Message:
Several improvements and fixes:

 * Change the Assist API. Rather than passing callbacks in each call, the
   callbacks are now registered beforehand. Then change the I/O Assist to
   fetch MMIO data via the Mem callback. This allows a guest to perform an
   I/O string operation on a memory that is itself an MMIO.

 * Introduce two new functions internal to libnvmm, read_guest_memory and
   write_guest_memory. They can handle mapped memory, MMIO memory and
   cross-page transactions.

 * Allow nvmm_gva_to_gpa and nvmm_gpa_to_hva to take non-page-aligned
   addresses. This simplifies a lot of things.

 * Support the MOVS instruction, and add a test for it. This instruction
   is special, in that it takes two implicit memory operands. In
   particular, it means that the two buffers can both be in MMIO memory,
   and we handle this case.

 * Fix gross copy-pasto in nvmm_hva_unmap. Also fix a few things here and
   there.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/lib/libnvmm/libnvmm.3 src/lib/libnvmm/libnvmm.c \
src/lib/libnvmm/libnvmm_x86.c
cvs rdiff -u -r1.3 -r1.4 src/lib/libnvmm/nvmm.h
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libnvmm/h_mem_assist.c \
src/tests/lib/libnvmm/h_mem_assist_asm.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libnvmm/libnvmm.3
diff -u src/lib/libnvmm/libnvmm.3:1.5 src/lib/libnvmm/libnvmm.3:1.6
--- src/lib/libnvmm/libnvmm.3:1.5	Sat Dec 15 13:39:43 2018
+++ src/lib/libnvmm/libnvmm.3	Thu Dec 27 07:22:31 2018
@@ -1,4 +1,4 @@
-.\"	$NetBSD: libnvmm.3,v 1.5 2018/12/15 13:39:43 maxv Exp $
+.\"	$NetBSD: libnvmm.3,v 1.6 2018/12/27 07:22:31 maxv Exp $
 .\"
 .\" Copyright (c) 2018 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 14, 2018
+.Dd December 26, 2018
 .Dt LIBNVMM 3
 .Os
 .Sh NAME
@@ -78,12 +78,14 @@
 .Ft int
 .Fn nvmm_gpa_to_hva "struct nvmm_machine *mach" "gpaddr_t gpa" \
 "uintptr_t *hva"
+.Ft void
+.Fn nvmm_callbacks_register "const struct nvmm_callbacks *cbs"
 .Ft int
 .Fn nvmm_assist_io "struct nvmm_machine *mach" "nvmm_cpuid_t cpuid" \
-"struct nvmm_exit *exit" "void (*cb)(struct nvmm_io *)"
+"struct nvmm_exit *exit"
 .Ft int
 .Fn nvmm_assist_mem "struct nvmm_machine *mach" "nvmm_cpuid_t cpuid" \
-"struct nvmm_exit *exit" "void (*cb)(struct nvmm_mem *)"
+"struct nvmm_exit *exit"
 .Sh DESCRIPTION
 .Nm
 provides a library for VMM software to handle hardware-accelerated virtual
@@ -228,6 +230,11 @@ into a host virtual address returned in
 .Fa gpa
 must be page-aligned.
 .Pp
+.Fn nvmm_callbacks_register
+registers in
+.Nm
+the callbacks descriptor passed as argument.
+.Pp
 .Fn nvmm_assist_io
 emulates the I/O operation described in
 .Fa exit
@@ -397,8 +404,8 @@ it is necessary for VMM software to emul
 provides an easy way for VMM software to perform that.
 .Pp
 .Fn nvmm_assist_io
-will call the
-.Fa cb
+will call the registered
+.Fa io
 callback function and give it a
 .Cd nvmm_io
 structure as argument.
@@ -444,8 +451,8 @@ provides an easy way for VMM software to
 Assist.
 .Pp
 .Fn nvmm_assist_mem
-will call the
-.Fa cb
+will call the registered
+.Fa mem
 callback function and give it a
 .Cd nvmm_mem
 structure as argument.
Index: src/lib/libnvmm/libnvmm.c
diff -u src/lib/libnvmm/libnvmm.c:1.5 src/lib/libnvmm/libnvmm.c:1.6
--- src/lib/libnvmm/libnvmm.c:1.5	Sat Dec 15 13:39:43 2018
+++ src/lib/libnvmm/libnvmm.c	Thu Dec 27 07:22:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: libnvmm.c,v 1.5 2018/12/15 13:39:43 maxv Exp $	*/
+/*	$NetBSD: libnvmm.c,v 1.6 2018/12/27 07:22:31 maxv Exp $	*/
 
 /*
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -43,6 +43,8 @@
 
 #include "nvmm.h"
 
+struct nvmm_callbacks __callbacks;
+
 typedef struct __area {
 	LIST_ENTRY(__area) list;
 	gpaddr_t gpa;
@@ -53,7 +55,6 @@ typedef struct __area {
 typedef LIST_HEAD(, __area) area_list_t;
 
 static int nvmm_fd = -1;
-static size_t nvmm_page_size = 0;
 
 /* -- */
 
@@ -146,7 +147,6 @@ nvmm_init(void)
 	nvmm_fd = open("/dev/nvmm", O_RDWR);
 	if (nvmm_fd == -1)
 		return -1;
-	nvmm_page_size = sysconf(_SC_PAGESIZE);
 	return 0;
 }
 
@@ -454,7 +454,7 @@ nvmm_hva_map(struct nvmm_machine *mach, 
 int
 nvmm_hva_unmap(struct nvmm_machine *mach, uintptr_t hva, size_t size)
 {
-	struct nvmm_ioc_hva_map args;
+	struct nvmm_ioc_hva_unmap args;
 	int ret;
 
 	if (nvmm_init() == -1) {
@@ -465,7 +465,7 @@ nvmm_hva_unmap(struct nvmm_machine *mach
 	args.hva = hva;
 	args.size = size;
 
-	ret = ioctl(nvmm_fd, 

CVS commit: src/doc

2018-12-26 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Thu Dec 27 04:54:03 UTC 2018

Modified Files:
src/doc: CHANGES

Log Message:
Note change to systat
Include missing periods


To generate a diff of this commit:
cvs rdiff -u -r1.2472 -r1.2473 src/doc/CHANGES

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2472 src/doc/CHANGES:1.2473
--- src/doc/CHANGES:1.2472	Mon Dec 24 16:59:40 2018
+++ src/doc/CHANGES	Thu Dec 27 04:54:03 2018
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2472 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2473 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -269,5 +269,7 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	sqlite3: Import 3.26.0. [christos 20181219]
 	network: Add SIOCSETHERCAP ioctl. [msaitoh 20181221]
 	byacc: Update to 20180609. [christos 20181223]
-	flex(1): Import flex-2.6.4 [christos 20181223]
-	threadpool(9): Added threadpool(9) API [thorpej 20181224]
+	flex(1): Import flex-2.6.4. [christos 20181223]
+	threadpool(9): Added threadpool(9) API. [thorpej 20181224]
+	systat(1): Extend vmstat display for better insight about bufcache.
+		[sevan 20181226]



CVS commit: src/sys/kern

2018-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Thu Dec 27 04:45:29 UTC 2018

Modified Files:
src/sys/kern: kern_threadpool.c

Log Message:
Restore curlwp->l_name in threadpool_job_done(), rather than after the
job function has returned.  This lays the groundwork for some job object
reference counting change that will be coming in a subsequent comment.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/kern/kern_threadpool.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_threadpool.c
diff -u src/sys/kern/kern_threadpool.c:1.11 src/sys/kern/kern_threadpool.c:1.12
--- src/sys/kern/kern_threadpool.c:1.11	Wed Dec 26 22:16:26 2018
+++ src/sys/kern/kern_threadpool.c	Thu Dec 27 04:45:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_threadpool.c,v 1.11 2018/12/26 22:16:26 thorpej Exp $	*/
+/*	$NetBSD: kern_threadpool.c,v 1.12 2018/12/27 04:45:29 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2018 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.11 2018/12/26 22:16:26 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.12 2018/12/27 04:45:29 thorpej Exp $");
 
 #include 
 #include 
@@ -107,6 +107,7 @@ TAILQ_HEAD(thread_head, threadpool_threa
 
 struct threadpool_thread {
 	struct lwp			*tpt_lwp;
+	char*tpt_lwp_savedname;
 	struct threadpool		*tpt_pool;
 	struct threadpool_job		*tpt_job;
 	kcondvar_t			tpt_cv;
@@ -693,6 +694,15 @@ threadpool_job_done(struct threadpool_jo
 	KASSERT(job->job_thread != NULL);
 	KASSERT(job->job_thread->tpt_lwp == curlwp);
 
+	/*
+	 * We can safely read this field; it's only modified right before
+	 * we call the job work function, and we are only preserving it
+	 * to use here; no one cares if it contains junk afterward.
+	 */
+	lwp_lock(curlwp);
+	curlwp->l_name = job->job_thread->tpt_lwp_savedname;
+	lwp_unlock(curlwp);
+
 	cv_broadcast(>job_cv);
 	job->job_thread = NULL;
 }
@@ -977,24 +987,25 @@ threadpool_thread(void *arg)
 
 		struct threadpool_job *const job = thread->tpt_job;
 		KASSERT(job != NULL);
-		mutex_spin_exit(>tp_lock);
-
-		TP_LOG(("%s: running job '%s' on thread %p.\n",
-		__func__, job->job_name, thread));
 
 		/* Set our lwp name to reflect what job we're doing.  */
 		lwp_lock(curlwp);
-		char *const lwp_name = curlwp->l_name;
+		char *const lwp_name __diagused = curlwp->l_name;
+		thread->tpt_lwp_savedname = curlwp->l_name;
 		curlwp->l_name = job->job_name;
 		lwp_unlock(curlwp);
 
+		mutex_spin_exit(>tp_lock);
+
+		TP_LOG(("%s: running job '%s' on thread %p.\n",
+		__func__, job->job_name, thread));
+
 		/* Run the job.  */
 		(*job->job_fn)(job);
 
-		/* Restore our lwp name.  */
-		lwp_lock(curlwp);
-		curlwp->l_name = lwp_name;
-		lwp_unlock(curlwp);
+		/* lwp name restored in threadpool_job_done(). */
+		KASSERTMSG((curlwp->l_name == lwp_name),
+		"someone forgot to call threadpool_job_done()!");
 
 		/* Job is done and its name is unreferenced.  Release it.  */
 		threadpool_job_rele(job);



CVS commit: src/sys/dev/ic

2018-12-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Thu Dec 27 02:54:00 UTC 2018

Modified Files:
src/sys/dev/ic: spdmem.c spdmemvar.h

Log Message:
 Print rank on DDR4.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/ic/spdmem.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/spdmemvar.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.29 src/sys/dev/ic/spdmem.c:1.30
--- src/sys/dev/ic/spdmem.c:1.29	Wed Dec 26 10:24:20 2018
+++ src/sys/dev/ic/spdmem.c	Thu Dec 27 02:54:00 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.29 2018/12/26 10:24:20 msaitoh Exp $ */
+/* $NetBSD: spdmem.c,v 1.30 2018/12/27 02:54:00 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.29 2018/12/26 10:24:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.30 2018/12/27 02:54:00 msaitoh Exp $");
 
 #include 
 #include 
@@ -869,7 +869,7 @@ decode_fbdimm(const struct sysctlnode *n
 static void
 decode_ddr4(const struct sysctlnode *node, device_t self, struct spdmem *s)
 {
-	int dimm_size, cycle_time;
+	int dimm_size, cycle_time, ranks;
 	int tAA_clocks, tRCD_clocks,tRP_clocks, tRAS_clocks;
 
 	aprint_naive("\n");
@@ -937,14 +937,17 @@ decode_ddr4(const struct sysctlnode *nod
 			  1 << (s->sm_ddr4.ddr4_primary_bus_width + 3),
 			  TRUE, "PC4", 0);
 
+	ranks = s->sm_ddr4.ddr4_package_ranks + 1;
 	aprint_verbose_dev(self,
-	"%d rows, %d cols, %d banks/group, %d bank groups, "
-	"%d.%03dns cycle time\n",
+	"%d rows, %d cols, %d ranks%s, %d banks/group, %d bank groups\n",
 	s->sm_ddr4.ddr4_rows + 12, s->sm_ddr4.ddr4_cols + 9,
+	ranks, (ranks > 1) ? ((s->sm_ddr4.ddr4_rank_mix == 1)
+		? " (asymmetric)" : " (symmetiric)") : "",
 	1 << (2 + s->sm_ddr4.ddr4_logbanks),
-	1 << s->sm_ddr4.ddr4_bankgroups,
-	cycle_time / 1000, cycle_time % 1000);
+	1 << s->sm_ddr4.ddr4_bankgroups);
 
+	aprint_verbose_dev(self, "%d.%03dns cycle time\n",
+	cycle_time / 1000, cycle_time % 1000);
 
 	tAA_clocks =  __DDR4_VALUE(tAAmin)  * 1000 / cycle_time;
 	tRCD_clocks = __DDR4_VALUE(tRCDmin) * 1000 / cycle_time;

Index: src/sys/dev/ic/spdmemvar.h
diff -u src/sys/dev/ic/spdmemvar.h:1.13 src/sys/dev/ic/spdmemvar.h:1.14
--- src/sys/dev/ic/spdmemvar.h:1.13	Wed Jan 18 06:02:50 2017
+++ src/sys/dev/ic/spdmemvar.h	Thu Dec 27 02:54:00 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmemvar.h,v 1.13 2017/01/18 06:02:50 msaitoh Exp $ */
+/* $NetBSD: spdmemvar.h,v 1.14 2018/12/27 02:54:00 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Paul Goyette
@@ -768,7 +768,8 @@ struct spdmem_ddr4 {/* Dual Data Rat
 		uint8_t	ddr4_device_width:3,	\
 		/* number of package ranks is field value plus 1 */ \
 		uint8_t	ddr4_package_ranks:3,	\
-		uint8_t	ddr4_unused9:2,		\
+		uint8_t	ddr4_rank_mix:1,	\
+		uint8_t	ddr4_unused9:1		\
 	);
 	SPD_BITFIELD(	\
 		/* primary width is offset by 3, extension is offset by 2 */ \



CVS commit: src/share/mk

2018-12-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 26 22:57:22 UTC 2018

Modified Files:
src/share/mk: bsd.inc.mk bsd.kinc.mk

Log Message:
Remove extra -c. -c has been the default behavior since 2003, and
the comment why it is needed was introduced in 2001. We don't want
to duplicate -c which is set in ${COPY} because someone might want
to override that.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/share/mk/bsd.inc.mk
cvs rdiff -u -r1.36 -r1.37 src/share/mk/bsd.kinc.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/mk/bsd.inc.mk
diff -u src/share/mk/bsd.inc.mk:1.32 src/share/mk/bsd.inc.mk:1.33
--- src/share/mk/bsd.inc.mk:1.32	Thu Mar 16 13:43:34 2006
+++ src/share/mk/bsd.inc.mk	Wed Dec 26 17:57:22 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.inc.mk,v 1.32 2006/03/16 18:43:34 jwise Exp $
+#	$NetBSD: bsd.inc.mk,v 1.33 2018/12/26 22:57:22 christos Exp $
 
 .include 
 
@@ -12,13 +12,12 @@ INCSYMLINKS?=
 incinstall::	# ensure existence
 .PHONY:		incinstall
 
-# -c is forced on here, in order to preserve modtimes for "make depend"
 __incinstall: .USE
 	@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
 	(${_MKSHMSG_INSTALL} ${.TARGET}; \
-	 ${_MKSHECHO} "${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \
+	 ${_MKSHECHO} "${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} \
 		-m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \
-	 ${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \
+	 ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} \
 		-m ${NONBINMODE} ${.ALLSRC} ${.TARGET})
 
 .for F in ${INCS:O:u}

Index: src/share/mk/bsd.kinc.mk
diff -u src/share/mk/bsd.kinc.mk:1.36 src/share/mk/bsd.kinc.mk:1.37
--- src/share/mk/bsd.kinc.mk:1.36	Thu Mar 16 13:43:34 2006
+++ src/share/mk/bsd.kinc.mk	Wed Dec 26 17:57:22 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.kinc.mk,v 1.36 2006/03/16 18:43:34 jwise Exp $
+#	$NetBSD: bsd.kinc.mk,v 1.37 2018/12/26 22:57:22 christos Exp $
 
 # Variables:
 #
@@ -39,13 +39,12 @@ ${DESTDIR}${INCSDIR}: .EXEC
 			${.TARGET}; \
 	fi
 
-# -c is forced on here, in order to preserve modtimes for "make depend"
 __incinstall: .USE
 	@cmp -s ${.ALLSRC} ${.TARGET} > /dev/null 2>&1 || \
 	(${_MKSHMSG_INSTALL} ${.TARGET}; \
-	 ${_MKSHECHO} "${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \
+	 ${_MKSHECHO} "${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} \
 		-m ${NONBINMODE} ${.ALLSRC} ${.TARGET}" && \
-	 ${INSTALL_FILE} -c -o ${BINOWN} -g ${BINGRP} \
+	 ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} \
 		-m ${NONBINMODE} ${.ALLSRC} ${.TARGET})
 
 .for F in ${INCS:O:u} ${DEPINCS:O:u}



CVS commit: src/tests/kernel/threadpool_tester

2018-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 26 22:21:10 UTC 2018

Modified Files:
src/tests/kernel/threadpool_tester: threadpool_tester.c

Log Message:
Fix spurios whitespace (thank you substandard vi clones).


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/tests/kernel/threadpool_tester/threadpool_tester.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/kernel/threadpool_tester/threadpool_tester.c
diff -u src/tests/kernel/threadpool_tester/threadpool_tester.c:1.2 src/tests/kernel/threadpool_tester/threadpool_tester.c:1.3
--- src/tests/kernel/threadpool_tester/threadpool_tester.c:1.2	Wed Dec 26 18:54:19 2018
+++ src/tests/kernel/threadpool_tester/threadpool_tester.c	Wed Dec 26 22:21:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: threadpool_tester.c,v 1.2 2018/12/26 18:54:19 thorpej Exp $	*/
+/*	$NetBSD: threadpool_tester.c,v 1.3 2018/12/26 22:21:10 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: threadpool_tester.c,v 1.2 2018/12/26 18:54:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: threadpool_tester.c,v 1.3 2018/12/26 22:21:10 thorpej Exp $");
 
 #include 
 #include 
@@ -79,17 +79,17 @@ threadpool_tester_get_unbound(SYSCTLFN_A
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if (error || newp == NULL)
 		return error;
-	
+
 	if (! pri_is_valid(val))
 		return EINVAL;
-	
+
 	error = threadpool_get(, val);
 	if (error) {
 		TP_LOG(("%s: threadpool_get(..., %d) failed -> %d\n",
 		__func__, val, error));
 		return error;
 	}
-	
+
 	mutex_enter(>ctx_mutex);
 	if (ctx->ctx_unbound[pri_to_idx(val)] == NULL)
 		ctx->ctx_unbound[pri_to_idx(val)] = pool;
@@ -128,10 +128,10 @@ threadpool_tester_put_unbound(SYSCTLFN_A
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if (error || newp == NULL)
 		return error;
-	
+
 	if (! pri_is_valid(val))
 		return EINVAL;
-	
+
 	mutex_enter(>ctx_mutex);
 	/* We only ever maintain a single reference. */
 	pool = ctx->ctx_unbound[pri_to_idx(val)];
@@ -167,7 +167,7 @@ threadpool_tester_run_unbound(SYSCTLFN_A
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if (error || newp == NULL)
 		return error;
-	
+
 	if (! pri_is_valid(val))
 		return EINVAL;
 
@@ -204,17 +204,17 @@ threadpool_tester_get_percpu(SYSCTLFN_AR
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if (error || newp == NULL)
 		return error;
-	
+
 	if (! pri_is_valid(val))
 		return EINVAL;
-	
+
 	error = threadpool_percpu_get(, val);
 	if (error) {
 		TP_LOG(("%s: threadpool_percpu_get(..., %d) failed -> %d\n",
 		__func__, val, error));
 		return error;
 	}
-	
+
 	mutex_enter(>ctx_mutex);
 	if (ctx->ctx_percpu[pri_to_idx(val)] == NULL)
 		ctx->ctx_percpu[pri_to_idx(val)] = pcpu;
@@ -253,10 +253,10 @@ threadpool_tester_put_percpu(SYSCTLFN_AR
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if (error || newp == NULL)
 		return error;
-	
+
 	if (! pri_is_valid(val))
 		return EINVAL;
-	
+
 	mutex_enter(>ctx_mutex);
 	/* We only ever maintain a single reference. */
 	pcpu = ctx->ctx_percpu[pri_to_idx(val)];
@@ -293,7 +293,7 @@ threadpool_tester_run_percpu(SYSCTLFN_AR
 	error = sysctl_lookup(SYSCTLFN_CALL());
 	if (error || newp == NULL)
 		return error;
-	
+
 	if (! pri_is_valid(val))
 		return EINVAL;
 
@@ -475,7 +475,7 @@ threadpool_tester_fini(void)
 	mutex_destroy(_ctx.ctx_mutex);
 
 	sysctl_teardown(_ctx.ctx_sysctllog);
-	
+
 	return 0;
 }
 
@@ -488,11 +488,11 @@ threadpool_tester_modcmd(modcmd_t cmd, v
 	case MODULE_CMD_INIT:
 		error = threadpool_tester_init();
 		break;
-	
+
 	case MODULE_CMD_FINI:
 		error = threadpool_tester_fini();
 		break;
-	
+
 	case MODULE_CMD_STAT:
 	default:
 		error = ENOTTY;



CVS commit: src/sys

2018-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 26 22:16:27 UTC 2018

Modified Files:
src/sys/kern: init_main.c kern_threadpool.c
src/sys/rump/librump/rumpkern: rump.c
src/sys/sys: threadpool.h

Log Message:
Rather than performing lazy initialization, statically initialize early
in the respective kernel startup routines.


To generate a diff of this commit:
cvs rdiff -u -r1.500 -r1.501 src/sys/kern/init_main.c
cvs rdiff -u -r1.10 -r1.11 src/sys/kern/kern_threadpool.c
cvs rdiff -u -r1.331 -r1.332 src/sys/rump/librump/rumpkern/rump.c
cvs rdiff -u -r1.5 -r1.6 src/sys/sys/threadpool.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/init_main.c
diff -u src/sys/kern/init_main.c:1.500 src/sys/kern/init_main.c:1.501
--- src/sys/kern/init_main.c:1.500	Tue Oct 30 19:40:35 2018
+++ src/sys/kern/init_main.c	Wed Dec 26 22:16:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_main.c,v 1.500 2018/10/30 19:40:35 kre Exp $	*/
+/*	$NetBSD: init_main.c,v 1.501 2018/12/26 22:16:26 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.500 2018/10/30 19:40:35 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: init_main.c,v 1.501 2018/12/26 22:16:26 thorpej Exp $");
 
 #include "opt_ddb.h"
 #include "opt_inet.h"
@@ -178,6 +178,7 @@ extern void *_binary_splash_image_end;
 #include 
 #include 
 #include 
+#include 
 #ifdef IPSEC
 #include 
 #endif
@@ -405,6 +406,9 @@ main(void)
 	/* Disable preemption during boot. */
 	kpreempt_disable();
 
+	/* Initialize the threadpool system. */
+	threadpools_init();
+
 	/* Initialize the UID hash table. */
 	uid_init();
 

Index: src/sys/kern/kern_threadpool.c
diff -u src/sys/kern/kern_threadpool.c:1.10 src/sys/kern/kern_threadpool.c:1.11
--- src/sys/kern/kern_threadpool.c:1.10	Wed Dec 26 21:43:39 2018
+++ src/sys/kern/kern_threadpool.c	Wed Dec 26 22:16:26 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_threadpool.c,v 1.10 2018/12/26 21:43:39 thorpej Exp $	*/
+/*	$NetBSD: kern_threadpool.c,v 1.11 2018/12/26 22:16:26 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2018 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.10 2018/12/26 21:43:39 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.11 2018/12/26 22:16:26 thorpej Exp $");
 
 #include 
 #include 
@@ -100,15 +100,6 @@ __KERNEL_RCSID(0, "$NetBSD: kern_threadp
 #include 
 #include 
 
-static ONCE_DECL(threadpool_init_once)
-
-#define	THREADPOOL_INIT()	\
-do {\
-	int threadpool_init_error __diagused =			\
-	RUN_ONCE(_init_once, threadpools_init);	\
-	KASSERT(threadpool_init_error == 0);			\
-} while (/*CONSTCOND*/0)
-
 /* Data structures */
 
 TAILQ_HEAD(job_head, threadpool_job);
@@ -234,7 +225,7 @@ threadpool_remove_percpu(struct threadpo
 #define	TP_LOG(x)		/* nothing */
 #endif /* THREADPOOL_VERBOSE */
 
-static int
+void
 threadpools_init(void)
 {
 
@@ -245,11 +236,6 @@ threadpools_init(void)
 	LIST_INIT(_threadpools);
 	LIST_INIT(_threadpools);
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
-
-	TP_LOG(("%s: sizeof(threadpool_job) = %zu\n",
-	__func__, sizeof(struct threadpool_job)));
-
-	return 0;
 }
 
 /* Thread pool creation */
@@ -373,8 +359,6 @@ threadpool_get(struct threadpool **poolp
 	struct threadpool_unbound *tpu, *tmp = NULL;
 	int error;
 
-	THREADPOOL_INIT();
-
 	ASSERT_SLEEPABLE();
 
 	if (! threadpool_pri_is_valid(pri))
@@ -422,8 +406,6 @@ threadpool_put(struct threadpool *pool, 
 	struct threadpool_unbound *tpu =
 	container_of(pool, struct threadpool_unbound, tpu_pool);
 
-	THREADPOOL_INIT();
-
 	ASSERT_SLEEPABLE();
 
 	KASSERT(threadpool_pri_is_valid(pri));
@@ -454,8 +436,6 @@ threadpool_percpu_get(struct threadpool_
 	struct threadpool_percpu *pool_percpu, *tmp = NULL;
 	int error;
 
-	THREADPOOL_INIT();
-
 	ASSERT_SLEEPABLE();
 
 	if (! threadpool_pri_is_valid(pri))
@@ -497,8 +477,6 @@ void
 threadpool_percpu_put(struct threadpool_percpu *pool_percpu, pri_t pri)
 {
 
-	THREADPOOL_INIT();
-
 	ASSERT_SLEEPABLE();
 
 	KASSERT(threadpool_pri_is_valid(pri));

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.331 src/sys/rump/librump/rumpkern/rump.c:1.332
--- src/sys/rump/librump/rumpkern/rump.c:1.331	Tue Jan  9 04:55:43 2018
+++ src/sys/rump/librump/rumpkern/rump.c	Wed Dec 26 22:16:27 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.331 2018/01/09 04:55:43 msaitoh Exp $	*/
+/*	$NetBSD: rump.c,v 1.332 2018/12/26 22:16:27 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.331 2018/01/09 04:55:43 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.332 2018/12/26 22:16:27 thorpej Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -65,6 +65,7 @@ 

CVS commit: src/share/man/man9

2018-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 26 21:48:55 UTC 2018

Modified Files:
src/share/man/man9: threadpool.9

Log Message:
Document the threadpool_job_fn_t type and its use.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/share/man/man9/threadpool.9

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man9/threadpool.9
diff -u src/share/man/man9/threadpool.9:1.2 src/share/man/man9/threadpool.9:1.3
--- src/share/man/man9/threadpool.9:1.2	Wed Dec 26 18:54:19 2018
+++ src/share/man/man9/threadpool.9	Wed Dec 26 21:48:55 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: threadpool.9,v 1.2 2018/12/26 18:54:19 thorpej Exp $
+.\" $NetBSD: threadpool.9,v 1.3 2018/12/26 21:48:55 thorpej Exp $
 .\"
 .\" Copyright (c) 2014 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd December 24, 2018
+.Dd December 26, 2018
 .Dt THREADPOOL 9
 .Os
 .\"
@@ -38,6 +38,8 @@
 .Sh SYNOPSIS
 .In sys/threadpool.h
 .\
+.Vt typedef void threadpool_job_fn_t(struct threadpool_job *);
+.\
 .Ft int
 .Fn threadpool_get "struct threadpool **poolp" "pri_t pri"
 .\"
@@ -57,7 +59,7 @@
 .Fn threadpool_percpu_ref_remote "struct threadpool_percpu *pool" "struct cpu_info *ci"
 .\
 .Ft void
-.Fn threadpool_job_init "struct threadpool_job *job" "void (*fn)(struct threadpool_job *)" "kmutex_t *interlock"
+.Fn threadpool_job_init "struct threadpool_job *job" "threadpool_job_fn_t fn" "kmutex_t *interlock"
 .\"
 .Ft void
 .Fn threadpool_job_destroy "struct threadpool_job *job"



CVS commit: src/sys

2018-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 26 21:43:39 UTC 2018

Modified Files:
src/sys/kern: kern_threadpool.c
src/sys/sys: threadpool.h

Log Message:
Adjust the definition of threadpool_job_fn_t to reflect Taylor's original
intent.  (The original didn't compile, and I'm not a very good mind reader.)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/kern/kern_threadpool.c
cvs rdiff -u -r1.4 -r1.5 src/sys/sys/threadpool.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_threadpool.c
diff -u src/sys/kern/kern_threadpool.c:1.9 src/sys/kern/kern_threadpool.c:1.10
--- src/sys/kern/kern_threadpool.c:1.9	Wed Dec 26 21:25:51 2018
+++ src/sys/kern/kern_threadpool.c	Wed Dec 26 21:43:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_threadpool.c,v 1.9 2018/12/26 21:25:51 thorpej Exp $	*/
+/*	$NetBSD: kern_threadpool.c,v 1.10 2018/12/26 21:43:39 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2018 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.9 2018/12/26 21:25:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.10 2018/12/26 21:43:39 thorpej Exp $");
 
 #include 
 #include 
@@ -140,7 +140,7 @@ static void	threadpool_rele(struct threa
 static int	threadpool_percpu_create(struct threadpool_percpu **, pri_t);
 static void	threadpool_percpu_destroy(struct threadpool_percpu *);
 
-static void	threadpool_job_dead(struct threadpool_job *);
+static threadpool_job_fn_t threadpool_job_dead;
 
 static int	threadpool_job_hold(struct threadpool_job *);
 static void	threadpool_job_rele(struct threadpool_job *);

Index: src/sys/sys/threadpool.h
diff -u src/sys/sys/threadpool.h:1.4 src/sys/sys/threadpool.h:1.5
--- src/sys/sys/threadpool.h:1.4	Wed Dec 26 21:36:50 2018
+++ src/sys/sys/threadpool.h	Wed Dec 26 21:43:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: threadpool.h,v 1.4 2018/12/26 21:36:50 thorpej Exp $	*/
+/*	$NetBSD: threadpool.h,v 1.5 2018/12/26 21:43:39 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -46,7 +46,7 @@ struct threadpool_job;
 struct threadpool_percpu;
 struct threadpool_thread;
 
-typedef void (*threadpool_job_fn_t)(struct threadpool_job *);
+typedef void threadpool_job_fn_t(struct threadpool_job *);
 
 struct threadpool_job {
 	kmutex_t			*job_lock;
@@ -54,7 +54,7 @@ struct threadpool_job {
 	TAILQ_ENTRY(threadpool_job)	job_entry;
 	volatile unsigned int		job_refcnt;
 	kcondvar_t			job_cv;
-	threadpool_job_fn_t		job_fn;
+	threadpool_job_fn_t		*job_fn;
 	charjob_name[MAXCOMLEN];
 };
 



CVS commit: src/sys/sys

2018-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 26 21:36:50 UTC 2018

Modified Files:
src/sys/sys: threadpool.h

Log Message:
Fix one de-_t'ficiation I missed.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/sys/threadpool.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/sys/threadpool.h
diff -u src/sys/sys/threadpool.h:1.3 src/sys/sys/threadpool.h:1.4
--- src/sys/sys/threadpool.h:1.3	Wed Dec 26 18:54:19 2018
+++ src/sys/sys/threadpool.h	Wed Dec 26 21:36:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: threadpool.h,v 1.3 2018/12/26 18:54:19 thorpej Exp $	*/
+/*	$NetBSD: threadpool.h,v 1.4 2018/12/26 21:36:50 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -48,7 +48,7 @@ struct threadpool_thread;
 
 typedef void (*threadpool_job_fn_t)(struct threadpool_job *);
 
-typedef struct threadpool_job {
+struct threadpool_job {
 	kmutex_t			*job_lock;
 	struct threadpool_thread	*job_thread;
 	TAILQ_ENTRY(threadpool_job)	job_entry;
@@ -56,7 +56,7 @@ typedef struct threadpool_job {
 	kcondvar_t			job_cv;
 	threadpool_job_fn_t		job_fn;
 	charjob_name[MAXCOMLEN];
-} threadpool_job_t;
+};
 
 int	threadpool_get(struct threadpool **, pri_t);
 void	threadpool_put(struct threadpool *, pri_t);



CVS commit: src/sys/kern

2018-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 26 21:25:52 UTC 2018

Modified Files:
src/sys/kern: kern_threadpool.c

Log Message:
Whitespace tweaks.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/kern/kern_threadpool.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_threadpool.c
diff -u src/sys/kern/kern_threadpool.c:1.8 src/sys/kern/kern_threadpool.c:1.9
--- src/sys/kern/kern_threadpool.c:1.8	Wed Dec 26 21:18:51 2018
+++ src/sys/kern/kern_threadpool.c	Wed Dec 26 21:25:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_threadpool.c,v 1.8 2018/12/26 21:18:51 thorpej Exp $	*/
+/*	$NetBSD: kern_threadpool.c,v 1.9 2018/12/26 21:25:51 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2018 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.8 2018/12/26 21:18:51 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.9 2018/12/26 21:25:51 thorpej Exp $");
 
 #include 
 #include 
@@ -385,7 +385,7 @@ threadpool_get(struct threadpool **poolp
 	if (tpu == NULL) {
 		mutex_exit(_lock);
 		TP_LOG(("%s: No pool for pri=%d, creating one.\n",
-			__func__, (int)pri));
+		__func__, (int)pri));
 		tmp = kmem_zalloc(sizeof(*tmp), KM_SLEEP);
 		error = threadpool_create(>tpu_pool, NULL, pri);
 		if (error) {
@@ -396,7 +396,7 @@ threadpool_get(struct threadpool **poolp
 		tpu = threadpool_lookup_unbound(pri);
 		if (tpu == NULL) {
 			TP_LOG(("%s: Won the creation race for pri=%d.\n",
-__func__, (int)pri));
+			__func__, (int)pri));
 			tpu = tmp;
 			tmp = NULL;
 			threadpool_insert_unbound(tpu);
@@ -433,7 +433,7 @@ threadpool_put(struct threadpool *pool, 
 	KASSERT(0 < tpu->tpu_refcnt);
 	if (--tpu->tpu_refcnt == 0) {
 		TP_LOG(("%s: Last reference for pri=%d, destroying pool.\n",
-			__func__, (int)pri));
+		__func__, (int)pri));
 		threadpool_remove_unbound(tpu);
 	} else {
 		tpu = NULL;
@@ -466,7 +466,7 @@ threadpool_percpu_get(struct threadpool_
 	if (pool_percpu == NULL) {
 		mutex_exit(_lock);
 		TP_LOG(("%s: No pool for pri=%d, creating one.\n",
-			__func__, (int)pri));
+		__func__, (int)pri));
 		error = threadpool_percpu_create(, pri);
 		if (error)
 			return error;
@@ -475,7 +475,7 @@ threadpool_percpu_get(struct threadpool_
 		pool_percpu = threadpool_lookup_percpu(pri);
 		if (pool_percpu == NULL) {
 			TP_LOG(("%s: Won the creation race for pri=%d.\n",
-__func__, (int)pri));
+			__func__, (int)pri));
 			pool_percpu = tmp;
 			tmp = NULL;
 			threadpool_insert_percpu(pool_percpu);
@@ -508,7 +508,7 @@ threadpool_percpu_put(struct threadpool_
 	KASSERT(0 < pool_percpu->tpp_refcnt);
 	if (--pool_percpu->tpp_refcnt == 0) {
 		TP_LOG(("%s: Last reference for pri=%d, destroying pool.\n",
-			__func__, (int)pri));
+		__func__, (int)pri));
 		threadpool_remove_percpu(pool_percpu);
 	} else {
 		pool_percpu = NULL;
@@ -675,13 +675,14 @@ static int
 threadpool_job_hold(struct threadpool_job *job)
 {
 	unsigned int refcnt;
+
 	do {
 		refcnt = job->job_refcnt;
 		if (refcnt == UINT_MAX)
 			return EBUSY;
 	} while (atomic_cas_uint(>job_refcnt, refcnt, (refcnt + 1))
 	!= refcnt);
-	
+
 	return 0;
 }
 
@@ -732,7 +733,7 @@ threadpool_schedule_job(struct threadpoo
 	 */
 	if (__predict_true(job->job_thread != NULL)) {
 		TP_LOG(("%s: job '%s' already runnining.\n",
-			__func__, job->job_name));
+		__func__, job->job_name));
 		return;
 	}
 
@@ -741,14 +742,14 @@ threadpool_schedule_job(struct threadpoo
 	if (__predict_false(TAILQ_EMPTY(>tp_idle_threads))) {
 		/* Nobody's idle.  Give it to the overseer.  */
 		TP_LOG(("%s: giving job '%s' to overseer.\n",
-			__func__, job->job_name));
+		__func__, job->job_name));
 		job->job_thread = >tp_overseer;
 		TAILQ_INSERT_TAIL(>tp_jobs, job, job_entry);
 	} else {
 		/* Assign it to the first idle thread.  */
 		job->job_thread = TAILQ_FIRST(>tp_idle_threads);
 		TP_LOG(("%s: giving job '%s' to idle thread %p.\n",
-			__func__, job->job_name, job->job_thread));
+		__func__, job->job_name, job->job_thread));
 		TAILQ_REMOVE(>tp_idle_threads, job->job_thread,
 		tpt_entry);
 		threadpool_job_hold(job);
@@ -845,7 +846,7 @@ threadpool_overseer_thread(void *arg)
 		while (TAILQ_EMPTY(>tp_jobs)) {
 			if (ISSET(pool->tp_flags, THREADPOOL_DYING)) {
 TP_LOG(("%s: THREADPOOL_DYING\n",
-	__func__));
+__func__));
 break;
 			}
 			cv_wait(>tpt_cv, >tp_lock);
@@ -856,7 +857,7 @@ threadpool_overseer_thread(void *arg)
 		/* If there are no threads, we'll have to try to start one.  */
 		if (TAILQ_EMPTY(>tp_idle_threads)) {
 			TP_LOG(("%s: Got a job, need to create a thread.\n",
-__func__));
+			__func__));
 			threadpool_hold(pool);
 			mutex_spin_exit(>tp_lock);
 
@@ -922,7 +923,7 @@ threadpool_overseer_thread(void *arg)
  * first.  We'll have to try again.
  */
 TP_LOG(("%s: 

CVS commit: src/sys/kern

2018-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 26 21:18:51 UTC 2018

Modified Files:
src/sys/kern: kern_threadpool.c

Log Message:
Stylistic tweak to previous.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/kern/kern_threadpool.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_threadpool.c
diff -u src/sys/kern/kern_threadpool.c:1.7 src/sys/kern/kern_threadpool.c:1.8
--- src/sys/kern/kern_threadpool.c:1.7	Wed Dec 26 21:15:50 2018
+++ src/sys/kern/kern_threadpool.c	Wed Dec 26 21:18:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_threadpool.c,v 1.7 2018/12/26 21:15:50 thorpej Exp $	*/
+/*	$NetBSD: kern_threadpool.c,v 1.8 2018/12/26 21:18:51 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2018 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.7 2018/12/26 21:15:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.8 2018/12/26 21:18:51 thorpej Exp $");
 
 #include 
 #include 
@@ -361,8 +361,7 @@ threadpool_rele(struct threadpool *pool)
 
 	KASSERT(mutex_owned(>tp_lock));
 	KASSERT(0 < pool->tp_refcnt);
-	pool->tp_refcnt--;
-	if (pool->tp_refcnt == 0)
+	if (--pool->tp_refcnt == 0)
 		cv_broadcast(>tp_overseer.tpt_cv);
 }
 



CVS commit: src/sys/kern

2018-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 26 21:15:50 UTC 2018

Modified Files:
src/sys/kern: kern_threadpool.c

Log Message:
Simplify thread reference counting of the thread pool object.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/kern/kern_threadpool.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_threadpool.c
diff -u src/sys/kern/kern_threadpool.c:1.6 src/sys/kern/kern_threadpool.c:1.7
--- src/sys/kern/kern_threadpool.c:1.6	Wed Dec 26 20:30:36 2018
+++ src/sys/kern/kern_threadpool.c	Wed Dec 26 21:15:50 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_threadpool.c,v 1.6 2018/12/26 20:30:36 thorpej Exp $	*/
+/*	$NetBSD: kern_threadpool.c,v 1.7 2018/12/26 21:15:50 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2018 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.6 2018/12/26 20:30:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.7 2018/12/26 21:15:50 thorpej Exp $");
 
 #include 
 #include 
@@ -127,14 +127,14 @@ struct threadpool {
 	struct threadpool_thread	tp_overseer;
 	struct job_head			tp_jobs;
 	struct thread_head		tp_idle_threads;
-	unsigned int			tp_refcnt;
+	uint64_t			tp_refcnt;
 	inttp_flags;
 #define	THREADPOOL_DYING	0x01
 	struct cpu_info			*tp_cpu;
 	pri_ttp_pri;
 };
 
-static int	threadpool_hold(struct threadpool *);
+static void	threadpool_hold(struct threadpool *);
 static void	threadpool_rele(struct threadpool *);
 
 static int	threadpool_percpu_create(struct threadpool_percpu **, pri_t);
@@ -274,13 +274,11 @@ threadpool_create(struct threadpool *con
 	/* XXX overseer */
 	TAILQ_INIT(>tp_jobs);
 	TAILQ_INIT(>tp_idle_threads);
-	pool->tp_refcnt = 0;
+	pool->tp_refcnt = 1;		/* overseer's reference */
 	pool->tp_flags = 0;
 	pool->tp_cpu = ci;
 	pool->tp_pri = pri;
 
-	error = threadpool_hold(pool);
-	KASSERT(error == 0);
 	pool->tp_overseer.tpt_lwp = NULL;
 	pool->tp_overseer.tpt_pool = pool;
 	pool->tp_overseer.tpt_job = NULL;
@@ -348,40 +346,24 @@ threadpool_destroy(struct threadpool *po
 	mutex_destroy(>tp_lock);
 }
 
-static int
+static void
 threadpool_hold(struct threadpool *pool)
 {
-	unsigned int refcnt;
-
-	do {
-		refcnt = pool->tp_refcnt;
-		if (refcnt == UINT_MAX)
-			return EBUSY;
-	} while (atomic_cas_uint(>tp_refcnt, refcnt, (refcnt + 1))
-	!= refcnt);
 
-	return 0;
+	KASSERT(mutex_owned(>tp_lock));
+	pool->tp_refcnt++;
+	KASSERT(pool->tp_refcnt != 0);
 }
 
 static void
 threadpool_rele(struct threadpool *pool)
 {
-	unsigned int refcnt;
 
-	do {
-		refcnt = pool->tp_refcnt;
-		KASSERT(0 < refcnt);
-		if (refcnt == 1) {
-			mutex_spin_enter(>tp_lock);
-			refcnt = atomic_dec_uint_nv(>tp_refcnt);
-			KASSERT(refcnt != UINT_MAX);
-			if (refcnt == 0)
-cv_broadcast(>tp_overseer.tpt_cv);
-			mutex_spin_exit(>tp_lock);
-			return;
-		}
-	} while (atomic_cas_uint(>tp_refcnt, refcnt, (refcnt - 1))
-	!= refcnt);
+	KASSERT(mutex_owned(>tp_lock));
+	KASSERT(0 < pool->tp_refcnt);
+	pool->tp_refcnt--;
+	if (pool->tp_refcnt == 0)
+		cv_broadcast(>tp_overseer.tpt_cv);
 }
 
 /* Unbound thread pools */
@@ -876,12 +858,7 @@ threadpool_overseer_thread(void *arg)
 		if (TAILQ_EMPTY(>tp_idle_threads)) {
 			TP_LOG(("%s: Got a job, need to create a thread.\n",
 __func__));
-			error = threadpool_hold(pool);
-			if (error) {
-(void)kpause("thrdplrf", false, hz,
->tp_lock);
-continue;
-			}
+			threadpool_hold(pool);
 			mutex_spin_exit(>tp_lock);
 
 			struct threadpool_thread *const thread =
@@ -910,6 +887,10 @@ threadpool_overseer_thread(void *arg)
 >tp_lock);
 continue;
 			}
+			/*
+			 * New kthread now owns the reference to the pool
+			 * taken above.
+			 */
 			KASSERT(lwp != NULL);
 			TAILQ_INSERT_TAIL(>tp_idle_threads, thread,
 			tpt_entry);
@@ -972,11 +953,11 @@ threadpool_overseer_thread(void *arg)
 
 		mutex_spin_enter(>tp_lock);
 	}
+	threadpool_rele(pool);
 	mutex_spin_exit(>tp_lock);
 
 	TP_LOG(("%s: exiting.\n", __func__));
 
-	threadpool_rele(pool);
 	kthread_exit(0);
 }
 
@@ -1045,6 +1026,7 @@ threadpool_thread(void *arg)
 		thread->tpt_job = NULL;
 		TAILQ_INSERT_TAIL(>tp_idle_threads, thread, tpt_entry);
 	}
+	threadpool_rele(pool);
 	mutex_spin_exit(>tp_lock);
 
 	TP_LOG(("%s: thread %p exiting.\n", __func__, thread));
@@ -1052,6 +1034,5 @@ threadpool_thread(void *arg)
 	KASSERT(!cv_has_waiters(>tpt_cv));
 	cv_destroy(>tpt_cv);
 	pool_cache_put(threadpool_thread_pc, thread);
-	threadpool_rele(pool);
 	kthread_exit(0);
 }



CVS commit: src/sys/kern

2018-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 26 20:30:36 UTC 2018

Modified Files:
src/sys/kern: kern_threadpool.c

Log Message:
Make the callers of threadpool_create() and threadpool_destroy()
responsibile for managing their own storage.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/kern/kern_threadpool.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_threadpool.c
diff -u src/sys/kern/kern_threadpool.c:1.5 src/sys/kern/kern_threadpool.c:1.6
--- src/sys/kern/kern_threadpool.c:1.5	Wed Dec 26 20:08:22 2018
+++ src/sys/kern/kern_threadpool.c	Wed Dec 26 20:30:36 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_threadpool.c,v 1.5 2018/12/26 20:08:22 thorpej Exp $	*/
+/*	$NetBSD: kern_threadpool.c,v 1.6 2018/12/26 20:30:36 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2018 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.5 2018/12/26 20:08:22 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.6 2018/12/26 20:30:36 thorpej Exp $");
 
 #include 
 #include 
@@ -156,7 +156,6 @@ static kmutex_t		threadpools_lock __cach
 #define	THREADPOOL_IDLE_TICKS	mstohz(30 * 1000)
 
 struct threadpool_unbound {
-	/* must be first; see threadpool_create() */
 	struct threadpool		tpu_pool;
 
 	/* protected by threadpools_lock */
@@ -262,10 +261,9 @@ threadpool_pri_is_valid(pri_t pri)
 }
 
 static int
-threadpool_create(struct threadpool **poolp, struct cpu_info *ci, pri_t pri,
-size_t size)
+threadpool_create(struct threadpool *const pool, struct cpu_info *ci,
+pri_t pri)
 {
-	struct threadpool *const pool = kmem_zalloc(size, KM_SLEEP);
 	struct lwp *lwp;
 	int ktflags;
 	int error;
@@ -303,7 +301,6 @@ threadpool_create(struct threadpool **po
 	cv_broadcast(>tp_overseer.tpt_cv);
 	mutex_spin_exit(>tp_lock);
 
-	*poolp = pool;
 	return 0;
 
 fail0:	KASSERT(error);
@@ -316,14 +313,13 @@ fail0:	KASSERT(error);
 	KASSERT(!cv_has_waiters(>tp_overseer.tpt_cv));
 	cv_destroy(>tp_overseer.tpt_cv);
 	mutex_destroy(>tp_lock);
-	kmem_free(pool, size);
 	return error;
 }
 
 /* Thread pool destruction */
 
 static void
-threadpool_destroy(struct threadpool *pool, size_t size)
+threadpool_destroy(struct threadpool *pool)
 {
 	struct threadpool_thread *thread;
 
@@ -350,7 +346,6 @@ threadpool_destroy(struct threadpool *po
 	KASSERT(!cv_has_waiters(>tp_overseer.tpt_cv));
 	cv_destroy(>tp_overseer.tpt_cv);
 	mutex_destroy(>tp_lock);
-	kmem_free(pool, size);
 }
 
 static int
@@ -407,16 +402,15 @@ threadpool_get(struct threadpool **poolp
 	mutex_enter(_lock);
 	tpu = threadpool_lookup_unbound(pri);
 	if (tpu == NULL) {
-		struct threadpool *new_pool;
 		mutex_exit(_lock);
 		TP_LOG(("%s: No pool for pri=%d, creating one.\n",
 			__func__, (int)pri));
-		error = threadpool_create(_pool, NULL, pri, sizeof(*tpu));
-		if (error)
+		tmp = kmem_zalloc(sizeof(*tmp), KM_SLEEP);
+		error = threadpool_create(>tpu_pool, NULL, pri);
+		if (error) {
+			kmem_free(tmp, sizeof(*tmp));
 			return error;
-		KASSERT(new_pool != NULL);
-		tmp = container_of(new_pool, struct threadpool_unbound,
-		tpu_pool);
+		}
 		mutex_enter(_lock);
 		tpu = threadpool_lookup_unbound(pri);
 		if (tpu == NULL) {
@@ -432,8 +426,10 @@ threadpool_get(struct threadpool **poolp
 	KASSERT(tpu->tpu_refcnt != 0);
 	mutex_exit(_lock);
 
-	if (tmp != NULL)
-		threadpool_destroy((struct threadpool *)tmp, sizeof(*tpu));
+	if (tmp != NULL) {
+		threadpool_destroy(>tpu_pool);
+		kmem_free(tmp, sizeof(*tmp));
+	}
 	KASSERT(tpu != NULL);
 	*poolp = >tpu_pool;
 	return 0;
@@ -463,8 +459,10 @@ threadpool_put(struct threadpool *pool, 
 	}
 	mutex_exit(_lock);
 
-	if (tpu)
-		threadpool_destroy(pool, sizeof(*tpu));
+	if (tpu) {
+		threadpool_destroy(>tpu_pool);
+		kmem_free(tpu, sizeof(*tpu));
+	}
 }
 
 /* Per-CPU thread pools */
@@ -591,9 +589,12 @@ threadpool_percpu_create(struct threadpo
 	for (i = 0, CPU_INFO_FOREACH(cii, ci), i++) {
 		struct threadpool *pool;
 
-		error = threadpool_create(, ci, pri, sizeof(*pool));
-		if (error)
+		pool = kmem_zalloc(sizeof(*pool), KM_SLEEP);
+		error = threadpool_create(pool, ci, pri);
+		if (error) {
+			kmem_free(pool, sizeof(*pool));
 			goto fail2;
+		}
 		percpu_traverse_enter();
 		struct threadpool **const poolp =
 		percpu_getptr_remote(pool_percpu->tpp_percpu, ci);
@@ -613,7 +614,8 @@ fail2:	for (j = 0, CPU_INFO_FOREACH(cii,
 		percpu_getptr_remote(pool_percpu->tpp_percpu, ci);
 		struct threadpool *const pool = *poolp;
 		percpu_traverse_exit();
-		threadpool_destroy(pool, sizeof(*pool));
+		threadpool_destroy(pool);
+		kmem_free(pool, sizeof(*pool));
 	}
 	percpu_free(pool_percpu->tpp_percpu, sizeof(struct taskthread_pool *));
 fail1:	kmem_free(pool_percpu, sizeof(*pool_percpu));
@@ -632,7 +634,8 @@ threadpool_percpu_destroy(struct threadp
 		percpu_getptr_remote(pool_percpu->tpp_percpu, ci);
 		

CVS commit: src/sys/kern

2018-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 26 20:08:22 UTC 2018

Modified Files:
src/sys/kern: kern_threadpool.c

Log Message:
Use uint64_t for the unbound and per-cpu thread pool ref counts; they're
always manipulated under a lock.  Rather than bother returning EBUSY,
just assert that the ref count never overlows (if it ever does, you have
bigger problems).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/kern/kern_threadpool.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/kern_threadpool.c
diff -u src/sys/kern/kern_threadpool.c:1.4 src/sys/kern/kern_threadpool.c:1.5
--- src/sys/kern/kern_threadpool.c:1.4	Wed Dec 26 18:54:19 2018
+++ src/sys/kern/kern_threadpool.c	Wed Dec 26 20:08:22 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_threadpool.c,v 1.4 2018/12/26 18:54:19 thorpej Exp $	*/
+/*	$NetBSD: kern_threadpool.c,v 1.5 2018/12/26 20:08:22 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2018 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.4 2018/12/26 18:54:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_threadpool.c,v 1.5 2018/12/26 20:08:22 thorpej Exp $");
 
 #include 
 #include 
@@ -161,7 +161,7 @@ struct threadpool_unbound {
 
 	/* protected by threadpools_lock */
 	LIST_ENTRY(threadpool_unbound)	tpu_link;
-	unsigned int			tpu_refcnt;
+	uint64_t			tpu_refcnt;
 };
 
 static LIST_HEAD(, threadpool_unbound) unbound_threadpools;
@@ -198,7 +198,7 @@ struct threadpool_percpu {
 
 	/* protected by threadpools_lock */
 	LIST_ENTRY(threadpool_percpu)	tpp_link;
-	unsigned int			tpp_refcnt;
+	uint64_t			tpp_refcnt;
 };
 
 static LIST_HEAD(, threadpool_percpu) percpu_threadpools;
@@ -428,13 +428,8 @@ threadpool_get(struct threadpool **poolp
 		}
 	}
 	KASSERT(tpu != NULL);
-	if (tpu->tpu_refcnt == UINT_MAX) {
-		mutex_exit(_lock);
-		if (tmp != NULL)
-			threadpool_destroy(>tpu_pool, sizeof(*tpu));
-		return EBUSY;
-	}
 	tpu->tpu_refcnt++;
+	KASSERT(tpu->tpu_refcnt != 0);
 	mutex_exit(_lock);
 
 	if (tmp != NULL)
@@ -463,8 +458,9 @@ threadpool_put(struct threadpool *pool, 
 		TP_LOG(("%s: Last reference for pri=%d, destroying pool.\n",
 			__func__, (int)pri));
 		threadpool_remove_unbound(tpu);
-	} else
+	} else {
 		tpu = NULL;
+	}
 	mutex_exit(_lock);
 
 	if (tpu)
@@ -507,13 +503,8 @@ threadpool_percpu_get(struct threadpool_
 		}
 	}
 	KASSERT(pool_percpu != NULL);
-	if (pool_percpu->tpp_refcnt == UINT_MAX) {
-		mutex_exit(_lock);
-		if (tmp != NULL)
-			threadpool_percpu_destroy(tmp);
-		return EBUSY;
-	}
 	pool_percpu->tpp_refcnt++;
+	KASSERT(pool_percpu->tpp_refcnt != 0);
 	mutex_exit(_lock);
 
 	if (tmp != NULL)
@@ -540,8 +531,9 @@ threadpool_percpu_put(struct threadpool_
 		TP_LOG(("%s: Last reference for pri=%d, destroying pool.\n",
 			__func__, (int)pri));
 		threadpool_remove_percpu(pool_percpu);
-	} else
+	} else {
 		pool_percpu = NULL;
+	}
 	mutex_exit(_lock);
 
 	if (pool_percpu)



CVS commit: src/sys/arch/evbarm/conf

2018-12-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Dec 26 19:54:09 UTC 2018

Modified Files:
src/sys/arch/evbarm/conf: GENERIC.common

Log Message:
Add BUSDMA_COUNTERS


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/evbarm/conf/GENERIC.common

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC.common
diff -u src/sys/arch/evbarm/conf/GENERIC.common:1.31 src/sys/arch/evbarm/conf/GENERIC.common:1.32
--- src/sys/arch/evbarm/conf/GENERIC.common:1.31	Sat Nov 10 16:19:58 2018
+++ src/sys/arch/evbarm/conf/GENERIC.common	Wed Dec 26 19:54:09 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC.common,v 1.31 2018/11/10 16:19:58 martin Exp $
+#	$NetBSD: GENERIC.common,v 1.32 2018/12/26 19:54:09 skrll Exp $
 #
 #	GENERIC evbarm kernel config (template)
 #
@@ -15,6 +15,7 @@ options 	NTP		# NTP phase/frequency lock
 
 # CPU options
 options 	PMAPCOUNTERS
+options 	BUSDMA_COUNTERS
 
 # Architecture options
 



CVS commit: src

2018-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 26 18:54:20 UTC 2018

Modified Files:
src/share/man/man9: threadpool.9
src/sys/kern: kern_threadpool.c
src/sys/sys: threadpool.h
src/tests/kernel/threadpool_tester: threadpool_tester.c
src/tests/rump/kernspace: threadpool.c

Log Message:
- De-opaque'ify struct threadpool_job.
- De-_t'ify all of the structure types.

No functional chage, no ABI change (verified with old rump unit test
before and after new librump.so).

Per Taylor's request.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man9/threadpool.9
cvs rdiff -u -r1.3 -r1.4 src/sys/kern/kern_threadpool.c
cvs rdiff -u -r1.2 -r1.3 src/sys/sys/threadpool.h
cvs rdiff -u -r1.1 -r1.2 \
src/tests/kernel/threadpool_tester/threadpool_tester.c
cvs rdiff -u -r1.2 -r1.3 src/tests/rump/kernspace/threadpool.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/share/man/man9/threadpool.9
diff -u src/share/man/man9/threadpool.9:1.1 src/share/man/man9/threadpool.9:1.2
--- src/share/man/man9/threadpool.9:1.1	Mon Dec 24 16:58:54 2018
+++ src/share/man/man9/threadpool.9	Wed Dec 26 18:54:19 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: threadpool.9,v 1.1 2018/12/24 16:58:54 thorpej Exp $
+.\" $NetBSD: threadpool.9,v 1.2 2018/12/26 18:54:19 thorpej Exp $
 .\"
 .\" Copyright (c) 2014 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -39,40 +39,40 @@
 .In sys/threadpool.h
 .\
 .Ft int
-.Fn threadpool_get "threadpool_t **poolp" "pri_t pri"
+.Fn threadpool_get "struct threadpool **poolp" "pri_t pri"
 .\"
 .Ft void
-.Fn threadpool_put "threadpool_t *pool" "pri_t pri"
+.Fn threadpool_put "struct threadpool *pool" "pri_t pri"
 .\
 .Ft int
-.Fn threadpool_percpu_get "threadpool_percpu_t **pool_percpup" "pri_t pri"
+.Fn threadpool_percpu_get "struct threadpool_percpu **pool_percpup" "pri_t pri"
 .\"
 .Ft void
-.Fn threadpool_percpu_put "threadpool_percpu_t *pool_percpu" "pri_t pri"
+.Fn threadpool_percpu_put "struct threadpool_percpu *pool_percpu" "pri_t pri"
 .\"
-.Ft threadpool_t *
-.Fn threadpool_percpu_ref "threadpool_percpu_t *pool"
+.Ft struct threadpool *
+.Fn threadpool_percpu_ref "struct threadpool_percpu *pool"
 .\"
-.Ft threadpool_t *
-.Fn threadpool_percpu_ref_remote "threadpool_percpu_t *pool" "struct cpu_info *ci"
+.Ft struct threadpool *
+.Fn threadpool_percpu_ref_remote "struct threadpool_percpu *pool" "struct cpu_info *ci"
 .\
 .Ft void
-.Fn threadpool_job_init "threadpool_job_t *job" "void (*fn)(threadpool_job_t *)" "kmutex_t *interlock"
+.Fn threadpool_job_init "struct threadpool_job *job" "void (*fn)(struct threadpool_job *)" "kmutex_t *interlock"
 .\"
 .Ft void
-.Fn threadpool_job_destroy "threadpool_job_t *job"
+.Fn threadpool_job_destroy "struct threadpool_job *job"
 .\"
 .Ft void
-.Fn threadpool_job_done "threadpool_job_t *job"
+.Fn threadpool_job_done "struct threadpool_job *job"
 .\
 .Ft void
-.Fn threadpool_schedule_job "threadpool_t *pool" "threadpool_job_t *job"
+.Fn threadpool_schedule_job "struct threadpool *pool" "struct threadpool_job *job"
 .\"
 .Ft void
-.Fn threadpool_cancel_job "threadpool_t *pool" "threadpool_job_t *job"
+.Fn threadpool_cancel_job "struct threadpool *pool" "struct threadpool_job *job"
 .\"
 .Ft bool
-.Fn threadpool_cancel_job_async "threadpool_t *pool" "threadpool_job_t *job"
+.Fn threadpool_cancel_job_async "struct threadpool *pool" "struct threadpool_job *job"
 .\"""
 .Sh DESCRIPTION
 The
@@ -94,18 +94,18 @@ and
 .Fn threadpool_percpu_put .
 .Pp
 Job state is stored in the
-.Vt threadpool_job_t
-object.
+.Vt threadpool_job
+structure.
 Callers of the
 .Nm
 abstraction
 must allocate memory for
-.Vt threadpool_job_t
-objects, but should consider them opaque, and should not inspect or
+.Vt threadpool_job
+structures, but should consider them opaque, and should not inspect or
 copy them.
 Each job represented by a
-.Vt threadpool_job_t
-object will be run only once at a time, until the action associated
+.Vt threadpool_job
+structure will be run only once at a time, until the action associated
 with it calls
 .Fn threadpool_job_done .
 .Pp

Index: src/sys/kern/kern_threadpool.c
diff -u src/sys/kern/kern_threadpool.c:1.3 src/sys/kern/kern_threadpool.c:1.4
--- src/sys/kern/kern_threadpool.c:1.3	Tue Dec 25 05:44:13 2018
+++ src/sys/kern/kern_threadpool.c	Wed Dec 26 18:54:19 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_threadpool.c,v 1.3 2018/12/25 05:44:13 thorpej Exp $	*/
+/*	$NetBSD: kern_threadpool.c,v 1.4 2018/12/26 18:54:19 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2018 The NetBSD Foundation, Inc.
@@ -76,12 +76,12 @@
  * touching remote CPUs' memory when scheduling a job, but that still
  * 

CVS commit: src/external/bsd/ntp/dist/ntpdate

2018-12-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec 26 18:31:29 UTC 2018

Modified Files:
src/external/bsd/ntp/dist/ntpdate: ntpdate.c

Log Message:
PR/53813: Edgar Pettijohn: Print usage message if no servers are found.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/external/bsd/ntp/dist/ntpdate/ntpdate.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/ntp/dist/ntpdate/ntpdate.c
diff -u src/external/bsd/ntp/dist/ntpdate/ntpdate.c:1.12 src/external/bsd/ntp/dist/ntpdate/ntpdate.c:1.13
--- src/external/bsd/ntp/dist/ntpdate/ntpdate.c:1.12	Sat Sep 29 17:52:34 2018
+++ src/external/bsd/ntp/dist/ntpdate/ntpdate.c	Wed Dec 26 13:31:29 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntpdate.c,v 1.12 2018/09/29 21:52:34 christos Exp $	*/
+/*	$NetBSD: ntpdate.c,v 1.13 2018/12/26 18:31:29 christos Exp $	*/
 
 /*
  * ntpdate - set the time of day by polling one or more NTP servers
@@ -433,6 +433,7 @@ ntpdatemain (
 	}
 
 	if (errflg) {
+usage:
 		(void) fprintf(stderr,
 		"usage: %s [-46bBdqsuv] [-a key#] [-e delay] [-k file] [-p samples] [-o version#] [-t timeo] server ...\n",
 		progname);
@@ -509,7 +510,7 @@ ntpdatemain (
 
 	if (sys_numservers == 0) {
 		msyslog(LOG_ERR, "no servers can be used, exiting");
-		exit(1);
+		goto usage;
 	}
 
 	/*



CVS commit: src/tests/rump/rumpkern

2018-12-26 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Dec 26 14:27:23 UTC 2018

Modified Files:
src/tests/rump/rumpkern: Makefile

Log Message:
Add -lrump after -lkernspace, because kernspace.a references symbols
from librump and hooray for static linking semantics.

Fixes sun2 build issue reported by kre@.

(XXX WTF did this only start failing after the addition of t_threadpool?)


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/tests/rump/rumpkern/Makefile

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/rump/rumpkern/Makefile
diff -u src/tests/rump/rumpkern/Makefile:1.17 src/tests/rump/rumpkern/Makefile:1.18
--- src/tests/rump/rumpkern/Makefile:1.17	Mon Dec 24 21:42:05 2018
+++ src/tests/rump/rumpkern/Makefile	Wed Dec 26 14:27:23 2018
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.17 2018/12/24 21:42:05 thorpej Exp $
+# $NetBSD: Makefile,v 1.18 2018/12/26 14:27:23 thorpej Exp $
 
 .include 
 
@@ -26,7 +26,7 @@ LDADD.t_modlinkset+=	-lrumpfs_cd9660 ${A
 LDADD+=			${ADD_TO_LD}
 
 KERNSPACE != cd ${.CURDIR}/../kernspace && ${PRINTOBJDIR}
-LDADD+=	-L${KERNSPACE} -lkernspace
+LDADD+=	-L${KERNSPACE} -lkernspace -lrump
 
 WARNS=	4
 



CVS commit: [netbsd-8] src/doc

2018-12-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Dec 26 13:19:55 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.1

Log Message:
Ticket #1144


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.80 -r1.1.2.81 src/doc/CHANGES-8.1

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/doc/CHANGES-8.1
diff -u src/doc/CHANGES-8.1:1.1.2.80 src/doc/CHANGES-8.1:1.1.2.81
--- src/doc/CHANGES-8.1:1.1.2.80	Tue Dec 25 11:26:48 2018
+++ src/doc/CHANGES-8.1	Wed Dec 26 13:19:54 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.80 2018/12/25 11:26:48 martin Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.81 2018/12/26 13:19:54 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -2104,3 +2104,9 @@ sys/external/bsd/drm2/nouveau/nouveau_pc
 	Do not attach too new "turing" based nouveau cards.
 	[maya, ticket #1145]
 
+sys/external/bsd/ipf/netinet/fil.c		1.22
+
+	Fix missing braces.
+	[sevan, ticket #1144]
+
+



CVS commit: [netbsd-8] src/sys/external/bsd/ipf/netinet

2018-12-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Dec 26 13:18:53 UTC 2018

Modified Files:
src/sys/external/bsd/ipf/netinet [netbsd-8]: fil.c

Log Message:
Pull up the following, requested by sevan in ticket #1144:

sys/external/bsd/ipf/netinet/fil.c  1.22

accidently commited to HEAD by mrg with a very misleading log message and
a bunch of unrelated changes - but really:

fix missing braces around a block (detected by newer gcc's indentation
checks).


To generate a diff of this commit:
cvs rdiff -u -r1.20.4.1 -r1.20.4.2 src/sys/external/bsd/ipf/netinet/fil.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/external/bsd/ipf/netinet/fil.c
diff -u src/sys/external/bsd/ipf/netinet/fil.c:1.20.4.1 src/sys/external/bsd/ipf/netinet/fil.c:1.20.4.2
--- src/sys/external/bsd/ipf/netinet/fil.c:1.20.4.1	Sat Sep 23 17:28:41 2017
+++ src/sys/external/bsd/ipf/netinet/fil.c	Wed Dec 26 13:18:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fil.c,v 1.20.4.1 2017/09/23 17:28:41 snj Exp $	*/
+/*	$NetBSD: fil.c,v 1.20.4.2 2018/12/26 13:18:53 martin Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -138,7 +138,7 @@ extern struct timeout ipf_slowtimer_ch;
 #if !defined(lint)
 #if defined(__NetBSD__)
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.20.4.1 2017/09/23 17:28:41 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fil.c,v 1.20.4.2 2018/12/26 13:18:53 martin Exp $");
 #else
 static const char sccsid[] = "@(#)fil.c	1.36 6/5/96 (C) 1993-2000 Darren Reed";
 static const char rcsid[] = "@(#)Id: fil.c,v 1.1.1.2 2012/07/22 13:45:07 darrenr Exp $";
@@ -4893,13 +4893,14 @@ frrequest(ipf_main_softc_t *softc, int u
 			error = ipf_outobj(softc, data, fp, IPFOBJ_FRENTRY);
 
 			if (error == 0) {
-if ((f->fr_dsize != 0) && (uptr != NULL))
+if ((f->fr_dsize != 0) && (uptr != NULL)) {
 	error = COPYOUT(f->fr_data, uptr,
 			f->fr_dsize);
 	if (error != 0) {
 		IPFERROR(28);
 		error = EFAULT;
 	}
+}
 if (error == 0) {
 	f->fr_hits = 0;
 	f->fr_bytes = 0;



CVS commit: src/sys/arch

2018-12-26 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Dec 26 11:12:57 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: spl.S
src/sys/arch/i386/i386: spl.S
src/sys/arch/xen/x86: xen_intr.c

Log Message:
Xen can use the native splraise(9) functions.

There is no need for a slower C version.


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/amd64/amd64/spl.S
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/i386/i386/spl.S
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/xen/x86/xen_intr.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/amd64/amd64/spl.S
diff -u src/sys/arch/amd64/amd64/spl.S:1.37 src/sys/arch/amd64/amd64/spl.S:1.38
--- src/sys/arch/amd64/amd64/spl.S:1.37	Tue Dec 25 06:50:11 2018
+++ src/sys/arch/amd64/amd64/spl.S	Wed Dec 26 11:12:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.37 2018/12/25 06:50:11 cherry Exp $	*/
+/*	$NetBSD: spl.S,v 1.38 2018/12/26 11:12:57 cherry Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -78,6 +78,17 @@
 
 	.text
 
+/*
+ * int splraise(int s);
+ */
+ENTRY(splraise)
+	movl	CPUVAR(ILEVEL),%eax
+	cmpl	%edi,%eax
+	cmoval	%eax,%edi
+	movl	%edi,CPUVAR(ILEVEL)
+	ret
+END(splraise)
+
 #ifndef XEN
 /*
  * Xsoftintr()
@@ -202,17 +213,6 @@ IDTVEC(resume_preempt)
 IDTVEC_END(resume_preempt)
 
 /*
- * int splraise(int s);
- */
-ENTRY(splraise)
-	movl	CPUVAR(ILEVEL),%eax
-	cmpl	%edi,%eax
-	cmoval	%eax,%edi
-	movl	%edi,CPUVAR(ILEVEL)
-	ret
-END(splraise)
-
-/*
  * void spllower(int s);
  *
  * Must be the same size as cx8_spllower().  This must use

Index: src/sys/arch/i386/i386/spl.S
diff -u src/sys/arch/i386/i386/spl.S:1.45 src/sys/arch/i386/i386/spl.S:1.46
--- src/sys/arch/i386/i386/spl.S:1.45	Tue Dec 25 09:00:26 2018
+++ src/sys/arch/i386/i386/spl.S	Wed Dec 26 11:12:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: spl.S,v 1.45 2018/12/25 09:00:26 cherry Exp $	*/
+/*	$NetBSD: spl.S,v 1.46 2018/12/26 11:12:57 cherry Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.45 2018/12/25 09:00:26 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.46 2018/12/26 11:12:57 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_spldebug.h"
@@ -44,7 +44,6 @@ __KERNEL_RCSID(0, "$NetBSD: spl.S,v 1.45
 
 	.text
 
-#ifndef XEN
 /*
  * int splraise(int s);
  */
@@ -68,6 +67,8 @@ ENTRY(splraise)
 	ret
 END(splraise)
 
+#ifndef XEN
+
 /*
  * void spllower(int s);
  *

Index: src/sys/arch/xen/x86/xen_intr.c
diff -u src/sys/arch/xen/x86/xen_intr.c:1.12 src/sys/arch/xen/x86/xen_intr.c:1.13
--- src/sys/arch/xen/x86/xen_intr.c:1.12	Tue Dec 25 09:00:26 2018
+++ src/sys/arch/xen/x86/xen_intr.c	Wed Dec 26 11:12:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_intr.c,v 1.12 2018/12/25 09:00:26 cherry Exp $	*/
+/*	$NetBSD: xen_intr.c,v 1.13 2018/12/26 11:12:57 cherry Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.12 2018/12/25 09:00:26 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.13 2018/12/26 11:12:57 cherry Exp $");
 
 #include 
 #include 
@@ -72,22 +72,6 @@ u_long xen_read_psl(void);
 void xen_write_psl(u_long);
 
 /*
- * Add a mask to cpl, and return the old value of cpl.
- */
-int
-splraise(int nlevel)
-{
-	int olevel;
-	struct cpu_info *ci = curcpu();
-
-	olevel = ci->ci_ilevel;
-	if (nlevel > olevel)
-		ci->ci_ilevel = nlevel;
-	__insn_barrier();
-	return (olevel);
-}
-
-/*
  * Restore a value to cpl (unmasking interrupts).  If any unmasked
  * interrupts are pending, call Xspllower() to process them.
  */



CVS commit: src/sys/dev/ic

2018-12-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Dec 26 10:24:20 UTC 2018

Modified Files:
src/sys/dev/ic: spdmem.c

Log Message:
- Fix DDR4's rows and columns value.
- Print "banks/group" instead of "banks" because it's not the total bank
  number.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ic/spdmem.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/ic/spdmem.c
diff -u src/sys/dev/ic/spdmem.c:1.28 src/sys/dev/ic/spdmem.c:1.29
--- src/sys/dev/ic/spdmem.c:1.28	Tue Oct 24 08:02:06 2017
+++ src/sys/dev/ic/spdmem.c	Wed Dec 26 10:24:20 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: spdmem.c,v 1.28 2017/10/24 08:02:06 msaitoh Exp $ */
+/* $NetBSD: spdmem.c,v 1.29 2018/12/26 10:24:20 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2007 Nicolas Joly
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.28 2017/10/24 08:02:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: spdmem.c,v 1.29 2018/12/26 10:24:20 msaitoh Exp $");
 
 #include 
 #include 
@@ -938,9 +938,9 @@ decode_ddr4(const struct sysctlnode *nod
 			  TRUE, "PC4", 0);
 
 	aprint_verbose_dev(self,
-	"%d rows, %d cols, %d banks, %d bank groups, "
+	"%d rows, %d cols, %d banks/group, %d bank groups, "
 	"%d.%03dns cycle time\n",
-	s->sm_ddr4.ddr4_rows + 9, s->sm_ddr4.ddr4_cols + 12,
+	s->sm_ddr4.ddr4_rows + 12, s->sm_ddr4.ddr4_cols + 9,
 	1 << (2 + s->sm_ddr4.ddr4_logbanks),
 	1 << s->sm_ddr4.ddr4_bankgroups,
 	cycle_time / 1000, cycle_time % 1000);



CVS commit: src/tests/net/if_ipsec

2018-12-26 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Dec 26 08:59:41 UTC 2018

Modified Files:
src/tests/net/if_ipsec: t_ipsec_natt.sh

Log Message:
Add ATF for ipsecif(4) which connect to two peers in the same NAPT.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/net/if_ipsec/t_ipsec_natt.sh

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/tests/net/if_ipsec/t_ipsec_natt.sh
diff -u src/tests/net/if_ipsec/t_ipsec_natt.sh:1.1 src/tests/net/if_ipsec/t_ipsec_natt.sh:1.2
--- src/tests/net/if_ipsec/t_ipsec_natt.sh:1.1	Tue Dec 25 03:54:44 2018
+++ src/tests/net/if_ipsec/t_ipsec_natt.sh	Wed Dec 26 08:59:41 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: t_ipsec_natt.sh,v 1.1 2018/12/25 03:54:44 knakahara Exp $
+#	$NetBSD: t_ipsec_natt.sh,v 1.2 2018/12/26 08:59:41 knakahara Exp $
 #
 # Copyright (c) 2018 Internet Initiative Japan Inc.
 # All rights reserved.
@@ -25,7 +25,8 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-SOCK_LOCAL=unix://ipsec_natt_local
+SOCK_LOCAL_A=unix://ipsec_natt_local_a
+SOCK_LOCAL_B=unix://ipsec_natt_local_b
 SOCK_NAT=unix://ipsec_natt_nat
 SOCK_REMOTE=unix://ipsec_natt_remote
 BUS_LOCAL=./bus_ipsec_natt_local
@@ -37,10 +38,12 @@ HIJACKING_NPF="${HIJACKING},blanket=/dev
 setup_servers()
 {
 
-	rump_server_crypto_start $SOCK_LOCAL netipsec ipsec
+	rump_server_crypto_start $SOCK_LOCAL_A netipsec ipsec
+	rump_server_crypto_start $SOCK_LOCAL_B netipsec ipsec
 	rump_server_npf_start $SOCK_NAT
 	rump_server_crypto_start $SOCK_REMOTE netipsec ipsec
-	rump_server_add_iface $SOCK_LOCAL shmif0 $BUS_LOCAL
+	rump_server_add_iface $SOCK_LOCAL_A shmif0 $BUS_LOCAL
+	rump_server_add_iface $SOCK_LOCAL_B shmif0 $BUS_LOCAL
 	rump_server_add_iface $SOCK_NAT shmif0 $BUS_LOCAL
 	rump_server_add_iface $SOCK_NAT shmif1 $BUS_NAT
 	rump_server_add_iface $SOCK_REMOTE shmif0 $BUS_NAT
@@ -293,24 +296,33 @@ check_tcp_com_over_ipsecif()
 test_ipsecif_natt_transport()
 {
 	local algo=$1
-	local ip_local=192.168.0.2
+	local ip_local_a=192.168.0.2
+	local ip_local_b=192.168.0.3
 	local ip_nat_local=192.168.0.1
 	local ip_nat_remote=10.0.0.1
 	local ip_remote=10.0.0.2
 	local subnet_local=192.168.0.0
-	local ip_local_ipsecif=172.16.100.1
-	local ip_remote_ipsecif=172.16.10.1
+	local ip_local_ipsecif_a=172.16.100.1
+	local ip_local_ipsecif_b=172.16.110.1
+	local ip_remote_ipsecif_a=172.16.10.1
+	local ip_remote_ipsecif_b=172.16.11.1
 
 	local npffile=./npf.conf
 	local file_send=./file.send
 	local algo_args="$(generate_algo_args esp-udp $algo)"
-	local pid= port=
+	local pid= port_a=  port_b=
 
 	setup_servers
 
-	export RUMP_SERVER=$SOCK_LOCAL
+	export RUMP_SERVER=$SOCK_LOCAL_A
 	atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.dad_count=0
-	atf_check -s exit:0 rump.ifconfig shmif0 $ip_local/24
+	atf_check -s exit:0 rump.ifconfig shmif0 $ip_local_a/24
+	atf_check -s exit:0 -o ignore \
+	rump.route -n add default $ip_nat_local
+
+	export RUMP_SERVER=$SOCK_LOCAL_B
+	atf_check -s exit:0 rump.sysctl -q -w net.inet.ip.dad_count=0
+	atf_check -s exit:0 rump.ifconfig shmif0 $ip_local_b/24
 	atf_check -s exit:0 -o ignore \
 	rump.route -n add default $ip_nat_local
 
@@ -327,7 +339,8 @@ test_ipsecif_natt_transport()
 	rump.route -n add -net $subnet_local $ip_nat_remote
 
 	# There is no NAT/NAPT. ping should just work.
-	check_ping_packets $SOCK_LOCAL $BUS_NAT $ip_local $ip_remote
+	check_ping_packets $SOCK_LOCAL_A $BUS_NAT $ip_local_a $ip_remote
+	check_ping_packets $SOCK_LOCAL_B $BUS_NAT $ip_local_b $ip_remote
 
 	# Setup an NAPT with npf
 	build_npf_conf $npffile "$subnet_local/24"
@@ -338,29 +351,88 @@ test_ipsecif_natt_transport()
 	$DEBUG && ${HIJACKING},"blanket=/dev/npf" npfctl show
 
 	# There is an NAPT. ping works but source IP/port are translated
-	check_ping_packets $SOCK_LOCAL $BUS_NAT $ip_nat_remote $ip_remote
+	check_ping_packets $SOCK_LOCAL_A $BUS_NAT $ip_nat_remote $ip_remote
+	check_ping_packets $SOCK_LOCAL_B $BUS_NAT $ip_nat_remote $ip_remote
 
 	# Try TCP communications just in case
-	check_tcp_com_prepare $SOCK_REMOTE $SOCK_LOCAL $BUS_NAT \
+	check_tcp_com_prepare $SOCK_REMOTE $SOCK_LOCAL_A $BUS_NAT \
+			  $ip_remote $ip_nat_remote $ip_remote
+	check_tcp_com_prepare $SOCK_REMOTE $SOCK_LOCAL_B $BUS_NAT \
 			  $ip_remote $ip_nat_remote $ip_remote
 
 	# Launch a nc server as a terminator of NAT-T on outside the NAPT
 	start_natt_terminator $SOCK_REMOTE $ip_remote 4500
 	echo zzz > $file_send
 
+	 Test for primary ipsecif(4) NAT-T.
+
+	export RUMP_SERVER=$SOCK_LOCAL_A
+	# Send a UDP packet to the remote server at port 4500 from the local
+	# host of port 4500. This makes a mapping on the NAPT between them
+	atf_check -s exit:0 $HIJACKING \
+	nc -u -w 3 -p 4500 $ip_remote 4500 < $file_send
+	# Launch a nc server as a terminator of NAT-T on inside the NAPT,
+	# taking over port 4500 of the local host.
+	start_natt_terminator $SOCK_LOCAL_A $ip_local_a 4500
+

CVS commit: src/sys/netipsec

2018-12-26 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Dec 26 08:58:51 UTC 2018

Modified Files:
src/sys/netipsec: ipsec_output.c ipsecif.c key.c

Log Message:
ipsecif(4) supports multiple peers in the same NAPT.

E.g. ipsec0 connects between NetBSD_A and NetBSD_B, ipsec1 connects
NetBSD_A and NetBSD_C at the following figure.

+--+
   +| NetBSD_B |
 +--+   +--+   |+--+
 | NetBSD_A |--- ... ---| NAPT |---+
 +--+   +--+   |+--+
   +| NetBSD_C |
+--+

Add ATF later.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/netipsec/ipsec_output.c
cvs rdiff -u -r1.12 -r1.13 src/sys/netipsec/ipsecif.c
cvs rdiff -u -r1.259 -r1.260 src/sys/netipsec/key.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/netipsec/ipsec_output.c
diff -u src/sys/netipsec/ipsec_output.c:1.81 src/sys/netipsec/ipsec_output.c:1.82
--- src/sys/netipsec/ipsec_output.c:1.81	Thu Nov 22 04:48:34 2018
+++ src/sys/netipsec/ipsec_output.c	Wed Dec 26 08:58:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsec_output.c,v 1.81 2018/11/22 04:48:34 knakahara Exp $	*/
+/*	$NetBSD: ipsec_output.c,v 1.82 2018/12/26 08:58:51 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003 Sam Leffler, Errno Consulting
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.81 2018/11/22 04:48:34 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsec_output.c,v 1.82 2018/12/26 08:58:51 knakahara Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -289,6 +289,24 @@ static void
 ipsec_fill_saidx_bymbuf(struct secasindex *saidx, const struct mbuf *m,
 const int af)
 {
+	struct m_tag *mtag;
+	u_int16_t natt_src = IPSEC_PORT_ANY;
+	u_int16_t natt_dst = IPSEC_PORT_ANY;
+
+	/*
+	 * For NAT-T enabled ipsecif(4), set NAT-T port numbers
+	 * even if the saidx uses transport mode.
+	 *
+	 * See also ipsecif[46]_output().
+	 */
+	mtag = m_tag_find(m, PACKET_TAG_IPSEC_NAT_T_PORTS);
+	if (mtag) {
+		u_int16_t *natt_ports;
+
+		natt_ports = (u_int16_t *)(mtag + 1);
+		natt_src = natt_ports[1];
+		natt_dst = natt_ports[0];
+	}
 
 	if (af == AF_INET) {
 		struct sockaddr_in *sin;
@@ -298,14 +316,14 @@ ipsec_fill_saidx_bymbuf(struct secasinde
 			sin = >src.sin;
 			sin->sin_len = sizeof(*sin);
 			sin->sin_family = AF_INET;
-			sin->sin_port = IPSEC_PORT_ANY;
+			sin->sin_port = natt_src;
 			sin->sin_addr = ip->ip_src;
 		}
 		if (saidx->dst.sa.sa_len == 0) {
 			sin = >dst.sin;
 			sin->sin_len = sizeof(*sin);
 			sin->sin_family = AF_INET;
-			sin->sin_port = IPSEC_PORT_ANY;
+			sin->sin_port = natt_dst;
 			sin->sin_addr = ip->ip_dst;
 		}
 	} else {
@@ -316,7 +334,7 @@ ipsec_fill_saidx_bymbuf(struct secasinde
 			sin6 = (struct sockaddr_in6 *)>src;
 			sin6->sin6_len = sizeof(*sin6);
 			sin6->sin6_family = AF_INET6;
-			sin6->sin6_port = IPSEC_PORT_ANY;
+			sin6->sin6_port = natt_src;
 			sin6->sin6_addr = ip6->ip6_src;
 			if (IN6_IS_SCOPE_LINKLOCAL(>ip6_src)) {
 /* fix scope id for comparing SPD */
@@ -329,7 +347,7 @@ ipsec_fill_saidx_bymbuf(struct secasinde
 			sin6 = (struct sockaddr_in6 *)>dst;
 			sin6->sin6_len = sizeof(*sin6);
 			sin6->sin6_family = AF_INET6;
-			sin6->sin6_port = IPSEC_PORT_ANY;
+			sin6->sin6_port = natt_dst;
 			sin6->sin6_addr = ip6->ip6_dst;
 			if (IN6_IS_SCOPE_LINKLOCAL(>ip6_dst)) {
 /* fix scope id for comparing SPD */

Index: src/sys/netipsec/ipsecif.c
diff -u src/sys/netipsec/ipsecif.c:1.12 src/sys/netipsec/ipsecif.c:1.13
--- src/sys/netipsec/ipsecif.c:1.12	Fri Dec  7 09:11:04 2018
+++ src/sys/netipsec/ipsecif.c	Wed Dec 26 08:58:51 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ipsecif.c,v 1.12 2018/12/07 09:11:04 knakahara Exp $  */
+/*	$NetBSD: ipsecif.c,v 1.13 2018/12/26 08:58:51 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 1.12 2018/12/07 09:11:04 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 1.13 2018/12/26 08:58:51 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -71,6 +71,7 @@ __KERNEL_RCSID(0, "$NetBSD: ipsecif.c,v 
 
 #include 
 
+static int ipsecif_set_natt_ports(struct ipsec_variant *, struct mbuf *);
 static void ipsecif4_input(struct mbuf *, int, int, void *);
 static int ipsecif4_output(struct ipsec_variant *, int, struct mbuf *);
 static int ipsecif4_filter4(const struct ip *, struct ipsec_variant *,
@@ -102,6 +103,32 @@ static const struct encapsw ipsecif4_enc
 static const struct encapsw ipsecif6_encapsw;
 #endif
 
+static int
+ipsecif_set_natt_ports(struct ipsec_variant *var, struct mbuf *m)
+{
+
+	KASSERT(if_ipsec_heldref_variant(var));
+
+	if (var->iv_sport || var->iv_dport) {
+		struct m_tag *mtag;

CVS commit: src/sys

2018-12-26 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Dec 26 08:55:14 UTC 2018

Modified Files:
src/sys/net: if_ipsec.c
src/sys/netipsec: key.c

Log Message:
Remove unnecessary addresses in PF_KEY message.

MOBIKE Extensions for PF_KEY draft-schilcher-mobike-pfkey-extension-01.txt says

5.  SPD Update
// snip
   SADB_X_SPDADD:
// snip
  sadb_x_ipsecrequest_reqid:

 An ID for that SA can be passed to the kernel in the
 sadb_x_ipsecrequest_reqid field.

  If tunnel mode is specified, the sadb_x_ipsecrequest structure is
  followed by two sockaddr structures that define the tunnel
  endpoint addresses.  In the case that transport mode is used, no
  additional addresses are specified.

see: https://tools.ietf.org/html/draft-schilcher-mobike-pfkey-extension-01

ipsecif(4) uses transport mode, so it should not add addresses.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/net/if_ipsec.c
cvs rdiff -u -r1.258 -r1.259 src/sys/netipsec/key.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/net/if_ipsec.c
diff -u src/sys/net/if_ipsec.c:1.19 src/sys/net/if_ipsec.c:1.20
--- src/sys/net/if_ipsec.c:1.19	Fri Dec  7 05:09:39 2018
+++ src/sys/net/if_ipsec.c	Wed Dec 26 08:55:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ipsec.c,v 1.19 2018/12/07 05:09:39 knakahara Exp $  */
+/*	$NetBSD: if_ipsec.c,v 1.20 2018/12/26 08:55:14 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.19 2018/12/07 05:09:39 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.20 2018/12/26 08:55:14 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1595,14 +1595,7 @@ if_ipsec_add_sp0(struct sockaddr *src, i
 	padlen = PFKEY_UNUNIT64(xpl.sadb_x_policy_len) - sizeof(xpl);
 	if (policy == IPSEC_POLICY_IPSEC) {
 		if_ipsec_add_mbuf(m, , sizeof(xisr));
-		/*
-		 * secpolicy.req->saidx.{src, dst} must be set port number,
-		 * when it is used for NAT-T.
-		 */
-		if_ipsec_add_mbuf_addr_port(m, src, sport, false);
-		if_ipsec_add_mbuf_addr_port(m, dst, dport, false);
 		padlen -= PFKEY_ALIGN8(sizeof(xisr));
-		padlen -= PFKEY_ALIGN8(src->sa_len + dst->sa_len);
 	}
 	if_ipsec_add_pad(m, padlen);
 

Index: src/sys/netipsec/key.c
diff -u src/sys/netipsec/key.c:1.258 src/sys/netipsec/key.c:1.259
--- src/sys/netipsec/key.c:1.258	Sat Dec 22 14:28:57 2018
+++ src/sys/netipsec/key.c	Wed Dec 26 08:55:14 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: key.c,v 1.258 2018/12/22 14:28:57 maxv Exp $	*/
+/*	$NetBSD: key.c,v 1.259 2018/12/26 08:55:14 knakahara Exp $	*/
 /*	$FreeBSD: key.c,v 1.3.2.3 2004/02/14 22:23:23 bms Exp $	*/
 /*	$KAME: key.c,v 1.191 2001/06/27 10:46:49 sakane Exp $	*/
 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.258 2018/12/22 14:28:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: key.c,v 1.259 2018/12/26 08:55:14 knakahara Exp $");
 
 /*
  * This code is referred to RFC 2367
@@ -1972,6 +1972,20 @@ _key_msg2sp(const struct sadb_x_policy *
 		(*p_isr)->level = xisr->sadb_x_ipsecrequest_level;
 
 		/* set IP addresses if there */
+		/*
+		 * NOTE:
+		 * MOBIKE Extensions for PF_KEY draft says:
+		 * If tunnel mode is specified, the sadb_x_ipsecrequest
+		 * structure is followed by two sockaddr structures that
+		 * define the tunnel endpoint addresses.  In the case that
+		 * transport mode is used, no additional addresses are
+		 * specified.
+		 * see: https://tools.ietf.org/html/draft-schilcher-mobike-pfkey-extension-01
+		 *
+		 * And then, the IP addresses will be set by
+		 * ipsec_fill_saidx_bymbuf() from packet in transport mode.
+		 * This behavior is used by NAT-T enabled ipsecif(4).
+		 */
 		if (xisr->sadb_x_ipsecrequest_len > sizeof(*xisr)) {
 			const struct sockaddr *paddr;
 



CVS commit: src/sys/dev/pci

2018-12-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Dec 26 08:25:53 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.1345 -r1.1346 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1344 -r1.1345 src/sys/dev/pci/pcidevs_data.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1345 src/sys/dev/pci/pcidevs.h:1.1346
--- src/sys/dev/pci/pcidevs.h:1.1345	Mon Dec  3 18:24:18 2018
+++ src/sys/dev/pci/pcidevs.h	Wed Dec 26 08:25:52 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1345 2018/12/03 18:24:18 bouyer Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1346 2018/12/26 08:25:52 msaitoh Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1356 2018/12/03 18:23:02 bouyer Exp
+ *	NetBSD: pcidevs,v 1.1357 2018/12/26 08:25:20 msaitoh Exp
  */
 
 /*
@@ -4155,6 +4155,7 @@
 #define	PCI_PRODUCT_INTEL_XE55_QP_REG	0x2c40		/* Xeon 5500 QuickPath Generic Non-Core Register */
 #define	PCI_PRODUCT_INTEL_CORE_QP_REG_2	0x2c51		/* Core i7-800 and i5-700 QuickPath Generic Non-Core Register */
 #define	PCI_PRODUCT_INTEL_CORE_QP_REG_1	0x2c61		/* Core i5-600, i3-500 and Pentium 6000 QuickPath Generic Non-Core Register */
+#define	PCI_PRODUCT_INTEL_CORE_QP_REG_3	0x2c62		/* Core QuickPath Generic Non-Core Register */
 #define	PCI_PRODUCT_INTEL_XE56_QP_REG	0x2c70		/* Xeon 5600 QuickPath Generic Non-Core Register */
 #define	PCI_PRODUCT_INTEL_CORE_QP_SAD_2	0x2c81		/* Core i7-800 and i5-700 QuickPath Generic System Address Decoder */
 #define	PCI_PRODUCT_INTEL_CORE_QPI_LINK_2	0x2c90		/* Core i7-800 and i5-700 QPI Link */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1344 src/sys/dev/pci/pcidevs_data.h:1.1345
--- src/sys/dev/pci/pcidevs_data.h:1.1344	Mon Dec  3 18:24:18 2018
+++ src/sys/dev/pci/pcidevs_data.h	Wed Dec 26 08:25:52 2018
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1344 2018/12/03 18:24:18 bouyer Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1345 2018/12/26 08:25:52 msaitoh Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1356 2018/12/03 18:23:02 bouyer Exp
+ *	NetBSD: pcidevs,v 1.1357 2018/12/26 08:25:20 msaitoh Exp
  */
 
 /*
@@ -7020,6 +7020,8 @@ static const uint16_t pci_products[] = {
 	18975, 23413, 558, 23420, 23368, 13092, 23395, 23404, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE_QP_REG_1, 
 	18975, 23427, 23435, 558, 23442, 21682, 23368, 13092, 23395, 23404, 0,
+	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE_QP_REG_3, 
+	18975, 23368, 13092, 23395, 23404, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_XE56_QP_REG, 
 	19518, 10707, 23368, 13092, 23395, 23404, 0,
 	PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_CORE_QP_SAD_2, 
@@ -15179,7 +15181,7 @@ static const char pci_words[] = { "." 
 	"L2C-CBC\0" /* 1 refs @ 13071 */
 	"L2C-MCI\0" /* 1 refs @ 13079 */
 	"SMMU\0" /* 1 refs @ 13087 */
-	"Generic\0" /* 7 refs @ 13092 */
+	"Generic\0" /* 8 refs @ 13092 */
 	"Interrupt\0" /* 6 refs @ 13100 */
 	"GPIO\0" /* 6 refs @ 13110 */
 	"MPI\0" /* 1 refs @ 13115 */
@@ -15952,7 +15954,7 @@ static const char pci_words[] = { "." 
 	"128M\0" /* 1 refs @ 18960 */
 	"Iron\0" /* 6 refs @ 18965 */
 	"Lake\0" /* 79 refs @ 18970 */
-	"Core\0" /* 176 refs @ 18975 */
+	"Core\0" /* 177 refs @ 18975 */
 	"Centrino\0" /* 28 refs @ 18980 */
 	"Advanced-N\0" /* 10 refs @ 18989 */
 	"6205\0" /* 2 refs @ 19000 */
@@ -16570,12 +16572,12 @@ static const char pci_words[] = { "." 
 	"82965PM/GM\0" /* 1 refs @ 23341 */
 	"82965GME\0" /* 7 refs @ 23352 */
 	"82GM45\0" /* 8 refs @ 23361 */
-	"QuickPath\0" /* 14 refs @ 23368 */
+	"QuickPath\0" /* 15 refs @ 23368 */
 	"Mirror\0" /* 4 refs @ 23378 */
 	"Test\0" /* 3 refs @ 23385 */
 	"Rank\0" /* 8 refs @ 23390 */
-	"Non-Core\0" /* 4 refs @ 23395 */
-	"Register\0" /* 4 refs @ 23404 */
+	"Non-Core\0" /* 5 refs @ 23395 */
+	"Register\0" /* 5 refs @ 23404 */
 	"i7-800\0" /* 15 refs @ 23413 */
 	"i5-700\0" /* 15 refs @ 23420 */
 	"i5-600,\0" /* 6 refs @ 23427 */



CVS commit: src/sys/dev/pci

2018-12-26 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Dec 26 08:25:20 UTC 2018

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
 Add yet another Intel Core QuickPath Generic Non-Core Register.


To generate a diff of this commit:
cvs rdiff -u -r1.1356 -r1.1357 src/sys/dev/pci/pcidevs

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1356 src/sys/dev/pci/pcidevs:1.1357
--- src/sys/dev/pci/pcidevs:1.1356	Mon Dec  3 18:23:02 2018
+++ src/sys/dev/pci/pcidevs	Wed Dec 26 08:25:20 2018
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1356 2018/12/03 18:23:02 bouyer Exp $
+$NetBSD: pcidevs,v 1.1357 2018/12/26 08:25:20 msaitoh Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -4148,6 +4148,7 @@ product INTEL XE55_IMC_CH2_THERM 0x2c33	
 product INTEL XE55_QP_REG	0x2c40	Xeon 5500 QuickPath Generic Non-Core Register
 product INTEL CORE_QP_REG_2	0x2c51	Core i7-800 and i5-700 QuickPath Generic Non-Core Register
 product INTEL CORE_QP_REG_1	0x2c61	Core i5-600, i3-500 and Pentium 6000 QuickPath Generic Non-Core Register
+product INTEL CORE_QP_REG_3	0x2c62	Core QuickPath Generic Non-Core Register
 product INTEL XE56_QP_REG	0x2c70	Xeon 5600 QuickPath Generic Non-Core Register
 product INTEL CORE_QP_SAD_2	0x2c81	Core i7-800 and i5-700 QuickPath Generic System Address Decoder
 product INTEL CORE_QPI_LINK_2	0x2c90	Core i7-800 and i5-700 QPI Link



CVS commit: src/sys/compat/netbsd32

2018-12-26 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Dec 26 08:01:40 UTC 2018

Modified Files:
src/sys/compat/netbsd32: netbsd32_compat_50.c netbsd32_fs.c
netbsd32_mod.c

Log Message:
remove duplicated prototypes and dated XXX comments.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/compat/netbsd32/netbsd32_compat_50.c
cvs rdiff -u -r1.81 -r1.82 src/sys/compat/netbsd32/netbsd32_fs.c
cvs rdiff -u -r1.13 -r1.14 src/sys/compat/netbsd32/netbsd32_mod.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_compat_50.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.32 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.33
--- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.32	Thu Dec  3 10:38:21 2015
+++ src/sys/compat/netbsd32/netbsd32_compat_50.c	Wed Dec 26 08:01:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_50.c,v 1.32 2015/12/03 10:38:21 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_compat_50.c,v 1.33 2018/12/26 08:01:40 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.32 2015/12/03 10:38:21 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.33 2018/12/26 08:01:40 mrg Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -504,7 +504,7 @@ compat_50_netbsd32___sigtimedwait(struct
 	compat_50_netbsd32_sigtimedwait_fetch_timeout,
 	compat_50_netbsd32_sigtimedwait_put_timeout);
 	if (!res)
-		*retval = 0; /* XXX NetBSD<=5 was not POSIX compliant */
+		*retval = 0; /* NetBSD<=5 was not POSIX compliant */
 	return res;
 }
 

Index: src/sys/compat/netbsd32/netbsd32_fs.c
diff -u src/sys/compat/netbsd32/netbsd32_fs.c:1.81 src/sys/compat/netbsd32/netbsd32_fs.c:1.82
--- src/sys/compat/netbsd32/netbsd32_fs.c:1.81	Sat Aug 11 03:41:06 2018
+++ src/sys/compat/netbsd32/netbsd32_fs.c	Wed Dec 26 08:01:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_fs.c,v 1.81 2018/08/11 03:41:06 mrg Exp $	*/
+/*	$NetBSD: netbsd32_fs.c,v 1.82 2018/12/26 08:01:40 mrg Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.81 2018/08/11 03:41:06 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_fs.c,v 1.82 2018/12/26 08:01:40 mrg Exp $");
 
 #include 
 #include 
@@ -727,11 +727,6 @@ out:
  * Use vfs vnode-to-name reverse cache; if that fails, fall back
  * to reading directory contents.
  */
-/* XXX NH Why does this exist */
-int
-getcwd_common(struct vnode *, struct vnode *,
-		   char **, char *, int, int, struct lwp *);
-
 int
 netbsd32___getcwd(struct lwp *l, const struct netbsd32___getcwd_args *uap, register_t *retval)
 {
@@ -1258,7 +1253,7 @@ netbsd32_utimensat(struct lwp *l, const 
 		syscallarg(netbsd32_timespecp_t) tptr;
 		syscallarg(int) flag;
 	} */
-	struct timespec ts[2], *tsp = NULL /* XXXgcc */;
+	struct timespec ts[2], *tsp;
 	int follow;
 	int error;
 
@@ -1356,7 +1351,7 @@ netbsd32_futimens(struct lwp *l, const s
 		syscallarg(int) fd;
 		syscallarg(netbsd32_timespecp_t) tptr;
 	} */
-	struct timespec ts[2], *tsp = NULL /* XXXgcc */;
+	struct timespec ts[2], *tsp;
 	file_t *fp;
 	int error;
 

Index: src/sys/compat/netbsd32/netbsd32_mod.c
diff -u src/sys/compat/netbsd32/netbsd32_mod.c:1.13 src/sys/compat/netbsd32/netbsd32_mod.c:1.14
--- src/sys/compat/netbsd32/netbsd32_mod.c:1.13	Thu Dec  3 02:51:01 2015
+++ src/sys/compat/netbsd32/netbsd32_mod.c	Wed Dec 26 08:01:40 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_mod.c,v 1.13 2015/12/03 02:51:01 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_mod.c,v 1.14 2018/12/26 08:01:40 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.13 2015/12/03 02:51:01 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_mod.c,v 1.14 2018/12/26 08:01:40 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_execfmt.h"
@@ -91,7 +91,7 @@ static struct execsw netbsd32_execsw[] =
 		.es_copyargs = netbsd32_elf32_copyargs,
 		.es_setregs = NULL,
 		.es_coredump = coredump_elf32,
-		.es_setup_stack = exec_setup_stack,	/* XXX XXX XXX */
+		.es_setup_stack = exec_setup_stack,
 	},
 #endif
 };