CVS commit: src/sys/kern

2020-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Apr 24 05:21:18 UTC 2020

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

Log Message:
Make sure PT_F_* bits are uintptr_t.


To generate a diff of this commit:
cvs rdiff -u -r1.247 -r1.248 src/sys/kern/kern_proc.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_proc.c
diff -u src/sys/kern/kern_proc.c:1.247 src/sys/kern/kern_proc.c:1.248
--- src/sys/kern/kern_proc.c:1.247	Fri Apr 24 03:22:06 2020
+++ src/sys/kern/kern_proc.c	Fri Apr 24 05:21:18 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_proc.c,v 1.247 2020/04/24 03:22:06 thorpej Exp $	*/
+/*	$NetBSD: kern_proc.c,v 1.248 2020/04/24 05:21:18 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.247 2020/04/24 03:22:06 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.248 2020/04/24 05:21:18 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kstack.h"
@@ -143,10 +143,10 @@ struct pid_table {
 	pid_t		pt_pid;
 };
 
-#define	PT_F_FREE		__BIT(0)
+#define	PT_F_FREE		((uintptr_t)__BIT(0))
 #define	PT_F_LWP		0	/* pseudo-flag */
-#define	PT_F_PROC		__BIT(1)
-#define	PT_F_HIDDEN		__BIT(2)
+#define	PT_F_PROC		((uintptr_t)__BIT(1))
+#define	PT_F_HIDDEN		((uintptr_t)__BIT(2))
 
 #define	PT_F_TYPEBITS		(PT_F_FREE|PT_F_PROC)
 #define	PT_F_ALLBITS		(PT_F_FREE|PT_F_PROC|PT_F_HIDDEN)



CVS commit: src/sys/dev/pci

2020-04-23 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Apr 24 04:55:40 UTC 2020

Modified Files:
src/sys/dev/pci: if_aq.c

Log Message:
fix typo


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/if_aq.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/pci/if_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.15 src/sys/dev/pci/if_aq.c:1.16
--- src/sys/dev/pci/if_aq.c:1.15	Fri Apr 24 04:34:57 2020
+++ src/sys/dev/pci/if_aq.c	Fri Apr 24 04:55:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.15 2020/04/24 04:34:57 ryo Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.16 2020/04/24 04:55:40 ryo Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.15 2020/04/24 04:34:57 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.16 2020/04/24 04:55:40 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -1167,7 +1167,7 @@ static const struct aq_product {
 	  AQ_MEDIA_TYPE_TP, AQ_LINK_100M | AQ_LINK_1G | AQ_LINK_2G5
 	},
 	{ PCI_VENDOR_AQUANTIA, PCI_PRODUCT_AQUANTIA_AQC100S,
-	  "Aquantia AQC100 10 Gigabit Network Adapter",
+	  "Aquantia AQC100S 10 Gigabit Network Adapter",
 	  AQ_MEDIA_TYPE_FIBRE, AQ_LINK_ALL
 	},
 	{ PCI_VENDOR_AQUANTIA, PCI_PRODUCT_AQUANTIA_AQC107S,



CVS commit: src/share/man/man4

2020-04-23 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Apr 24 04:37:27 UTC 2020

Modified Files:
src/share/man/man4: aq.4

Log Message:
add AQC100, AQC100S, D100


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/aq.4

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/man4/aq.4
diff -u src/share/man/man4/aq.4:1.3 src/share/man/man4/aq.4:1.4
--- src/share/man/man4/aq.4:1.3	Mon Feb 10 05:53:11 2020
+++ src/share/man/man4/aq.4	Fri Apr 24 04:37:27 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: aq.4,v 1.3 2020/02/10 05:53:11 ryo Exp $
+.\"	$NetBSD: aq.4,v 1.4 2020/04/24 04:37:27 ryo Exp $
 .\"
 .\" Copyright (c) 2020 Ryo Shimizu 
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 10, 2020
+.Dd April 24, 2020
 .Dt AQ 4
 .Os
 .Sh NAME
@@ -40,6 +40,8 @@ Supported controllers include:
 .Pp
 .Bl -bullet -compact
 .It
+AQC100 10 Gigabit Network Adapter
+.It
 AQC107 10 Gigabit Network Adapter
 .It
 AQC108 5 Gigabit Network Adapter
@@ -50,6 +52,8 @@ AQC111 5 Gigabit Network Adapter
 .It
 AQC112 2.5 Gigabit Network Adapter
 .It
+AQC100S 10 Gigabit Network Adapter
+.It
 AQC107S 10 Gigabit Network Adapter
 .It
 AQC108S 5 Gigabit Network Adapter
@@ -60,6 +64,8 @@ AQC111S 5 Gigabit Network Adapter
 .It
 AQC112S 2.5 Gigabit Network Adapter
 .It
+D100 10 Gigabit Network Adapter
+.It
 D107 10 Gigabit Network Adapter
 .It
 D108 5 Gigabit Network Adapter



CVS commit: src/sys/dev/pci

2020-04-23 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Apr 24 04:34:57 UTC 2020

Modified Files:
src/sys/dev/pci: if_aq.c

Log Message:
add support AQC100S and D100.
not tested, but they are probably the same as the AQC100.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pci/if_aq.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/pci/if_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.14 src/sys/dev/pci/if_aq.c:1.15
--- src/sys/dev/pci/if_aq.c:1.14	Thu Apr 23 06:28:34 2020
+++ src/sys/dev/pci/if_aq.c	Fri Apr 24 04:34:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.14 2020/04/23 06:28:34 ryo Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.15 2020/04/24 04:34:57 ryo Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.14 2020/04/23 06:28:34 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.15 2020/04/24 04:34:57 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -1166,6 +1166,10 @@ static const struct aq_product {
 	  "Aquantia AQC112 2.5 Gigabit Network Adapter",
 	  AQ_MEDIA_TYPE_TP, AQ_LINK_100M | AQ_LINK_1G | AQ_LINK_2G5
 	},
+	{ PCI_VENDOR_AQUANTIA, PCI_PRODUCT_AQUANTIA_AQC100S,
+	  "Aquantia AQC100 10 Gigabit Network Adapter",
+	  AQ_MEDIA_TYPE_FIBRE, AQ_LINK_ALL
+	},
 	{ PCI_VENDOR_AQUANTIA, PCI_PRODUCT_AQUANTIA_AQC107S,
 	  "Aquantia AQC107S 10 Gigabit Network Adapter",
 	  AQ_MEDIA_TYPE_TP, AQ_LINK_ALL
@@ -1186,6 +1190,10 @@ static const struct aq_product {
 	  "Aquantia AQC112S 2.5 Gigabit Network Adapter",
 	  AQ_MEDIA_TYPE_TP, AQ_LINK_100M | AQ_LINK_1G | AQ_LINK_2G5
 	},
+	{ PCI_VENDOR_AQUANTIA, PCI_PRODUCT_AQUANTIA_D100,
+	  "Aquantia D100 10 Gigabit Network Adapter",
+	  AQ_MEDIA_TYPE_FIBRE, AQ_LINK_ALL
+	},
 	{ PCI_VENDOR_AQUANTIA, PCI_PRODUCT_AQUANTIA_D107,
 	  "Aquantia D107 10 Gigabit Network Adapter",
 	  AQ_MEDIA_TYPE_TP, AQ_LINK_ALL



CVS commit: src/sys/rump/librump/rumpkern

2020-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Apr 24 03:56:12 UTC 2020

Modified Files:
src/sys/rump/librump/rumpkern: lwproc.c

Log Message:
Adapt to LWP ID allocation changes.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/rump/librump/rumpkern/lwproc.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/rump/librump/rumpkern/lwproc.c
diff -u src/sys/rump/librump/rumpkern/lwproc.c:1.45 src/sys/rump/librump/rumpkern/lwproc.c:1.46
--- src/sys/rump/librump/rumpkern/lwproc.c:1.45	Sun Apr 19 20:32:00 2020
+++ src/sys/rump/librump/rumpkern/lwproc.c	Fri Apr 24 03:56:12 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: lwproc.c,v 1.45 2020/04/19 20:32:00 thorpej Exp $	*/
+/*  $NetBSD: lwproc.c,v 1.46 2020/04/24 03:56:12 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #define RUMP__CURLWP_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.45 2020/04/19 20:32:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.46 2020/04/24 03:56:12 thorpej Exp $");
 
 #include 
 #include 
@@ -311,6 +311,7 @@ lwproc_freelwp(struct lwp *l)
 	KASSERT(l->l_refcnt == 0);
 
 	/* ok, zero references, continue with nuke */
+	proc_free_lwpid(p, l->l_lid);
 	LIST_REMOVE(l, l_sibling);
 	KASSERT(p->p_nlwps >= 1);
 	if (--p->p_nlwps == 0) {
@@ -361,7 +362,7 @@ lwproc_makelwp(struct proc *p, struct lw
 	l->l_refcnt = 1;
 	l->l_proc = p;
 
-	l->l_lid = p->p_nlwpid++;
+	proc_alloc_lwpid(p, l);
 	LIST_INSERT_HEAD(>p_lwps, l, l_sibling);
 
 	l->l_fd = p->p_fd;



CVS commit: src/tests/lib/libc/sys

2020-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Apr 24 03:25:20 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.c t_ptrace_x86_wait.h

Log Message:
Update for new LWP behavior -- as of 9.99.59, the LWP ID of a single-LWP
process is the PID, not 1.


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/tests/lib/libc/sys/t_ptrace_wait.c
cvs rdiff -u -r1.24 -r1.25 src/tests/lib/libc/sys/t_ptrace_x86_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.171 src/tests/lib/libc/sys/t_ptrace_wait.c:1.172
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.171	Fri Apr 17 22:53:52 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Fri Apr 24 03:25:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.171 2020/04/17 22:53:52 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.172 2020/04/24 03:25:20 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.171 2020/04/17 22:53:52 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.172 2020/04/24 03:25:20 thorpej Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -7506,8 +7506,11 @@ syscall_body(const char *op)
 	DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for child\n");
 	SYSCALL_REQUIRE(ptrace(PT_GET_SIGINFO, child, , sizeof(info)) != -1);
 
+	/*
+	 * N.B. 9.99.59 and later - single-LWP processes lwpid==pid.
+	 */
 	DPRINTF("Before checking siginfo_t and lwpid\n");
-	ATF_REQUIRE_EQ(info.psi_lwpid, 1);
+	ATF_REQUIRE(info.psi_lwpid == 1 || info.psi_lwpid == child);
 	ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
 	ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_SCE);
 
@@ -7549,8 +7552,13 @@ syscall_body(const char *op)
 			ptrace(PT_GET_SIGINFO, child, , sizeof(info))
 			!= -1);
 
+			/*
+			 * N.B. 9.99.59 and later - single-LWP processes
+			 * lwpid==pid.
+			 */
 			DPRINTF("Before checking siginfo_t and lwpid\n");
-			ATF_REQUIRE_EQ(info.psi_lwpid, 1);
+			ATF_REQUIRE(info.psi_lwpid == 1 ||
+info.psi_lwpid == child);
 			ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, SIGTRAP);
 			ATF_REQUIRE_EQ(info.psi_siginfo.si_code, TRAP_SCX);
 
@@ -8502,6 +8510,13 @@ USER_VA0_DISABLE(user_va0_disable_pt_det
  * buf_len.  The actual length of the note is returned (which can be greater
  * than buf_len, indicating that it has been truncated).  If the note is not
  * found, -1 is returned.
+ *
+ * If the note_name ends in '*', then we find the first note that matches
+ * the note_name prefix up to the '*' character, e.g.:
+ *
+ *	NetBSD-CORE@*
+ *
+ * finds the first note whose name prefix matches "NetBSD-CORE@".
  */
 static ssize_t core_find_note(const char *core_path,
 const char *note_name, uint64_t note_type, void *buf, size_t buf_len)
@@ -8510,8 +8525,16 @@ static ssize_t core_find_note(const char
 	Elf *core_elf;
 	size_t core_numhdr, i;
 	ssize_t ret = -1;
-	/* note: we assume note name will be null-terminated */
-	size_t name_len = strlen(note_name) + 1;
+	size_t name_len = strlen(note_name);
+	bool prefix_match = false;
+
+	if (note_name[name_len - 1] == '*') {
+		prefix_match = true;
+		name_len--;
+	} else {
+		/* note: we assume note name will be null-terminated */
+		name_len++;
+	}
 
 	SYSCALL_REQUIRE((core_fd = open(core_path, O_RDONLY)) != -1);
 	SYSCALL_REQUIRE(elf_version(EV_CURRENT) != EV_NONE);
@@ -8554,7 +8577,10 @@ static ssize_t core_find_note(const char
 			/* indicates end of notes */
 			if (note_hdr.n_namesz == 0 || note_hdr.n_descsz == 0)
 break;
-			if (note_hdr.n_namesz == name_len &&
+			if (((prefix_match &&
+			  note_hdr.n_namesz > name_len) ||
+			 (!prefix_match &&
+			  note_hdr.n_namesz == name_len)) &&
 			note_hdr.n_namesz <= sizeof(name_buf)) {
 SYSCALL_REQUIRE(pread(core_fd, name_buf,
 note_hdr.n_namesz, offset)
@@ -8652,7 +8678,10 @@ ATF_TC_BODY(core_dump_procinfo, tc)
 	ATF_CHECK_EQ(procinfo.cpi_rgid, getgid());
 	ATF_CHECK_EQ(procinfo.cpi_egid, getegid());
 	ATF_CHECK_EQ(procinfo.cpi_nlwps, 1);
-	ATF_CHECK_EQ(procinfo.cpi_siglwp, 1);
+	/*
+	 * N.B. 9.99.59 and later - single-LWP processes lwpid==pid.
+	 */
+	ATF_CHECK(procinfo.cpi_siglwp == 1 || procinfo.cpi_siglwp == child);
 
 	unlink(core_path);
 

Index: src/tests/lib/libc/sys/t_ptrace_x86_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.24 src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.25
--- src/tests/lib/libc/sys/t_ptrace_x86_wait.h:1.24	Thu Feb 20 23:57:16 2020
+++ src/tests/lib/libc/sys/t_ptrace_x86_wait.h	Fri Apr 24 03:25:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_x86_wait.h,v 1.24 2020/02/20 23:57:16 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_x86_wait.h,v 1.25 2020/04/24 03:25:20 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ 

CVS commit: src/sys/sys

2020-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Apr 24 03:22:52 UTC 2020

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

Log Message:
NetBSD 9.99.59 -- LWP ID allocation changes.


To generate a diff of this commit:
cvs rdiff -u -r1.661 -r1.662 src/sys/sys/param.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/param.h
diff -u src/sys/sys/param.h:1.661 src/sys/sys/param.h:1.662
--- src/sys/sys/param.h:1.661	Thu Apr 23 23:40:04 2020
+++ src/sys/sys/param.h	Fri Apr 24 03:22:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.661 2020/04/23 23:40:04 ad Exp $	*/
+/*	$NetBSD: param.h,v 1.662 2020/04/24 03:22:52 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999005800	/* NetBSD 9.99.58 */
+#define	__NetBSD_Version__	999005900	/* NetBSD 9.99.59 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys

2020-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Apr 24 03:22:06 UTC 2020

Modified Files:
src/sys/compat/linux/common: linux_exec.c linux_sched.c
src/sys/kern: kern_exec.c kern_exit.c kern_fork.c kern_lwp.c
kern_proc.c sys_lwp.c
src/sys/sys: lwp.h proc.h

Log Message:
Overhaul the way LWP IDs are allocated.  Instead of each LWP having it's
own LWP ID space, LWP IDs came from the same number space as PIDs.  The
lead LWP of a process gets the PID as its LID.  If a multi-LWP process's
lead LWP exits, the PID persists for the process.

In addition to providing system-wide unique thread IDs, this also lets us
eliminate the per-process LWP radix tree, and some associated locks.

Remove the separate "global thread ID" map added previously; it is no longer
needed to provide this functionality.

Nudged in this direction by ad@ and chs@.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/compat/linux/common/linux_exec.c
cvs rdiff -u -r1.74 -r1.75 src/sys/compat/linux/common/linux_sched.c
cvs rdiff -u -r1.498 -r1.499 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.288 -r1.289 src/sys/kern/kern_exit.c
cvs rdiff -u -r1.222 -r1.223 src/sys/kern/kern_fork.c
cvs rdiff -u -r1.234 -r1.235 src/sys/kern/kern_lwp.c
cvs rdiff -u -r1.246 -r1.247 src/sys/kern/kern_proc.c
cvs rdiff -u -r1.78 -r1.79 src/sys/kern/sys_lwp.c
cvs rdiff -u -r1.206 -r1.207 src/sys/sys/lwp.h
cvs rdiff -u -r1.362 -r1.363 src/sys/sys/proc.h

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

Modified files:

Index: src/sys/compat/linux/common/linux_exec.c
diff -u src/sys/compat/linux/common/linux_exec.c:1.121 src/sys/compat/linux/common/linux_exec.c:1.122
--- src/sys/compat/linux/common/linux_exec.c:1.121	Sat Feb 15 17:13:55 2020
+++ src/sys/compat/linux/common/linux_exec.c	Fri Apr 24 03:22:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_exec.c,v 1.121 2020/02/15 17:13:55 ad Exp $	*/
+/*	$NetBSD: linux_exec.c,v 1.122 2020/04/24 03:22:06 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1994, 1995, 1998, 2000, 2007, 2008, 2020
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_exec.c,v 1.121 2020/02/15 17:13:55 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_exec.c,v 1.122 2020/04/24 03:22:06 thorpej Exp $");
 
 #include 
 #include 
@@ -130,8 +130,6 @@ linux_e_proc_exec(struct proc *p, struct
 	}
 
 	KASSERT(p->p_nlwps == 1);
-	l = LIST_FIRST(>p_lwps);
-	lwp_renumber(l, p->p_pid);
 }
 
 void
@@ -152,7 +150,6 @@ linux_e_proc_fork(struct proc *p2, struc
 
 	KASSERT(p2->p_nlwps == 1);
 	l2 = LIST_FIRST(>p_lwps);
-	lwp_renumber(l2, p2->p_pid);
 	led1 = l1->l_emuldata;
 	led2 = l2->l_emuldata;
 	led2->led_child_tidptr = led1->led_child_tidptr;

Index: src/sys/compat/linux/common/linux_sched.c
diff -u src/sys/compat/linux/common/linux_sched.c:1.74 src/sys/compat/linux/common/linux_sched.c:1.75
--- src/sys/compat/linux/common/linux_sched.c:1.74	Sun Apr 19 20:31:59 2020
+++ src/sys/compat/linux/common/linux_sched.c	Fri Apr 24 03:22:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_sched.c,v 1.74 2020/04/19 20:31:59 thorpej Exp $	*/
+/*	$NetBSD: linux_sched.c,v 1.75 2020/04/24 03:22:06 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2019 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.74 2020/04/19 20:31:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.75 2020/04/24 03:22:06 thorpej Exp $");
 
 #include 
 #include 
@@ -195,7 +195,7 @@ linux_clone_nptl(struct lwp *l, const st
 		return ENOMEM;
 	}
 
-	error = lwp_create(l, p, uaddr, LWP_DETACHED | LWP_PIDLID,
+	error = lwp_create(l, p, uaddr, LWP_DETACHED,
 	SCARG(uap, stack), 0, child_return, NULL, , l->l_class,
 	>l_sigmask, >l_sigstk);
 	if (__predict_false(error)) {

Index: src/sys/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.498 src/sys/kern/kern_exec.c:1.499
--- src/sys/kern/kern_exec.c:1.498	Tue Apr 21 21:42:47 2020
+++ src/sys/kern/kern_exec.c	Fri Apr 24 03:22:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.498 2020/04/21 21:42:47 ad Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.499 2020/04/24 03:22:06 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.498 2020/04/21 21:42:47 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.499 2020/04/24 03:22:06 thorpej Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -1148,10 +1148,6 @@ emulexec(struct lwp *l, struct exec_pack
 	&& p->p_emul != epp->ep_esch->es_emul)
 		(*p->p_emul->e_proc_exit)(p);
 
-	/* This is now LWP 1.  Re-number the LWP if needed. */
-	if (l->l_lid != 1)
-		lwp_renumber(l, 1);
-
 	/*
 	 * Call exec hook. Emulation code may NOT store reference to anything
 	 * from 
@@ -2495,10 +2491,18 @@ do_posix_spawn(struct lwp *l1, pid_t *pi
 	 * Allocate new proc. Borrow proc0 vmspace for it, we will
 	 

CVS commit: src/sys/arch/x86/x86

2020-04-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Apr 24 02:27:59 UTC 2020

Modified Files:
src/sys/arch/x86/x86: procfs_machdep.c

Log Message:
 Add AMD protected processor identification number (PPIN).


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/x86/x86/procfs_machdep.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/x86/x86/procfs_machdep.c
diff -u src/sys/arch/x86/x86/procfs_machdep.c:1.36 src/sys/arch/x86/x86/procfs_machdep.c:1.37
--- src/sys/arch/x86/x86/procfs_machdep.c:1.36	Wed Apr  1 08:21:38 2020
+++ src/sys/arch/x86/x86/procfs_machdep.c	Fri Apr 24 02:27:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_machdep.c,v 1.36 2020/04/01 08:21:38 msaitoh Exp $ */
+/*	$NetBSD: procfs_machdep.c,v 1.37 2020/04/24 02:27:59 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.36 2020/04/01 08:21:38 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_machdep.c,v 1.37 2020/04/24 02:27:59 msaitoh Exp $");
 
 #include 
 #include 
@@ -155,7 +155,7 @@ static const char * const x86_features[]
 	{ /* (13) AMD 0x8008 ebx */
 	"clzero", "irperf", "xsaveerptr", NULL, "rdpru", NULL, NULL, NULL,
 	NULL, "wbnoinvd", NULL, NULL, NULL, NULL, NULL, NULL,
-	NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+	NULL, NULL, NULL, NULL, NULL, NULL, NULL, "PPIN",
 	NULL, "virt_ssbd", NULL, NULL, NULL, NULL, NULL, NULL},
 
 	{ /* (14) 0x0006 eax */



CVS commit: src/sys/lib/libkern

2020-04-23 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 24 00:22:57 UTC 2020

Modified Files:
src/sys/lib/libkern: Makefile.compiler-rt

Log Message:
For m68k, do not compile in {,u}divmodsi4 also, that are not used by
codes generated by gcc (confirmed not only for kernel, but also all
executables and libraries for userland).

Fix build failure for MODULAR kernel, noticed by mlelstv.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/lib/libkern/Makefile.compiler-rt

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

Modified files:

Index: src/sys/lib/libkern/Makefile.compiler-rt
diff -u src/sys/lib/libkern/Makefile.compiler-rt:1.11 src/sys/lib/libkern/Makefile.compiler-rt:1.12
--- src/sys/lib/libkern/Makefile.compiler-rt:1.11	Thu Apr 23 03:09:18 2020
+++ src/sys/lib/libkern/Makefile.compiler-rt	Fri Apr 24 00:22:57 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.compiler-rt,v 1.11 2020/04/23 03:09:18 rin Exp $
+# $NetBSD: Makefile.compiler-rt,v 1.12 2020/04/24 00:22:57 rin Exp $
 
 COMPILER_RT_SRCDIR=	${NETBSDSRCDIR}/sys/external/bsd/compiler_rt/dist
 
@@ -62,17 +62,13 @@ GENERIC_SRCS+= \
 	ctzsi2.c
 .endif
 
-.if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha"
-GENERIC_SRCS+= \
-	divmodsi4.c \
-	udivmodsi4.c
-.endif
-
 .if ${MACHINE_CPU} != "aarch64" && ${MACHINE} != "alpha" && \
 ${MACHINE_ARCH} != "m68k"
 GENERIC_SRCS+= \
+	divmodsi4.c \
 	divsi3.c \
 	modsi3.c \
+	udivmodsi4.c \
 	udivsi3.c \
 	umodsi3.c
 .endif



CVS commit: src/sys/sys

2020-04-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Apr 23 23:40:04 UTC 2020

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

Log Message:
NetBSD 9.99.58 - ubc_uiomove needs to see new flag


To generate a diff of this commit:
cvs rdiff -u -r1.660 -r1.661 src/sys/sys/param.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/param.h
diff -u src/sys/sys/param.h:1.660 src/sys/sys/param.h:1.661
--- src/sys/sys/param.h:1.660	Tue Apr 21 21:53:53 2020
+++ src/sys/sys/param.h	Thu Apr 23 23:40:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.660 2020/04/21 21:53:53 ad Exp $	*/
+/*	$NetBSD: param.h,v 1.661 2020/04/23 23:40:04 ad Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999005700	/* NetBSD 9.99.57 */
+#define	__NetBSD_Version__	999005800	/* NetBSD 9.99.58 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/arch

2020-04-23 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Thu Apr 23 23:22:41 UTC 2020

Modified Files:
src/sys/arch/aarch64/include: profile.h
src/sys/arch/arm/include: asm.h

Log Message:
Fix userland gprof profiling on aarch64.

Adjusts _PROF_PROLOGUE to match OpenBSD; reworks our MCOUNT to retrieve
frompc placed on stack by the prologue, and to streamline sp manipulation
when preserving argument registers.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/aarch64/include/profile.h
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/arm/include/asm.h

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

Modified files:

Index: src/sys/arch/aarch64/include/profile.h
diff -u src/sys/arch/aarch64/include/profile.h:1.1 src/sys/arch/aarch64/include/profile.h:1.2
--- src/sys/arch/aarch64/include/profile.h:1.1	Sun Aug 10 05:47:38 2014
+++ src/sys/arch/aarch64/include/profile.h	Thu Apr 23 23:22:41 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: profile.h,v 1.1 2014/08/10 05:47:38 matt Exp $ */
+/* $NetBSD: profile.h,v 1.2 2020/04/23 23:22:41 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -51,20 +51,18 @@
 	/*\
 	 * Preserve registers that are trashed during mcount		\
 	 */\
-	__asm("sub	sp, sp, #80");	\
-	__asm("stp	x29, x30, [sp, #64]");\
-	__asm("add	x29, sp, #64");	\
-	__asm("stp	x0, x1, [x29, #0]");\
-	__asm("stp	x2, x3, [x29, #16]");\
-	__asm("stp	x4, x5, [x29, #32]");\
-	__asm("stp	x6, x7, [x29, #48]");\
+	__asm("stp	x29, x30, [sp, #-80]!");			\
+	__asm("stp	x0, x1, [sp, #16]");\
+	__asm("stp	x2, x3, [sp, #32]");\
+	__asm("stp	x4, x5, [sp, #48]");\
+	__asm("stp	x6, x7, [sp, #64]");\
 	/*\
 	 * find the return address for mcount,\
 	 * and the return address for mcount's caller.			\
 	 *\
 	 * frompcindex = pc pushed by call into self.			\
 	 */\
-	__asm("mov	x0, x19");	\
+	__asm("ldr	x0, [x29, #8]");\
 	/*\
 	 * selfpc = pc pushed by mcount call\
 	 */\
@@ -76,12 +74,11 @@
 	/*\
 	 * Restore registers that were trashed during mcount		\
 	 */\
-	__asm("ldp	x0, x1, [x29, #0]");\
-	__asm("ldp	x2, x3, [x29, #16]");\
-	__asm("ldp	x4, x5, [x29, #32]");\
-	__asm("ldp	x6, x7, [x29, #48]");\
-	__asm("ldp	x29, x30, [x29, #64]");\
-	__asm("add	sp, sp, #80");	\
+	__asm("ldp	x0, x1, [sp, #16]");\
+	__asm("ldp	x2, x3, [sp, #32]");\
+	__asm("ldp	x4, x5, [sp, #48]");\
+	__asm("ldp	x6, x7, [sp, #64]");\
+	__asm("ldp	x29, x30, [sp], #80");\
 	__asm("ret");			\
 	__asm(".size	" MCOUNT_ASM_NAME ", .-" MCOUNT_ASM_NAME);
 

Index: src/sys/arch/arm/include/asm.h
diff -u src/sys/arch/arm/include/asm.h:1.33 src/sys/arch/arm/include/asm.h:1.34
--- src/sys/arch/arm/include/asm.h:1.33	Tue Apr 21 11:35:02 2020
+++ src/sys/arch/arm/include/asm.h	Thu Apr 23 23:22:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: asm.h,v 1.33 2020/04/21 11:35:02 joerg Exp $	*/
+/*	$NetBSD: asm.h,v 1.34 2020/04/23 23:22:41 jakllsch Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -145,7 +145,10 @@
 
 #ifdef GPROF
 # define _PROF_PROLOGUE	\
-	mov x9, x30; bl __mcount
+	stp	x29, x30, [sp, #-16]!;	\
+	mov	fp, sp;			\
+	bl	__mcount; 		\
+	ldp	x29, x30, [sp], #16;
 #else
 # define _PROF_PROLOGUE
 #endif



CVS commit: src/sys/kern

2020-04-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Apr 23 22:58:36 UTC 2020

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

Log Message:
cache_lookup_linked(): We can't use the name to decide how to lock the dir,
since the name refers to the child (found object) not the parent (the thing
that's being locked).

Fix it by always doing rw_tryenter().  There's not much to be won by
optimising for the contended case, and were this routine doing lockless
lookups (the eventual goal) it wouldn't be hanging around waiting for
changes either.


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/kern/vfs_cache.c

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

Modified files:

Index: src/sys/kern/vfs_cache.c
diff -u src/sys/kern/vfs_cache.c:1.140 src/sys/kern/vfs_cache.c:1.141
--- src/sys/kern/vfs_cache.c:1.140	Wed Apr 22 21:35:52 2020
+++ src/sys/kern/vfs_cache.c	Thu Apr 23 22:58:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_cache.c,v 1.140 2020/04/22 21:35:52 ad Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.141 2020/04/23 22:58:36 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -172,7 +172,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.140 2020/04/22 21:35:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.141 2020/04/23 22:58:36 ad Exp $");
 
 #define __NAMECACHE_PRIVATE
 #ifdef _KERNEL_OPT
@@ -668,12 +668,8 @@ cache_lookup_linked(struct vnode *dvp, c
 	 * on the lock as child -> parent is the wrong direction.
 	 */
 	if (*plock != >vi_nc_lock) {
-		if (namelen == 2 && name[0] == '.' && name[1] == '.') {
-			if (!rw_tryenter(>vi_nc_lock, RW_READER)) {
-return false;
-			}
-		} else {
-			rw_enter(>vi_nc_lock, RW_READER);
+		if (!rw_tryenter(>vi_nc_lock, RW_READER)) {
+			return false;
 		}
 		if (*plock != NULL) {
 			rw_exit(*plock);



CVS commit: src/sys/uvm

2020-04-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Apr 23 21:53:01 UTC 2020

Modified Files:
src/sys/uvm: uvm_bio.c uvm_glue.c

Log Message:
Enable ubc_direct by default, but only on systems with no more than 2 CPUs
for now.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/uvm/uvm_bio.c
cvs rdiff -u -r1.177 -r1.178 src/sys/uvm/uvm_glue.c

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

Modified files:

Index: src/sys/uvm/uvm_bio.c
diff -u src/sys/uvm/uvm_bio.c:1.110 src/sys/uvm/uvm_bio.c:1.111
--- src/sys/uvm/uvm_bio.c:1.110	Thu Apr 23 21:47:09 2020
+++ src/sys/uvm/uvm_bio.c	Thu Apr 23 21:53:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_bio.c,v 1.110 2020/04/23 21:47:09 ad Exp $	*/
+/*	$NetBSD: uvm_bio.c,v 1.111 2020/04/23 21:53:01 ad Exp $	*/
 
 /*
  * Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.110 2020/04/23 21:47:09 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.111 2020/04/23 21:53:01 ad Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_ubc.h"
@@ -64,7 +64,7 @@ static int __noinline ubc_uiomove_direct
 			  int, int);
 static void __noinline ubc_zerorange_direct(struct uvm_object *, off_t, size_t, int);
 
-bool ubc_direct = false; /* XXX */
+bool ubc_direct = true;
 #endif
 
 /*

Index: src/sys/uvm/uvm_glue.c
diff -u src/sys/uvm/uvm_glue.c:1.177 src/sys/uvm/uvm_glue.c:1.178
--- src/sys/uvm/uvm_glue.c:1.177	Thu Mar  5 12:21:00 2020
+++ src/sys/uvm/uvm_glue.c	Thu Apr 23 21:53:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_glue.c,v 1.177 2020/03/05 12:21:00 rin Exp $	*/
+/*	$NetBSD: uvm_glue.c,v 1.178 2020/04/23 21:53:01 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.177 2020/03/05 12:21:00 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_glue.c,v 1.178 2020/04/23 21:53:01 ad Exp $");
 
 #include "opt_kgdb.h"
 #include "opt_kstack.h"
@@ -504,6 +504,18 @@ uvm_scheduler(void)
 	/* Start the freelist cache. */
 	uvm_pgflcache_start();
 
+#ifdef PMAP_DIRECT
+	/*
+	 * XXX Temporary ugly hack.  Just before boot, disable ubc_direct if
+	 * there's more than a couple of CPUs, since it has concurrency
+	 * problems.
+	 */
+	if (ncpu > 2) {
+		extern bool ubc_direct;
+		ubc_direct = false;
+	}
+#endif
+
 	for (;;) {
 		/* Update legacy stats for post-mortem debugging. */
 		uvm_update_uvmexp();



CVS commit: src/sys

2020-04-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Apr 23 21:47:09 UTC 2020

Modified Files:
src/sys/fs/adosfs: advnops.c
src/sys/fs/cd9660: cd9660_vnops.c
src/sys/fs/efs: efs_vnops.c
src/sys/fs/filecorefs: filecore_vnops.c
src/sys/fs/hfs: hfs_vnops.c
src/sys/fs/msdosfs: msdosfs_denode.c msdosfs_vnops.c
src/sys/fs/nilfs: nilfs_vnops.c
src/sys/fs/puffs: puffs_vnops.c
src/sys/fs/sysvbfs: sysvbfs_vnops.c
src/sys/fs/tmpfs: tmpfs_subr.c tmpfs_vnops.c
src/sys/fs/udf: udf_allocation.c udf_vnops.c
src/sys/fs/v7fs: v7fs_vnops.c
src/sys/nfs: nfs_bio.c
src/sys/rump/librump/rumpvfs: rumpfs.c
src/sys/ufs/chfs: chfs_subr.c chfs_vnops.c
src/sys/ufs/ext2fs: ext2fs_inode.c ext2fs_readwrite.c
src/sys/ufs/ffs: ffs_inode.c
src/sys/ufs/lfs: lfs_inode.c ulfs_readwrite.c
src/sys/ufs/ufs: ufs_readwrite.c
src/sys/uvm: uvm_bio.c uvm_extern.h

Log Message:
PR kern/54759 (vm.ubc_direct deadlock when read()/write() into mapping of 
itself)

- Add new flag UBC_ISMAPPED which tells ubc_uiomove() the object is mmap()ed
  somewhere.  Use it to decide whether to do direct-mapped copy, rather than
  poking around directly in the vnode in ubc_uiomove(), which is ugly and
  doesn't work for tmpfs.  It would be nicer to contain all this in UVM but
  the filesystem provides the needed locking here (VV_MAPPED) and to
  reinvent that would suck more.

- Rename UBC_UNMAP_FLAG() to UBC_VNODE_FLAGS().  Pass in UBC_ISMAPPED where
  appropriate.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/fs/adosfs/advnops.c
cvs rdiff -u -r1.55 -r1.56 src/sys/fs/cd9660/cd9660_vnops.c
cvs rdiff -u -r1.38 -r1.39 src/sys/fs/efs/efs_vnops.c
cvs rdiff -u -r1.44 -r1.45 src/sys/fs/filecorefs/filecore_vnops.c
cvs rdiff -u -r1.34 -r1.35 src/sys/fs/hfs/hfs_vnops.c
cvs rdiff -u -r1.58 -r1.59 src/sys/fs/msdosfs/msdosfs_denode.c
cvs rdiff -u -r1.101 -r1.102 src/sys/fs/msdosfs/msdosfs_vnops.c
cvs rdiff -u -r1.39 -r1.40 src/sys/fs/nilfs/nilfs_vnops.c
cvs rdiff -u -r1.214 -r1.215 src/sys/fs/puffs/puffs_vnops.c
cvs rdiff -u -r1.64 -r1.65 src/sys/fs/sysvbfs/sysvbfs_vnops.c
cvs rdiff -u -r1.108 -r1.109 src/sys/fs/tmpfs/tmpfs_subr.c
cvs rdiff -u -r1.135 -r1.136 src/sys/fs/tmpfs/tmpfs_vnops.c
cvs rdiff -u -r1.40 -r1.41 src/sys/fs/udf/udf_allocation.c
cvs rdiff -u -r1.111 -r1.112 src/sys/fs/udf/udf_vnops.c
cvs rdiff -u -r1.28 -r1.29 src/sys/fs/v7fs/v7fs_vnops.c
cvs rdiff -u -r1.195 -r1.196 src/sys/nfs/nfs_bio.c
cvs rdiff -u -r1.156 -r1.157 src/sys/rump/librump/rumpvfs/rumpfs.c
cvs rdiff -u -r1.11 -r1.12 src/sys/ufs/chfs/chfs_subr.c
cvs rdiff -u -r1.37 -r1.38 src/sys/ufs/chfs/chfs_vnops.c
cvs rdiff -u -r1.88 -r1.89 src/sys/ufs/ext2fs/ext2fs_inode.c
cvs rdiff -u -r1.76 -r1.77 src/sys/ufs/ext2fs/ext2fs_readwrite.c
cvs rdiff -u -r1.127 -r1.128 src/sys/ufs/ffs/ffs_inode.c
cvs rdiff -u -r1.159 -r1.160 src/sys/ufs/lfs/lfs_inode.c
cvs rdiff -u -r1.26 -r1.27 src/sys/ufs/lfs/ulfs_readwrite.c
cvs rdiff -u -r1.125 -r1.126 src/sys/ufs/ufs/ufs_readwrite.c
cvs rdiff -u -r1.109 -r1.110 src/sys/uvm/uvm_bio.c
cvs rdiff -u -r1.223 -r1.224 src/sys/uvm/uvm_extern.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/fs/adosfs/advnops.c
diff -u src/sys/fs/adosfs/advnops.c:1.52 src/sys/fs/adosfs/advnops.c:1.53
--- src/sys/fs/adosfs/advnops.c:1.52	Thu Apr 23 09:58:37 2020
+++ src/sys/fs/adosfs/advnops.c	Thu Apr 23 21:47:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: advnops.c,v 1.52 2020/04/23 09:58:37 jdolecek Exp $	*/
+/*	$NetBSD: advnops.c,v 1.53 2020/04/23 21:47:07 ad Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.52 2020/04/23 09:58:37 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.53 2020/04/23 21:47:07 ad Exp $");
 
 #include 
 #include 
@@ -270,7 +270,7 @@ adosfs_read(void *v)
 break;
 			}
 			error = ubc_uiomove(>v_uobj, uio, bytelen, advice,
-			UBC_READ | UBC_PARTIALOK | UBC_UNMAP_FLAG(vp));
+			UBC_READ | UBC_PARTIALOK | UBC_VNODE_FLAGS(vp));
 			if (error) {
 break;
 			}

Index: src/sys/fs/cd9660/cd9660_vnops.c
diff -u src/sys/fs/cd9660/cd9660_vnops.c:1.55 src/sys/fs/cd9660/cd9660_vnops.c:1.56
--- src/sys/fs/cd9660/cd9660_vnops.c:1.55	Fri Jul 12 17:18:30 2019
+++ src/sys/fs/cd9660/cd9660_vnops.c	Thu Apr 23 21:47:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd9660_vnops.c,v 1.55 2019/07/12 17:18:30 maxv Exp $	*/
+/*	$NetBSD: cd9660_vnops.c,v 1.56 2020/04/23 21:47:07 ad Exp $	*/
 
 /*-
  * Copyright (c) 1994
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cd9660_vnops.c,v 1.55 2019/07/12 17:18:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cd9660_vnops.c,v 1.56 2020/04/23 21:47:07 ad Exp $");
 
 #include 
 #include 
@@ -241,7 +241,7 @@ cd9660_read(void *v)
 			if (bytelen == 0)
 break;
 			error = 

CVS commit: src/sys/arch/x86/x86

2020-04-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Apr 23 21:35:18 UTC 2020

Modified Files:
src/sys/arch/x86/x86: cpu.c

Log Message:
- Install HPET based DELAY() before going multiuser then recalibrate the TSC.
  Idea from joerg@.

- Take overhead into account when computing CPU frequency.

- Don't flush cache before computing TSC skew.


To generate a diff of this commit:
cvs rdiff -u -r1.185 -r1.186 src/sys/arch/x86/x86/cpu.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/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.185 src/sys/arch/x86/x86/cpu.c:1.186
--- src/sys/arch/x86/x86/cpu.c:1.185	Tue Apr 21 02:56:37 2020
+++ src/sys/arch/x86/x86/cpu.c	Thu Apr 23 21:35:18 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: cpu.c,v 1.185 2020/04/21 02:56:37 msaitoh Exp $	*/
+/*	$NetBSD: cpu.c,v 1.186 2020/04/23 21:35:18 ad Exp $	*/
 
 /*
- * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
+ * Copyright (c) 2000-2020 NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.185 2020/04/21 02:56:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.186 2020/04/23 21:35:18 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -73,6 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.18
 #include "lapic.h"
 #include "ioapic.h"
 #include "acpica.h"
+#include "hpet.h"
 
 #include 
 #include 
@@ -118,6 +119,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.18
 #endif
 
 #include 
+#include 
 #include 
 #include 
 
@@ -197,6 +199,8 @@ static vaddr_t cmos_data_mapping;
 #endif
 struct cpu_info *cpu_starting;
 
+int (*cpu_nullop_ptr)(void *) = nullop;
+
 #ifdef MULTIPROCESSOR
 void		cpu_hatch(void *);
 static void	cpu_boot_secondary(struct cpu_info *ci);
@@ -428,8 +432,11 @@ cpu_attach(device_t parent, device_t sel
 	 * must be done to allow booting other processors.
 	 */
 	if (!again) {
-		atomic_or_32(>ci_flags, CPUF_PRESENT | CPUF_PRIMARY);
+		/* Make sure DELAY() (likely i8254_delay()) is initialized. */
+		DELAY(1);
+
 		/* Basic init. */
+		atomic_or_32(>ci_flags, CPUF_PRESENT | CPUF_PRIMARY);
 		cpu_intr_init(ci);
 		cpu_get_tsc_freq(ci);
 		cpu_init(ci);
@@ -445,8 +452,6 @@ cpu_attach(device_t parent, device_t sel
 			lapic_calibrate_timer(ci);
 		}
 #endif
-		/* Make sure DELAY() is initialized. */
-		DELAY(1);
 		kcsan_cpu_init(ci);
 		again = true;
 	}
@@ -704,7 +709,6 @@ cpu_init(struct cpu_info *ci)
 
 	if (ci != _info_primary) {
 		/* Synchronize TSC */
-		wbinvd();
 		atomic_or_32(>ci_flags, CPUF_RUNNING);
 		tsc_sync_ap(ci);
 	} else {
@@ -720,6 +724,14 @@ cpu_boot_secondary_processors(void)
 	kcpuset_t *cpus;
 	u_long i;
 
+#if NHPET > 0
+	/* Use HPET delay, and re-calibrate TSC on boot CPU using HPET. */
+	if (hpet_delay_p() && x86_delay == i8254_delay) {
+		delay_func = x86_delay = hpet_delay;
+		cpu_get_tsc_freq(curcpu());
+	}
+#endif
+
 #ifndef XEN
 	/* Now that we know the number of CPUs, patch the text segment. */
 	x86_patch(false);
@@ -830,7 +842,6 @@ cpu_start_secondary(struct cpu_info *ci)
 		 */
 		psl = x86_read_psl();
 		x86_disable_intr();
-		wbinvd();
 		tsc_sync_bp(ci);
 		x86_write_psl(psl);
 	}
@@ -861,7 +872,6 @@ cpu_boot_secondary(struct cpu_info *ci)
 		drift = ci->ci_data.cpu_cc_skew;
 		psl = x86_read_psl();
 		x86_disable_intr();
-		wbinvd();
 		tsc_sync_bp(ci);
 		x86_write_psl(psl);
 		drift -= ci->ci_data.cpu_cc_skew;
@@ -907,7 +917,6 @@ cpu_hatch(void *v)
 	 * Synchronize the TSC for the first time. Note that interrupts are
 	 * off at this point.
 	 */
-	wbinvd();
 	atomic_or_32(>ci_flags, CPUF_PRESENT);
 	tsc_sync_ap(ci);
 
@@ -1295,7 +1304,8 @@ cpu_shutdown(device_t dv, int how)
 void
 cpu_get_tsc_freq(struct cpu_info *ci)
 {
-	uint64_t freq = 0, last_tsc;
+	uint64_t freq = 0, t0, t1;
+	int64_t overhead;
 
 	if (cpu_hascounter())
 		freq = cpu_tsc_freq_cpuid(ci);
@@ -1304,11 +1314,31 @@ cpu_get_tsc_freq(struct cpu_info *ci)
 		/* Use TSC frequency taken from CPUID. */
 		ci->ci_data.cpu_cc_freq = freq;
 	} else {
-		/* Calibrate TSC frequency. */
-		last_tsc = cpu_counter_serializing();
+		/*
+		 * Work out the approximate overhead involved below.
+		 * Discard the result of the first go around the loop.
+		 */
+		overhead = 0;		
+		for (int i = 0; i <= 8; i++) {
+			__insn_barrier();
+			t0 = cpu_counter_serializing();
+			(*cpu_nullop_ptr)(NULL);
+			t1 = cpu_counter_serializing();
+			__insn_barrier();
+			if (i > 0) {
+overhead += (t1 - t0);
+			}
+		}
+		overhead >>= 3;
+
+		/* Now warm up x86_delay() and do the calibration. */
+		x86_delay(1);
+		__insn_barrier();
+		t0 = cpu_counter_serializing();
 		x86_delay(10);
-		ci->ci_data.cpu_cc_freq =
-		(cpu_counter_serializing() - last_tsc) * 10;
+		t1 = cpu_counter_serializing();
+		__insn_barrier();
+		ci->ci_data.cpu_cc_freq = (t1 - t0 - 

CVS commit: src/sys/uvm

2020-04-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Apr 23 21:12:06 UTC 2020

Modified Files:
src/sys/uvm: uvm_bio.c

Log Message:
ubc_direct_release(): unbusy the pages directly since pg->interlock is
being taken.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/uvm/uvm_bio.c

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

Modified files:

Index: src/sys/uvm/uvm_bio.c
diff -u src/sys/uvm/uvm_bio.c:1.108 src/sys/uvm/uvm_bio.c:1.109
--- src/sys/uvm/uvm_bio.c:1.108	Tue Apr  7 19:12:25 2020
+++ src/sys/uvm/uvm_bio.c	Thu Apr 23 21:12:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_bio.c,v 1.108 2020/04/07 19:12:25 ad Exp $	*/
+/*	$NetBSD: uvm_bio.c,v 1.109 2020/04/23 21:12:06 ad Exp $	*/
 
 /*
  * Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.108 2020/04/07 19:12:25 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.109 2020/04/23 21:12:06 ad Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_ubc.h"
@@ -910,8 +910,16 @@ ubc_direct_release(struct uvm_object *uo
 	for (int i = 0; i < npages; i++) {
 		struct vm_page *pg = pgs[i];
 
+		pg->flags &= ~PG_BUSY;
+		UVM_PAGE_OWN(pg, NULL);
+		if (pg->flags & PG_RELEASED) {
+			pg->flags &= ~PG_RELEASED;
+			uvm_pagefree(pg);
+			continue;
+		}
 		uvm_pagelock(pg);
 		uvm_pageactivate(pg);
+		uvm_pagewakeup(pg);
 		uvm_pageunlock(pg);
 
 		/* Page was changed, no longer fake and neither clean. */
@@ -922,7 +930,6 @@ ubc_direct_release(struct uvm_object *uo
 			"page %p not dirty", pg);
 		}
 	}
-	uvm_page_unbusy(pgs, npages);
 	rw_exit(uobj->vmobjlock);
 }
 



CVS commit: src/sys/arch/x86/x86

2020-04-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Apr 23 20:38:33 UTC 2020

Modified Files:
src/sys/arch/x86/x86: tsc.c

Log Message:
When computing TSC skew make 8 measurements and use the average.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/x86/x86/tsc.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/x86/x86/tsc.c
diff -u src/sys/arch/x86/x86/tsc.c:1.41 src/sys/arch/x86/x86/tsc.c:1.42
--- src/sys/arch/x86/x86/tsc.c:1.41	Tue Apr 21 02:56:37 2020
+++ src/sys/arch/x86/x86/tsc.c	Thu Apr 23 20:38:33 2020
@@ -1,7 +1,7 @@
-/*	$NetBSD: tsc.c,v 1.41 2020/04/21 02:56:37 msaitoh Exp $	*/
+/*	$NetBSD: tsc.c,v 1.42 2020/04/23 20:38:33 ad Exp $	*/
 
 /*-
- * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * Copyright (c) 2008, 2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.41 2020/04/21 02:56:37 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.42 2020/04/23 20:38:33 ad Exp $");
 
 #include 
 #include 
@@ -229,13 +229,17 @@ tsc_read_bp(struct cpu_info *ci, uint64_
 void
 tsc_sync_bp(struct cpu_info *ci)
 {
-	uint64_t bptsc, aptsc;
+	int64_t bptsc, aptsc, bsum = 0, asum = 0;
 
 	tsc_read_bp(ci, , ); /* discarded - cache effects */
-	tsc_read_bp(ci, , );
+	for (int i = 0; i < 8; i++) {
+		tsc_read_bp(ci, , );
+		bsum += bptsc;
+		asum += aptsc;
+	}
 
 	/* Compute final value to adjust for skew. */
-	ci->ci_data.cpu_cc_skew = bptsc - aptsc;
+	ci->ci_data.cpu_cc_skew = (bsum - asum) >> 3;
 }
 
 /*
@@ -270,7 +274,9 @@ tsc_sync_ap(struct cpu_info *ci)
 {
 
 	tsc_post_ap(ci);
-	tsc_post_ap(ci);
+	for (int i = 0; i < 8; i++) {
+		tsc_post_ap(ci);
+	}
 }
 
 static void



CVS commit: src/sys/dev/ic

2020-04-23 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Apr 23 20:33:57 UTC 2020

Modified Files:
src/sys/dev/ic: hpet.c hpetvar.h

Log Message:
Implement a HPET based DELAY().


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/hpet.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/hpetvar.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/hpet.c
diff -u src/sys/dev/ic/hpet.c:1.13 src/sys/dev/ic/hpet.c:1.14
--- src/sys/dev/ic/hpet.c:1.13	Mon Oct 31 12:47:15 2011
+++ src/sys/dev/ic/hpet.c	Thu Apr 23 20:33:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: hpet.c,v 1.13 2011/10/31 12:47:15 yamt Exp $ */
+/* $NetBSD: hpet.c,v 1.14 2020/04/23 20:33:57 ad Exp $ */
 
 /*
  * Copyright (c) 2006 Nicolas Joly
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hpet.c,v 1.13 2011/10/31 12:47:15 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hpet.c,v 1.14 2020/04/23 20:33:57 ad Exp $");
 
 #include 
 #include 
@@ -43,6 +43,7 @@ __KERNEL_RCSID(0, "$NetBSD: hpet.c,v 1.1
 #include 
 
 #include 
+#include 
 
 #include 
 #include 
@@ -50,9 +51,12 @@ __KERNEL_RCSID(0, "$NetBSD: hpet.c,v 1.1
 static u_int	hpet_get_timecount(struct timecounter *);
 static bool	hpet_resume(device_t, const pmf_qual_t *);
 
+static struct hpet_softc *hpet0 __read_mostly;
+
 int
 hpet_detach(device_t dv, int flags)
 {
+#if 0 /* XXX DELAY() is based off this, detaching is not a good idea. */
 	struct hpet_softc *sc = device_private(dv);
 	int rc;
 
@@ -64,6 +68,9 @@ hpet_detach(device_t dv, int flags)
 	bus_space_write_4(sc->sc_memt, sc->sc_memh, HPET_CONFIG, sc->sc_config);
 
 	return 0;
+#else
+	return EBUSY;
+#endif
 }
 
 void
@@ -84,8 +91,8 @@ hpet_attach_subr(device_t dv)
 	tc->tc_counter_mask = 0x;
 
 	/* Get frequency */
-	val = bus_space_read_4(sc->sc_memt, sc->sc_memh, HPET_PERIOD);
-	if (val == 0 || val > HPET_PERIOD_MAX) {
+	sc->sc_period = bus_space_read_4(sc->sc_memt, sc->sc_memh, HPET_PERIOD);
+	if (sc->sc_period == 0 || sc->sc_period > HPET_PERIOD_MAX) {
 		aprint_error_dev(dv, "invalid timer period\n");
 		return;
 	}
@@ -104,7 +111,7 @@ hpet_attach_subr(device_t dv)
 		}
 	}
 
-	tmp = (1000ULL * 2) / val;
+	tmp = (1000ULL * 2) / sc->sc_period;
 	tc->tc_frequency = (tmp / 2) + (tmp & 1);
 
 	/* Enable timer */
@@ -120,6 +127,9 @@ hpet_attach_subr(device_t dv)
 
 	if (!pmf_device_register(dv, NULL, hpet_resume))
 		aprint_error_dev(dv, "couldn't establish power handler\n");
+
+	if (device_unit(dv) == 0)
+		hpet0 = sc;
 }
 
 static u_int
@@ -143,6 +153,38 @@ hpet_resume(device_t dv, const pmf_qual_
 	return true;
 }
 
+bool
+hpet_delay_p(void)
+{
+
+	return hpet0 != NULL;
+}
+
+void
+hpet_delay(unsigned int us)
+{
+	struct hpet_softc *sc;
+	uint32_t ntick, otick;
+	int64_t delta;
+
+	/*
+	 * Read timer before slow division.  Assume that each read of the
+	 * HPET costs ~500ns.  Aim for the middle and subtract 750ns for
+	 * overhead.
+	 */
+	sc = hpet0;
+	otick = bus_space_read_4(sc->sc_memt, sc->sc_memh, HPET_MCOUNT_LO);
+	delta = (((int64_t)us * 10) - 75000) / sc->sc_period;
+
+	while (delta > 0) {
+		SPINLOCK_BACKOFF_HOOK;
+		ntick = bus_space_read_4(sc->sc_memt, sc->sc_memh,
+		HPET_MCOUNT_LO);
+		delta -= (uint32_t)(ntick - otick);
+		otick = ntick;
+	}
+}
+
 MODULE(MODULE_CLASS_DRIVER, hpet, NULL);
 
 #ifdef _MODULE

Index: src/sys/dev/ic/hpetvar.h
diff -u src/sys/dev/ic/hpetvar.h:1.4 src/sys/dev/ic/hpetvar.h:1.5
--- src/sys/dev/ic/hpetvar.h:1.4	Tue Jun 14 16:33:51 2011
+++ src/sys/dev/ic/hpetvar.h	Thu Apr 23 20:33:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: hpetvar.h,v 1.4 2011/06/14 16:33:51 jruoho Exp $ */
+/* $NetBSD: hpetvar.h,v 1.5 2020/04/23 20:33:57 ad Exp $ */
 
 /*
  * Copyright (c) 2006 Nicolas Joly
@@ -31,6 +31,8 @@
 #ifndef _DEV_IC_HPETVAR_H_
 #define _DEV_IC_HPETVAR_H_
 
+#include 
+
 struct hpet_softc {
 	bus_size_t		sc_mems;
 	bus_space_tag_t		sc_memt;
@@ -38,10 +40,13 @@ struct hpet_softc {
 
 	bool			sc_mapped;
 	uint32_t		sc_config;
+	int32_t			sc_period;
 	struct			timecounter sc_tc;
 };
 
 void	hpet_attach_subr(device_t);
 int	hpet_detach(device_t, int flags);
+void	hpet_delay(unsigned int);
+bool	hpet_delay_p(void);
 
 #endif /* _DEV_IC_HPETVAR_H_ */



CVS commit: src/share/mk

2020-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 23 19:24:53 UTC 2020

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Swirch arm to the new binutils


To generate a diff of this commit:
cvs rdiff -u -r1.1183 -r1.1184 src/share/mk/bsd.own.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.own.mk
diff -u src/share/mk/bsd.own.mk:1.1183 src/share/mk/bsd.own.mk:1.1184
--- src/share/mk/bsd.own.mk:1.1183	Wed Apr 15 19:10:27 2020
+++ src/share/mk/bsd.own.mk	Thu Apr 23 15:24:53 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1183 2020/04/15 23:10:27 christos Exp $
+#	$NetBSD: bsd.own.mk,v 1.1184 2020/04/23 19:24:53 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -170,7 +170,8 @@ EXTERNAL_GDB_SUBDIR=		/does/not/exist
 # What binutils is used?
 #
 .if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" || \
-${MACHINE_ARCH} == "powerpc64" || ${MACHINE_ARCH} == "powerpc"
+${MACHINE_ARCH} == "powerpc64" || ${MACHINE_ARCH} == "powerpc" || \
+${MACHINE_CPU} == "aarch64" || ${MACHINE_CPU} == "arm"
 HAVE_BINUTILS?=	234
 .else
 HAVE_BINUTILS?=	231



CVS commit: src/sys/arch/aarch64/aarch64

2020-04-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Thu Apr 23 17:21:53 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: netbsd32_machdep.c sig_machdep.c

Log Message:
Typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/aarch64/aarch64/netbsd32_machdep.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/aarch64/sig_machdep.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/aarch64/aarch64/netbsd32_machdep.c
diff -u src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.11 src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.12
--- src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.11	Thu Apr 23 16:37:39 2020
+++ src/sys/arch/aarch64/aarch64/netbsd32_machdep.c	Thu Apr 23 17:21:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.11 2020/04/23 16:37:39 tnn Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.12 2020/04/23 17:21:53 skrll Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.11 2020/04/23 16:37:39 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.12 2020/04/23 17:21:53 skrll Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -270,7 +270,7 @@ netbsd32_sendsig_siginfo(const ksiginfo_
 	tf->tf_reg[13] = (uint32_t)(uintptr_t)fp;		/* sp */
 	tf->tf_reg[14] = (uint32_t)(uintptr_t)sdesc->sd_tramp;	/* lr */
 
-	/* Remember if we'ere now on the signal stack */
+	/* Remember if we're now on the signal stack */
 	if (onstack_p)
 		ss->ss_flags |= SS_ONSTACK;
 }

Index: src/sys/arch/aarch64/aarch64/sig_machdep.c
diff -u src/sys/arch/aarch64/aarch64/sig_machdep.c:1.3 src/sys/arch/aarch64/aarch64/sig_machdep.c:1.4
--- src/sys/arch/aarch64/aarch64/sig_machdep.c:1.3	Tue Jul 17 00:36:30 2018
+++ src/sys/arch/aarch64/aarch64/sig_machdep.c	Thu Apr 23 17:21:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sig_machdep.c,v 1.3 2018/07/17 00:36:30 christos Exp $ */
+/* $NetBSD: sig_machdep.c,v 1.4 2020/04/23 17:21:53 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sig_machdep.c,v 1.3 2018/07/17 00:36:30 christos Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sig_machdep.c,v 1.4 2020/04/23 17:21:53 skrll Exp $");
 
 #include 
 #include 
@@ -108,7 +108,7 @@ sendsig_siginfo(const ksiginfo_t *ksi, c
 	tf->tf_pc = handler;
 
 	/*
-	 * Remember if we'ere now on the signal stack.
+	 * Remember if we're now on the signal stack.
 	 */
 	if (onstack_p)
 		ss->ss_flags |= SS_ONSTACK;



CVS commit: src/sys/arch/aarch64/aarch64

2020-04-23 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Thu Apr 23 16:37:39 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: netbsd32_machdep.c

Log Message:
fix inverted logic in NETBSD32 user signal stack handling (PR evbarm/55200)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/aarch64/aarch64/netbsd32_machdep.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/aarch64/aarch64/netbsd32_machdep.c
diff -u src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.10 src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.11
--- src/sys/arch/aarch64/aarch64/netbsd32_machdep.c:1.10	Fri Jan 31 09:08:57 2020
+++ src/sys/arch/aarch64/aarch64/netbsd32_machdep.c	Thu Apr 23 16:37:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.10 2020/01/31 09:08:57 maxv Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.11 2020/04/23 16:37:39 tnn Exp $	*/
 
 /*
  * Copyright (c) 2018 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.10 2020/01/31 09:08:57 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.11 2020/04/23 16:37:39 tnn Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -217,7 +217,7 @@ netbsd32_sendsig_siginfo(const ksiginfo_
 	int error;
 
 	const bool onstack_p =
-	(ss->ss_flags & (SS_DISABLE | SS_ONSTACK)) &&
+	(ss->ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 &&
 	(sa->sa_flags & SA_ONSTACK);
 
 	vaddr_t sp = onstack_p ?



CVS commit: src/sys/arch/amd64/amd64

2020-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 23 16:16:15 UTC 2020

Modified Files:
src/sys/arch/amd64/amd64: netbsd32_machdep.c

Log Message:
use shortcut variables for readability.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/sys/arch/amd64/amd64/netbsd32_machdep.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/netbsd32_machdep.c
diff -u src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.133 src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.134
--- src/sys/arch/amd64/amd64/netbsd32_machdep.c:1.133	Wed Dec 11 21:15:42 2019
+++ src/sys/arch/amd64/amd64/netbsd32_machdep.c	Thu Apr 23 12:16:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_machdep.c,v 1.133 2019/12/12 02:15:42 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_machdep.c,v 1.134 2020/04/23 16:16:14 christos Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.133 2019/12/12 02:15:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.134 2020/04/23 16:16:14 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -214,18 +214,20 @@ netbsd32_sendsig_siginfo(const ksiginfo_
 	int onstack, error;
 	int sig = ksi->ksi_signo;
 	struct netbsd32_sigframe_siginfo *fp, frame;
-	sig_t catcher = SIGACTION(p, sig).sa_handler;
+	const struct sigaction *sa = (p, sig);
+	sig_t catcher = sa->sa_handler;
 	struct trapframe *tf = l->l_md.md_regs;
+	struct sigaltstack * const ss = >l_sigstk;
 
 	/* Do we need to jump onto the signal stack? */
 	onstack =
-	(l->l_sigstk.ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 &&
-	(SIGACTION(p, sig).sa_flags & SA_ONSTACK) != 0;
+	(ss->ss_flags & (SS_DISABLE | SS_ONSTACK)) == 0 &&
+	(sa->sa_flags & SA_ONSTACK) != 0;
 
 	/* Allocate space for the signal handler context. */
 	if (onstack)
 		fp = (struct netbsd32_sigframe_siginfo *)
-		((char *)l->l_sigstk.ss_sp + l->l_sigstk.ss_size);
+		((char *)ss->ss_sp + ss->ss_size);
 	else
 		fp = (struct netbsd32_sigframe_siginfo *)tf->tf_rsp;
 
@@ -252,7 +254,7 @@ netbsd32_sendsig_siginfo(const ksiginfo_
 	frame.sf_uc.uc_flags = _UC_SIGMASK;
 	frame.sf_uc.uc_sigmask = *mask;
 	frame.sf_uc.uc_link = (uint32_t)(uintptr_t)l->l_ctxlink;
-	frame.sf_uc.uc_flags |= (l->l_sigstk.ss_flags & SS_ONSTACK)
+	frame.sf_uc.uc_flags |= (ss->ss_flags & SS_ONSTACK)
 	? _UC_SETSTACK : _UC_CLRSTACK;
 	sendsig_reset(l, sig);
 



CVS commit: src/external/bsd/atf/dist/tools

2020-04-23 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 23 16:05:16 UTC 2020

Modified Files:
src/external/bsd/atf/dist/tools: env.cpp

Log Message:
Add the system binary paths too since tests use them.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/atf/dist/tools/env.cpp

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/atf/dist/tools/env.cpp
diff -u src/external/bsd/atf/dist/tools/env.cpp:1.3 src/external/bsd/atf/dist/tools/env.cpp:1.4
--- src/external/bsd/atf/dist/tools/env.cpp:1.3	Mon Mar 30 21:02:18 2020
+++ src/external/bsd/atf/dist/tools/env.cpp	Thu Apr 23 12:05:15 2020
@@ -53,7 +53,7 @@ impl::get(const std::string& name)
 if (val != NULL)
 	return val;
 if (strcmp(n, "PATH") == 0)
-	return "/bin:/usr/bin";
+	return "/bin:/usr/bin:/sbin:/usr/sbin";
 	
 throw tools::system_error(IMPL_NAME "::set",
 			"Cannot get environment variable '" + name +



CVS commit: src/share/man/man4

2020-04-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Apr 23 15:54:36 UTC 2020

Modified Files:
src/share/man/man4: sk.4

Log Message:
elaborate on why we don't support hardware checksum offloading, and probably
never will


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/share/man/man4/sk.4

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/man4/sk.4
diff -u src/share/man/man4/sk.4:1.23 src/share/man/man4/sk.4:1.24
--- src/share/man/man4/sk.4:1.23	Fri Aug 30 09:24:19 2019
+++ src/share/man/man4/sk.4	Thu Apr 23 15:54:36 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sk.4,v 1.23 2019/08/30 09:24:19 wiz Exp $
+.\"	$NetBSD: sk.4,v 1.24 2020/04/23 15:54:36 jdolecek Exp $
 .\"
 .\" Copyright (c) 2003, The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -58,7 +58,7 @@
 .\"
 .\" $FreeBSD: src/share/man/man4/man4.i386/sk.4,v 1.3 1999/08/28 00:20:29 peter Exp $
 .\"
-.Dd August 24, 2019
+.Dd April 23, 2020
 .Dt SK 4
 .Os
 .Sh NAME
@@ -285,6 +285,12 @@ Support for the Marvell Yukon-2 was adde
 .An Mark Kettenis Aq Mt kette...@openbsd.org .
 .Sh BUGS
 Support for checksum offload is unimplemented.
+Particularly for Yukon-II hardware, there are multiple different
+receive and transmit offload silicon bugs which have to be worked
+around in software when using hardware offloading.
+For this reason, support for hardware offloading
+is not very desirable for therse controllers, and unlikely to be
+ever implemented.
 .Pp
 Performance with at least some Marvell-based adapters is poor,
 especially on loaded PCI buses or when the adapters are behind



CVS commit: src/share/man/man4

2020-04-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Apr 23 15:55:14 UTC 2020

Modified Files:
src/share/man/man4: sk.4

Log Message:
fix tyop


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/share/man/man4/sk.4

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/man4/sk.4
diff -u src/share/man/man4/sk.4:1.24 src/share/man/man4/sk.4:1.25
--- src/share/man/man4/sk.4:1.24	Thu Apr 23 15:54:36 2020
+++ src/share/man/man4/sk.4	Thu Apr 23 15:55:14 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sk.4,v 1.24 2020/04/23 15:54:36 jdolecek Exp $
+.\"	$NetBSD: sk.4,v 1.25 2020/04/23 15:55:14 jdolecek Exp $
 .\"
 .\" Copyright (c) 2003, The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -289,7 +289,7 @@ Particularly for Yukon-II hardware, ther
 receive and transmit offload silicon bugs which have to be worked
 around in software when using hardware offloading.
 For this reason, support for hardware offloading
-is not very desirable for therse controllers, and unlikely to be
+is not very desirable for these controllers, and unlikely to be
 ever implemented.
 .Pp
 Performance with at least some Marvell-based adapters is poor,



CVS commit: src/sys/arch/xen/xen

2020-04-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Apr 23 15:06:50 UTC 2020

Modified Files:
src/sys/arch/xen/xen: if_xennet_xenbus.c

Log Message:
also let backend know that feature-ipv6-csum-offload is supported


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/xen/xen/if_xennet_xenbus.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/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.115 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.116
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.115	Thu Apr 23 14:54:48 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Thu Apr 23 15:06:49 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.115 2020/04/23 14:54:48 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.116 2020/04/23 15:06:49 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.115 2020/04/23 14:54:48 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.116 2020/04/23 15:06:49 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -576,6 +576,12 @@ again:
 		goto abort_transaction;
 	}
 	error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path,
+	"feature-ipv6-csum-offload", "%u", 1);
+	if (error) {
+		errmsg = "writing feature-ipv6-csum-offload";
+		goto abort_transaction;
+	}
+	error = xenbus_printf(xbt, sc->sc_xbusd->xbusd_path,
 	"event-channel", "%u", sc->sc_evtchn);
 	if (error) {
 		errmsg = "writing event channel";



CVS commit: src/sys/arch/xen/xen

2020-04-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Apr 23 14:54:48 UTC 2020

Modified Files:
src/sys/arch/xen/xen: if_xennet_xenbus.c

Log Message:
g/c unused macro


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/xen/xen/if_xennet_xenbus.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/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.114 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.115
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.114	Sun Apr 12 13:57:07 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Thu Apr 23 14:54:48 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.114 2020/04/12 13:57:07 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.115 2020/04/23 14:54:48 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.114 2020/04/12 13:57:07 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.115 2020/04/23 14:54:48 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -195,8 +195,6 @@ struct xennet_xenbus_softc {
 	bool sc_ipv6_csum;	/* whether backend support IPv6 csum offload */
 	krndsource_t sc_rnd_source;
 };
-#define SC_NLIVEREQ(sc) ((sc)->sc_rx_ring.req_prod_pvt - \
-			(sc)->sc_rx_ring.sring->rsp_prod)
 
 static pool_cache_t if_xennetrxbuf_cache;
 static int if_xennetrxbuf_cache_inited=0;



CVS commit: [netbsd-7] src/doc

2020-04-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 23 14:18:09 UTC 2020

Modified Files:
src/doc [netbsd-7]: CHANGES-7.3

Log Message:
Ticket #1728


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

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-7.3
diff -u src/doc/CHANGES-7.3:1.1.2.79 src/doc/CHANGES-7.3:1.1.2.80
--- src/doc/CHANGES-7.3:1.1.2.79	Wed Apr 15 14:52:56 2020
+++ src/doc/CHANGES-7.3	Thu Apr 23 14:18:09 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.3,v 1.1.2.79 2020/04/15 14:52:56 martin Exp $
+# $NetBSD: CHANGES-7.3,v 1.1.2.80 2020/04/23 14:18:09 martin Exp $
 
 A complete list of changes from the NetBSD 7.2 release to the NetBSD 7.3
 release:
@@ -832,3 +832,9 @@ sys/netinet6/nd6_rtr.c1.148 (via pat
 	PR kern/55091 and PR bin/54997: fix default route selection.
 	[kim, ticket #1727]
 
+external/bsd/bind/include/config.h		(apply patch)
+
+	Fix BIND configuration for big-endian hosts.
+	This should make DNSSEC work on such hosts as well.
+	[he, ticket #1728]
+



CVS commit: [netbsd-7] src/external/bsd/bind/include

2020-04-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 23 14:16:01 UTC 2020

Modified Files:
src/external/bsd/bind/include [netbsd-7]: config.h

Log Message:
Apply patch, requested by he in ticket #1728:

src/external/bsd/bind/include/config.h  (apply patch)

Fix BIND configuration for big-endian hosts.
This should make DNSSEC work on such hosts as well.


To generate a diff of this commit:
cvs rdiff -u -r1.14.2.6 -r1.14.2.7 src/external/bsd/bind/include/config.h

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/bind/include/config.h
diff -u src/external/bsd/bind/include/config.h:1.14.2.6 src/external/bsd/bind/include/config.h:1.14.2.7
--- src/external/bsd/bind/include/config.h:1.14.2.6	Tue Jun 20 17:09:58 2017
+++ src/external/bsd/bind/include/config.h	Thu Apr 23 14:16:01 2020
@@ -594,6 +594,11 @@ int sigwait(const unsigned int *set, int
 /* #  undef WORDS_BIGENDIAN */
 # endif
 #endif
+#else /* __NetBSD__ */
+# include 
+# if _BYTE_ORDER == _BIG_ENDIAN
+#  define WORDS_BIGENDIAN 1
+# endif
 #endif
 
 /* Define to empty if `const' does not conform to ANSI C. */



CVS commit: [netbsd-8] src/doc

2020-04-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 23 14:13:05 UTC 2020

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

Log Message:
Tickets #1537 - #1539


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/doc/CHANGES-8.3

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.3
diff -u src/doc/CHANGES-8.3:1.1.2.3 src/doc/CHANGES-8.3:1.1.2.4
--- src/doc/CHANGES-8.3:1.1.2.3	Wed Apr 22 18:21:41 2020
+++ src/doc/CHANGES-8.3	Thu Apr 23 14:13:05 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.3 2020/04/22 18:21:41 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.4 2020/04/23 14:13:05 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -81,3 +81,23 @@ sys/compat/ossaudio/ossaudio.c			1.83
 	ossaudio: Avoid giving userland uninitialized memory.
 	[maxv, ticket #1535]
 
+etc/rc.d/network1.75
+share/man/man5/rc.conf.5			1.172
+
+	Allow rc.conf to setup resolv.conf via resolvconf(8).
+	[kim, ticket #1537]
+
+etc/rc.d/network1.77,1.78 (plus patch)
+share/man/man5/ifconfig.if.5			1.19,1.20
+usr.sbin/rtsold/rtsold.8			1.37-1.42
+
+	Add an "rtsol" keyword to ifconfig.if for enabling IPv6 RS/RA.
+	[kim, ticket #1538]
+
+external/bsd/bind/include/config.h		(apply patch)
+
+	Fix BIND configuration for big-endian hosts.
+	This should make DNSSEC work on such hosts as well.
+	[he, ticket #1539]
+
+



CVS commit: [netbsd-8] src/external/bsd/bind/include

2020-04-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 23 14:10:50 UTC 2020

Modified Files:
src/external/bsd/bind/include [netbsd-8]: config.h

Log Message:
Apply patch, requested by he in ticket #1539:

external/bsd/bind/include/config.h (apply patch)

Fix BIND configuration for big-endian hosts.
This should make DNSSEC work on such hosts as well.


To generate a diff of this commit:
cvs rdiff -u -r1.20.8.1 -r1.20.8.2 src/external/bsd/bind/include/config.h

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/bind/include/config.h
diff -u src/external/bsd/bind/include/config.h:1.20.8.1 src/external/bsd/bind/include/config.h:1.20.8.2
--- src/external/bsd/bind/include/config.h:1.20.8.1	Wed Jun 21 18:03:51 2017
+++ src/external/bsd/bind/include/config.h	Thu Apr 23 14:10:50 2020
@@ -594,6 +594,11 @@ int sigwait(const unsigned int *set, int
 /* #  undef WORDS_BIGENDIAN */
 # endif
 #endif
+#else /* __NetBSD__ */
+# include 
+# if _BYTE_ORDER == _BIG_ENDIAN
+#  define WORDS_BIGENDIAN 1
+# endif
 #endif
 
 /* Define to empty if `const' does not conform to ANSI C. */



CVS commit: [netbsd-8] src

2020-04-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 23 13:59:32 UTC 2020

Modified Files:
src/etc/rc.d [netbsd-8]: network
src/share/man/man5 [netbsd-8]: ifconfig.if.5
src/usr.sbin/rtsold [netbsd-8]: rtsold.8

Log Message:
Pull up following revision(s) (requested by kim in ticket #1538):

usr.sbin/rtsold/rtsold.8: revision 1.37
usr.sbin/rtsold/rtsold.8: revision 1.38
usr.sbin/rtsold/rtsold.8: revision 1.39
share/man/man5/ifconfig.if.5: revision 1.20
etc/rc.d/network: revision 1.77
etc/rc.d/network: revision 1.78 (plus patch)
usr.sbin/rtsold/rtsold.8: revision 1.40
usr.sbin/rtsold/rtsold.8: revision 1.41
usr.sbin/rtsold/rtsold.8: revision 1.42
share/man/man5/ifconfig.if.5: revision 1.19

Add rtsol to the NAME section as well

rc.d/network: improve wording of waiting for DAD to finish

Revert unrelated changes to prior

Use .Dl for one line literal display.  Add SEE ALSO.

Remove trailing dot in SEE ALSO.

Add an "rtsol" keyword to ifconfig.if for enabling IPv6 RS/RA

Sort SEE ALSO.

Update date


To generate a diff of this commit:
cvs rdiff -u -r1.71.8.1 -r1.71.8.2 src/etc/rc.d/network
cvs rdiff -u -r1.18 -r1.18.8.1 src/share/man/man5/ifconfig.if.5
cvs rdiff -u -r1.36 -r1.36.8.1 src/usr.sbin/rtsold/rtsold.8

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

Modified files:

Index: src/etc/rc.d/network
diff -u src/etc/rc.d/network:1.71.8.1 src/etc/rc.d/network:1.71.8.2
--- src/etc/rc.d/network:1.71.8.1	Thu Apr 23 13:43:42 2020
+++ src/etc/rc.d/network	Thu Apr 23 13:59:32 2020
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: network,v 1.71.8.1 2020/04/23 13:43:42 martin Exp $
+# $NetBSD: network,v 1.71.8.2 2020/04/23 13:59:32 martin Exp $
 #
 
 # PROVIDE: network
@@ -215,7 +215,8 @@ network_start_interfaces()
 	# For each line from the $ifconfig_xxN variable or the
 	# /etc/ifconfig.xxN file, we ignore comments and blank lines,
 	# treat lines beginning with "!" as commands to execute, treat
-	# "dhcp" as a special case to invoke dhcpcd, and for any other
+	# "dhcp" as a special case to invoke dhcpcd, treat "rtsol" as
+	# a special case to send a router solicitation, and for any other
 	# line we run "ifconfig xxN", using each line of the file as the
 	# arguments for a separate "ifconfig" invocation.
 	#
@@ -322,6 +323,14 @@ network_start_interfaces()
 		${dhcpcd_flags} $int
 fi
 ;;
+			rtsol)
+if ! checkyesno dhcpcd; then
+	/sbin/sysctl -qw \
+		net.inet6.ip6.accept_rtadv=1
+	/sbin/dhcpcd -q6T --nodhcp6 $int \
+		>/dev/null
+fi
+;;
 			*)
 # Pass args to ifconfig.  Note
 # that args may contain embedded
@@ -447,10 +456,9 @@ network_start_ipv6_autoconf()
 
 network_wait_dad()
 {
-	# Wait for the DAD flags to clear form all addresses.
+	# Wait for the DAD flags to clear from all addresses.
 	if [ -n "$ifconfig_wait_dad_flags" ]; then
-		echo 'Waiting for DAD to complete for' \
-		'statically configured addresses...'
+		echo "Waiting for duplicate address detection to finish..."
 		ifconfig $ifconfig_wait_dad_flags
 	fi
 }

Index: src/share/man/man5/ifconfig.if.5
diff -u src/share/man/man5/ifconfig.if.5:1.18 src/share/man/man5/ifconfig.if.5:1.18.8.1
--- src/share/man/man5/ifconfig.if.5:1.18	Mon Dec 29 14:22:25 2014
+++ src/share/man/man5/ifconfig.if.5	Thu Apr 23 13:59:32 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: ifconfig.if.5,v 1.18 2014/12/29 14:22:25 wiz Exp $
+.\"	$NetBSD: ifconfig.if.5,v 1.18.8.1 2020/04/23 13:59:32 martin Exp $
 .\"
 .\" Copyright (c) 1996 Matthew R. Green
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd December 18, 2014
+.Dd April 15, 2020
 .Dt IFCONFIG.IF 5
 .Os
 .Sh NAME
@@ -94,6 +94,23 @@ is set to true in
 and any per interface configuration or restriction is done in
 .Xr dhcpcd.conf 5 .
 .Pp
+If the line is equal to
+.Dq rtsol ,
+kernel processing of router advertisements will be enabled and an IPv6
+router solicitation message will be sent out on the interface.
+This is useful on networks where default routes can best be learned
+from router advertisements.
+However, if
+.Sy dhcpcd
+has been set to true in
+.Xr rc.conf 5 ,
+it is assumed that
+.Xr dhcpcd 8
+will take care of sending any necessary router solicitation messages and
+processing received router advertisements through its configuration in
+.Xr dhcpcd.conf 5
+instead.
+.Pp
 If a line is empty, or starts with
 .Sq # ,
 the line will be ignored as comment.
@@ -119,6 +136,19 @@ inet6 2001:db8::1 prefixlen 64 alias
 inet6 2001:db8:: prefixlen 64 alias anycast
 .Ed
 .Pp
+For networks that do not use a virtual address for the default gateway
+that could be set using a single address in
+.Sy defaultroute6 ,
+static IPv6 address configuration could use the
+.Dq rtsol
+keyword instead to solicit router advertisements 

CVS commit: [netbsd-8] src

2020-04-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 23 13:43:42 UTC 2020

Modified Files:
src/etc/rc.d [netbsd-8]: network
src/share/man/man5 [netbsd-8]: rc.conf.5

Log Message:
Pull up following revision(s) (requested by kim in ticket #1537):

share/man/man5/rc.conf.5: revision 1.172
etc/rc.d/network: revision 1.75

Allow rc.conf to setup resolv.conf via resolvconf(8).

This allows all static network config to be in rc.conf rather than
spread across files.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.71.8.1 src/etc/rc.d/network
cvs rdiff -u -r1.166.6.1 -r1.166.6.2 src/share/man/man5/rc.conf.5

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

Modified files:

Index: src/etc/rc.d/network
diff -u src/etc/rc.d/network:1.71 src/etc/rc.d/network:1.71.8.1
--- src/etc/rc.d/network:1.71	Sun Mar  6 18:50:06 2016
+++ src/etc/rc.d/network	Thu Apr 23 13:43:42 2020
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: network,v 1.71 2016/03/06 18:50:06 christos Exp $
+# $NetBSD: network,v 1.71.8.1 2020/04/23 13:43:42 martin Exp $
 #
 
 # PROVIDE: network
@@ -52,6 +52,7 @@ network_start()
 	have_inet6 &&
 	network_start_ipv6_autoconf
 	network_wait_dad
+	network_start_resolv
 	network_start_local
 }
 
@@ -454,6 +455,32 @@ network_wait_dad()
 	fi
 }
 
+network_start_resolv()
+{
+	resconf=
+
+	if [ -n "$dns_domain" ]; then
+		resconf="${resconf}domain $dns_domain$nl"
+	fi
+	if [ -n "$dns_search" ]; then
+		resconf="${resconf}search $dns_search$nl"
+	fi
+	for n in $dns_nameservers; do
+		resconf="${resconf}nameserver $n$nl"
+	done
+	if [ -n "$dns_sortlist" ]; then
+		resconf="${resconf}sortlist $dns_sortlist$nl"
+	fi
+	if [ -n "$dns_options" ]; then
+		resconf="${resconf}options $dns_options$nl"
+	fi
+	if [ -n "$resconf" ]; then
+		resconf="# Generated by /etc/rc.d/network$nl$resconf"
+		echo 'Configuring resolv.conf'
+		printf %s "$resconf" | resolvconf -m "${dns_metric:-0}" -a network
+	fi
+}
+
 network_start_local()
 {
 	# XXX this must die
@@ -467,6 +494,7 @@ network_stop()
 	echo "Stopping network."
 
 	network_stop_local
+	network_stop_resolv
 	network_stop_aliases
 	[ "$net_interfaces" != NO ] &&
 	network_stop_interfaces
@@ -481,6 +509,11 @@ network_stop_local()
 	fi
 }
 
+network_stop_resolv()
+{
+	resolvconf -f -d network
+}
+
 network_stop_aliases()
 {
 	echo "Deleting aliases."

Index: src/share/man/man5/rc.conf.5
diff -u src/share/man/man5/rc.conf.5:1.166.6.1 src/share/man/man5/rc.conf.5:1.166.6.2
--- src/share/man/man5/rc.conf.5:1.166.6.1	Tue May 14 11:33:43 2019
+++ src/share/man/man5/rc.conf.5	Thu Apr 23 13:43:42 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: rc.conf.5,v 1.166.6.1 2019/05/14 11:33:43 martin Exp $
+.\"	$NetBSD: rc.conf.5,v 1.166.6.2 2020/04/23 13:43:42 martin Exp $
 .\"
 .\" Copyright (c) 1996 Matthew R. Green
 .\" All rights reserved.
@@ -55,7 +55,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.Dd May 14, 2019
+.Dd April 23, 2020
 .Dt RC.CONF 5
 .Os
 .Sh NAME
@@ -249,6 +249,30 @@ If empty or not set, then the contents o
 A space separated list of interface names.
 These interfaces will be configured down when going from multiuser to single-user
 mode or on system shutdown.
+.It Sy dns_domain
+A string.
+Sets domain in
+.Pa /etc/resolv.conf .
+.It Sy dns_search
+A string.
+Sets search in
+.Pa /etc/resolv.conf .
+.It Sy dns_nameservers
+A string of space seperated domain name servers.
+Sets nameserver for each value in
+.Pa /etc/resolv.conf .
+.It Sy dns_sortlist
+A string.
+Sets sortlist in
+.Pa /etc/resolv.conf .
+.It Sy dns_options
+A string.
+Sets options in
+.Pa /etc/resolv.conf .
+.It Sy dns_metric
+An unsigned integer.
+Sets the priority of the above DNS to other sources, lowest wins.
+Defaults to 0.
 .Pp
 This is important for some stateful interfaces, for example PPP over ISDN
 connections that cost money by connection time or PPPoE interfaces which



CVS commit: src/sys/arch/x86/pci

2020-04-23 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr 23 13:40:36 UTC 2020

Modified Files:
src/sys/arch/x86/pci: amdsmn.c

Log Message:
Apply previous change ("Don't mix sign and unsigned operands. Just use
size_t for the loop.") to another loop variable.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/x86/pci/amdsmn.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/x86/pci/amdsmn.c
diff -u src/sys/arch/x86/pci/amdsmn.c:1.8 src/sys/arch/x86/pci/amdsmn.c:1.9
--- src/sys/arch/x86/pci/amdsmn.c:1.8	Mon Apr 20 13:02:57 2020
+++ src/sys/arch/x86/pci/amdsmn.c	Thu Apr 23 13:40:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdsmn.c,v 1.8 2020/04/20 13:02:57 joerg Exp $	*/
+/*	$NetBSD: amdsmn.c,v 1.9 2020/04/23 13:40:36 simonb Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2019 Conrad Meyer 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.8 2020/04/20 13:02:57 joerg Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.9 2020/04/23 13:40:36 simonb Exp $ ");
 
 /*
  * Driver for the AMD Family 15h (model 60+) and 17h CPU
@@ -107,7 +107,7 @@ static int
 amdsmn_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct pci_attach_args *pa = aux;
-	unsigned int i;
+	size_t i;
 
 	if (PCI_VENDOR(pa->pa_id) != PCI_VENDOR_AMD)
 		return 0;



CVS commit: [netbsd-9] src/doc

2020-04-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 23 13:33:05 UTC 2020

Modified Files:
src/doc [netbsd-9]: CHANGES-9.1

Log Message:
Tickets #844 and #845


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.39 -r1.1.2.40 src/doc/CHANGES-9.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-9.1
diff -u src/doc/CHANGES-9.1:1.1.2.39 src/doc/CHANGES-9.1:1.1.2.40
--- src/doc/CHANGES-9.1:1.1.2.39	Wed Apr 22 18:26:06 2020
+++ src/doc/CHANGES-9.1	Thu Apr 23 13:33:05 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.39 2020/04/22 18:26:06 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.40 2020/04/23 13:33:05 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -985,3 +985,18 @@ external/gpl3/gcc/lib/libsupc++/Makefile
 	PR 54660: pull in atomicity.h (atomicity.cc) on sparc.
 	[mrg, ticket #843]
 
+external/bsd/dhcpcd/dist/src/defs.h		(apply patch)
+external/bsd/dhcpcd/dist/src/dhcp.c		(apply patch)
+external/bsd/dhcpcd/dist/src/dhcp6.c		(apply patch)
+external/bsd/dhcpcd/dist/src/ipv6nd.c		(apply patch)
+doc/3RDPARTY	(apply patch)
+
+	Update to dhcpcd-8.1.9 which fixes alignment issues.
+	[roy, ticket #844]
+
+sys/netinet6/nd6_nbr.c1.178
+
+	inet6: avoid setting llentry to an invalid state when processing a
+	solicited ND6 packet.
+	[roy, ticket #845]
+



CVS commit: [netbsd-9] src/sys/netinet6

2020-04-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 23 13:31:43 UTC 2020

Modified Files:
src/sys/netinet6 [netbsd-9]: nd6_nbr.c

Log Message:
Pull up following revision(s) (requested by roy in ticket #845):

sys/netinet6/nd6_nbr.c: revision 1.178

inet6: nd6_na_input() now considers ln_state <= ND6_LLINFO_INCOMPLETE

Otherwise if ln_state != ND6_LLINFO_INCOMPLETE and the is no lladdr
and this message was solicited then ln_state is set to ND6_LLINFO_REACHABLE
which could then cause a panic in nd6_resolve().

If ln_state > ND6_LLINFO_INCOMPLETE then it's assumed we have a lladdr.
Potentially this could have been triggered by the introduction of
ND6_LLINFO_PURGE in nd6.c r1.143 but also by the re-introduction of
ND6_LLINFO_INCOMPLETE in nd6.c r1.263.

Depending on the timing, it's technically possible to receive such
a message after the llentry is created with ND6_LLINFO_NOSTATE.


To generate a diff of this commit:
cvs rdiff -u -r1.166.2.4 -r1.166.2.5 src/sys/netinet6/nd6_nbr.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/netinet6/nd6_nbr.c
diff -u src/sys/netinet6/nd6_nbr.c:1.166.2.4 src/sys/netinet6/nd6_nbr.c:1.166.2.5
--- src/sys/netinet6/nd6_nbr.c:1.166.2.4	Mon Sep 30 15:55:40 2019
+++ src/sys/netinet6/nd6_nbr.c	Thu Apr 23 13:31:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nd6_nbr.c,v 1.166.2.4 2019/09/30 15:55:40 martin Exp $	*/
+/*	$NetBSD: nd6_nbr.c,v 1.166.2.5 2020/04/23 13:31:43 martin Exp $	*/
 /*	$KAME: nd6_nbr.c,v 1.61 2001/02/10 16:06:14 jinmei Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.166.2.4 2019/09/30 15:55:40 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nd6_nbr.c,v 1.166.2.5 2020/04/23 13:31:43 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -735,7 +735,7 @@ nd6_na_input(struct mbuf *m, int off, in
 		goto freeit;
 
 	rt_cmd = 0;
-	if (ln->ln_state == ND6_LLINFO_INCOMPLETE) {
+	if (ln->ln_state <= ND6_LLINFO_INCOMPLETE) {
 		/*
 		 * If the link-layer has address, and no lladdr option came,
 		 * discard the packet.



CVS commit: src/sys/arch/macppc/dev

2020-04-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 23 12:56:40 UTC 2020

Modified Files:
src/sys/arch/macppc/dev: lmu.c

Log Message:
make this work properly:
- get rid of cargo-culted register assignments, I found the right ones by
  experiment, now both light sensors report sane values
- keyboard brightness seems to max out at 16, act like it
- do what MacOS does and fade keyboard brightness instead of just switching
- add sysctls to configure keyboard brightness and environmental light
  thresholds
- don't poll the chip more often than once a second


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/macppc/dev/lmu.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/macppc/dev/lmu.c
diff -u src/sys/arch/macppc/dev/lmu.c:1.3 src/sys/arch/macppc/dev/lmu.c:1.4
--- src/sys/arch/macppc/dev/lmu.c:1.3	Thu Apr 23 09:47:31 2020
+++ src/sys/arch/macppc/dev/lmu.c	Thu Apr 23 12:56:40 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lmu.c,v 1.3 2020/04/23 09:47:31 macallan Exp $ */
+/* $NetBSD: lmu.c,v 1.4 2020/04/23 12:56:40 macallan Exp $ */
 
 /*-
  * Copyright (c) 2020 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.3 2020/04/23 09:47:31 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.4 2020/04/23 12:56:40 macallan Exp $");
 
 #include 
 #include 
@@ -40,11 +40,18 @@ __KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.3 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
 #include 
 
+#ifdef LMU_DEBUG
+#define DPRINTF printf
+#else
+#define DPRINTF if (0) printf
+#endif
+
 struct lmu_softc {
 	device_t	sc_dev;
 	i2c_tag_t	sc_i2c;
@@ -54,7 +61,9 @@ struct lmu_softc {
 	struct sysmon_envsys *sc_sme;
 	envsys_data_t	sc_sensors[2];
 	callout_t	sc_adjust;
-	int		sc_thresh, sc_hyst, sc_level;
+	int		sc_thresh, sc_hyst, sc_level, sc_target, sc_current;
+	int		sc_lux[2];
+	time_t		sc_last;
 	int		sc_lid_state, sc_video_state;
 };
 
@@ -65,6 +74,8 @@ static void	lmu_sensors_refresh(struct s
 static void	lmu_set_brightness(struct lmu_softc *, int);
 static int	lmu_get_brightness(struct lmu_softc *, int);
 static void	lmu_adjust(void *);
+static int 	lmu_sysctl(SYSCTLFN_ARGS);
+static int 	lmu_sysctl_thresh(SYSCTLFN_ARGS);
 
 CFATTACH_DECL_NEW(lmu, sizeof(struct lmu_softc),
 lmu_match, lmu_attach, NULL, NULL);
@@ -75,6 +86,11 @@ static const struct device_compatible_en
 	{ NULL,			0 }
 };
 
+/* time between polling the light sensors */
+#define LMU_POLL	(hz * 2)
+/* time between updates to keyboard brightness */
+#define LMU_FADE	(hz / 16)
+
 static void
 lmu_lid_open(device_t dev)
 {
@@ -125,11 +141,13 @@ lmu_attach(device_t parent, device_t sel
 	struct lmu_softc *sc = device_private(self);
 	struct i2c_attach_args *ia = aux;
 	envsys_data_t *s;
+	const struct sysctlnode *me;
 
 	sc->sc_dev = self;
 	sc->sc_i2c = ia->ia_tag;
 	sc->sc_addr = ia->ia_addr;
 	sc->sc_node = ia->ia_cookie;
+	sc->sc_last = 0;
 
 	aprint_naive("\n");
 	aprint_normal(": ambient light sensor\n");
@@ -161,7 +179,7 @@ lmu_attach(device_t parent, device_t sel
 	s->state = ENVSYS_SINVALID;
 	s->units = ENVSYS_LUX;
 	strcpy(s->desc, "left");
-	s->private = 2;
+	s->private = 1;
 	sysmon_envsys_sensor_attach(sc->sc_sme, s);
 
 	sysmon_envsys_register(sc->sc_sme);
@@ -169,7 +187,30 @@ lmu_attach(device_t parent, device_t sel
 	/* TODO: make this adjustable via sysctl */
 	sc->sc_thresh = 300;
 	sc->sc_hyst = 30;
-	sc->sc_level = 100;
+	sc->sc_level = 16;
+	sc->sc_target = 0;
+	sc->sc_current = 0;
+
+	sysctl_createv(NULL, 0, NULL, ,
+		CTLFLAG_READWRITE,
+		CTLTYPE_NODE, "lmu",
+		SYSCTL_DESCR("LMU driver"),
+		NULL, 0, NULL, 0,
+		CTL_HW, CTL_CREATE, CTL_EOL);
+
+	sysctl_createv(NULL, 0, NULL, NULL,
+		CTLFLAG_READWRITE,
+		CTLTYPE_INT, "level",
+		SYSCTL_DESCR("keyboard brightness"),
+		lmu_sysctl, 0, (void *)sc, 0,
+		CTL_HW, me->sysctl_num, CTL_CREATE, CTL_EOL);
+
+	sysctl_createv(NULL, 0, NULL, NULL,
+		CTLFLAG_READWRITE,
+		CTLTYPE_INT, "threshold",
+		SYSCTL_DESCR("environmental light threshold"),
+		lmu_sysctl_thresh, 1, (void *)sc, 0,
+		CTL_HW, me->sysctl_num, CTL_CREATE, CTL_EOL);
 
 	callout_init(>sc_adjust, 0);
 	callout_setfunc(>sc_adjust, lmu_adjust, sc);
@@ -193,28 +234,38 @@ lmu_sensors_refresh(struct sysmon_envsys
 static int
 lmu_get_brightness(struct lmu_softc *sc, int reg)
 {
-	int error;
-	uint16_t buf;
-	uint8_t cmd = reg;
+	int error, i;
+	uint16_t buf[2];
+	uint8_t cmd = 0;
+
+	if (reg > 1) return -1;
+	if (time_second == sc->sc_last)
+		return sc->sc_lux[reg];
 
 	iic_acquire_bus(sc->sc_i2c, 0);
 	error = iic_exec(sc->sc_i2c, I2C_OP_READ_WITH_STOP,
-		sc->sc_addr, , 1, , 2, 0);
+		sc->sc_addr, , 1, buf, 4, 0);
 	iic_release_bus(sc->sc_i2c, 0);
 	if (error) return -1;
-	return be16toh(buf);
+	sc->sc_last = time_second;
+
+	for (i = 0; i < 2; i++)
+		sc->sc_lux[i] = be16toh(buf[i]);
+
+	DPRINTF("<%d %04x %04x>", reg, buf[0], buf[1]);
+	
+	return 

CVS commit: [netbsd-9] src

2020-04-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Apr 23 12:06:10 UTC 2020

Modified Files:
src/doc [netbsd-9]: 3RDPARTY
src/external/bsd/dhcpcd/dist/src [netbsd-9]: defs.h dhcp.c dhcp6.c
ipv6nd.c

Log Message:
Apply patch, requested by roy in ticket #844:

external/bsd/dhcpcd/dist/src/defs.h(apply patch)
external/bsd/dhcpcd/dist/src/dhcp.c(apply patch)
external/bsd/dhcpcd/dist/src/dhcp6.c   (apply patch)
external/bsd/dhcpcd/dist/src/ipv6nd.c  (apply patch)
doc/3RDPARTY   (apply patch)

Update to dhcpcd-8.1.9 which fixes alignment issues.


To generate a diff of this commit:
cvs rdiff -u -r1.1640.2.14 -r1.1640.2.15 src/doc/3RDPARTY
cvs rdiff -u -r1.1.1.25.2.8 -r1.1.1.25.2.9 \
src/external/bsd/dhcpcd/dist/src/defs.h
cvs rdiff -u -r1.23.2.7 -r1.23.2.8 src/external/bsd/dhcpcd/dist/src/dhcp.c
cvs rdiff -u -r1.11.2.7 -r1.11.2.8 src/external/bsd/dhcpcd/dist/src/dhcp6.c
cvs rdiff -u -r1.10.2.6 -r1.10.2.7 src/external/bsd/dhcpcd/dist/src/ipv6nd.c

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1640.2.14 src/doc/3RDPARTY:1.1640.2.15
--- src/doc/3RDPARTY:1.1640.2.14	Sun Apr 12 17:33:24 2020
+++ src/doc/3RDPARTY	Thu Apr 23 12:06:09 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1640.2.14 2020/04/12 17:33:24 martin Exp $
+#	$NetBSD: 3RDPARTY,v 1.1640.2.15 2020/04/23 12:06:09 martin Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -341,12 +341,12 @@ Notes:
 Use the dhcp2netbsd script.
 
 Package:	dhcpcd
-Version:	8.1.8
-Current Vers:	8.1.8
+Version:	8.1.9
+Current Vers:	8.1.9
 Maintainer:	roy
 Archive Site:	ftp://roy.marples.name/pub/dhcpcd/
 Home Page:	http://roy.marples.name/projects/dhcpcd/
-Date:		2020-04-12
+Date:		2020-04-21
 Mailing List: 	dhcpcd-disc...@marples.name
 License:	BSD (2-clause)
 Location:	external/bsd/dhcpcd/dist

Index: src/external/bsd/dhcpcd/dist/src/defs.h
diff -u src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.25.2.8 src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.25.2.9
--- src/external/bsd/dhcpcd/dist/src/defs.h:1.1.1.25.2.8	Sun Apr 12 17:33:24 2020
+++ src/external/bsd/dhcpcd/dist/src/defs.h	Thu Apr 23 12:06:09 2020
@@ -29,7 +29,7 @@
 #define CONFIG_H
 
 #define PACKAGE			"dhcpcd"
-#define VERSION			"8.1.8"
+#define VERSION			"8.1.9"
 
 #ifndef CONFIG
 # define CONFIG			SYSCONFDIR "/" PACKAGE ".conf"

Index: src/external/bsd/dhcpcd/dist/src/dhcp.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp.c:1.23.2.7 src/external/bsd/dhcpcd/dist/src/dhcp.c:1.23.2.8
--- src/external/bsd/dhcpcd/dist/src/dhcp.c:1.23.2.7	Sun Apr 12 08:29:40 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcp.c	Thu Apr 23 12:06:09 2020
@@ -3308,7 +3308,7 @@ is_packet_udp_bootp(void *packet, size_t
 	memcpy(, (char *)ip + ip_hlen, sizeof(udp));
 	if (ntohs(udp.uh_ulen) < sizeof(udp))
 		return false;
-	if (ip_hlen + (size_t)ntohs(udp.uh_ulen) > plen)
+	if (ip_hlen + ntohs(udp.uh_ulen) > plen)
 		return false;
 
 	/* Check it's to and from the right ports. */
@@ -3453,12 +3453,16 @@ dhcp_readbpf(void *arg)
 			}
 			break;
 		}
-		if (bytes < fl) {
-			logerrx("%s: %s: short frame header",
-			__func__, ifp->name);
-			break;
+		if (fl != 0) {
+			if (bytes < fl) {
+logerrx("%s: %s: short frame header",
+__func__, ifp->name);
+break;
+			}
+			bytes -= fl;
+			memmove(buf, buf + fl, (size_t)bytes);
 		}
-		dhcp_packet(ifp, buf + fl, (size_t)(bytes - fl));
+		dhcp_packet(ifp, buf, (size_t)bytes);
 		/* Check we still have a state after processing. */
 		if ((state = D_STATE(ifp)) == NULL)
 			break;
@@ -3506,15 +3510,18 @@ dhcp_readudp(struct dhcpcd_ctx *ctx, str
 		.iov_base = buf,
 		.iov_len = sizeof(buf),
 	};
+	union {
+		struct cmsghdr hdr;
 #ifdef IP_RECVIF
-	unsigned char ctl[CMSG_SPACE(sizeof(struct sockaddr_dl))] = { 0 };
+		uint8_t buf[CMSG_SPACE(sizeof(struct sockaddr_dl))];
 #else
-	unsigned char ctl[CMSG_SPACE(sizeof(struct in_pktinfo))] = { 0 };
+		uint8_t buf[CMSG_SPACE(sizeof(struct in_pktinfo))];
 #endif
+	} cmsgbuf = { .buf = { 0 } };
 	struct msghdr msg = {
 	.msg_name = , .msg_namelen = sizeof(from),
 	.msg_iov = , .msg_iovlen = 1,
-	.msg_control = ctl, .msg_controllen = sizeof(ctl),
+	.msg_control = buf, .msg_controllen = sizeof(cmsgbuf.buf),
 	};
 	int s;
 	ssize_t bytes;

Index: src/external/bsd/dhcpcd/dist/src/dhcp6.c
diff -u src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.11.2.7 src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.11.2.8
--- src/external/bsd/dhcpcd/dist/src/dhcp6.c:1.11.2.7	Sun Apr 12 17:57:13 2020
+++ src/external/bsd/dhcpcd/dist/src/dhcp6.c	Thu Apr 23 12:06:09 2020
@@ -3581,11 +3581,14 @@ dhcp6_recv(struct dhcpcd_ctx *ctx, struc
 		.iov_base = buf,
 		.iov_len = sizeof(buf),
 	};
-	unsigned char 

CVS commit: src/distrib/sets/lists/modules

2020-04-23 Thread Yuuki Enomoto
Module Name:src
Committed By:   uki
Date:   Thu Apr 23 11:41:28 UTC 2020

Modified Files:
src/distrib/sets/lists/modules: mi

Log Message:
Add -unknown- to "./netbsd" in modules/mi to fix "build.sh syspkgs" failure


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/distrib/sets/lists/modules/mi

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

Modified files:

Index: src/distrib/sets/lists/modules/mi
diff -u src/distrib/sets/lists/modules/mi:1.136 src/distrib/sets/lists/modules/mi:1.137
--- src/distrib/sets/lists/modules/mi:1.136	Sat Apr  4 19:50:53 2020
+++ src/distrib/sets/lists/modules/mi	Thu Apr 23 11:41:28 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.136 2020/04/04 19:50:53 christos Exp $
+# $NetBSD: mi,v 1.137 2020/04/23 11:41:28 uki Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -483,4 +483,4 @@
 ./etc/mtree/set.modulesmodules-sys-root	kmod
 ./stand/@MACHINE@modules-base-kernel	kmod,!kernel_dir
 ./stand/@MACHINE@/@OSRELEASE@			modules-base-kernel	kmod,!kernel_dir
-./netbsdkmod,kernel_dir
+./netbsd	-unknown-		kmod,kernel_dir



CVS commit: src/sys/fs/adosfs

2020-04-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Apr 23 09:58:37 UTC 2020

Modified Files:
src/sys/fs/adosfs: advnops.c

Log Message:
fix obvious typo in error handling - buf error should go to b_error


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/fs/adosfs/advnops.c

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

Modified files:

Index: src/sys/fs/adosfs/advnops.c
diff -u src/sys/fs/adosfs/advnops.c:1.51 src/sys/fs/adosfs/advnops.c:1.52
--- src/sys/fs/adosfs/advnops.c:1.51	Fri Jan 17 20:08:07 2020
+++ src/sys/fs/adosfs/advnops.c	Thu Apr 23 09:58:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: advnops.c,v 1.51 2020/01/17 20:08:07 ad Exp $	*/
+/*	$NetBSD: advnops.c,v 1.52 2020/04/23 09:58:37 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.51 2020/01/17 20:08:07 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: advnops.c,v 1.52 2020/04/23 09:58:37 jdolecek Exp $");
 
 #include 
 #include 
@@ -387,7 +387,7 @@ adosfs_strategy(void *v)
 	if (bp->b_blkno == bp->b_lblkno) {
 		error = VOP_BMAP(vp, bp->b_lblkno, NULL, >b_blkno, NULL);
 		if (error) {
-			bp->b_flags = error;
+			bp->b_error = error;
 			biodone(bp);
 			goto reterr;
 		}



CVS commit: src/sys/arch/macppc/dev

2020-04-23 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Apr 23 09:47:31 UTC 2020

Modified Files:
src/sys/arch/macppc/dev: lmu.c

Log Message:
drop openfirm.h include


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/macppc/dev/lmu.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/macppc/dev/lmu.c
diff -u src/sys/arch/macppc/dev/lmu.c:1.2 src/sys/arch/macppc/dev/lmu.c:1.3
--- src/sys/arch/macppc/dev/lmu.c:1.2	Thu Feb  6 02:17:24 2020
+++ src/sys/arch/macppc/dev/lmu.c	Thu Apr 23 09:47:31 2020
@@ -1,4 +1,4 @@
- /* $NetBSD: lmu.c,v 1.2 2020/02/06 02:17:24 macallan Exp $ */
+/* $NetBSD: lmu.c,v 1.3 2020/04/23 09:47:31 macallan Exp $ */
 
 /*-
  * Copyright (c) 2020 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.2 2020/02/06 02:17:24 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.3 2020/04/23 09:47:31 macallan Exp $");
 
 #include 
 #include 
@@ -41,8 +41,6 @@ __KERNEL_RCSID(0, "$NetBSD: lmu.c,v 1.2 
 #include 
 #include 
 
-#include 
-
 #include 
 
 #include 
@@ -56,7 +54,7 @@ struct lmu_softc {
 	struct sysmon_envsys *sc_sme;
 	envsys_data_t	sc_sensors[2];
 	callout_t	sc_adjust;
-	int sc_thresh, sc_hyst, sc_level;
+	int		sc_thresh, sc_hyst, sc_level;
 	int		sc_lid_state, sc_video_state;
 };
 



CVS commit: src/sys/dev

2020-04-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Apr 23 09:40:08 UTC 2020

Modified Files:
src/sys/dev: vnd.c

Log Message:
pass b_flags B_PHYS and B_RAW when setting up the buf for underlying device

should fix misfired KASSERT() in xbd(4)


To generate a diff of this commit:
cvs rdiff -u -r1.276 -r1.277 src/sys/dev/vnd.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/vnd.c
diff -u src/sys/dev/vnd.c:1.276 src/sys/dev/vnd.c:1.277
--- src/sys/dev/vnd.c:1.276	Mon Apr 13 08:05:02 2020
+++ src/sys/dev/vnd.c	Thu Apr 23 09:40:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnd.c,v 1.276 2020/04/13 08:05:02 maxv Exp $	*/
+/*	$NetBSD: vnd.c,v 1.277 2020/04/23 09:40:08 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008, 2020 The NetBSD Foundation, Inc.
@@ -91,7 +91,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.276 2020/04/13 08:05:02 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vnd.c,v 1.277 2020/04/23 09:40:08 jdolecek Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_vnd.h"
@@ -724,7 +724,7 @@ vndthread(void *arg)
 
 		bp = >vx_buf;
 		buf_init(bp);
-		bp->b_flags = (obp->b_flags & B_READ);
+		bp->b_flags = (obp->b_flags & (B_READ | B_PHYS | B_RAW));
 		bp->b_oflags = obp->b_oflags;
 		bp->b_cflags = obp->b_cflags;
 		bp->b_iodone = vndiodone;



CVS commit: src/usr.bin/units

2020-04-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Apr 23 09:38:17 UTC 2020

Modified Files:
src/usr.bin/units: units.lib

Log Message:
If we're having Thai units, make them correct.  A tarangwah is a square wah,
which is ~4m^2 but not exactly (just as a wah is not exactly 2m, but close).
(wah apparently comes from the width of a person with hands outstretched...)


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/units/units.lib

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

Modified files:

Index: src/usr.bin/units/units.lib
diff -u src/usr.bin/units/units.lib:1.23 src/usr.bin/units/units.lib:1.24
--- src/usr.bin/units/units.lib:1.23	Wed Apr 22 16:57:57 2020
+++ src/usr.bin/units/units.lib	Thu Apr 23 09:38:17 2020
@@ -1,4 +1,4 @@
-/	$NetBSD: units.lib,v 1.23 2020/04/22 16:57:57 scole Exp $
+/	$NetBSD: units.lib,v 1.24 2020/04/23 09:38:17 kre Exp $
 
 / primitive units
 
@@ -665,7 +665,7 @@ yot			400 sen
 
 / Thai area
 
-tarangwah		4 m2
+tarangwah		wah2
 ngan			100 tarangwah
 rai			4 ngan
 



CVS commit: src/doc

2020-04-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Apr 23 09:22:02 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
fix too many zeroes in date entry


To generate a diff of this commit:
cvs rdiff -u -r1.2678 -r1.2679 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.2678 src/doc/CHANGES:1.2679
--- src/doc/CHANGES:1.2678	Thu Apr 23 09:17:37 2020
+++ src/doc/CHANGES	Thu Apr 23 09:22:02 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2678 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2679 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -174,7 +174,7 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 		[maxv 20200412]
 	aarch64: Add support for Branch Target Identification (BTI).
 		[maxv 20200413]
-	umass(4): Removed obsolete ISD-ATA support [jdolecek 202000413]
+	umass(4): Removed obsolete ISD-ATA support [jdolecek 20200413]
 	dhcpcd(8): Import version 9.0.1 [roy 20200413]
 	xbd(4): Make the driver MP-safe [jdolecek 20200413]
 	xbd(4): Support regular 64KB MAXPHYS [jdolecek 20200415]



CVS commit: src/doc

2020-04-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Apr 23 09:17:37 UTC 2020

Modified Files:
src/doc: CHANGES

Log Message:
xbdback(4) is MP-safe


To generate a diff of this commit:
cvs rdiff -u -r1.2677 -r1.2678 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.2677 src/doc/CHANGES:1.2678
--- src/doc/CHANGES:1.2677	Tue Apr 21 14:29:00 2020
+++ src/doc/CHANGES	Thu Apr 23 09:17:37 2020
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2677 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2678 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -181,3 +181,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	xbd(4): Support indirect segments [jdolecek 20200416]
 	dhcpcd(8): Import version 9.0.2 [roy 20200421]
 	xbdback(4): Support indirect segments [jdolecek 20200421]
+	xbdback(4): Make the driver MP-safe [jdolecek 20200423]



CVS commit: src/sys/arch/xen/xen

2020-04-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Apr 23 09:16:21 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xbdback_xenbus.c

Log Message:
make xbdback actually MPSAFE and stop using KERNEL_LOCK()

remove no longer necessary atomics, the counters are now always
updated with held mutex


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/xen/xen/xbdback_xenbus.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/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.89 src/sys/arch/xen/xen/xbdback_xenbus.c:1.90
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.89	Thu Apr 23 08:09:25 2020
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Thu Apr 23 09:16:21 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbdback_xenbus.c,v 1.89 2020/04/23 08:09:25 jdolecek Exp $  */
+/*  $NetBSD: xbdback_xenbus.c,v 1.90 2020/04/23 09:16:21 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,9 +26,8 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.89 2020/04/23 08:09:25 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.90 2020/04/23 09:16:21 jdolecek Exp $");
 
-#include 
 #include 
 #include 
 #include 
@@ -227,11 +226,11 @@ struct xbdback_instance {
 	struct timeval xbdi_lasterr_time;/* error time tracking */
 };
 /* Manipulation of the above reference count. */
-#define xbdi_get(xbdip) atomic_inc_uint(&(xbdip)->xbdi_refcnt)
-#define xbdi_put(xbdip)  \
-do { \
-	if (atomic_dec_uint_nv(&(xbdip)->xbdi_refcnt) == 0)  \
-   xbdback_finish_disconnect(xbdip); \
+#define xbdi_get(xbdip) (xbdip)->xbdi_refcnt++
+#define xbdi_put(xbdip)		\
+do {\
+	if (--((xbdip)->xbdi_refcnt) == 0)  			\
+   xbdback_finish_disconnect(xbdip);		\
 } while (/* CONSTCOND */ 0)
 
 static SLIST_HEAD(, xbdback_instance) xbdback_instances;
@@ -269,6 +268,8 @@ static void *xbdback_co_do_io(struct xbd
 
 static void xbdback_io_error(struct xbdback_io *, int);
 static void xbdback_iodone(struct buf *);
+static void xbdback_iodone_locked(struct xbdback_instance *,
+		struct xbdback_io *, struct buf *);
 static void xbdback_send_reply(struct xbdback_instance *, uint64_t , int , int);
 
 static void *xbdback_map_shm(struct xbdback_io *);
@@ -336,10 +337,6 @@ xbdback_xenbus_create(struct xenbus_devi
 		return EFTYPE;
 	}
 
-	/* XXXSMP unlocked search */
-	if (xbdif_lookup(domid, handle)) {
-		return EEXIST;
-	}
 	xbdi = kmem_zalloc(sizeof(*xbdi), KM_SLEEP);
 
 	xbdi->xbdi_domid = domid;
@@ -347,15 +344,21 @@ xbdback_xenbus_create(struct xenbus_devi
 	snprintf(xbdi->xbdi_name, sizeof(xbdi->xbdi_name), "xbdb%di%d",
 	xbdi->xbdi_domid, xbdi->xbdi_handle);
 
+	mutex_enter(_lock);
+	if (xbdif_lookup(domid, handle)) {
+		mutex_exit(_lock);
+		kmem_free(xbdi, sizeof(*xbdi));
+		return EEXIST;
+	}
+	SLIST_INSERT_HEAD(_instances, xbdi, next);
+	mutex_exit(_lock);
+
 	/* initialize status and reference counter */
 	xbdi->xbdi_status = DISCONNECTED;
 	xbdi_get(xbdi);
 
 	mutex_init(>xbdi_lock, MUTEX_DEFAULT, IPL_BIO);
 	cv_init(>xbdi_cv, xbdi->xbdi_name);
-	mutex_enter(_lock);
-	SLIST_INSERT_HEAD(_instances, xbdi, next);
-	mutex_exit(_lock);
 
 	xbusd->xbusd_u.b.b_cookie = xbdi;	
 	xbusd->xbusd_u.b.b_detach = xbdback_xenbus_destroy;
@@ -852,7 +855,7 @@ xbdback_finish_disconnect(struct xbdback
 
 	xbdi->xbdi_status = DISCONNECTED;
 
-	cv_signal(>xbdi_cv);
+	cv_broadcast(>xbdi_cv);
 }
 
 static bool
@@ -861,14 +864,14 @@ xbdif_lookup(domid_t dom , uint32_t hand
 	struct xbdback_instance *xbdi;
 	bool found = false;
 
-	mutex_enter(_lock);
+	KASSERT(mutex_owned(_lock));
+
 	SLIST_FOREACH(xbdi, _instances, next) {
 		if (xbdi->xbdi_domid == dom && xbdi->xbdi_handle == handle) {
 			found = true;
 			break;
 		}
 	}
-	mutex_exit(_lock);
 
 	return found;
 }
@@ -881,7 +884,9 @@ xbdback_evthandler(void *arg)
 	XENPRINTF(("xbdback_evthandler domain %d: cont %p\n",
 	xbdi->xbdi_domid, xbdi->xbdi_cont));
 
+	mutex_enter(>xbdi_lock);
 	xbdback_wakeup_thread(xbdi);
+	mutex_exit(>xbdi_lock);
 
 	return 1;
 }
@@ -895,16 +900,14 @@ xbdback_thread(void *arg)
 {
 	struct xbdback_instance *xbdi = arg;
 
+	mutex_enter(>xbdi_lock);
 	for (;;) {
-		mutex_enter(>xbdi_lock);
 		switch (xbdi->xbdi_status) {
 		case WAITING:
 			cv_wait(>xbdi_cv, >xbdi_lock);
-			mutex_exit(>xbdi_lock);
 			break;
 		case RUN:
 			xbdi->xbdi_status = WAITING; /* reset state */
-			mutex_exit(>xbdi_lock);
 
 			if (xbdi->xbdi_cont == NULL) {
 xbdi->xbdi_cont = xbdback_co_main;
@@ -916,22 +919,24 @@ xbdback_thread(void *arg)
 			if (xbdi->xbdi_pendingreqs > 0) {
 /* there are pending I/Os. Wait for them. */
 cv_wait(>xbdi_cv, >xbdi_lock);
-mutex_exit(>xbdi_lock);
-break;
+continue;
 			}
 			
 			/* All I/Os should have been 

CVS commit: src/bin/sh

2020-04-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Thu Apr 23 09:01:33 UTC 2020

Modified Files:
src/bin/sh: eval.c

Log Message:
Stop forcing the -e option off in the subshell createds for a command
substitution.  This was inherited in the big "-e" fixup patch set (rev 1.50)
of Jan 2000, which came from dash.   dash no longer acts this way.


To generate a diff of this commit:
cvs rdiff -u -r1.178 -r1.179 src/bin/sh/eval.c

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

Modified files:

Index: src/bin/sh/eval.c
diff -u src/bin/sh/eval.c:1.178 src/bin/sh/eval.c:1.179
--- src/bin/sh/eval.c:1.178	Tue Feb  4 16:06:59 2020
+++ src/bin/sh/eval.c	Thu Apr 23 09:01:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.178 2020/02/04 16:06:59 kre Exp $	*/
+/*	$NetBSD: eval.c,v 1.179 2020/04/23 09:01:33 kre Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)eval.c	8.9 (Berkeley) 6/8/95";
 #else
-__RCSID("$NetBSD: eval.c,v 1.178 2020/02/04 16:06:59 kre Exp $");
+__RCSID("$NetBSD: eval.c,v 1.179 2020/04/23 09:01:33 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -771,7 +771,6 @@ evalbackcmd(union node *n, struct backcm
 			FORCEINTON;
 			close(pip[0]);
 			movefd(pip[1], 1);
-			eflag = 0;
 			evaltree(n, EV_EXIT);
 			/* NOTREACHED */
 		}



CVS commit: src/sys/arch/xen/xen

2020-04-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Apr 23 08:09:25 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xbdback_xenbus.c

Log Message:
allocate xbdback_io instances as part of struct xbdback_instance and
stop using pool_cache(9), to remove possibility for the allocation to sleep


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/xen/xen/xbdback_xenbus.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/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.88 src/sys/arch/xen/xen/xbdback_xenbus.c:1.89
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.88	Thu Apr 23 07:39:07 2020
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Thu Apr 23 08:09:25 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbdback_xenbus.c,v 1.88 2020/04/23 07:39:07 jdolecek Exp $  */
+/*  $NetBSD: xbdback_xenbus.c,v 1.89 2020/04/23 08:09:25 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.88 2020/04/23 07:39:07 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.89 2020/04/23 08:09:25 jdolecek Exp $");
 
 #include 
 #include 
@@ -142,6 +142,41 @@ struct xbdback_va {
 	vaddr_t xv_vaddr;
 };
 
+/*
+ * For each I/O operation associated with one of those requests, an
+ * xbdback_io is allocated from a pool.  It may correspond to multiple
+ * Xen disk requests, or parts of them, if several arrive at once that
+ * can be coalesced.
+ */
+struct xbdback_io {
+	SLIST_ENTRY(xbdback_io) xio_next;
+	/* The instance pointer is duplicated for convenience. */
+	struct xbdback_instance *xio_xbdi; /* our xbd instance */
+	uint8_t xio_operation;
+	uint64_t xio_id;
+	union {
+		struct {
+			struct buf xio_buf; /* our I/O */
+			/* the virtual address to map the request at */
+			vaddr_t xio_vaddr;
+			struct xbdback_va *xio_xv;
+			vaddr_t xio_start_offset;	/* I/O start offset */
+			/* grants to map */
+			grant_ref_t xio_gref[VBD_MAX_INDIRECT_SEGMENTS];
+			/* grants release */
+			grant_handle_t xio_gh[VBD_MAX_INDIRECT_SEGMENTS];
+			uint16_t xio_nrma; /* number of guest pages */
+		} xio_rw;
+	} u;
+};
+#define xio_buf		u.xio_rw.xio_buf
+#define xio_vaddr	u.xio_rw.xio_vaddr
+#define xio_start_offset	u.xio_rw.xio_start_offset
+#define xio_xv		u.xio_rw.xio_xv
+#define xio_gref	u.xio_rw.xio_gref
+#define xio_gh		u.xio_rw.xio_gh
+#define xio_nrma	u.xio_rw.xio_nrma
+
 /* we keep the xbdback instances in a linked list */
 struct xbdback_instance {
 	SLIST_ENTRY(xbdback_instance) next;
@@ -154,7 +189,9 @@ struct xbdback_instance {
 	kmutex_t xbdi_lock;
 	kcondvar_t xbdi_cv;	/* wait channel for thread work */
 	xbdback_state_t xbdi_status; /* thread's status */
-	/* KVA for mapping transfers */
+	/* context and KVA for mapping transfers */
+	struct xbdback_io xbdi_io[BLKIF_RING_SIZE];
+	SLIST_HEAD(, xbdback_io) xbdi_io_free;
 	struct xbdback_va xbdi_va[BLKIF_RING_SIZE];
 	SLIST_HEAD(, xbdback_va) xbdi_va_free;
 	/* backing device parameters */
@@ -200,46 +237,6 @@ do {
 static SLIST_HEAD(, xbdback_instance) xbdback_instances;
 static kmutex_t xbdback_lock;
 
-/*
- * For each I/O operation associated with one of those requests, an
- * xbdback_io is allocated from a pool.  It may correspond to multiple
- * Xen disk requests, or parts of them, if several arrive at once that
- * can be coalesced.
- */
-struct xbdback_io {
-	/* The instance pointer is duplicated for convenience. */
-	struct xbdback_instance *xio_xbdi; /* our xbd instance */
-	uint8_t xio_operation;
-	uint64_t xio_id;
-	union {
-		struct {
-			struct buf xio_buf; /* our I/O */
-			/* the virtual address to map the request at */
-			vaddr_t xio_vaddr;
-			struct xbdback_va *xio_xv;
-			vaddr_t xio_start_offset;	/* I/O start offset */
-			/* grants to map */
-			grant_ref_t xio_gref[VBD_MAX_INDIRECT_SEGMENTS];
-			/* grants release */
-			grant_handle_t xio_gh[VBD_MAX_INDIRECT_SEGMENTS];
-			uint16_t xio_nrma; /* number of guest pages */
-		} xio_rw;
-	} u;
-};
-#define xio_buf		u.xio_rw.xio_buf
-#define xio_vaddr	u.xio_rw.xio_vaddr
-#define xio_start_offset	u.xio_rw.xio_start_offset
-#define xio_xv		u.xio_rw.xio_xv
-#define xio_gref	u.xio_rw.xio_gref
-#define xio_gh		u.xio_rw.xio_gh
-#define xio_nrma	u.xio_rw.xio_nrma
-
-/*
- * Pools to manage the chain of block requests and I/Os fragments
- * submitted by frontend.
- */
-static struct pool_cache xbdback_io_pool;
-
 /* Interval between reports of I/O errors from frontend */
 static const struct timeval xbdback_err_intvl = { 1, 0 };
 
@@ -277,9 +274,8 @@ static void xbdback_send_reply(struct xb
 static void *xbdback_map_shm(struct xbdback_io *);
 static void xbdback_unmap_shm(struct xbdback_io *);
 
-static void *xbdback_pool_get(struct pool_cache *,
-			  struct xbdback_instance *);
-static void xbdback_pool_put(struct pool_cache 

CVS commit: src

2020-04-23 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Thu Apr 23 07:54:53 UTC 2020

Modified Files:
src/bin/csh: extern.h time.c
src/usr.bin/time: ext.h time.1 time.c

Log Message:
Add '-t' option for tcsh-style time output.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/bin/csh/extern.h
cvs rdiff -u -r1.21 -r1.22 src/bin/csh/time.c
cvs rdiff -u -r1.3 -r1.4 src/usr.bin/time/ext.h
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/time/time.1
cvs rdiff -u -r1.23 -r1.24 src/usr.bin/time/time.c

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

Modified files:

Index: src/bin/csh/extern.h
diff -u src/bin/csh/extern.h:1.31 src/bin/csh/extern.h:1.32
--- src/bin/csh/extern.h:1.31	Sat Jan  5 16:54:00 2019
+++ src/bin/csh/extern.h	Thu Apr 23 07:54:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.31 2019/01/05 16:54:00 christos Exp $ */
+/* $NetBSD: extern.h,v 1.32 2020/04/23 07:54:53 simonb Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -297,7 +297,7 @@ void plist(struct varent *);
  */
 void donice(Char **, struct command *);
 void dotime(Char **, struct command *);
-void prusage1(FILE *, const char *, struct rusage *, struct rusage *,
+void prusage1(FILE *, const char *, int, struct rusage *, struct rusage *,
 	 struct timespec *, struct timespec *);
 void prusage(FILE *, struct rusage *, struct rusage *, struct timespec *,
  struct timespec *);

Index: src/bin/csh/time.c
diff -u src/bin/csh/time.c:1.21 src/bin/csh/time.c:1.22
--- src/bin/csh/time.c:1.21	Sat Jul 15 14:35:55 2017
+++ src/bin/csh/time.c	Thu Apr 23 07:54:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: time.c,v 1.21 2017/07/15 14:35:55 christos Exp $ */
+/* $NetBSD: time.c,v 1.22 2020/04/23 07:54:53 simonb Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)time.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: time.c,v 1.21 2017/07/15 14:35:55 christos Exp $");
+__RCSID("$NetBSD: time.c,v 1.22 2020/04/23 07:54:53 simonb Exp $");
 #endif
 #endif /* not lint */
 
@@ -49,7 +49,7 @@ __RCSID("$NetBSD: time.c,v 1.21 2017/07/
 /*
  * C Shell - routines handling process timing and niceing
  */
-static void pdeltat(FILE *, struct timeval *, struct timeval *);
+static void pdeltat(FILE *, int, struct timeval *, struct timeval *);
 static void pcsecs(FILE *, long);
 
 #ifndef NOT_CSH
@@ -138,12 +138,13 @@ prusage(FILE *fp, struct rusage *r0, str
 	cp = short2str(vp->vec[1]);
 else
 	cp = "%Uu %Ss %E %P %X+%Dk %I+%Oio %Fpf+%Ww";
-prusage1(fp, cp, r0, r1, e, b);
+prusage1(fp, cp, 1, r0, r1, e, b);
 }
 #endif
 
 void
-prusage1(FILE *fp, const char *cp, struct rusage *r0, struct rusage *r1,
+prusage1(FILE *fp, const char *cp, int prec,
+struct rusage *r0, struct rusage *r1,
 struct timespec *e, struct timespec *b)
 {
 long i;
@@ -201,10 +202,10 @@ prusage1(FILE *fp, const char *cp, struc
 		(void)fprintf(fp, "%ld", r1->ru_minflt - r0->ru_minflt);
 		break;
 	case 'S':		/* system CPU time used */
-		pdeltat(fp, >ru_stime, >ru_stime);
+		pdeltat(fp, prec, >ru_stime, >ru_stime);
 		break;
 	case 'U':		/* user CPU time used */
-		pdeltat(fp, >ru_utime, >ru_utime);
+		pdeltat(fp, prec, >ru_utime, >ru_utime);
 		break;
 	case 'W':		/* number of swaps */
 		i = r1->ru_nswap - r0->ru_nswap;
@@ -234,13 +235,13 @@ prusage1(FILE *fp, const char *cp, struc
 }
 
 static void
-pdeltat(FILE *fp, struct timeval *t1, struct timeval *t0)
+pdeltat(FILE *fp, int prec, struct timeval *t1, struct timeval *t0)
 {
 struct timeval td;
 
 timersub(t1, t0, );
-(void)fprintf(fp, "%ld.%01ld", (long)td.tv_sec,
-	(long)(td.tv_usec / 10));
+(void)fprintf(fp, "%ld.%0*ld", (long)td.tv_sec,
+	prec, (long)(td.tv_usec / 10));
 }
 
 #define  P2DIG(fp, i) (void)fprintf(fp, "%ld%ld", (i) / 10, (i) % 10)

Index: src/usr.bin/time/ext.h
diff -u src/usr.bin/time/ext.h:1.3 src/usr.bin/time/ext.h:1.4
--- src/usr.bin/time/ext.h:1.3	Sat Jul 15 14:34:08 2017
+++ src/usr.bin/time/ext.h	Thu Apr 23 07:54:53 2020
@@ -1,5 +1,5 @@
-/*	$NetBSD: ext.h,v 1.3 2017/07/15 14:34:08 christos Exp $	*/
+/*	$NetBSD: ext.h,v 1.4 2020/04/23 07:54:53 simonb Exp $	*/
 
 /* borrowed from ../../bin/csh/extern.h */
-void prusage1(FILE *, const char *fmt, struct rusage *, struct rusage *,
+void prusage1(FILE *, const char *fmt, int, struct rusage *, struct rusage *,
 struct timespec *, struct timespec *);

Index: src/usr.bin/time/time.1
diff -u src/usr.bin/time/time.1:1.28 src/usr.bin/time/time.1:1.29
--- src/usr.bin/time/time.1:1.28	Sat Jul 15 14:40:36 2017
+++ src/usr.bin/time/time.1	Thu Apr 23 07:54:53 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: time.1,v 1.28 2017/07/15 14:40:36 wiz Exp $
+.\"	$NetBSD: time.1,v 1.29 2020/04/23 07:54:53 simonb Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)time.1	8.1 (Berkeley) 6/6/93
 

CVS commit: src/sys/arch/xen/xen

2020-04-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Apr 23 07:39:07 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xbdback_xenbus.c

Log Message:
g/c no longer used xbdi_same_page and xbdi_lastfragio_time


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/xen/xen/xbdback_xenbus.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/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.87 src/sys/arch/xen/xen/xbdback_xenbus.c:1.88
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.87	Thu Apr 23 07:24:40 2020
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Thu Apr 23 07:39:07 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbdback_xenbus.c,v 1.87 2020/04/23 07:24:40 jdolecek Exp $  */
+/*  $NetBSD: xbdback_xenbus.c,v 1.88 2020/04/23 07:39:07 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.87 2020/04/23 07:24:40 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.88 2020/04/23 07:39:07 jdolecek Exp $");
 
 #include 
 #include 
@@ -186,12 +186,8 @@ struct xbdback_instance {
 	bus_dmamap_t xbdi_seg_dmamap;
 	grant_ref_t xbdi_in_gntref;
 	/* other state */
-	int xbdi_same_page; /* are we merging two segments on the same page? */
 	uint xbdi_pendingreqs; /* number of I/O in fly */
 	struct timeval xbdi_lasterr_time;/* error time tracking */
-#ifdef DEBUG
-	struct timeval xbdi_lastfragio_time; /* fragmented I/O tracking */
-#endif
 };
 /* Manipulation of the above reference count. */
 #define xbdi_get(xbdip) atomic_inc_uint(&(xbdip)->xbdi_refcnt)



CVS commit: src/sys/arch/xen/xen

2020-04-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Thu Apr 23 07:24:40 UTC 2020

Modified Files:
src/sys/arch/xen/xen: xbdback_xenbus.c

Log Message:
g/c no longer needed xbdi_io structure member, just pass it as continuation
parameter


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/xen/xen/xbdback_xenbus.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/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.86 src/sys/arch/xen/xen/xbdback_xenbus.c:1.87
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.86	Tue Apr 21 13:56:18 2020
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Thu Apr 23 07:24:40 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbdback_xenbus.c,v 1.86 2020/04/21 13:56:18 jdolecek Exp $  */
+/*  $NetBSD: xbdback_xenbus.c,v 1.87 2020/04/23 07:24:40 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.86 2020/04/21 13:56:18 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.87 2020/04/23 07:24:40 jdolecek Exp $");
 
 #include 
 #include 
@@ -77,7 +77,6 @@ __KERNEL_RCSID(0, "$NetBSD: xbdback_xenb
 
 CTASSERT(XENSHM_MAX_PAGES_PER_REQUEST >= VBD_MAX_INDIRECT_SEGMENTS);
 
-struct xbdback_io;
 struct xbdback_instance;
 
 /*
@@ -186,8 +185,6 @@ struct xbdback_instance {
 	struct blkif_request_segment xbdi_seg[VBD_MAX_INDIRECT_SEGMENTS];
 	bus_dmamap_t xbdi_seg_dmamap;
 	grant_ref_t xbdi_in_gntref;
-	/* _io state: I/O associated to this instance */
-	struct xbdback_io *xbdi_io;
 	/* other state */
 	int xbdi_same_page; /* are we merging two segments on the same page? */
 	uint xbdi_pendingreqs; /* number of I/O in fly */
@@ -1043,7 +1040,6 @@ fail:
 			break;
 		}
 	} else {
-		KASSERT(xbdi->xbdi_io == NULL);
 		xbdi->xbdi_cont = xbdback_co_main_done2;
 	}
 	return xbdi;
@@ -1090,7 +1086,6 @@ xbdback_co_main_done2(struct xbdback_ins
 {
 	int work_to_do;
 
-	KASSERT(xbdi->xbdi_io == NULL);
 	RING_FINAL_CHECK_FOR_REQUESTS(>xbdi_ring.ring_n, work_to_do);
 	if (work_to_do)
 		xbdi->xbdi_cont = xbdback_co_main;
@@ -1126,12 +1121,12 @@ xbdback_co_cache_doflush(struct xbdback_
 	struct xbdback_io *xbd_io;
 
 	XENPRINTF(("xbdback_co_cache_doflush %p %p\n", xbdi, obj));
-	xbd_io = xbdi->xbdi_io = obj;
+	xbd_io = obj;
 	xbd_io->xio_xbdi = xbdi;
 	xbd_io->xio_operation = xbdi->xbdi_xen_req.operation;
 	xbd_io->xio_id = xbdi->xbdi_xen_req.id;
 	xbdi->xbdi_cont = xbdback_co_do_io;
-	return xbdi;
+	return xbd_io;
 }
 
 /*
@@ -1235,7 +1230,6 @@ xbdback_co_io(struct xbdback_instance *x
 	if (req->nr_segments < 1)
 		goto bad_nr_segments;
 
-	KASSERT(xbdi->xbdi_io == NULL);
 	xbdi->xbdi_cont = xbdback_co_io_gotio;
 	return xbdback_pool_get(_io_pool, xbdi);
 
@@ -1268,7 +1262,7 @@ xbdback_co_io_gotio(struct xbdback_insta
 	atomic_inc_uint(>xbdi_pendingreqs);
 	
 	req = >xbdi_xen_req;
-	xbd_io = xbdi->xbdi_io = obj;
+	xbd_io = obj;
 	memset(xbd_io, 0, sizeof(*xbd_io));
 	buf_init(_io->xio_buf);
 	xbd_io->xio_xbdi = xbdi;
@@ -1339,7 +1333,7 @@ xbdback_co_io_gotio(struct xbdback_insta
 	xbd_io->xio_buf.b_private = xbd_io;
 
 	xbdi->xbdi_cont = xbdback_co_do_io;
-	return xbdback_map_shm(xbdi->xbdi_io);
+	return xbdback_map_shm(xbd_io);
 }
 
 static void
@@ -1356,7 +1350,7 @@ xbdback_io_error(struct xbdback_io *xbd_
 static void *
 xbdback_co_do_io(struct xbdback_instance *xbdi, void *obj)
 {
-	struct xbdback_io *xbd_io = xbdi->xbdi_io;
+	struct xbdback_io *xbd_io = obj;
 
 	switch (xbd_io->xio_operation) {
 	case BLKIF_OP_FLUSH_DISKCACHE:
@@ -1379,7 +1373,6 @@ xbdback_co_do_io(struct xbdback_instance
 		xbd_io->xio_operation, error);
 		xbdback_pool_put(_io_pool, xbd_io);
 		xbdi_put(xbdi);
-		xbdi->xbdi_io = NULL;
 		xbdi->xbdi_cont = xbdback_co_main_incr;
 		return xbdi;
 	}
@@ -1395,7 +1388,6 @@ xbdback_co_do_io(struct xbdback_instance
 		}
 		/* will call xbdback_iodone() asynchronously when done */
 		bdev_strategy(_io->xio_buf);
-		xbdi->xbdi_io = NULL;
 		xbdi->xbdi_cont = xbdback_co_main_incr;
 		return xbdi;
 	default:
@@ -1553,16 +1545,16 @@ xbdback_map_shm(struct xbdback_io *xbd_i
 		}
 		printf("\n");
 #endif
-		return xbdi;
+		return xbd_io;
 	default:
 		if (ratecheck(>xbdi_lasterr_time, _err_intvl)) {
 			printf("xbdback_map_shm: xen_shm error %d ", error);
 		}
-		xbdback_io_error(xbdi->xbdi_io, error);
+		/* this will also free xbd_io via xbdback_iodone() */
+		xbdback_io_error(xbd_io, error);
 		SLIST_INSERT_HEAD(>xbdi_va_free, xbd_io->xio_xv, xv_next);
 		xbd_io->xio_xv = NULL;
-		xbdi->xbdi_io = NULL;
-		// do not retry
+		/* do not retry */
 		xbdi->xbdi_cont = xbdback_co_main_incr;
 		return xbdi;
 	}



CVS commit: src/sys/dev/pci

2020-04-23 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Apr 23 06:28:34 UTC 2020

Modified Files:
src/sys/dev/pci: if_aq.c

Log Message:
sort product table, and tabify


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/if_aq.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/pci/if_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.13 src/sys/dev/pci/if_aq.c:1.14
--- src/sys/dev/pci/if_aq.c:1.13	Thu Apr 23 06:27:21 2020
+++ src/sys/dev/pci/if_aq.c	Thu Apr 23 06:28:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.13 2020/04/23 06:27:21 ryo Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.14 2020/04/23 06:28:34 ryo Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.13 2020/04/23 06:27:21 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.14 2020/04/23 06:28:34 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -1142,6 +1142,10 @@ static const struct aq_product {
 	enum aq_media_type aq_media_type;
 	aq_link_speed_t aq_available_rates;
 } aq_products[] = {
+	{ PCI_VENDOR_AQUANTIA, PCI_PRODUCT_AQUANTIA_AQC100,
+	  "Aquantia AQC100 10 Gigabit Network Adapter",
+	  AQ_MEDIA_TYPE_FIBRE, AQ_LINK_ALL
+	},
 	{ PCI_VENDOR_AQUANTIA, PCI_PRODUCT_AQUANTIA_AQC107,
 	  "Aquantia AQC107 10 Gigabit Network Adapter",
 	  AQ_MEDIA_TYPE_TP, AQ_LINK_ALL
@@ -1154,10 +1158,6 @@ static const struct aq_product {
 	  "Aquantia AQC109 2.5 Gigabit Network Adapter",
 	  AQ_MEDIA_TYPE_TP, AQ_LINK_100M | AQ_LINK_1G | AQ_LINK_2G5
 	},
-{ PCI_VENDOR_AQUANTIA, PCI_PRODUCT_AQUANTIA_AQC100,
-  "Aquantia AQC100 10 Gigabit Network Adapter",
-  AQ_MEDIA_TYPE_FIBRE, AQ_LINK_ALL
-},
 	{ PCI_VENDOR_AQUANTIA, PCI_PRODUCT_AQUANTIA_AQC111,
 	  "Aquantia AQC111 5 Gigabit Network Adapter",
 	  AQ_MEDIA_TYPE_TP, AQ_LINK_100M | AQ_LINK_1G | AQ_LINK_2G5 | AQ_LINK_5G



CVS commit: src/sys/dev/pci

2020-04-23 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Thu Apr 23 06:27:21 UTC 2020

Modified Files:
src/sys/dev/pci: if_aq.c

Log Message:
On FIBRE devices, there are times when linkstat interrupt doesn't occur?
reported from Andrius V. thanks.

- use polling instead of linkstat interrupt when FIBRE
- add AQ_FORCE_POLL_LINKSTAT options (not by default)


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/if_aq.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/pci/if_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.12 src/sys/dev/pci/if_aq.c:1.13
--- src/sys/dev/pci/if_aq.c:1.12	Wed Apr 22 22:54:43 2020
+++ src/sys/dev/pci/if_aq.c	Thu Apr 23 06:27:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aq.c,v 1.12 2020/04/22 22:54:43 christos Exp $	*/
+/*	$NetBSD: if_aq.c,v 1.13 2020/04/23 06:27:21 ryo Exp $	*/
 
 /**
  * aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.12 2020/04/22 22:54:43 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.13 2020/04/23 06:27:21 ryo Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_if_aq.h"
@@ -1310,6 +1310,14 @@ aq_attach(device_t parent, device_t self
 		sc->sc_msix = false;
 	}
 
+	/* XXX: on FIBRE, linkstat interrupt does not occur on boot? */
+	if (aqp->aq_media_type == AQ_MEDIA_TYPE_FIBRE)
+		sc->sc_poll_linkstat = true;
+
+#ifdef AQ_FORCE_POLL_LINKSTAT
+	sc->sc_poll_linkstat = true;
+#endif
+
 	aprint_debug_dev(sc->sc_dev,
 	"ncpu=%d, pci_msix_count=%d."
 	" allocate %d interrupts for %d%s queues%s\n",