CVS commit: src/share/man/man4/man4.evbarm

2021-09-15 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Sep 16 02:53:28 UTC 2021

Modified Files:
src/share/man/man4/man4.evbarm: vchiq.4

Log Message:
Describe how to obtain debugging information from vchiq(4).

Ok nia@


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/man4.evbarm/vchiq.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/man4.evbarm/vchiq.4
diff -u src/share/man/man4/man4.evbarm/vchiq.4:1.1 src/share/man/man4/man4.evbarm/vchiq.4:1.2
--- src/share/man/man4/man4.evbarm/vchiq.4:1.1	Fri Feb 26 10:33:46 2021
+++ src/share/man/man4/man4.evbarm/vchiq.4	Thu Sep 16 02:53:28 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: vchiq.4,v 1.1 2021/02/26 10:33:46 nia Exp $
+.\" $NetBSD: vchiq.4,v 1.2 2021/09/16 02:53:28 nat Exp $
 .\"
 .\" Copyright (c) 2021 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -46,7 +46,16 @@ interface exposed to userland.
 Audio output support is provided by the kernel through
 .Xr vcaudio 4 ,
 which uses this messaging interface to the GPU internally.
+.Pp
+Debugging information may be obtained reading the device with
+.Xr cat 1 .
+eg:
+.Dl cat /dev/vchiq
+.Pp
+Information such as slots and usage by particular functions of the VideoCore 4
+device are displayed.
 .Sh SEE ALSO
+.Xr cat 1 ,
 .Xr bcmgpio 4 ,
 .Xr vcaudio 4 ,
 .Pa pkgsrc/misc/raspberrypi-userland ,



CVS commit: src/share/man/man4/man4.evbarm

2021-09-15 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Thu Sep 16 02:53:28 UTC 2021

Modified Files:
src/share/man/man4/man4.evbarm: vchiq.4

Log Message:
Describe how to obtain debugging information from vchiq(4).

Ok nia@


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/man4.evbarm/vchiq.4

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



CVS commit: src/bin/sh

2021-09-15 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Sep 15 20:21:48 UTC 2021

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

Log Message:
Fix an ordering error in the previous (and even earlier, going back
a way, but made more serious with the recent changes).

The n>&n operation (more or less a no-op, except it clears CLOEXEC)
should precede almost everything else - and simply be made to fail if
an attempt is made to apply it to a sh internal fd.

We were renumbering the internal fd (the n> part considered first)
which was dumb, but OK, before, but now rejecting the operation
(the >&n) part when n should not be visible to the script.  That
made something of a mess (and could lead to the shell believing its
job control tty was at a fd it never got moved to).

Do things in the correct order, and simply fail that case for internal
fds (for every other n>xxx for any xxx sh simply renumbers its internal fd
n to some other fd before attempting the operation, even n>&- ... those are
all fine).

[In all the above the '>' is used in place of any redirect operator].


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/bin/sh/redir.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/redir.c
diff -u src/bin/sh/redir.c:1.68 src/bin/sh/redir.c:1.69
--- src/bin/sh/redir.c:1.68	Wed Sep 15 18:29:45 2021
+++ src/bin/sh/redir.c	Wed Sep 15 20:21:47 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: redir.c,v 1.68 2021/09/15 18:29:45 kre Exp $	*/
+/*	$NetBSD: redir.c,v 1.69 2021/09/15 20:21:47 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)redir.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: redir.c,v 1.68 2021/09/15 18:29:45 kre Exp $");
+__RCSID("$NetBSD: redir.c,v 1.69 2021/09/15 20:21:47 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -245,6 +245,18 @@ redirect(union node *redir, int flags)
 		fd, max_user_fd, user_fd_limit));
 		if (fd < user_fd_limit && fd > max_user_fd)
 			max_user_fd = fd;
+		if ((n->nfile.type == NTOFD || n->nfile.type == NFROMFD) &&
+		n->ndup.dupfd == fd) {
+			VTRACE(DBG_REDIR, ("!cloexec\n"));
+			if (sh_fd(fd) != NULL ||
+			saved_redirected_fd(fd) != NULL)
+error("fd %d: %s", fd, strerror(EBADF));
+			/* redirect from/to same file descriptor */
+			/* make sure it stays open */
+			if (fcntl(fd, F_SETFD, 0) < 0)
+error("fd %d: %s", fd, strerror(errno));
+			continue;
+		}
 		if ((renamed = saved_redirected_fd(fd)) != NULL) {
 			int to = pick_new_fd(fd);
 
@@ -255,15 +267,6 @@ redirect(union node *redir, int flags)
 (void)close(fd);
 		}
 		renumber_sh_fd(sh_fd(fd));
-		if ((n->nfile.type == NTOFD || n->nfile.type == NFROMFD) &&
-		n->ndup.dupfd == fd) {
-			/* redirect from/to same file descriptor */
-			/* make sure it stays open */
-			if (fcntl(fd, F_SETFD, 0) < 0)
-error("fd %d: %s", fd, strerror(errno));
-			VTRACE(DBG_REDIR, ("!cloexec\n"));
-			continue;
-		}
 
 		if ((flags & REDIR_PUSH) && !is_renamed(sv->renamed, fd)) {
 			int bigfd;
@@ -421,6 +424,7 @@ openredirect(union node *redir, char mem
 		if (copyfd(f, fd, cloexec) < 0) {
 			int e = errno;
 
+			VTRACE(DBG_REDIR, (" failed: %s\n", strerror(e)));
 			close(f);
 			error("redirect reassignment (fd %d) failed: %s", fd,
 			strerror(e));



CVS commit: src/bin/sh

2021-09-15 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Sep 15 20:21:48 UTC 2021

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

Log Message:
Fix an ordering error in the previous (and even earlier, going back
a way, but made more serious with the recent changes).

The n>&n operation (more or less a no-op, except it clears CLOEXEC)
should precede almost everything else - and simply be made to fail if
an attempt is made to apply it to a sh internal fd.

We were renumbering the internal fd (the n> part considered first)
which was dumb, but OK, before, but now rejecting the operation
(the >&n) part when n should not be visible to the script.  That
made something of a mess (and could lead to the shell believing its
job control tty was at a fd it never got moved to).

Do things in the correct order, and simply fail that case for internal
fds (for every other n>xxx for any xxx sh simply renumbers its internal fd
n to some other fd before attempting the operation, even n>&- ... those are
all fine).

[In all the above the '>' is used in place of any redirect operator].


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/bin/sh/redir.c

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



CVS commit: src/bin/sh

2021-09-15 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Sep 15 18:30:57 UTC 2021

Modified Files:
src/bin/sh: miscbltin.c sh.1

Log Message:
Have the ulimit command watch for ulimit -n (alter number of available fds)
and keep the rest of the shell aware of any changes.

While here, modify 'ulimit -aSH' to print both the soft and hard limits
for the resources, rather than just (in this case, as H comes last) the
hard limit.   In any other case when both S and H are present, and we're
examining a limit, use the soft limit (just as if neither were given).

No change for setting limits (both are set, unless exactly one of -H
or -S is given).   However, we now check for overflow when converting
the value to be assigned, rather than just truncating the value however
it happens to work out...


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/bin/sh/miscbltin.c
cvs rdiff -u -r1.233 -r1.234 src/bin/sh/sh.1

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/miscbltin.c
diff -u src/bin/sh/miscbltin.c:1.44 src/bin/sh/miscbltin.c:1.45
--- src/bin/sh/miscbltin.c:1.44	Sat May 13 15:03:34 2017
+++ src/bin/sh/miscbltin.c	Wed Sep 15 18:30:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: miscbltin.c,v 1.44 2017/05/13 15:03:34 gson Exp $	*/
+/*	$NetBSD: miscbltin.c,v 1.45 2021/09/15 18:30:57 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)miscbltin.c	8.4 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: miscbltin.c,v 1.44 2017/05/13 15:03:34 gson Exp $");
+__RCSID("$NetBSD: miscbltin.c,v 1.45 2021/09/15 18:30:57 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -63,6 +63,7 @@ __RCSID("$NetBSD: miscbltin.c,v 1.44 201
 #include "error.h"
 #include "builtins.h"
 #include "mystring.h"
+#include "redir.h"		/* for user_fd_limit */
 
 #undef rflag
 
@@ -357,7 +358,7 @@ ulimitcmd(int argc, char **argv)
 	int	c;
 	rlim_t val = 0;
 	enum { SOFT = 0x1, HARD = 0x2 }
-			how = SOFT | HARD;
+			how = 0, which;
 	const struct limits	*l;
 	int		set, all = 0;
 	int		optc, what;
@@ -367,10 +368,10 @@ ulimitcmd(int argc, char **argv)
 	while ((optc = nextopt("HSabtfdscmlrpnv")) != '\0')
 		switch (optc) {
 		case 'H':
-			how = HARD;
+			how |= HARD;
 			break;
 		case 'S':
-			how = SOFT;
+			how |= SOFT;
 			break;
 		case 'a':
 			all = 1;
@@ -390,38 +391,58 @@ ulimitcmd(int argc, char **argv)
 
 		if (all || argptr[1])
 			error("too many arguments");
+		if (how == 0)
+			how = HARD | SOFT;
+
 		if (strcmp(p, "unlimited") == 0)
 			val = RLIM_INFINITY;
 		else {
 			val = (rlim_t) 0;
 
-			while ((c = *p++) >= '0' && c <= '9')
-val = (val * 10) + (long)(c - '0');
+			while ((c = *p++) >= '0' && c <= '9') {
+if (val >= RLIM_INFINITY/10)
+	error("value overflow");
+val = (val * 10);
+if (val >= RLIM_INFINITY - (long)(c - '0'))
+	error("value overflow");
+val += (long)(c - '0');
+			}
 			if (c)
 error("bad number");
+			if (val > RLIM_INFINITY / l->factor)
+error("value overflow");
 			val *= l->factor;
 		}
-	}
+	} else if (how == 0)
+		how = SOFT;
+
 	if (all) {
 		for (l = limits; l->name; l++) {
 			getrlimit(l->cmd, &limit);
-			if (how & SOFT)
-val = limit.rlim_cur;
-			else if (how & HARD)
-val = limit.rlim_max;
-
-			out1fmt("%-13s (-%c %-11s) ", l->name, l->option,
+			out1fmt("%-13s (-%c %-11s)", l->name, l->option,
 			l->unit);
-			if (val == RLIM_INFINITY)
-out1fmt("unlimited\n");
-			else
-			{
-val /= l->factor;
+
+			which = how;
+			while (which != 0) {
+if (which & SOFT) {
+	val = limit.rlim_cur;
+	which &= ~SOFT;
+} else if (which & HARD) {
+	val = limit.rlim_max;
+	which &= ~HARD;
+}
+
+if (val == RLIM_INFINITY)
+	out1fmt("unlimited");
+else {
+	val /= l->factor;
 #ifdef BSD4_4
-out1fmt("%lld\n", (long long) val);
+	out1fmt("%9lld", (long long) val);
 #else
-out1fmt("%ld\n", (long) val);
+	out1fmt("%9ld", (long) val);
 #endif
+}
+out1fmt("%c", which ? '\t' : '\n');
 			}
 		}
 		return 0;
@@ -436,6 +457,8 @@ ulimitcmd(int argc, char **argv)
 			limit.rlim_cur = val;
 		if (setrlimit(l->cmd, &limit) < 0)
 			error("error setting limit (%s)", strerror(errno));
+		if (l->cmd == RLIMIT_NOFILE)
+			user_fd_limit = sysconf(_SC_OPEN_MAX);
 	} else {
 		if (how & SOFT)
 			val = limit.rlim_cur;

Index: src/bin/sh/sh.1
diff -u src/bin/sh/sh.1:1.233 src/bin/sh/sh.1:1.234
--- src/bin/sh/sh.1:1.233	Sun Sep 12 06:53:08 2021
+++ src/bin/sh/sh.1	Wed Sep 15 18:30:57 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sh.1,v 1.233 2021/09/12 06:53:08 wiz Exp $
+.\"	$NetBSD: sh.1,v 1.234 2021/09/15 18:30:57 kre Exp $
 .\" Copyright (c) 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
 .\"
@@ -3720,13 +3720,20 @@ If neither
 nor
 .Fl S
 is specified, the soft limit is displayed or both limits are set.
-If both are specified, the last one

CVS commit: src/bin/sh

2021-09-15 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Sep 15 18:30:57 UTC 2021

Modified Files:
src/bin/sh: miscbltin.c sh.1

Log Message:
Have the ulimit command watch for ulimit -n (alter number of available fds)
and keep the rest of the shell aware of any changes.

While here, modify 'ulimit -aSH' to print both the soft and hard limits
for the resources, rather than just (in this case, as H comes last) the
hard limit.   In any other case when both S and H are present, and we're
examining a limit, use the soft limit (just as if neither were given).

No change for setting limits (both are set, unless exactly one of -H
or -S is given).   However, we now check for overflow when converting
the value to be assigned, rather than just truncating the value however
it happens to work out...


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/bin/sh/miscbltin.c
cvs rdiff -u -r1.233 -r1.234 src/bin/sh/sh.1

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



CVS commit: src/bin/sh

2021-09-15 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Sep 15 18:29:45 UTC 2021

Modified Files:
src/bin/sh: main.c parser.c redir.c redir.h

Log Message:
Improve the solution for the 2nd access to a fd which shouldn't
be available ("13") issue reported by Jan Schaumann on netbsd-users.

This fixes a bug in the earlier fix (a day or so ago) which could allow the
shell's idea of which fd range was in use by the script to get wildly
incorrect, but now also actually looks to see which fd's are in use as
renamed other user fd's during the lifetime of a redirection which needs
to be able to be undone (most redirections occur after a fork and are
permanent in the child process).   Attempting to access such a fd (as with
attempts to access a fd in use by the shell for its own purposes) is treated
as an attempt to access a closed fd (EBADF).  Attempting to reuse the fd
for some other purpose (which should be rare, even for scripts attempting
to cause problems, since the shell generally knows which fds the script
wants to use, and avoids them) will cause the renamed (renumbered) fd
to be renamed again (moved aside to some other available fd), just as
happens with the shell's private fds.

Also, when a generic fd is required, don't give up because of EMFILE
or similar unless there are no available fds at all (we might prefer >10
or bigger, but if there are none there, use anything).  This avoids
redirection errors when ulimit -n has been set small, and all the fds >10
that are available have been used, but we need somewhere to park the old
user of a fd while we reuse that fd for the redirection.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/bin/sh/main.c
cvs rdiff -u -r1.173 -r1.174 src/bin/sh/parser.c
cvs rdiff -u -r1.67 -r1.68 src/bin/sh/redir.c
cvs rdiff -u -r1.25 -r1.26 src/bin/sh/redir.h

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/main.c
diff -u src/bin/sh/main.c:1.85 src/bin/sh/main.c:1.86
--- src/bin/sh/main.c:1.85	Fri Feb  7 01:25:08 2020
+++ src/bin/sh/main.c	Wed Sep 15 18:29:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.85 2020/02/07 01:25:08 fox Exp $	*/
+/*	$NetBSD: main.c,v 1.86 2021/09/15 18:29:45 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.7 (Berkeley) 7/19/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.85 2020/02/07 01:25:08 fox Exp $");
+__RCSID("$NetBSD: main.c,v 1.86 2021/09/15 18:29:45 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -85,6 +85,7 @@ int rootpid;
 int rootshell;
 struct jmploc main_handler;
 int max_user_fd;
+long user_fd_limit;
 #if PROFILE
 short profile_buf[16384];
 extern int etext();
@@ -131,6 +132,7 @@ main(int argc, char **argv)
 	max_user_fd = fcntl(0, F_MAXFD);
 	if (max_user_fd < 2)
 		max_user_fd = 2;
+	user_fd_limit = sysconf(_SC_OPEN_MAX);
 
 	setlocale(LC_ALL, "");
 

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.173 src/bin/sh/parser.c:1.174
--- src/bin/sh/parser.c:1.173	Tue Sep 14 14:49:39 2021
+++ src/bin/sh/parser.c	Wed Sep 15 18:29:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.173 2021/09/14 14:49:39 kre Exp $	*/
+/*	$NetBSD: parser.c,v 1.174 2021/09/15 18:29:45 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c	8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.173 2021/09/14 14:49:39 kre Exp $");
+__RCSID("$NetBSD: parser.c,v 1.174 2021/09/15 18:29:45 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -746,9 +746,12 @@ fixredir(union node *n, const char *text
 	if (!err)
 		n->ndup.vname = NULL;
 
-	if (is_number(text))
+	if (is_number(text)) {
 		n->ndup.dupfd = number(text);
-	else if (text[0] == '-' && text[1] == '\0')
+		if (n->ndup.dupfd < user_fd_limit &&
+		n->ndup.dupfd > max_user_fd)
+			max_user_fd = n->ndup.dupfd;
+	} else if (text[0] == '-' && text[1] == '\0')
 		n->ndup.dupfd = -1;
 	else {
 
@@ -757,8 +760,6 @@ fixredir(union node *n, const char *text
 		else
 			n->ndup.vname = makeword(startlinno - elided_nl);
 	}
-	if (n->ndup.dupfd > max_user_fd)
-		max_user_fd = n->ndup.dupfd;
 }
 
 
@@ -1592,8 +1593,9 @@ parseredir(const char *out,  int c)
 	fd = (*out == '\0') ? -1 : number(out);		/* number(out) >= 0 */
 	np->nfile.fd = fd;	/* do this again later with updated fd */
 	if (fd != np->nfile.fd)
-		error("file descriptor (%d) out of range", fd);
-	if (fd > max_user_fd)
+		error("file descriptor (%d) out of range (max %ld)",
+		fd, user_fd_limit - 1);
+	if (fd < user_fd_limit && fd > max_user_fd)
 		max_user_fd = fd;
 
 	VTRACE(DBG_LEXER, ("parseredir after '%s%c' ", out, c));

Index: src/bin/sh/redir.c
diff -u src/bin/sh/redir.c:1.67 src/bin/sh/redir.c:1.68
--- src/bin/sh/redir.c:1.67	Tue Sep 14 14:49:39 2021
+++ src/bin/sh/redir.c	Wed Sep 15 18:29:45 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: redir.c,v 1.67 2021/09/14 1

CVS commit: src/bin/sh

2021-09-15 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Sep 15 18:29:45 UTC 2021

Modified Files:
src/bin/sh: main.c parser.c redir.c redir.h

Log Message:
Improve the solution for the 2nd access to a fd which shouldn't
be available ("13") issue reported by Jan Schaumann on netbsd-users.

This fixes a bug in the earlier fix (a day or so ago) which could allow the
shell's idea of which fd range was in use by the script to get wildly
incorrect, but now also actually looks to see which fd's are in use as
renamed other user fd's during the lifetime of a redirection which needs
to be able to be undone (most redirections occur after a fork and are
permanent in the child process).   Attempting to access such a fd (as with
attempts to access a fd in use by the shell for its own purposes) is treated
as an attempt to access a closed fd (EBADF).  Attempting to reuse the fd
for some other purpose (which should be rare, even for scripts attempting
to cause problems, since the shell generally knows which fds the script
wants to use, and avoids them) will cause the renamed (renumbered) fd
to be renamed again (moved aside to some other available fd), just as
happens with the shell's private fds.

Also, when a generic fd is required, don't give up because of EMFILE
or similar unless there are no available fds at all (we might prefer >10
or bigger, but if there are none there, use anything).  This avoids
redirection errors when ulimit -n has been set small, and all the fds >10
that are available have been used, but we need somewhere to park the old
user of a fd while we reuse that fd for the redirection.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/bin/sh/main.c
cvs rdiff -u -r1.173 -r1.174 src/bin/sh/parser.c
cvs rdiff -u -r1.67 -r1.68 src/bin/sh/redir.c
cvs rdiff -u -r1.25 -r1.26 src/bin/sh/redir.h

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



CVS commit: src/sys

2021-09-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Sep 15 17:33:08 UTC 2021

Modified Files:
src/sys/arch/sparc/sparc: promlib.c
src/sys/dev/acpi: acpi_pci.c acpi_util.c
src/sys/dev/ofw: ofw_pci_subr.c ofw_subr.c
src/sys/dev/pci: Makefile pci.c pcivar.h
src/sys/kern: subr_device.c
src/sys/sys: Makefile device.h
Added Files:
src/sys/dev/pci: pci_calls.h
src/sys/sys: device_calls.h

Log Message:
Adjust the device_call() calling convention so as to provide type checking
of the arguments passed to the call, using auto-generated argument
structures and binding macros.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/sparc/sparc/promlib.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/acpi/acpi_pci.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/acpi/acpi_util.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ofw/ofw_pci_subr.c
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/ofw/ofw_subr.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/Makefile
cvs rdiff -u -r1.161 -r1.162 src/sys/dev/pci/pci.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/pci_calls.h
cvs rdiff -u -r1.115 -r1.116 src/sys/dev/pci/pcivar.h
cvs rdiff -u -r1.8 -r1.9 src/sys/kern/subr_device.c
cvs rdiff -u -r1.176 -r1.177 src/sys/sys/Makefile
cvs rdiff -u -r1.174 -r1.175 src/sys/sys/device.h
cvs rdiff -u -r0 -r1.1 src/sys/sys/device_calls.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/sparc/sparc/promlib.c
diff -u src/sys/arch/sparc/sparc/promlib.c:1.48 src/sys/arch/sparc/sparc/promlib.c:1.49
--- src/sys/arch/sparc/sparc/promlib.c:1.48	Mon May 10 13:59:30 2021
+++ src/sys/arch/sparc/sparc/promlib.c	Wed Sep 15 17:33:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: promlib.c,v 1.48 2021/05/10 13:59:30 thorpej Exp $ */
+/*	$NetBSD: promlib.c,v 1.49 2021/09/15 17:33:08 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: promlib.c,v 1.48 2021/05/10 13:59:30 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: promlib.c,v 1.49 2021/09/15 17:33:08 thorpej Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_sparc_arch.h"
@@ -45,6 +45,8 @@ __KERNEL_RCSID(0, "$NetBSD: promlib.c,v 
 #include 
 #include 
 
+#include 
+
 #ifdef _STANDALONE
 #include 
 #define malloc(s,t,f)	alloc(s)
@@ -276,7 +278,7 @@ obp_device_enumerate_children(device_t d
 
 	return 0;
 }
-OBP_DEVICE_CALL_REGISTER("device-enumerate-children",
+OBP_DEVICE_CALL_REGISTER(DEVICE_ENUMERATE_CHILDREN_STR,
 			 obp_device_enumerate_children)
 #endif /* ! _STANDALONE */
 

Index: src/sys/dev/acpi/acpi_pci.c
diff -u src/sys/dev/acpi/acpi_pci.c:1.31 src/sys/dev/acpi/acpi_pci.c:1.32
--- src/sys/dev/acpi/acpi_pci.c:1.31	Wed May 12 23:22:33 2021
+++ src/sys/dev/acpi/acpi_pci.c	Wed Sep 15 17:33:08 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_pci.c,v 1.31 2021/05/12 23:22:33 thorpej Exp $ */
+/* $NetBSD: acpi_pci.c,v 1.32 2021/09/15 17:33:08 thorpej Exp $ */
 
 /*
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.31 2021/05/12 23:22:33 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v 1.32 2021/09/15 17:33:08 thorpej Exp $");
 
 #include 
 #include 
@@ -41,6 +41,8 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_pci.c,v
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 #include 
@@ -576,5 +578,5 @@ acpi_pci_bus_get_child_devhandle(device_
 
 	return ENODEV;
 }
-ACPI_DEVICE_CALL_REGISTER("pci-bus-get-child-devhandle",
+ACPI_DEVICE_CALL_REGISTER(PCI_BUS_GET_CHILD_DEVHANDLE_STR,
 			  acpi_pci_bus_get_child_devhandle)

Index: src/sys/dev/acpi/acpi_util.c
diff -u src/sys/dev/acpi/acpi_util.c:1.25 src/sys/dev/acpi/acpi_util.c:1.26
--- src/sys/dev/acpi/acpi_util.c:1.25	Mon Aug  9 20:49:09 2021
+++ src/sys/dev/acpi/acpi_util.c	Wed Sep 15 17:33:08 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_util.c,v 1.25 2021/08/09 20:49:09 andvar Exp $ */
+/*	$NetBSD: acpi_util.c,v 1.26 2021/09/15 17:33:08 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007, 2021 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.25 2021/08/09 20:49:09 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.26 2021/09/15 17:33:08 thorpej Exp $");
 
 #include 
 #include 
@@ -75,6 +75,8 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_util.c,
 #include 
 #include 
 
+#include 
+
 #include 
 
 #define _COMPONENT	ACPI_BUS_COMPONENT
@@ -153,7 +155,7 @@ acpi_device_enumerate_children(device_t 
 
 	return 0;
 }
-ACPI_DEVICE_CALL_REGISTER("device-enumerate-children",
+ACPI_DEVICE_CALL_REGISTER(DEVICE_ENUMERATE_CHILDREN_STR,
 			  acpi_device_enumerate_children)
 
 /*

Index: src/sys/dev/ofw/ofw_pci_subr.c
diff -u src/sys/dev/ofw/ofw_pci_subr.c:1.1 src/sys/dev/ofw/ofw_pci_subr.c:1.2
--- src/sys/dev/ofw/ofw_pci_subr.c:1.1	Wed May 12 23:22:33 2021
+++ src/sys/dev/ofw/ofw_pci_subr.c	Wed Sep 15 17:33:08

CVS commit: src/sys

2021-09-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Sep 15 17:33:08 UTC 2021

Modified Files:
src/sys/arch/sparc/sparc: promlib.c
src/sys/dev/acpi: acpi_pci.c acpi_util.c
src/sys/dev/ofw: ofw_pci_subr.c ofw_subr.c
src/sys/dev/pci: Makefile pci.c pcivar.h
src/sys/kern: subr_device.c
src/sys/sys: Makefile device.h
Added Files:
src/sys/dev/pci: pci_calls.h
src/sys/sys: device_calls.h

Log Message:
Adjust the device_call() calling convention so as to provide type checking
of the arguments passed to the call, using auto-generated argument
structures and binding macros.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/sparc/sparc/promlib.c
cvs rdiff -u -r1.31 -r1.32 src/sys/dev/acpi/acpi_pci.c
cvs rdiff -u -r1.25 -r1.26 src/sys/dev/acpi/acpi_util.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ofw/ofw_pci_subr.c
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/ofw/ofw_subr.c
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/Makefile
cvs rdiff -u -r1.161 -r1.162 src/sys/dev/pci/pci.c
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/pci_calls.h
cvs rdiff -u -r1.115 -r1.116 src/sys/dev/pci/pcivar.h
cvs rdiff -u -r1.8 -r1.9 src/sys/kern/subr_device.c
cvs rdiff -u -r1.176 -r1.177 src/sys/sys/Makefile
cvs rdiff -u -r1.174 -r1.175 src/sys/sys/device.h
cvs rdiff -u -r0 -r1.1 src/sys/sys/device_calls.h

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



CVS commit: src/sys

2021-09-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Sep 15 17:26:07 UTC 2021

Added Files:
src/sys/dev/pci: pci_calls
src/sys/kern: device_calls

Log Message:
Device call interface definition files for the "device" and "pci"
subsystems.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/pci_calls
cvs rdiff -u -r0 -r1.1 src/sys/kern/device_calls

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

Added files:

Index: src/sys/dev/pci/pci_calls
diff -u /dev/null src/sys/dev/pci/pci_calls:1.1
--- /dev/null	Wed Sep 15 17:26:07 2021
+++ src/sys/dev/pci/pci_calls	Wed Sep 15 17:26:07 2021
@@ -0,0 +1,62 @@
+$NetBSD: pci_calls,v 1.1 2021/09/15 17:26:07 thorpej Exp $
+
+/*-
+ * Copyright (c) 2021 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Device calls used by the PCI subsystem.
+ */
+
+subsystem pci;
+
+#include 
+
+/*
+ * pci-bus-get-child-devhandle
+ *
+ * Retrieve the devhandle for the PCI device represented by 'tag'
+ * in the PCI segment represented by 'pc'.  The PCI bus's device_t
+ * is the one that's passed in the call, and the device whose handle
+ * is being requested must be a direct child of that bus, otherwise
+ * behavior is undefined.
+ *
+ * Call returns 0 if successful, or an error code upon failure:
+ *
+ * ENOTSUP	The device handle implementation for the
+ *		PCI bus does not support this device call.
+ *
+ * ENODEV	The PCI device represented by the pcitag_t
+ *		was not found in a bus-scoped search of the
+ *		platform device tree.
+ */
+pci-bus-get-child-devhandle {
+	pci_chipset_tag_t pc;		/* IN */
+	pcitag_t tag;			/* IN */
+	devhandle_t devhandle;		/* OUT */
+};

Index: src/sys/kern/device_calls
diff -u /dev/null src/sys/kern/device_calls:1.1
--- /dev/null	Wed Sep 15 17:26:07 2021
+++ src/sys/kern/device_calls	Wed Sep 15 17:26:06 2021
@@ -0,0 +1,50 @@
+$NetBSD: device_calls,v 1.1 2021/09/15 17:26:06 thorpej Exp $
+
+/*-
+ * Copyright (c) 2021 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Device calls used by the device autoco

CVS commit: src/sys

2021-09-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Sep 15 17:26:07 UTC 2021

Added Files:
src/sys/dev/pci: pci_calls
src/sys/kern: device_calls

Log Message:
Device call interface definition files for the "device" and "pci"
subsystems.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/pci/pci_calls
cvs rdiff -u -r0 -r1.1 src/sys/kern/device_calls

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



CVS commit: src/sys/kern

2021-09-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Sep 15 17:25:14 UTC 2021

Added Files:
src/sys/kern: gendevcalls.awk

Log Message:
Add an awk program that reads in a device call interface description
file and emits a header file containing the argument and call binding
structures for those calls.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/kern/gendevcalls.awk

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

Added files:

Index: src/sys/kern/gendevcalls.awk
diff -u /dev/null src/sys/kern/gendevcalls.awk:1.1
--- /dev/null	Wed Sep 15 17:25:14 2021
+++ src/sys/kern/gendevcalls.awk	Wed Sep 15 17:25:14 2021
@@ -0,0 +1,208 @@
+#! /usr/bin/awk -f
+#	$NetBSD: gendevcalls.awk,v 1.1 2021/09/15 17:25:14 thorpej Exp $
+#
+# Copyright (c) 2021 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Jason R. Thorpe.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# Parses a device call definition file and produces argument and
+# binding structures.
+#
+
+function emit_binding(field) {
+	printf("union %s_binding {\n", call_name_ub)
+	printf("\tstruct device_call_generic generic;\n")
+	if (field != "") {
+		printf("\tstruct {\n")
+		printf("\t\tconst char *name;\n")
+		printf("\t\tstruct %s_args *args;\n", call_name_ub)
+		printf("\t} %s;\n", field);
+	}
+	printf("};\n")
+}
+
+function emit_name_macro() {
+	printf("\n")
+	printf("#define %s_STR \"%s\"\n", call_name_ub_uc, call_name)
+}
+
+function emit_invoke_macro(field, marg, carg) {
+	printf("\n")
+	printf("#define %s%s \\\n", call_name_ub_uc, marg)
+	printf("\t&((const union %s_binding){ \\\n", call_name_ub)
+	printf("\t\t.%s.name = \"%s\", \\\n", field, call_name)
+	printf("\t\t.%s.args = %s, \\\n", field, carg)
+	printf("\t})\n")
+}
+
+function start_decl(arg) {
+	if (state == "expecting-subsystem") {
+		print "must declare a subsystem before declaring a call " \
+		"at line " NR \
+		> "/dev/stderr"
+		exit 1
+	}
+
+	if (state != "expecting-decl-start") {
+		print "unexpected start of declaration at line " NR \
+		> "/dev/stderr"
+		exit 1
+	}
+
+	call_name = arg
+
+	if (index(call_name, call_name_prefix) != 1) {
+		printf("method name '%s' at line %d must begin with '%s'\n", \
+		call_name, NR, call_name_prefix) \
+		> "/dev/stderr"
+		exit 1
+	}
+
+	call_name_ub = arg
+	gsub("\-", "_", call_name_ub)
+	call_name_ub_uc = toupper(call_name_ub)
+}
+
+NR == 1 {
+	VERSION = $0
+	gsub("\\$", "", VERSION)
+	gsub(/ $/, "", VERSION)
+
+	printf("/*\t$NetBSD" "$\t*/\n\n")
+	printf("/*\n")
+	printf(" * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.\n")
+	printf(" *\n")
+	printf(" * generated from:\n")
+	printf(" *\t%s\n", VERSION)
+	printf(" */\n")
+
+	subsystem = ""
+	state = "expecting-subsystem"
+
+	next
+}
+#
+# Subystem declaration.  We use this to generate header file guards,
+# as well as to sanity-check the method names when they are declared.
+#
+state == "expecting-subsystem" && \
+/^subsystem[ \t]+[a-zA-Z]+[a-zA-Z0-9\-]*[ \t]*;[ \t]*$/ {
+	subsystem = $2
+
+	# strip the trailing ;
+	gsub(";$", "", subsystem)
+
+	subsystem_ub = subsystem
+	gsub("\-", "_", subsystem_ub)
+	subsystem_ub_uc = toupper(subsystem_ub)
+
+	# now tack on a trailing - for sanity checking method
+	# names later.
+	call_name_prefix = subsystem "-"
+
+	# Emit the leading header guard.
+	printf("#ifndef _%s_CALLS_H_\n", subsystem_ub_uc)
+	printf("#define _%s_CALLS_H_\n", subsystem_ub_uc)
+
+	# Pull in  for 'struct device_call_generic'.
+	printf("\n#include \n")
+
+	state = "expecting-decl-start"
+
+	next
+}
+#
+# Beginning of a call-with-a

CVS commit: src/sys/kern

2021-09-15 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Wed Sep 15 17:25:14 UTC 2021

Added Files:
src/sys/kern: gendevcalls.awk

Log Message:
Add an awk program that reads in a device call interface description
file and emits a header file containing the argument and call binding
structures for those calls.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/kern/gendevcalls.awk

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



CVS commit: [netbsd-8] src/doc

2021-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 15 16:39:19 UTC 2021

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

Log Message:
Ticket #1696


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.101 -r1.1.2.102 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.101 src/doc/CHANGES-8.3:1.1.2.102
--- src/doc/CHANGES-8.3:1.1.2.101	Wed Sep 15 16:34:29 2021
+++ src/doc/CHANGES-8.3	Wed Sep 15 16:39:19 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.101 2021/09/15 16:34:29 martin Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.102 2021/09/15 16:39:19 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -2023,3 +2023,89 @@ build.sh	1.348-1.352, 1.356
 	Support for MKREPRO and automatic timestamps when the source
 	tree is from git or mercurial.
 	[martin, ticket #1695]
+
+sys/dev/pci/ixgbe/ixgbe.c			1.252, 1.280-1.283, 1.286-1.287, 1.289-1.290 via patch
+sys/dev/pci/ixgbe/ixgbe.h			1.73, 1.76-1.80 via patch
+sys/dev/pci/ixgbe/ix_txrx.c			1.68-1.93
+sys/dev/pci/ixgbe/ixv.c1.153, 1.157-1.161, 1.163-1.166 via patch
+sys/dev/pci/ixgbe/if_bypass.c			1.7-1.9
+sys/dev/pci/ixgbe/if_fdir.c			1.4-1.5
+sys/dev/pci/ixgbe/if_sriov.c			1.10-1.11
+sys/dev/pci/ixgbe/ixgbe_82598.c			1.16
+sys/dev/pci/ixgbe/ixgbe_82599.c			1.23
+sys/dev/pci/ixgbe/ixgbe_api.c			1.25
+sys/dev/pci/ixgbe/ixgbe_bypass.h		1.2
+sys/dev/pci/ixgbe/ixgbe_common.c		1.30-1.33
+sys/dev/pci/ixgbe/ixgbe_dcb.c			1.10-1.11
+sys/dev/pci/ixgbe/ixgbe_dcb.h			1.7
+sys/dev/pci/ixgbe/ixgbe_dcb_82598.c		1.8-1.9
+sys/dev/pci/ixgbe/ixgbe_dcb_82598.h		1.7
+sys/dev/pci/ixgbe/ixgbe_dcb_82599.c		1.8-1.9
+sys/dev/pci/ixgbe/ixgbe_dcb_82599.h		1.7
+sys/dev/pci/ixgbe/ixgbe_fdir.h			1.3
+sys/dev/pci/ixgbe/ixgbe_features.h		1.3
+sys/dev/pci/ixgbe/ixgbe_mbx.c			1.12
+sys/dev/pci/ixgbe/ixgbe_netbsd.c		1.16-1.17
+sys/dev/pci/ixgbe/ixgbe_netbsd.h		1.13-1.14
+sys/dev/pci/ixgbe/ixgbe_netmap.c		1.3-1.4
+sys/dev/pci/ixgbe/ixgbe_netmap.h		1.2
+sys/dev/pci/ixgbe/ixgbe_osdep.c			1.7
+sys/dev/pci/ixgbe/ixgbe_osdep.h			1.29-1.30
+sys/dev/pci/ixgbe/ixgbe_phy.c			1.24
+sys/dev/pci/ixgbe/ixgbe_rss.h			1.5
+sys/dev/pci/ixgbe/ixgbe_sriov.h			1.4
+sys/dev/pci/ixgbe/ixgbe_type.h			1.49
+sys/dev/pci/ixgbe/ixgbe_vf.c			1.27
+sys/dev/pci/ixgbe/ixgbe_x540.c			1.18-1.19
+sys/dev/pci/ixgbe/ixgbe_x540.h			1.9
+sys/dev/pci/ixgbe/ixgbe_x550.c			1.19-1.20
+sys/dev/pci/ixgbe/ixgbe_x550.h			1.6
+sys/dev/pci/files.pci1.438
+share/man/man4/ixg.41.15
+share/man/man4/ixv.41.8
+
+	- Use MCLGET() instead of homegrown cluster (jcl) allocation mechanism.
+	  Before this commit, resource shortage was easily occurred because
+	  the total number of the clusters is small.
+	- Improve performance:
+	  - Use m_adj(ETHER_ALIGN) more.
+	  - Sprinkle __predict_false() in the RX path.
+	  - Don't pre-allocate a cluster for RXCOPY case to improve short
+	packet's performance.
+	- Call bus_dmamap_unload(9) via ixgbe_dmamap_unload(), before freeing
+	  DMA buffer. Also, when the buffer is already freed, do not call
+	  bus_dmamap_unload(9) (no resource leaks with this change). This
+	  change is required to make ixg(4) work on alpha.
+	- Keep m_len and m_pkthdr.len consistent to prevent panic on arm.
+	- Fix panic when bus_dmamap_load_mbuf() failed in
+	  ixgbe_setup_receive_ring().
+	- Added BUS_DMA_COHERENT flag to bus_dmamem_map() to improve stability
+	  on aarch64.
+	- Use uint64_t instead of bus_addr_t for the TX descriptor's buffer
+	  address. At least, this change is required for macppc
+	  (sizeof(bus_addr_t) == 4) to make TX work.
+	- Fix little-endian dependence.
+	- Set rxr->next_to_refresh correctly in ixgbe_setup_receive_ring().
+	- Refresh unrefreshed descriptors' buffers correctly.
+	- Don't call bus_dmamap_sync with rx_mbuf_sz(== MCLBYTES) to prevent
+	  panic.
+	- Save the discard_multidesc state to not to forget the state by
+	  exiting rxeof().
+	- Add missing increment of no_mbuf error counter.
+	- Don't increment no_mbuf evcnt(9) when discarding multi-descriptor
+	  packet.
+	- ixv: Modify error message to sync with ixgbe.c
+	- Print the error value of ixgbe_reset_hw() for debugging.
+	- Remove extra unlock/lock processing around if_percpuq_enqueue().
+	- Refactor rxr->next_to_check updating.
+	- Add new sysctl "rx_copy_len".
+	- Add a new sysctl to read rxr->next_to_refresh.
+	- Print error number when error occurred.
+	- Rename ix{gbe,v}_stop() with ix{gbe,v}_stop_locked(). No functional
+	  change.
+	- Don't use fixed value.
+	- Comment out flow director processing in fast path.
+	- Add missing NetBSD RCS IDs and __KERNEL_RCSID()s.
+	- KNF.
+	- Fix typos.
+	[msaitoh, ticket #1696]



CVS commit: [netbsd-8] src/doc

2021-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 15 16:39:19 UTC 2021

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

Log Message:
Ticket #1696


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

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



CVS commit: [netbsd-8] src

2021-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 15 16:38:01 UTC 2021

Modified Files:
src/share/man/man4 [netbsd-8]: ixg.4 ixv.4
src/sys/dev/pci [netbsd-8]: files.pci
src/sys/dev/pci/ixgbe [netbsd-8]: if_bypass.c if_fdir.c if_sriov.c
ix_txrx.c ixgbe.c ixgbe.h ixgbe_82598.c ixgbe_82599.c ixgbe_api.c
ixgbe_bypass.h ixgbe_common.c ixgbe_dcb.c ixgbe_dcb.h
ixgbe_dcb_82598.c ixgbe_dcb_82598.h ixgbe_dcb_82599.c
ixgbe_dcb_82599.h ixgbe_fdir.h ixgbe_features.h ixgbe_mbx.c
ixgbe_netbsd.c ixgbe_netbsd.h ixgbe_netmap.c ixgbe_netmap.h
ixgbe_osdep.c ixgbe_osdep.h ixgbe_phy.c ixgbe_rss.h ixgbe_sriov.h
ixgbe_type.h ixgbe_vf.c ixgbe_x540.c ixgbe_x540.h ixgbe_x550.c
ixgbe_x550.h ixv.c

Log Message:
Pull up the following (all via patch), requested by msaitoh in ticket #1696:

sysdev/pci/ixgbe/ixgbe.c1.252, 1.280-1.283, 
1.286-1.287, 1.289-1.290 via patch
sysdev/pci/ixgbe/ixgbe.h1.73, 1.76-1.80 via 
patch
sysdev/pci/ixgbe/ix_txrx.c  1.68-1.93
sysdev/pci/ixgbe/ixv.c  1.153, 1.157-1.161, 
1.163-1.166 via patch
sysdev/pci/ixgbe/if_bypass.c1.7-1.9
sysdev/pci/ixgbe/if_fdir.c  1.4-1.5
sysdev/pci/ixgbe/if_sriov.c 1.10-1.11
sysdev/pci/ixgbe/ixgbe_82598.c  1.16
sysdev/pci/ixgbe/ixgbe_82599.c  1.23
sysdev/pci/ixgbe/ixgbe_api.c1.25
sysdev/pci/ixgbe/ixgbe_bypass.h 1.2
sysdev/pci/ixgbe/ixgbe_common.c 1.30-1.33
sysdev/pci/ixgbe/ixgbe_dcb.c1.10-1.11
sysdev/pci/ixgbe/ixgbe_dcb.h1.7
sysdev/pci/ixgbe/ixgbe_dcb_82598.c  1.8-1.9
sysdev/pci/ixgbe/ixgbe_dcb_82598.h  1.7
sysdev/pci/ixgbe/ixgbe_dcb_82599.c  1.8-1.9
sysdev/pci/ixgbe/ixgbe_dcb_82599.h  1.7
sysdev/pci/ixgbe/ixgbe_fdir.h   1.3
sysdev/pci/ixgbe/ixgbe_features.h   1.3
sysdev/pci/ixgbe/ixgbe_mbx.c1.12
sysdev/pci/ixgbe/ixgbe_netbsd.c 1.16-1.17
sysdev/pci/ixgbe/ixgbe_netbsd.h 1.13-1.14
sysdev/pci/ixgbe/ixgbe_netmap.c 1.3-1.4
sysdev/pci/ixgbe/ixgbe_netmap.h 1.2
sysdev/pci/ixgbe/ixgbe_osdep.c  1.7
sysdev/pci/ixgbe/ixgbe_osdep.h  1.29-1.30
sysdev/pci/ixgbe/ixgbe_phy.c1.24
sysdev/pci/ixgbe/ixgbe_rss.h1.5
sysdev/pci/ixgbe/ixgbe_sriov.h  1.4
sysdev/pci/ixgbe/ixgbe_type.h   1.49
sysdev/pci/ixgbe/ixgbe_vf.c 1.27
sysdev/pci/ixgbe/ixgbe_x540.c   1.18-1.19
sysdev/pci/ixgbe/ixgbe_x540.h   1.9
sysdev/pci/ixgbe/ixgbe_x550.c   1.19-1.20
sysdev/pci/ixgbe/ixgbe_x550.h   1.6
sysdev/pci/files.pci1.438
share/man/man4/ixg.41.15
share/man/man4/ixv.41.8

- Use MCLGET() instead of homegrown cluster (jcl) allocation mechanism.
  Before this commit, resource shortage was easily occurred because
  the total number of the clusters is small.
- Improve performance:
  - Use m_adj(ETHER_ALIGN) more.
  - Sprinkle __predict_false() in the RX path.
  - Don't pre-allocate a cluster for RXCOPY case to improve short
packet's performance.
- Call bus_dmamap_unload(9) via ixgbe_dmamap_unload(), before freeing
  DMA buffer. Also, when the buffer is already freed, do not call
  bus_dmamap_unload(9) (no resource leaks with this change). This
  change is required to make ixg(4) work on alpha.
- Keep m_len and m_pkthdr.len consistent to prevent panic on arm.
- Fix panic when bus_dmamap_load_mbuf() failed in
  ixgbe_setup_receive_ring().
- Added BUS_DMA_COHERENT flag to bus_dmamem_map() to improve stability
  on aarch64.
- Use uint64_t instead of bus_addr_t for the TX descriptor's buffer
  address. At least, this change is required for macppc
  (sizeof(bus_addr_t) == 4) to make TX work.
- Fix little-endian dependence.
- Set rxr->next_to_refresh correctly in ixgbe_setup_receive_ring().
- Refresh unrefreshed descriptors' buffers correctly.
- Don't call bus_dmamap_sync with rx_mbuf_sz(== MCLBYTES) to prevent
  panic.
- Save the discard_multidesc state to not to forget the state by
  exiting rxeof().
- Add missing increment of no_mbuf error counter.
- Don't increment no_mbuf evcnt(9) when discarding multi-descriptor
  packet.
- ixv: Modify error message to sync with ixgbe.c
- Print the error value of 

CVS commit: [netbsd-8] src

2021-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 15 16:38:01 UTC 2021

Modified Files:
src/share/man/man4 [netbsd-8]: ixg.4 ixv.4
src/sys/dev/pci [netbsd-8]: files.pci
src/sys/dev/pci/ixgbe [netbsd-8]: if_bypass.c if_fdir.c if_sriov.c
ix_txrx.c ixgbe.c ixgbe.h ixgbe_82598.c ixgbe_82599.c ixgbe_api.c
ixgbe_bypass.h ixgbe_common.c ixgbe_dcb.c ixgbe_dcb.h
ixgbe_dcb_82598.c ixgbe_dcb_82598.h ixgbe_dcb_82599.c
ixgbe_dcb_82599.h ixgbe_fdir.h ixgbe_features.h ixgbe_mbx.c
ixgbe_netbsd.c ixgbe_netbsd.h ixgbe_netmap.c ixgbe_netmap.h
ixgbe_osdep.c ixgbe_osdep.h ixgbe_phy.c ixgbe_rss.h ixgbe_sriov.h
ixgbe_type.h ixgbe_vf.c ixgbe_x540.c ixgbe_x540.h ixgbe_x550.c
ixgbe_x550.h ixv.c

Log Message:
Pull up the following (all via patch), requested by msaitoh in ticket #1696:

sysdev/pci/ixgbe/ixgbe.c1.252, 1.280-1.283, 
1.286-1.287, 1.289-1.290 via patch
sysdev/pci/ixgbe/ixgbe.h1.73, 1.76-1.80 via 
patch
sysdev/pci/ixgbe/ix_txrx.c  1.68-1.93
sysdev/pci/ixgbe/ixv.c  1.153, 1.157-1.161, 
1.163-1.166 via patch
sysdev/pci/ixgbe/if_bypass.c1.7-1.9
sysdev/pci/ixgbe/if_fdir.c  1.4-1.5
sysdev/pci/ixgbe/if_sriov.c 1.10-1.11
sysdev/pci/ixgbe/ixgbe_82598.c  1.16
sysdev/pci/ixgbe/ixgbe_82599.c  1.23
sysdev/pci/ixgbe/ixgbe_api.c1.25
sysdev/pci/ixgbe/ixgbe_bypass.h 1.2
sysdev/pci/ixgbe/ixgbe_common.c 1.30-1.33
sysdev/pci/ixgbe/ixgbe_dcb.c1.10-1.11
sysdev/pci/ixgbe/ixgbe_dcb.h1.7
sysdev/pci/ixgbe/ixgbe_dcb_82598.c  1.8-1.9
sysdev/pci/ixgbe/ixgbe_dcb_82598.h  1.7
sysdev/pci/ixgbe/ixgbe_dcb_82599.c  1.8-1.9
sysdev/pci/ixgbe/ixgbe_dcb_82599.h  1.7
sysdev/pci/ixgbe/ixgbe_fdir.h   1.3
sysdev/pci/ixgbe/ixgbe_features.h   1.3
sysdev/pci/ixgbe/ixgbe_mbx.c1.12
sysdev/pci/ixgbe/ixgbe_netbsd.c 1.16-1.17
sysdev/pci/ixgbe/ixgbe_netbsd.h 1.13-1.14
sysdev/pci/ixgbe/ixgbe_netmap.c 1.3-1.4
sysdev/pci/ixgbe/ixgbe_netmap.h 1.2
sysdev/pci/ixgbe/ixgbe_osdep.c  1.7
sysdev/pci/ixgbe/ixgbe_osdep.h  1.29-1.30
sysdev/pci/ixgbe/ixgbe_phy.c1.24
sysdev/pci/ixgbe/ixgbe_rss.h1.5
sysdev/pci/ixgbe/ixgbe_sriov.h  1.4
sysdev/pci/ixgbe/ixgbe_type.h   1.49
sysdev/pci/ixgbe/ixgbe_vf.c 1.27
sysdev/pci/ixgbe/ixgbe_x540.c   1.18-1.19
sysdev/pci/ixgbe/ixgbe_x540.h   1.9
sysdev/pci/ixgbe/ixgbe_x550.c   1.19-1.20
sysdev/pci/ixgbe/ixgbe_x550.h   1.6
sysdev/pci/files.pci1.438
share/man/man4/ixg.41.15
share/man/man4/ixv.41.8

- Use MCLGET() instead of homegrown cluster (jcl) allocation mechanism.
  Before this commit, resource shortage was easily occurred because
  the total number of the clusters is small.
- Improve performance:
  - Use m_adj(ETHER_ALIGN) more.
  - Sprinkle __predict_false() in the RX path.
  - Don't pre-allocate a cluster for RXCOPY case to improve short
packet's performance.
- Call bus_dmamap_unload(9) via ixgbe_dmamap_unload(), before freeing
  DMA buffer. Also, when the buffer is already freed, do not call
  bus_dmamap_unload(9) (no resource leaks with this change). This
  change is required to make ixg(4) work on alpha.
- Keep m_len and m_pkthdr.len consistent to prevent panic on arm.
- Fix panic when bus_dmamap_load_mbuf() failed in
  ixgbe_setup_receive_ring().
- Added BUS_DMA_COHERENT flag to bus_dmamem_map() to improve stability
  on aarch64.
- Use uint64_t instead of bus_addr_t for the TX descriptor's buffer
  address. At least, this change is required for macppc
  (sizeof(bus_addr_t) == 4) to make TX work.
- Fix little-endian dependence.
- Set rxr->next_to_refresh correctly in ixgbe_setup_receive_ring().
- Refresh unrefreshed descriptors' buffers correctly.
- Don't call bus_dmamap_sync with rx_mbuf_sz(== MCLBYTES) to prevent
  panic.
- Save the discard_multidesc state to not to forget the state by
  exiting rxeof().
- Add missing increment of no_mbuf error counter.
- Don't increment no_mbuf evcnt(9) when discarding multi-descriptor
  packet.
- ixv: Modify error message to sync with ixgbe.c
- Print the error value of 

CVS commit: [netbsd-8] src/doc

2021-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 15 16:34:29 UTC 2021

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

Log Message:
Fix editor mishap/typo


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.115 -r1.1.2.116 src/doc/CHANGES-8.2
cvs rdiff -u -r1.1.2.100 -r1.1.2.101 src/doc/CHANGES-8.3

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



CVS commit: [netbsd-8] src/doc

2021-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 15 16:34:29 UTC 2021

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

Log Message:
Fix editor mishap/typo


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.115 -r1.1.2.116 src/doc/CHANGES-8.2
cvs rdiff -u -r1.1.2.100 -r1.1.2.101 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.2
diff -u src/doc/CHANGES-8.2:1.1.2.115 src/doc/CHANGES-8.2:1.1.2.116
--- src/doc/CHANGES-8.2:1.1.2.115	Tue Mar 31 05:08:40 2020
+++ src/doc/CHANGES-8.2	Wed Sep 15 16:34:29 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.115 2020/03/31 05:08:40 martin Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.116 2021/09/15 16:34:29 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -1920,7 +1920,7 @@ sys/dev/pci/ixgbe/if_bypass.c		1.5
 sys/dev/pci/ixgbe/ixgbe_osdep.c		1.5
 sys/dev/pci/ixgbe/ix_txrx.c		1.58-1.60
 sys/dev/pci/ixgbe/ixgbe.c		1.195,1.220-1.221 via patch
-sys/dev/pci/ixgbe/ixgbe.h		1.60-1.2
+sys/dev/pci/ixgbe/ixgbe.h		1.60-1.62
 sys/dev/pci/ixgbe/ixgbe_api.c		1.24
 sys/dev/pci/ixgbe/ixgbe_common.c	1.26
 sys/dev/pci/ixgbe/ixgbe_netbsd.c	1.11-1.12

Index: src/doc/CHANGES-8.3
diff -u src/doc/CHANGES-8.3:1.1.2.100 src/doc/CHANGES-8.3:1.1.2.101
--- src/doc/CHANGES-8.3:1.1.2.100	Wed Sep 15 05:12:03 2021
+++ src/doc/CHANGES-8.3	Wed Sep 15 16:34:29 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.3,v 1.1.2.100 2021/09/15 05:12:03 msaitoh Exp $
+# $NetBSD: CHANGES-8.3,v 1.1.2.101 2021/09/15 16:34:29 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -1775,7 +1775,7 @@ sys/dev/pci/ixgbe/ixgbe.c			1.259, 1.278
 sys/dev/pci/ixgbe/ixgbe.h			1.75
 sys/dev/pci/ixgbe/ixgbe_netbsd.h		1.12
 sys/dev/pci/ixgbe/ixgbe_vf.c			1.24-1.26
-sys/dev/pci/ixgbe/ixgbe_x550.c			1.17
+sys/dev/pci/ixgbe/ixgbe_x540.c			1.17
 sys/dev/pci/ixgbe/ixv.c1.155-1.156
 sys/dev/pci/ixgbe/ix_txrx.c			1.64-67
 sys/dev/pci/files.pci1.436



CVS commit: [netbsd-9] src/doc

2021-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 15 16:32:30 UTC 2021

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

Log Message:
Ticket #1346


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.29 -r1.1.2.30 src/doc/CHANGES-9.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-9.3
diff -u src/doc/CHANGES-9.3:1.1.2.29 src/doc/CHANGES-9.3:1.1.2.30
--- src/doc/CHANGES-9.3:1.1.2.29	Tue Sep 14 02:23:35 2021
+++ src/doc/CHANGES-9.3	Wed Sep 15 16:32:30 2021
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.3,v 1.1.2.29 2021/09/14 02:23:35 msaitoh Exp $
+# $NetBSD: CHANGES-9.3,v 1.1.2.30 2021/09/15 16:32:30 martin Exp $
 
 A complete list of changes from the NetBSD 9.2 release to the NetBSD 9.3
 release:
@@ -646,3 +646,87 @@ build.sh	1.348-1.352, 1.356
 	Support for MKREPRO and automatic timestamps when the source
 	tree is from git or mercurial.
 	[martin, ticket #1345]
+
+sys/dev/pci/ixgbe/ixgbe.c			1.252, 1.280-1.283, 1.286-1.287, 1.289-1.290 via patch
+sys/dev/pci/ixgbe/ixgbe.h			1.76-1.80 via patch
+sys/dev/pci/ixgbe/ix_txrx.c			1.68-1.79, 1.80-1.93
+sys/dev/pci/ixgbe/ixv.c1.153, 1.157-1.161, 1.163-1.166 via patch
+sys/dev/pci/ixgbe/if_bypass.c			1.7-1.9
+sys/dev/pci/ixgbe/if_fdir.c			1.4-1.5
+sys/dev/pci/ixgbe/if_sriov.c			1.10-1.11
+sys/dev/pci/ixgbe/ixgbe_bypass.h		1.2
+sys/dev/pci/ixgbe/ixgbe_82598.c			1.16
+sys/dev/pci/ixgbe/ixgbe_82599.c			1.23
+sys/dev/pci/ixgbe/ixgbe_api.c			1.25
+sys/dev/pci/ixgbe/ixgbe_common.c		1.30-1.33
+sys/dev/pci/ixgbe/ixgbe_dcb.c			1.10-1.11
+sys/dev/pci/ixgbe/ixgbe_dcb.h			1.7
+sys/dev/pci/ixgbe/ixgbe_dcb_82598.c		1.8-1.9
+sys/dev/pci/ixgbe/ixgbe_dcb_82598.h		1.7
+sys/dev/pci/ixgbe/ixgbe_dcb_82599.c		1.8-1.9
+sys/dev/pci/ixgbe/ixgbe_dcb_82599.h		1.7
+sys/dev/pci/ixgbe/ixgbe_fdir.h			1.3
+sys/dev/pci/ixgbe/ixgbe_features.h		1.3
+sys/dev/pci/ixgbe/ixgbe_mbx.c			1.12
+sys/dev/pci/ixgbe/ixgbe_netbsd.c		1.13, 1.16-1.17
+sys/dev/pci/ixgbe/ixgbe_netbsd.h		1.13-1.14
+sys/dev/pci/ixgbe/ixgbe_netmap.c		1.3-1.4
+sys/dev/pci/ixgbe/ixgbe_netmap.h		1.2
+sys/dev/pci/ixgbe/ixgbe_osdep.c			1.7
+sys/dev/pci/ixgbe/ixgbe_osdep.h			1.29-1.30
+sys/dev/pci/ixgbe/ixgbe_phy.c			1.24
+sys/dev/pci/ixgbe/ixgbe_rss.h			1.5
+sys/dev/pci/ixgbe/ixgbe_sriov.h			1.4
+sys/dev/pci/ixgbe/ixgbe_type.h			1.49
+sys/dev/pci/ixgbe/ixgbe_vf.c			1.27
+sys/dev/pci/ixgbe/ixgbe_x540.c			1.18-1.19
+sys/dev/pci/ixgbe/ixgbe_x540.h			1.9
+sys/dev/pci/ixgbe/ixgbe_x550.c			1.19-1.20
+sys/dev/pci/ixgbe/ixgbe_x550.h			1.6
+sys/dev/pci/files.pci1.438
+share/man/man4/ixg.41.15
+share/man/man4/ixv.41.8
+
+	- Use MCLGET() instead of homegrown cluster (jcl) allocation mechanism.
+	  Before this commit, resource shortage was easily occurred because
+	  the total number of the clusters is small.
+	- Improve performace:
+	  - Use m_adj(ETHER_ALIGN) more.
+	  - Sprinkle __predict_false() in the RX path.
+	  - Don't pre-allocate a cluster for RXCOPY case to improve short
+	packet's performance.
+	- Call bus_dmamap_unload(9) via ixgbe_dmamap_unload(), before freeing
+	  DMA buffer. Also, when the buffer is already freed, do not call
+  bus_dmamap_unload(9) (no resource leaks with this change). This
+	  change is required to make ixg(4) work on alpha.
+	- Keep m_len and m_pkthdr.len consistent to prevent panic on arm.
+	- Fix panic when bus_dmamap_load_mbuf() failed in
+	  ixgbe_setup_receive_ring().
+	- Added BUS_DMA_COHERENT flag to bus_dmamem_map() to improve stability
+	  on aarch64.
+	- Use uint64_t instead of bus_addr_t for the TX descriptor's buffer
+	  address. At least, this change is required for macppc
+	  (sizeof(bus_addr_t) == 4) to make TX work.
+	- Fix little-endian dependence.
+	- Set rxr->next_to_refresh correctly in ixgbe_setup_receive_ring().
+	- Refresh unrefreshed descriptors' buffers correctly.
+	- Don't call bus_dmamap_sync with rx_mbuf_sz(== MCLBYTES) to prevent
+	  panic.
+	- Save the discard_multidesc state to not to forget the state by
+	  exiting rxeof().
+	- Add missing increment of no_mbuf error counter.
+	- Don't increment no_mbuf evcnt(9) when discarding multi-descriptor
+	  packet.
+	- ixv: Modify error message to sync with ixgbe.c
+	- Print the error value of ixgbe_reset_hw() for debugging.
+	- Remove extra unlock/lock processing around if_percpuq_enqueue().
+	- Refactor rxr->next_to_check updating.
+	- Add new sysctl "rx_copy_len".
+	- Add a new sysctl to read rxr->next_to_refresh.
+	- Print error number when error occurred.
+	- Comment out flow director processing in fast path.
+	- Add missing NetBSD RCS IDs and __KERNEL_RCSID()s.
+	- KNF.
+	- Fix typos.
+	[msaitoh, ticket #1346]
+



CVS commit: [netbsd-9] src/doc

2021-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 15 16:32:30 UTC 2021

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

Log Message:
Ticket #1346


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.29 -r1.1.2.30 src/doc/CHANGES-9.3

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



CVS commit: [netbsd-9] src

2021-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 15 16:30:51 UTC 2021

Modified Files:
src/share/man/man4 [netbsd-9]: ixg.4 ixv.4
src/sys/dev/pci [netbsd-9]: files.pci
src/sys/dev/pci/ixgbe [netbsd-9]: if_bypass.c if_fdir.c if_sriov.c
ix_txrx.c ixgbe.c ixgbe.h ixgbe_82598.c ixgbe_82599.c ixgbe_api.c
ixgbe_bypass.h ixgbe_common.c ixgbe_dcb.c ixgbe_dcb.h
ixgbe_dcb_82598.c ixgbe_dcb_82598.h ixgbe_dcb_82599.c
ixgbe_dcb_82599.h ixgbe_fdir.h ixgbe_features.h ixgbe_mbx.c
ixgbe_netbsd.c ixgbe_netbsd.h ixgbe_netmap.c ixgbe_netmap.h
ixgbe_osdep.c ixgbe_osdep.h ixgbe_phy.c ixgbe_rss.h ixgbe_sriov.h
ixgbe_type.h ixgbe_vf.c ixgbe_x540.c ixgbe_x540.h ixgbe_x550.c
ixgbe_x550.h ixv.c

Log Message:
Pull up the following (via patch), requested by msaitoh in ticket #1346:

sys/dev/pci/ixgbe/ixgbe.c   1.252, 1.280-1.283, 
1.286-1.287, 1.289-1.290 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.73, 1.76-1.80 via 
patch
sys/dev/pci/ixgbe/ix_txrx.c 1.68-1.93
sys/dev/pci/ixgbe/ixv.c 1.153, 1.157-1.161, 
1.163-1.166 via patch
sys/dev/pci/ixgbe/if_bypass.c   1.7-1.9
sys/dev/pci/ixgbe/if_fdir.c 1.4-1.5
sys/dev/pci/ixgbe/if_sriov.c1.10-1.11
sys/dev/pci/ixgbe/ixgbe_82598.c 1.16
sys/dev/pci/ixgbe/ixgbe_82599.c 1.23
sys/dev/pci/ixgbe/ixgbe_api.c   1.25
sys/dev/pci/ixgbe/ixgbe_bypass.h1.2
sys/dev/pci/ixgbe/ixgbe_common.c1.30-1.33
sys/dev/pci/ixgbe/ixgbe_dcb.c   1.10-1.11
sys/dev/pci/ixgbe/ixgbe_dcb.h   1.7
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c 1.8-1.9
sys/dev/pci/ixgbe/ixgbe_dcb_82598.h 1.7
sys/dev/pci/ixgbe/ixgbe_dcb_82599.c 1.8-1.9
sys/dev/pci/ixgbe/ixgbe_dcb_82599.h 1.7
sys/dev/pci/ixgbe/ixgbe_fdir.h  1.3
sys/dev/pci/ixgbe/ixgbe_features.h  1.3
sys/dev/pci/ixgbe/ixgbe_mbx.c   1.12
sys/dev/pci/ixgbe/ixgbe_netbsd.c1.13, 1.16-1.17
sys/dev/pci/ixgbe/ixgbe_netbsd.h1.13-1.14
sys/dev/pci/ixgbe/ixgbe_netmap.c1.3-1.4
sys/dev/pci/ixgbe/ixgbe_netmap.h1.2
sys/dev/pci/ixgbe/ixgbe_osdep.c 1.7
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.29-1.30
sys/dev/pci/ixgbe/ixgbe_phy.c   1.24
sys/dev/pci/ixgbe/ixgbe_rss.h   1.5
sys/dev/pci/ixgbe/ixgbe_sriov.h 1.4
sys/dev/pci/ixgbe/ixgbe_type.h  1.49
sys/dev/pci/ixgbe/ixgbe_vf.c1.27
sys/dev/pci/ixgbe/ixgbe_x540.c  1.18-1.19
sys/dev/pci/ixgbe/ixgbe_x540.h  1.9
sys/dev/pci/ixgbe/ixgbe_x550.c  1.19-1.20
sys/dev/pci/ixgbe/ixgbe_x550.h  1.6
sys/dev/pci/files.pci   1.438
share/man/man4/ixg.41.15
share/man/man4/ixv.41.8

- Use MCLGET() instead of homegrown cluster (jcl) allocation mechanism.
  Before this commit, resource shortage was easily occurred because
  the total number of the clusters is small.
- Improve performance:
  - Use m_adj(ETHER_ALIGN) more.
  - Sprinkle __predict_false() in the RX path.
  - Don't pre-allocate a cluster for RXCOPY case to improve short
packet's performance.
- Call bus_dmamap_unload(9) via ixgbe_dmamap_unload(), before freeing
  DMA buffer. Also, when the buffer is already freed, do not call
  bus_dmamap_unload(9) (no resource leaks with this change). This
  change is required to make ixg(4) work on alpha.
- Keep m_len and m_pkthdr.len consistent to prevent panic on arm.
- Fix panic when bus_dmamap_load_mbuf() failed in
  ixgbe_setup_receive_ring().
- Added BUS_DMA_COHERENT flag to bus_dmamem_map() to improve stability
  on aarch64.
- Use uint64_t instead of bus_addr_t for the TX descriptor's buffer
  address. At least, this change is required for macppc
  (sizeof(bus_addr_t) == 4) to make TX work.
- Fix little-endian dependence.
- Set rxr->next_to_refresh correctly in ixgbe_setup_receive_ring().
- Refresh unrefreshed descriptors' buffers correctly.
- Don't call bus_dmamap_sync with rx_mbuf_sz(== MCLBYTES) to prevent
  panic.
- Save the discard_multidesc state to not to forget the state by
  exiting rxeof().
- Add missing increment of no_mbuf error counter.
- Don't increment no_mbuf evcnt(9) when discarding multi-descriptor
  packet.
- ixv: Modify error message to sync with ixgbe.c
- Print the error value o

CVS commit: [netbsd-9] src

2021-09-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Sep 15 16:30:51 UTC 2021

Modified Files:
src/share/man/man4 [netbsd-9]: ixg.4 ixv.4
src/sys/dev/pci [netbsd-9]: files.pci
src/sys/dev/pci/ixgbe [netbsd-9]: if_bypass.c if_fdir.c if_sriov.c
ix_txrx.c ixgbe.c ixgbe.h ixgbe_82598.c ixgbe_82599.c ixgbe_api.c
ixgbe_bypass.h ixgbe_common.c ixgbe_dcb.c ixgbe_dcb.h
ixgbe_dcb_82598.c ixgbe_dcb_82598.h ixgbe_dcb_82599.c
ixgbe_dcb_82599.h ixgbe_fdir.h ixgbe_features.h ixgbe_mbx.c
ixgbe_netbsd.c ixgbe_netbsd.h ixgbe_netmap.c ixgbe_netmap.h
ixgbe_osdep.c ixgbe_osdep.h ixgbe_phy.c ixgbe_rss.h ixgbe_sriov.h
ixgbe_type.h ixgbe_vf.c ixgbe_x540.c ixgbe_x540.h ixgbe_x550.c
ixgbe_x550.h ixv.c

Log Message:
Pull up the following (via patch), requested by msaitoh in ticket #1346:

sys/dev/pci/ixgbe/ixgbe.c   1.252, 1.280-1.283, 
1.286-1.287, 1.289-1.290 via patch
sys/dev/pci/ixgbe/ixgbe.h   1.73, 1.76-1.80 via 
patch
sys/dev/pci/ixgbe/ix_txrx.c 1.68-1.93
sys/dev/pci/ixgbe/ixv.c 1.153, 1.157-1.161, 
1.163-1.166 via patch
sys/dev/pci/ixgbe/if_bypass.c   1.7-1.9
sys/dev/pci/ixgbe/if_fdir.c 1.4-1.5
sys/dev/pci/ixgbe/if_sriov.c1.10-1.11
sys/dev/pci/ixgbe/ixgbe_82598.c 1.16
sys/dev/pci/ixgbe/ixgbe_82599.c 1.23
sys/dev/pci/ixgbe/ixgbe_api.c   1.25
sys/dev/pci/ixgbe/ixgbe_bypass.h1.2
sys/dev/pci/ixgbe/ixgbe_common.c1.30-1.33
sys/dev/pci/ixgbe/ixgbe_dcb.c   1.10-1.11
sys/dev/pci/ixgbe/ixgbe_dcb.h   1.7
sys/dev/pci/ixgbe/ixgbe_dcb_82598.c 1.8-1.9
sys/dev/pci/ixgbe/ixgbe_dcb_82598.h 1.7
sys/dev/pci/ixgbe/ixgbe_dcb_82599.c 1.8-1.9
sys/dev/pci/ixgbe/ixgbe_dcb_82599.h 1.7
sys/dev/pci/ixgbe/ixgbe_fdir.h  1.3
sys/dev/pci/ixgbe/ixgbe_features.h  1.3
sys/dev/pci/ixgbe/ixgbe_mbx.c   1.12
sys/dev/pci/ixgbe/ixgbe_netbsd.c1.13, 1.16-1.17
sys/dev/pci/ixgbe/ixgbe_netbsd.h1.13-1.14
sys/dev/pci/ixgbe/ixgbe_netmap.c1.3-1.4
sys/dev/pci/ixgbe/ixgbe_netmap.h1.2
sys/dev/pci/ixgbe/ixgbe_osdep.c 1.7
sys/dev/pci/ixgbe/ixgbe_osdep.h 1.29-1.30
sys/dev/pci/ixgbe/ixgbe_phy.c   1.24
sys/dev/pci/ixgbe/ixgbe_rss.h   1.5
sys/dev/pci/ixgbe/ixgbe_sriov.h 1.4
sys/dev/pci/ixgbe/ixgbe_type.h  1.49
sys/dev/pci/ixgbe/ixgbe_vf.c1.27
sys/dev/pci/ixgbe/ixgbe_x540.c  1.18-1.19
sys/dev/pci/ixgbe/ixgbe_x540.h  1.9
sys/dev/pci/ixgbe/ixgbe_x550.c  1.19-1.20
sys/dev/pci/ixgbe/ixgbe_x550.h  1.6
sys/dev/pci/files.pci   1.438
share/man/man4/ixg.41.15
share/man/man4/ixv.41.8

- Use MCLGET() instead of homegrown cluster (jcl) allocation mechanism.
  Before this commit, resource shortage was easily occurred because
  the total number of the clusters is small.
- Improve performance:
  - Use m_adj(ETHER_ALIGN) more.
  - Sprinkle __predict_false() in the RX path.
  - Don't pre-allocate a cluster for RXCOPY case to improve short
packet's performance.
- Call bus_dmamap_unload(9) via ixgbe_dmamap_unload(), before freeing
  DMA buffer. Also, when the buffer is already freed, do not call
  bus_dmamap_unload(9) (no resource leaks with this change). This
  change is required to make ixg(4) work on alpha.
- Keep m_len and m_pkthdr.len consistent to prevent panic on arm.
- Fix panic when bus_dmamap_load_mbuf() failed in
  ixgbe_setup_receive_ring().
- Added BUS_DMA_COHERENT flag to bus_dmamem_map() to improve stability
  on aarch64.
- Use uint64_t instead of bus_addr_t for the TX descriptor's buffer
  address. At least, this change is required for macppc
  (sizeof(bus_addr_t) == 4) to make TX work.
- Fix little-endian dependence.
- Set rxr->next_to_refresh correctly in ixgbe_setup_receive_ring().
- Refresh unrefreshed descriptors' buffers correctly.
- Don't call bus_dmamap_sync with rx_mbuf_sz(== MCLBYTES) to prevent
  panic.
- Save the discard_multidesc state to not to forget the state by
  exiting rxeof().
- Add missing increment of no_mbuf error counter.
- Don't increment no_mbuf evcnt(9) when discarding multi-descriptor
  packet.
- ixv: Modify error message to sync with ixgbe.c
- Print the error value o

CVS commit: src/bin/ps

2021-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 15 13:16:57 UTC 2021

Modified Files:
src/bin/ps: keyword.c

Log Message:
Don't assign v to newvar, so we can still access the original length.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/bin/ps/keyword.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/ps/keyword.c
diff -u src/bin/ps/keyword.c:1.59 src/bin/ps/keyword.c:1.60
--- src/bin/ps/keyword.c:1.59	Tue Sep 14 18:01:17 2021
+++ src/bin/ps/keyword.c	Wed Sep 15 09:16:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: keyword.c,v 1.59 2021/09/14 22:01:17 christos Exp $	*/
+/*	$NetBSD: keyword.c,v 1.60 2021/09/15 13:16:57 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)keyword.c	8.5 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: keyword.c,v 1.59 2021/09/14 22:01:17 christos Exp $");
+__RCSID("$NetBSD: keyword.c,v 1.60 2021/09/15 13:16:57 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -383,7 +383,6 @@ findvar(const char *p)
 
 	struct var *newvar = emalloc(sizeof(*newvar));
 	*newvar = *v;
-	v = newvar;
 
 	if (hp) {
 		/*
@@ -407,7 +406,7 @@ findvar(const char *p)
 	if (*p != *pp)
 		newvar->flag |= ALTPR|LJUST;
 
-	return v;
+	return newvar;
 }
 
 static int



CVS commit: src/bin/ps

2021-09-15 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep 15 13:16:57 UTC 2021

Modified Files:
src/bin/ps: keyword.c

Log Message:
Don't assign v to newvar, so we can still access the original length.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/bin/ps/keyword.c

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



Re: CVS commit: src/sys

2021-09-15 Thread Rin Okuyama

On 2021/09/15 21:55, Taylor R Campbell wrote:

Date: Wed, 15 Sep 2021 19:58:20 +0900
From: Rin Okuyama 

login: [  95.5000696] panic: kernel diagnostic assertion "slock != NULL" failed: file 
"../../../../uvm/uvm_pdaemon.c", line 398 pg 0x8c66bd88 uobj 0x8fa7e400, NULL lock
[...]

It seems that I can avoid this panic if

- revert kern_ksyms.c to rev 1.98 (*), *or*
- set savecore=NO in rc.conf.

(*) I've not tested revs 1.99--1.103.

Can you please take a look into?


Interesting.  I'm not sure what's going on here.  The uvm panic looks
like a compounded symptom rather than the original problem.

Can you try booting with savecore=NO and see if `cat /dev/ksyms' or
`nm /dev/ksyms' works?

Can you also try rev. 1.103 and see if that makes a difference, just
to narrow it down?  (No point in trying the other revisions.  Unlikely
that 1.103 will work if 1.104 doesn't, but will help to confidently
narrow it down.)


'nm /dev/ksyms' works fine for 1.104. Also, panic does not occur after that,
as far as I can see.

For 1.103, savecore does not work and panic occurs during multiuser boot with
savecore=YES in the same manner as for 1.104. On the other hand,
'nm /dev/ksyms' works fine.

For 1.102 (== 1.98), whereas savecore works, nm complains as:


# nm /dev/ksyms
nm: warning: /dev/ksyms has a corrupt section with a size (18) larger than the 
file size
nm: warning: /dev/ksyms has a corrupt section with a size (4a560) larger than 
the file size
nm: warning: /dev/ksyms has a corrupt section with a size (46de5) larger than 
the file size
nm: warning: /dev/ksyms has a corrupt section with a size (40) larger than the 
file size
8c38fec8 t C.7
8c3e5b08 t CSWTCH.118
...


Thanks,
rin


Re: CVS commit: src/sys

2021-09-15 Thread Taylor R Campbell
> Date: Wed, 15 Sep 2021 19:58:20 +0900
> From: Rin Okuyama 
> 
> login: [  95.5000696] panic: kernel diagnostic assertion "slock != NULL" 
> failed: file "../../../../uvm/uvm_pdaemon.c", line 398 pg 0x8c66bd88 uobj 
> 0x8fa7e400, NULL lock
> [...]
> 
> It seems that I can avoid this panic if
> 
> - revert kern_ksyms.c to rev 1.98 (*), *or*
> - set savecore=NO in rc.conf.
> 
> (*) I've not tested revs 1.99--1.103.
> 
> Can you please take a look into?

Interesting.  I'm not sure what's going on here.  The uvm panic looks
like a compounded symptom rather than the original problem.

Can you try booting with savecore=NO and see if `cat /dev/ksyms' or
`nm /dev/ksyms' works?

Can you also try rev. 1.103 and see if that makes a difference, just
to narrow it down?  (No point in trying the other revisions.  Unlikely
that 1.103 will work if 1.104 doesn't, but will help to confidently
narrow it down.)


CVS commit: src/sys/arch/sh3/sh3

2021-09-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Sep 15 11:03:25 UTC 2021

Modified Files:
src/sys/arch/sh3/sh3: exception.c

Log Message:
For kernel mode address error, do not overwrite tf->tf_spc and tf->tf_r0
*before* checking pcb->pbc_onfault != NULL.

Should fix part of

PR port-sh3/56382
PR port-sh3/56401

i.e., DDB will no longer wrongly indicate NULL as fault PC for kernel mode
address error (and 0xe == EFAULT as r0).

Yes, we have another bugs that cause panics described in the two PRs, but
now we can examine them more easily :).


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/sh3/sh3/exception.c

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



CVS commit: src/sys/arch/sh3/sh3

2021-09-15 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Sep 15 11:03:25 UTC 2021

Modified Files:
src/sys/arch/sh3/sh3: exception.c

Log Message:
For kernel mode address error, do not overwrite tf->tf_spc and tf->tf_r0
*before* checking pcb->pbc_onfault != NULL.

Should fix part of

PR port-sh3/56382
PR port-sh3/56401

i.e., DDB will no longer wrongly indicate NULL as fault PC for kernel mode
address error (and 0xe == EFAULT as r0).

Yes, we have another bugs that cause panics described in the two PRs, but
now we can examine them more easily :).


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/sh3/sh3/exception.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/sh3/sh3/exception.c
diff -u src/sys/arch/sh3/sh3/exception.c:1.73 src/sys/arch/sh3/sh3/exception.c:1.74
--- src/sys/arch/sh3/sh3/exception.c:1.73	Tue Dec  3 12:42:21 2019
+++ src/sys/arch/sh3/sh3/exception.c	Wed Sep 15 11:03:24 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: exception.c,v 1.73 2019/12/03 12:42:21 ad Exp $	*/
+/*	$NetBSD: exception.c,v 1.74 2021/09/15 11:03:24 rin Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2019 The NetBSD Foundation, Inc. All rights reserved.
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.73 2019/12/03 12:42:21 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.74 2021/09/15 11:03:24 rin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -196,11 +196,10 @@ general_exception(struct lwp *l, struct 
 	case EXPEVT_ADDR_ERR_LD: /* FALLTHROUGH */
 	case EXPEVT_ADDR_ERR_ST:
 		pcb = lwp_getpcb(l);
-		KDASSERT(pcb->pcb_onfault != NULL);
+		if (__predict_false(pcb->pcb_onfault == NULL))
+			goto do_panic;
 		tf->tf_spc = (int)pcb->pcb_onfault;
 		tf->tf_r0 = EFAULT;
-		if (tf->tf_spc == 0)
-			goto do_panic;
 		break;
 
 	case EXPEVT_ADDR_ERR_LD | EXP_USER: /* FALLTHROUGH */



Re: CVS commit: src/sys

2021-09-15 Thread Rin Okuyama

Hi,

On 2021/09/11 19:09, Taylor R Campbell wrote:

Module Name:src
Committed By:   riastradh
Date:   Sat Sep 11 10:09:55 UTC 2021

Modified Files:
src/sys/arch/sparc64/sparc64: machdep.c
src/sys/kern: kern_ksyms.c subr_csan.c subr_msan.c
src/sys/sys: ksyms.h

Log Message:
ksyms: Use pserialize(9) for kernel access to ksyms.

This makes it available in interrupt context, e.g. for printing
messages with kernel symbol names for return addresses as drm wants
to do.


To generate a diff of this commit:
cvs rdiff -u -r1.302 -r1.303 src/sys/arch/sparc64/sparc64/machdep.c
cvs rdiff -u -r1.103 -r1.104 src/sys/kern/kern_ksyms.c
cvs rdiff -u -r1.12 -r1.13 src/sys/kern/subr_csan.c
cvs rdiff -u -r1.16 -r1.17 src/sys/kern/subr_msan.c
cvs rdiff -u -r1.41 -r1.42 src/sys/sys/ksyms.h

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


kern_ksyms.c rev 1.104 causes this on landisk (sh3):


Checking for core dump...
savecore: (null): kvm_nlist: bad namelist
Sep 15 19:03:53 hdlu savecore: (null): kvm_nlist: bad namelist
savecore: (null): _dumpdev not in namelist
Sep 15 19:03:53 hdlu savecore: (null): _dumpdev not in namelist
Starting local daemons:.
Updating motd.
Starting ntpd.
Starting postfix.
Starting inetd.
Starting cron.
Wed Sep 15 19:04:33 JST 2021

NetBSD/landisk (hdlu) (constty)

login: [  95.5000696] panic: kernel diagnostic assertion "slock != NULL" failed: file 
"../../../../uvm/uvm_pdaemon.c", line 398 pg 0x8c66bd88 uobj 0x8fa7e400, NULL lock
[  95.6535669] cpu0: Begin traceback...
[  95.7031947] db_panic() at netbsd:vpanic+0xea
[  95.7500715] vpanic() at netbsd:kern_assert+0x24
[  95.7969493] kern_assert() at netbsd:uvmpd_page_owner_lock+0x56
[  95.8750798] uvmpd_page_owner_lock() at netbsd:uvmpd_trylockowner+0x3e
[  95.9531988] uvmpd_trylockowner() at netbsd:uvmpdpol_balancequeue+0x19c
[  96.0313226] uvmpdpol_balancequeue() at netbsd:uvm_pageout+0x5fa
[  96.0993345] uvm_pageout() at netbsd:lwp_trampoline+0xc
[  96.1568912] lwp_trampoline() at 0
[  96.1997961] cpu0: End traceback...
Stopped in pid 0.107 (system) atnetbsd:cpu_Debugger+0x6:mov
r14, r15
db>


It seems that I can avoid this panic if

- revert kern_ksyms.c to rev 1.98 (*), *or*
- set savecore=NO in rc.conf.

(*) I've not tested revs 1.99--1.103.

Can you please take a look into?

Thanks,
rin


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

2021-09-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep 15 07:49:54 UTC 2021

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

Log Message:
Use __SHIFTIN. Same code before and after.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/aarch64/aarch64/pmap.c

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.111 src/sys/arch/aarch64/aarch64/pmap.c:1.112
--- src/sys/arch/aarch64/aarch64/pmap.c:1.111	Sun Sep 12 08:23:57 2021
+++ src/sys/arch/aarch64/aarch64/pmap.c	Wed Sep 15 07:49:54 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.111 2021/09/12 08:23:57 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.112 2021/09/15 07:49:54 skrll Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.111 2021/09/12 08:23:57 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.112 2021/09/15 07:49:54 skrll Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -1449,7 +1449,9 @@ pmap_activate(struct lwp *l)
 	if (pm->pm_asid == -1)
 		pm->pm_asid = l->l_proc->p_pid;
 
-	ttbr0 = ((uint64_t)pm->pm_asid << 48) | pm->pm_l0table_pa;
+	ttbr0 =
+	 __SHIFTIN(pm->pm_asid, TTBR_ASID) |
+	 __SHIFTIN(pm->pm_l0table_pa, TTBR_BADDR);
 	cpu_set_ttbr0(ttbr0);
 
 	/* Re-enable translation table walks using TTBR0 */



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

2021-09-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Sep 15 07:49:54 UTC 2021

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

Log Message:
Use __SHIFTIN. Same code before and after.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/aarch64/aarch64/pmap.c

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