CVS commit: src/sys/modules/lua

2021-08-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Aug  7 04:19:31 UTC 2021

Modified Files:
src/sys/modules/lua: lua.c

Log Message:
Make sure that buffers allocated by lua_alloc() are aligned to 8-byte
boundaries as done by kmem_alloc(9).

Fix alignment faults on armv5te; GCC emits ldrd/strd instructions for
memory operands that are guaranteed to be aligned properly.

Drop unnecessary __packed attribute from alloc_header_t at the same time.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/modules/lua/lua.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/modules/lua/lua.c
diff -u src/sys/modules/lua/lua.c:1.25 src/sys/modules/lua/lua.c:1.26
--- src/sys/modules/lua/lua.c:1.25	Tue Jun 29 22:40:53 2021
+++ src/sys/modules/lua/lua.c	Sat Aug  7 04:19:31 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: lua.c,v 1.25 2021/06/29 22:40:53 dholland Exp $ */
+/*	$NetBSD: lua.c,v 1.26 2021/08/07 04:19:31 rin Exp $ */
 
 /*
  * Copyright (c) 2011 - 2017 by Marc Balmer .
@@ -547,14 +547,18 @@ lua_require(lua_State *L)
 
 typedef struct {
 	size_t size;
-} __packed alloc_header_t;
+} alloc_header_t;
 
 static void *
 lua_alloc(void *ud, void *ptr, size_t osize, size_t nsize)
 {
 	void *nptr = NULL;
 
-	const size_t hdr_size = sizeof(alloc_header_t);
+	/*
+	 * Make sure that buffers allocated by lua_alloc() are aligned to
+	 * 8-byte boundaries as done by kmem_alloc(9).
+	 */
+	const size_t hdr_size = roundup(sizeof(alloc_header_t), 8);
 	alloc_header_t *hdr = (alloc_header_t *) ((char *) ptr - hdr_size);
 
 	if (nsize == 0) { /* freeing */



CVS commit: src/sys/modules/lua

2021-08-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Aug  7 04:19:31 UTC 2021

Modified Files:
src/sys/modules/lua: lua.c

Log Message:
Make sure that buffers allocated by lua_alloc() are aligned to 8-byte
boundaries as done by kmem_alloc(9).

Fix alignment faults on armv5te; GCC emits ldrd/strd instructions for
memory operands that are guaranteed to be aligned properly.

Drop unnecessary __packed attribute from alloc_header_t at the same time.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/modules/lua/lua.c

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



CVS commit: src/share/man/man9

2021-08-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Aug  7 03:28:42 UTC 2021

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

Log Message:
x68k now uses KAUTH_MACHDEP_UNMANAGEDMEM.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/share/man/man9/kauth.9

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

Modified files:

Index: src/share/man/man9/kauth.9
diff -u src/share/man/man9/kauth.9:1.112 src/share/man/man9/kauth.9:1.113
--- src/share/man/man9/kauth.9:1.112	Sun Jul 15 05:16:41 2018
+++ src/share/man/man9/kauth.9	Sat Aug  7 03:28:42 2021
@@ -1,4 +1,4 @@
-.\" $NetBSD: kauth.9,v 1.112 2018/07/15 05:16:41 maxv Exp $
+.\" $NetBSD: kauth.9,v 1.113 2021/08/07 03:28:42 isaki Exp $
 .\"
 .\" Copyright (c) 2005, 2006 Elad Efrat 
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd July 14, 2018
+.Dd August 7, 2021
 .Dt KAUTH 9
 .Os
 .Sh NAME
@@ -1061,6 +1061,7 @@ Affects
 .Em powerpc ,
 .Em sh3 ,
 .Em vax ,
+.Em x68k ,
 .Em xen .
 .El
 .Ss Device Scope



CVS commit: src/share/man/man9

2021-08-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Aug  7 03:28:42 UTC 2021

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

Log Message:
x68k now uses KAUTH_MACHDEP_UNMANAGEDMEM.


To generate a diff of this commit:
cvs rdiff -u -r1.112 -r1.113 src/share/man/man9/kauth.9

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



CVS commit: src/lib/libc/gen

2021-08-06 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug  7 03:17:23 UTC 2021

Modified Files:
src/lib/libc/gen: signal.3

Log Message:
typo


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/gen/signal.3

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



CVS commit: src/lib/libc/gen

2021-08-06 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Sat Aug  7 03:17:23 UTC 2021

Modified Files:
src/lib/libc/gen: signal.3

Log Message:
typo


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/lib/libc/gen/signal.3

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

Modified files:

Index: src/lib/libc/gen/signal.3
diff -u src/lib/libc/gen/signal.3:1.28 src/lib/libc/gen/signal.3:1.29
--- src/lib/libc/gen/signal.3:1.28	Wed Dec  6 16:38:22 2017
+++ src/lib/libc/gen/signal.3	Sat Aug  7 03:17:23 2021
@@ -1,4 +1,4 @@
-.\"	$NetBSD: signal.3,v 1.28 2017/12/06 16:38:22 dholland Exp $
+.\"	$NetBSD: signal.3,v 1.29 2021/08/07 03:17:23 dholland Exp $
 .\"
 .\" Copyright (c) 1980, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -148,7 +148,7 @@ function;
 ignored signals remain ignored.
 .Pp
 Only functions that are async-signal-safe can safely be used in signal
-handlers, see
+handlers; see
 .Xr sigaction 2
 for a complete list.
 .Sh RETURN VALUES



CVS commit: [thorpej-futex2] src/tests/lib/libc/sys

2021-08-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug  7 01:46:54 UTC 2021

Modified Files:
src/tests/lib/libc/sys [thorpej-futex2]: t_futex_ops.c

Log Message:
futex_wake_highest_pri is not expected to fail on the thorpej-futex2
branch.


To generate a diff of this commit:
cvs rdiff -u -r1.5.8.1 -r1.5.8.2 src/tests/lib/libc/sys/t_futex_ops.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_futex_ops.c
diff -u src/tests/lib/libc/sys/t_futex_ops.c:1.5.8.1 src/tests/lib/libc/sys/t_futex_ops.c:1.5.8.2
--- src/tests/lib/libc/sys/t_futex_ops.c:1.5.8.1	Sat Aug  7 01:44:51 2021
+++ src/tests/lib/libc/sys/t_futex_ops.c	Sat Aug  7 01:46:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: t_futex_ops.c,v 1.5.8.1 2021/08/07 01:44:51 thorpej Exp $ */
+/* $NetBSD: t_futex_ops.c,v 1.5.8.2 2021/08/07 01:46:54 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2019, 2020\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_futex_ops.c,v 1.5.8.1 2021/08/07 01:44:51 thorpej Exp $");
+__RCSID("$NetBSD: t_futex_ops.c,v 1.5.8.2 2021/08/07 01:46:54 thorpej Exp $");
 
 #include 
 #include 
@@ -1483,7 +1483,6 @@ ATF_TC_HEAD(futex_wake_highest_pri, tc)
 }
 ATF_TC_BODY(futex_wake_highest_pri, tc)
 {
-	atf_tc_expect_fail("PR kern/55230");
 	do_test_wake_highest_pri();
 }
 ATF_TC_CLEANUP(futex_wake_highest_pri, tc)



CVS commit: [thorpej-futex2] src/tests/lib/libc/sys

2021-08-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug  7 01:46:54 UTC 2021

Modified Files:
src/tests/lib/libc/sys [thorpej-futex2]: t_futex_ops.c

Log Message:
futex_wake_highest_pri is not expected to fail on the thorpej-futex2
branch.


To generate a diff of this commit:
cvs rdiff -u -r1.5.8.1 -r1.5.8.2 src/tests/lib/libc/sys/t_futex_ops.c

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



CVS commit: [thorpej-futex2] src/tests/lib/libc/sys

2021-08-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug  7 01:44:51 UTC 2021

Modified Files:
src/tests/lib/libc/sys [thorpej-futex2]: t_futex_ops.c

Log Message:
Fix the unit test for FUTEX_REQUEUE and FUTEX_CMP_REQUEUE to account
for the different return value semantics.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.8.1 src/tests/lib/libc/sys/t_futex_ops.c

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



CVS commit: [thorpej-futex2] src/tests/lib/libc/sys

2021-08-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug  7 01:44:51 UTC 2021

Modified Files:
src/tests/lib/libc/sys [thorpej-futex2]: t_futex_ops.c

Log Message:
Fix the unit test for FUTEX_REQUEUE and FUTEX_CMP_REQUEUE to account
for the different return value semantics.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.5.8.1 src/tests/lib/libc/sys/t_futex_ops.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_futex_ops.c
diff -u src/tests/lib/libc/sys/t_futex_ops.c:1.5 src/tests/lib/libc/sys/t_futex_ops.c:1.5.8.1
--- src/tests/lib/libc/sys/t_futex_ops.c:1.5	Wed May  6 05:14:27 2020
+++ src/tests/lib/libc/sys/t_futex_ops.c	Sat Aug  7 01:44:51 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: t_futex_ops.c,v 1.5 2020/05/06 05:14:27 thorpej Exp $ */
+/* $NetBSD: t_futex_ops.c,v 1.5.8.1 2021/08/07 01:44:51 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2019, 2020 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2019, 2020\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_futex_ops.c,v 1.5 2020/05/06 05:14:27 thorpej Exp $");
+__RCSID("$NetBSD: t_futex_ops.c,v 1.5.8.1 2021/08/07 01:44:51 thorpej Exp $");
 
 #include 
 #include 
@@ -824,9 +824,21 @@ do_futex_requeue_test(int flags, int op)
 	 * FUTEX 1: 0 LWPs
 	 */
 
-	/* Move all waiters from 0 to 1. */
-	ATF_REQUIRE(__futex(_word, op | flags,
-			0, NULL, _word1, INT_MAX, good_val3) == 0);
+	/*
+	 * Move all waiters from 0 to 1.
+	 *
+	 * N.B. different return value semantics for FUTEX_REQUEUE
+	 * vs. FUTEX_CMP_REQUEUE.
+	 */
+	if (op == FUTEX_CMP_REQUEUE) {
+		ATF_REQUIRE(__futex(_word, op | flags,
+0, NULL, _word1, INT_MAX,
+good_val3) == 4);
+	} else {
+		ATF_REQUIRE(__futex(_word, op | flags,
+0, NULL, _word1, INT_MAX,
+good_val3) == 0);
+	}
 
 	/*
 	 * FUTEX 0: 0 LWPs



CVS commit: [thorpej-futex2] src/sys/kern

2021-08-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug  7 01:22:34 UTC 2021

Modified Files:
src/sys/kern [thorpej-futex2]: sys_futex.c

Log Message:
The return values for FUTEX_REQUEUE and FUTEX_CMP_REQUEUE are different,
but we weren't doing to the right thing.

FUTEX_REQUEUE returns the number of waiters awakened.

FUTEX_CMP_REQUEUE returns the number of waiters awakenend plus the
number of waiters requeued (and it is an exercise for the caller to
calculate the number requeued, if it cares).


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.4 -r1.12.4.5 src/sys/kern/sys_futex.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/sys_futex.c
diff -u src/sys/kern/sys_futex.c:1.12.4.4 src/sys/kern/sys_futex.c:1.12.4.5
--- src/sys/kern/sys_futex.c:1.12.4.4	Fri Aug  6 23:53:53 2021
+++ src/sys/kern/sys_futex.c	Sat Aug  7 01:22:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_futex.c,v 1.12.4.4 2021/08/06 23:53:53 thorpej Exp $	*/
+/*	$NetBSD: sys_futex.c,v 1.12.4.5 2021/08/07 01:22:33 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2018, 2019, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_futex.c,v 1.12.4.4 2021/08/06 23:53:53 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_futex.c,v 1.12.4.5 2021/08/07 01:22:33 thorpej Exp $");
 
 /*
  * Futexes
@@ -1158,7 +1158,7 @@ futex_wait(struct futex *f, int q, const
 static unsigned
 futex_wake(struct futex *f, int q, unsigned int const nwake,
 struct futex *f2, int q2, unsigned int const nrequeue,
-int bitset)
+int bitset, unsigned int *nrequeuedp)
 {
 	struct lwp *l, *l_next;
 	unsigned nwoken = 0;
@@ -1234,7 +1234,10 @@ futex_wake(struct futex *f, int q, unsig
 	futex_sq_unlock2(f, f2);
 
 	/* Return the number of waiters woken and requeued.  */
-	return nwoken + nrequeued;
+	if (nrequeuedp != NULL) {
+		*nrequeuedp = nrequeued;
+	}
+	return nwoken;
 }
 
 /*
@@ -1473,7 +1476,7 @@ futex_func_wake(bool shared, int *uaddr,
 	 */
 	futex_op_lock(f);
 	nwoken = futex_wake(f, FUTEX_WRITERQ, val,
-			NULL, FUTEX_WRITERQ, 0, val3);
+			NULL, FUTEX_WRITERQ, 0, val3, NULL);
 	futex_op_unlock(f);
 
 	/* Release the futex.  */
@@ -1498,6 +1501,7 @@ futex_func_requeue(bool shared, int op, 
 {
 	struct futex *f = NULL, *f2 = NULL;
 	unsigned nwoken = 0;	/* default to zero woken on early return */
+	unsigned nrequeued = 0;
 	int error;
 
 	/* Reject negative number of wakeups or requeues. */
@@ -1534,13 +1538,19 @@ futex_func_requeue(bool shared, int op, 
 		error = 0;
 		nwoken = futex_wake(f, FUTEX_WRITERQ, val,
 f2, FUTEX_WRITERQ, val2,
-FUTEX_BITSET_MATCH_ANY);
+FUTEX_BITSET_MATCH_ANY,
+);
 	}
 	futex_op_unlock2(f, f2);
 
 out:
-	/* Return the number of waiters woken.  */
-	*retval = nwoken;
+	/*
+	 * For FUTUEX_REQUEUE, return the numner of waiters woken.
+	 *
+	 * For FUTEX_CMP_REQUEUE, return the number of waiters woken
+	 * **and** requeued.
+	 */
+	*retval = nwoken + (op == FUTEX_CMP_REQUEUE) ? nrequeued : 0;
 
 	/* Release the futexes if we got them.  */
 	if (f2)
@@ -1728,11 +1738,11 @@ futex_func_wake_op(bool shared, int *uad
 	} while (actual != oldval);
 	nwoken = (f ? futex_wake(f, FUTEX_WRITERQ, val,
  NULL, FUTEX_WRITERQ, 0,
- FUTEX_BITSET_MATCH_ANY) : 0);
+ FUTEX_BITSET_MATCH_ANY, NULL) : 0);
 	if (f2 && futex_compute_cmp(oldval, val3))
 		nwoken += futex_wake(f2, FUTEX_WRITERQ, val2,
  NULL, FUTEX_WRITERQ, 0,
- FUTEX_BITSET_MATCH_ANY);
+ FUTEX_BITSET_MATCH_ANY, NULL);
 
 	/* Success! */
 	error = 0;
@@ -2067,7 +2077,7 @@ release_futex(uintptr_t const uptr, lwpi
 	if (oldval & FUTEX_WAITERS) {
 		(void)futex_wake(f, FUTEX_WRITERQ, 1,
  NULL, FUTEX_WRITERQ, 0,
- FUTEX_BITSET_MATCH_ANY);
+ FUTEX_BITSET_MATCH_ANY, NULL);
 	}
 
 	/* Unlock the queue and release the futex.  */



CVS commit: [thorpej-futex2] src/sys/kern

2021-08-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Aug  7 01:22:34 UTC 2021

Modified Files:
src/sys/kern [thorpej-futex2]: sys_futex.c

Log Message:
The return values for FUTEX_REQUEUE and FUTEX_CMP_REQUEUE are different,
but we weren't doing to the right thing.

FUTEX_REQUEUE returns the number of waiters awakened.

FUTEX_CMP_REQUEUE returns the number of waiters awakenend plus the
number of waiters requeued (and it is an exercise for the caller to
calculate the number requeued, if it cares).


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.4 -r1.12.4.5 src/sys/kern/sys_futex.c

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



CVS commit: [thorpej-futex2] src/sys/kern

2021-08-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Aug  6 23:53:53 UTC 2021

Modified Files:
src/sys/kern [thorpej-futex2]: sys_futex.c

Log Message:
Isolate knowledge of the union-ness of futex_key to where it's declared.


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.3 -r1.12.4.4 src/sys/kern/sys_futex.c

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



CVS commit: [thorpej-futex2] src/sys/kern

2021-08-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Aug  6 23:53:53 UTC 2021

Modified Files:
src/sys/kern [thorpej-futex2]: sys_futex.c

Log Message:
Isolate knowledge of the union-ness of futex_key to where it's declared.


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.3 -r1.12.4.4 src/sys/kern/sys_futex.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/sys_futex.c
diff -u src/sys/kern/sys_futex.c:1.12.4.3 src/sys/kern/sys_futex.c:1.12.4.4
--- src/sys/kern/sys_futex.c:1.12.4.3	Fri Aug  6 18:23:57 2021
+++ src/sys/kern/sys_futex.c	Fri Aug  6 23:53:53 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_futex.c,v 1.12.4.3 2021/08/06 18:23:57 thorpej Exp $	*/
+/*	$NetBSD: sys_futex.c,v 1.12.4.4 2021/08/06 23:53:53 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2018, 2019, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_futex.c,v 1.12.4.3 2021/08/06 18:23:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_futex.c,v 1.12.4.4 2021/08/06 23:53:53 thorpej Exp $");
 
 /*
  * Futexes
@@ -190,13 +190,16 @@ SDT_PROBE_DEFINE1(futex, wait, sleepq_bl
  *	A futex is addressed either by a vmspace+va (private) or by
  *	a uvm_voaddr (shared).
  */
-union futex_key {
+typedef union futex_key {
 	struct {
 		struct vmspace			*vmspace;
 		vaddr_tva;
 	}			fk_private;
 	struct uvm_voaddr	fk_shared;
-};
+} futex_key_t;
+
+CTASSERT(offsetof(futex_key_t, fk_private.va) ==
+	 offsetof(futex_key_t, fk_shared.offset));
 
 /*
  * struct futex
@@ -217,7 +220,7 @@ union futex_key {
  *	XXX field of the key.  Worth it?
  */
 struct futex {
-	union futex_key		fx_key;
+	futex_key_t		fx_key;
 	struct rb_node		fx_node;
 	unsigned long		fx_refcnt;
 	bool			fx_shared;
@@ -284,8 +287,8 @@ static int
 compare_futex_key(void *cookie, const void *n, const void *k)
 {
 	const struct futex *fa = n;
-	const union futex_key *fka = >fx_key;
-	const union futex_key *fkb = k;
+	const futex_key_t *fka = >fx_key;
+	const futex_key_t *fkb = k;
 
 	if ((uintptr_t)fka->fk_private.vmspace <
 	(uintptr_t)fkb->fk_private.vmspace)
@@ -319,8 +322,8 @@ static int
 compare_futex_shared_key(void *cookie, const void *n, const void *k)
 {
 	const struct futex *fa = n;
-	const union futex_key *fka = >fx_key;
-	const union futex_key *fkb = k;
+	const futex_key_t *fka = >fx_key;
+	const futex_key_t *fkb = k;
 
 	return uvm_voaddr_compare(>fk_shared, >fk_shared);
 }
@@ -539,7 +542,7 @@ futex_dtor(void *arg __unused, void *obj
  *	Initialize a futex key for lookup, etc.
  */
 static int
-futex_key_init(union futex_key *fk, struct vmspace *vm, vaddr_t va, bool shared)
+futex_key_init(futex_key_t *fk, struct vmspace *vm, vaddr_t va, bool shared)
 {
 	int error = 0;
 
@@ -560,7 +563,7 @@ futex_key_init(union futex_key *fk, stru
  *	Release a futex key.
  */
 static void
-futex_key_fini(union futex_key *fk, bool shared)
+futex_key_fini(futex_key_t *fk, bool shared)
 {
 	if (__predict_false(shared))
 		uvm_voaddr_release(>fk_shared);
@@ -578,7 +581,7 @@ futex_key_fini(union futex_key *fk, bool
  *	Never sleeps for memory, but may sleep to acquire a lock.
  */
 static struct futex *
-futex_create(union futex_key *fk, bool shared, uint8_t class)
+futex_create(futex_key_t *fk, bool shared, uint8_t class)
 {
 	struct futex *f;
 
@@ -725,7 +728,7 @@ futex_rele_count_not_last(struct futex *
  *	futex_lookup_create().
  */
 static int
-futex_lookup_by_key(union futex_key *fk, bool shared, uint8_t class,
+futex_lookup_by_key(futex_key_t *fk, bool shared, uint8_t class,
 struct futex **fp)
 {
 	struct futex *f;
@@ -804,7 +807,7 @@ out:	mutex_exit(_tab.lock);
 static int
 futex_lookup(int *uaddr, bool shared, uint8_t class, struct futex **fp)
 {
-	union futex_key fk;
+	futex_key_t fk;
 	struct vmspace *vm = curproc->p_vmspace;
 	vaddr_t va = (vaddr_t)uaddr;
 	int error;
@@ -852,7 +855,7 @@ futex_lookup(int *uaddr, bool shared, ui
 static int
 futex_lookup_create(int *uaddr, bool shared, uint8_t class, struct futex **fp)
 {
-	union futex_key fk;
+	futex_key_t fk;
 	struct vmspace *vm = curproc->p_vmspace;
 	struct futex *f = NULL;
 	vaddr_t va = (vaddr_t)uaddr;



CVS commit: src/sys/arch

2021-08-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Aug  6 19:38:54 UTC 2021

Modified Files:
src/sys/arch/aarch64/conf: files.aarch64
src/sys/arch/arm/acpi: acpi_platform.c
src/sys/arch/arm/arm: psci.c psci.h
src/sys/arch/arm/conf: files.arm
src/sys/arch/arm/fdt: psci_fdt.c
Added Files:
src/sys/arch/arm/arm: smccc.c smccc.h

Log Message:
Arm: Add support for SMC Calling Convention

Arm DEN0028 defines a calling mechanism used with Secure Monitor Call (SMC)
and Hypervisor Call (HVC) instructions. To discover SMCCC, we must:

 1) Find the PSCI conduit (either via ACPI FADT, or Device Tree)
 2) Use PSCI_VERSION to determine whether PSCI_FEATURES is supported
 3) Call PSCI_FEATURES with SMCCC_VERSION to determine the implementation
version.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/aarch64/conf/files.aarch64
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/acpi/acpi_platform.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/arm/psci.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/arm/psci.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/arm/smccc.c \
src/sys/arch/arm/arm/smccc.h
cvs rdiff -u -r1.164 -r1.165 src/sys/arch/arm/conf/files.arm
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/fdt/psci_fdt.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/conf/files.aarch64
diff -u src/sys/arch/aarch64/conf/files.aarch64:1.31 src/sys/arch/aarch64/conf/files.aarch64:1.32
--- src/sys/arch/aarch64/conf/files.aarch64:1.31	Sat Jul 24 23:38:41 2021
+++ src/sys/arch/aarch64/conf/files.aarch64	Fri Aug  6 19:38:53 2021
@@ -1,4 +1,4 @@
-#	$NetBSD: files.aarch64,v 1.31 2021/07/24 23:38:41 jmcneill Exp $
+#	$NetBSD: files.aarch64,v 1.32 2021/08/06 19:38:53 jmcneill Exp $
 
 defflag opt_cpuoptions.h	AARCH64_ALIGNMENT_CHECK
 defflag opt_cpuoptions.h	AARCH64_EL0_STACK_ALIGNMENT_CHECK
@@ -33,11 +33,15 @@ defparam opt_console.h		CONSPEED
 defparam opt_console.h		CONMODE
 defparam opt_console.h		CONADDR
 
-# Power State Coordination Interface (PSCI)
 # FP support
 file	arch/aarch64/aarch64/fpu.c
 
-device	psci
+# SMC Calling Convention
+define	smccc
+file	arch/arm/arm/smccc.c			smccc
+
+# Power State Coordination Interface (PSCI)
+device	psci: smccc
 file	arch/arm/arm/psci.c			psci
 file	arch/arm/arm/psci_arm.S			psci
 

Index: src/sys/arch/arm/acpi/acpi_platform.c
diff -u src/sys/arch/arm/acpi/acpi_platform.c:1.26 src/sys/arch/arm/acpi/acpi_platform.c:1.27
--- src/sys/arch/arm/acpi/acpi_platform.c:1.26	Wed May 12 23:22:32 2021
+++ src/sys/arch/arm/acpi/acpi_platform.c	Fri Aug  6 19:38:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_platform.c,v 1.26 2021/05/12 23:22:32 thorpej Exp $ */
+/* $NetBSD: acpi_platform.c,v 1.27 2021/08/06 19:38:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include "opt_multiprocessor.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.26 2021/05/12 23:22:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_platform.c,v 1.27 2021/08/06 19:38:53 jmcneill Exp $");
 
 #include 
 #include 
@@ -55,6 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: acpi_platfor
 
 #include 
 
+#include 
 #include 
 #include 
 

Index: src/sys/arch/arm/arm/psci.c
diff -u src/sys/arch/arm/arm/psci.c:1.5 src/sys/arch/arm/arm/psci.c:1.6
--- src/sys/arch/arm/arm/psci.c:1.5	Sat Jan 16 23:51:50 2021
+++ src/sys/arch/arm/arm/psci.c	Fri Aug  6 19:38:53 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: psci.c,v 1.5 2021/01/16 23:51:50 chs Exp $ */
+/* $NetBSD: psci.c,v 1.6 2021/08/06 19:38:53 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.5 2021/01/16 23:51:50 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.6 2021/08/06 19:38:53 jmcneill Exp $");
 
 #include 
 #include 
@@ -45,6 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: psci.c,v 1.5
 #else
 #define	PSCI_CPU_ON		0x8403
 #endif
+#define	PSCI_FEATURES		0x840a
 
 static psci_fn psci_call_fn;
 
@@ -53,9 +54,10 @@ static uint32_t psci_functions[PSCI_FUNC
 [PSCI_FUNC_SYSTEM_OFF] = PSCI_SYSTEM_OFF,
 	[PSCI_FUNC_SYSTEM_RESET] = PSCI_SYSTEM_RESET,
 	[PSCI_FUNC_CPU_ON] = PSCI_CPU_ON,
+	[PSCI_FUNC_FEATURES] = PSCI_FEATURES,
 };
 
-static int
+int
 psci_call(register_t fid, register_t arg1, register_t arg2, register_t arg3)
 {
 	KASSERT(psci_call_fn != NULL);
@@ -98,6 +100,15 @@ psci_system_reset(void)
 	psci_call(psci_functions[PSCI_FUNC_SYSTEM_RESET], 0, 0, 0);
 }
 
+int
+psci_features(uint32_t fid)
+{
+	if (psci_functions[PSCI_FUNC_FEATURES] == 0) {
+		return PSCI_NOT_SUPPORTED;
+	}
+	return psci_call(psci_functions[PSCI_FUNC_FEATURES], fid, 0, 0);
+}
+
 void
 psci_init(psci_fn fn)
 {

Index: src/sys/arch/arm/arm/psci.h
diff -u src/sys/arch/arm/arm/psci.h:1.2 src/sys/arch/arm/arm/psci.h:1.3
--- src/sys/arch/arm/arm/psci.h:1.2	Sat Oct 13 00:07:55 2018
+++ 

CVS commit: src/sys/arch

2021-08-06 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Fri Aug  6 19:38:54 UTC 2021

Modified Files:
src/sys/arch/aarch64/conf: files.aarch64
src/sys/arch/arm/acpi: acpi_platform.c
src/sys/arch/arm/arm: psci.c psci.h
src/sys/arch/arm/conf: files.arm
src/sys/arch/arm/fdt: psci_fdt.c
Added Files:
src/sys/arch/arm/arm: smccc.c smccc.h

Log Message:
Arm: Add support for SMC Calling Convention

Arm DEN0028 defines a calling mechanism used with Secure Monitor Call (SMC)
and Hypervisor Call (HVC) instructions. To discover SMCCC, we must:

 1) Find the PSCI conduit (either via ACPI FADT, or Device Tree)
 2) Use PSCI_VERSION to determine whether PSCI_FEATURES is supported
 3) Call PSCI_FEATURES with SMCCC_VERSION to determine the implementation
version.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/aarch64/conf/files.aarch64
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/acpi/acpi_platform.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/arm/psci.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/arm/psci.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/arm/smccc.c \
src/sys/arch/arm/arm/smccc.h
cvs rdiff -u -r1.164 -r1.165 src/sys/arch/arm/conf/files.arm
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/arm/fdt/psci_fdt.c

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



CVS commit: [thorpej-futex2] src/sys/kern

2021-08-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Aug  6 18:23:58 UTC 2021

Modified Files:
src/sys/kern [thorpej-futex2]: sys_futex.c

Log Message:
Correct a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.2 -r1.12.4.3 src/sys/kern/sys_futex.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/sys_futex.c
diff -u src/sys/kern/sys_futex.c:1.12.4.2 src/sys/kern/sys_futex.c:1.12.4.3
--- src/sys/kern/sys_futex.c:1.12.4.2	Thu Aug  5 23:23:50 2021
+++ src/sys/kern/sys_futex.c	Fri Aug  6 18:23:57 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_futex.c,v 1.12.4.2 2021/08/05 23:23:50 thorpej Exp $	*/
+/*	$NetBSD: sys_futex.c,v 1.12.4.3 2021/08/06 18:23:57 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2018, 2019, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_futex.c,v 1.12.4.2 2021/08/05 23:23:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_futex.c,v 1.12.4.3 2021/08/06 18:23:57 thorpej Exp $");
 
 /*
  * Futexes
@@ -1250,7 +1250,7 @@ futex_op_lock(struct futex *f)
 /*
  * futex_op_unlock(f)
  *
- *	Release the queue lock of f.
+ *	Release the op lock of f.
  */
 static void
 futex_op_unlock(struct futex *f)



CVS commit: [thorpej-futex2] src/sys/kern

2021-08-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Aug  6 18:23:58 UTC 2021

Modified Files:
src/sys/kern [thorpej-futex2]: sys_futex.c

Log Message:
Correct a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.12.4.2 -r1.12.4.3 src/sys/kern/sys_futex.c

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



CVS commit: src/sys/dev/ic

2021-08-06 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Aug  6 18:15:48 UTC 2021

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

Log Message:
conditionally put back the include of 

This is a kludge to fix the build on some ports. According to pmap(9),
including  should be sufficient to use
"bool pmap_is_modified(struct vm_page *pg)". However, on several ports,
the function is implemented as a macro and depends on implementation
details of "struct vm_page *", which is normally an incomplete forward
declaration only. XXX revert when all ports are fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/ssdfb.c

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



CVS commit: src/sys/dev/ic

2021-08-06 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Fri Aug  6 18:15:48 UTC 2021

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

Log Message:
conditionally put back the include of 

This is a kludge to fix the build on some ports. According to pmap(9),
including  should be sufficient to use
"bool pmap_is_modified(struct vm_page *pg)". However, on several ports,
the function is implemented as a macro and depends on implementation
details of "struct vm_page *", which is normally an incomplete forward
declaration only. XXX revert when all ports are fixed.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/dev/ic/ssdfb.c

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

Modified files:

Index: src/sys/dev/ic/ssdfb.c
diff -u src/sys/dev/ic/ssdfb.c:1.19 src/sys/dev/ic/ssdfb.c:1.20
--- src/sys/dev/ic/ssdfb.c:1.19	Thu Aug  5 22:31:20 2021
+++ src/sys/dev/ic/ssdfb.c	Fri Aug  6 18:15:48 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $ */
+/* $NetBSD: ssdfb.c,v 1.20 2021/08/06 18:15:48 tnn Exp $ */
 
 /*
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.19 2021/08/05 22:31:20 tnn Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.20 2021/08/06 18:15:48 tnn Exp $");
 
 #include "opt_ddb.h"
 
@@ -43,6 +43,9 @@ __KERNEL_RCSID(0, "$NetBSD: ssdfb.c,v 1.
 
 #include 
 #include 
+#ifdef pmap_is_modified
+#include 
+#endif
 
 #include 
 #include 



CVS commit: src/tests/usr.bin/xlint/lint2

2021-08-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Aug  6 16:21:00 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint2: msg_001.exp msg_001.ln msg_002.exp
msg_002.ln

Log Message:
tests/lint: add tests for declared but unused variables


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint2/msg_001.exp \
src/tests/usr.bin/xlint/lint2/msg_001.ln \
src/tests/usr.bin/xlint/lint2/msg_002.exp \
src/tests/usr.bin/xlint/lint2/msg_002.ln

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

Modified files:

Index: src/tests/usr.bin/xlint/lint2/msg_001.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_001.exp:1.1 src/tests/usr.bin/xlint/lint2/msg_001.exp:1.2
--- src/tests/usr.bin/xlint/lint2/msg_001.exp:1.1	Thu Aug  5 22:36:08 2021
+++ src/tests/usr.bin/xlint/lint2/msg_001.exp	Fri Aug  6 16:21:00 2021
@@ -0,0 +1,2 @@
+defined_not_used defined( msg_000.c(2) ), but never used
+used_not_defined used( msg_000.c(3) ), but not defined
Index: src/tests/usr.bin/xlint/lint2/msg_001.ln
diff -u src/tests/usr.bin/xlint/lint2/msg_001.ln:1.1 src/tests/usr.bin/xlint/lint2/msg_001.ln:1.2
--- src/tests/usr.bin/xlint/lint2/msg_001.ln:1.1	Thu Aug  5 22:36:08 2021
+++ src/tests/usr.bin/xlint/lint2/msg_001.ln	Fri Aug  6 16:21:00 2021
@@ -1,6 +1,11 @@
-# $NetBSD: msg_001.ln,v 1.1 2021/08/05 22:36:08 rillig Exp $
+# $NetBSD: msg_001.ln,v 1.2 2021/08/06 16:21:00 rillig Exp $
 #
 # Test data for message 1 of lint2:
 #	%s defined( %s ), but never used
 #
-# TODO: add actual test data
+
+0smsg_000.c
+Smsg_000.c
+
+3c0.3p1i16used_not_definedf2IDI
+2d0.2do16defined_not_usedf0I
Index: src/tests/usr.bin/xlint/lint2/msg_002.exp
diff -u src/tests/usr.bin/xlint/lint2/msg_002.exp:1.1 src/tests/usr.bin/xlint/lint2/msg_002.exp:1.2
--- src/tests/usr.bin/xlint/lint2/msg_002.exp:1.1	Thu Aug  5 22:36:08 2021
+++ src/tests/usr.bin/xlint/lint2/msg_002.exp	Fri Aug  6 16:21:00 2021
@@ -0,0 +1,2 @@
+defined defined( msg_002.c(3) ), but never used
+only_declared declared( msg_002.c(2) ), but never used or defined
Index: src/tests/usr.bin/xlint/lint2/msg_002.ln
diff -u src/tests/usr.bin/xlint/lint2/msg_002.ln:1.1 src/tests/usr.bin/xlint/lint2/msg_002.ln:1.2
--- src/tests/usr.bin/xlint/lint2/msg_002.ln:1.1	Thu Aug  5 22:36:08 2021
+++ src/tests/usr.bin/xlint/lint2/msg_002.ln	Fri Aug  6 16:21:00 2021
@@ -1,6 +1,14 @@
-# $NetBSD: msg_002.ln,v 1.1 2021/08/05 22:36:08 rillig Exp $
+# $NetBSD: msg_002.ln,v 1.2 2021/08/06 16:21:00 rillig Exp $
 #
 # Test data for message 2 of lint2:
 #	%s declared( %s ), but never used or defined
 #
-# TODO: add actual test data
+
+0smsg_002.c
+Smsg_002.c
+
+# extern int only_declared;
+2d0.2e13only_declaredI
+
+# int defined;
+3d0.3t7definedI



CVS commit: src/tests/usr.bin/xlint/lint2

2021-08-06 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Fri Aug  6 16:21:00 UTC 2021

Modified Files:
src/tests/usr.bin/xlint/lint2: msg_001.exp msg_001.ln msg_002.exp
msg_002.ln

Log Message:
tests/lint: add tests for declared but unused variables


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/usr.bin/xlint/lint2/msg_001.exp \
src/tests/usr.bin/xlint/lint2/msg_001.ln \
src/tests/usr.bin/xlint/lint2/msg_002.exp \
src/tests/usr.bin/xlint/lint2/msg_002.ln

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



Re: CVS commit: src/sys/arch/arm/xscale

2021-08-06 Thread Kengo NAKAHARA

Hi,

On 2021/08/06 17:58, Rin Okuyama wrote:

Module Name:src
Committed By:   rin
Date:   Fri Aug  6 08:58:42 UTC 2021

Modified Files:
src/sys/arch/arm/xscale: i80321_intr.h

Log Message:
Do *NOT* lower IPL in i80321_splraise().

Fix various strange crashes for DIAGNOSTIC kernel on evbarm/HDL_G,
including one worked around by if_wm.c rev 1.706:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/pci/if_wm.c#rev1.706


if_wm.c:r1.706 also fixes a potential bug which causes infinite loop
when do "sysctl -w hw.wmX.txrx_workqueue=1" on single processor system.
So, I leave the code.


Thanks,


--
//
Internet Initiative Japan Inc.

Device Engineering Section,
Product Division,
Technology Unit

Kengo NAKAHARA 




CVS commit: src/sys/arch/arm/xscale

2021-08-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  6 09:01:36 UTC 2021

Modified Files:
src/sys/arch/arm/xscale: i80321_icu.c i80321var.h

Log Message:
Simplify i80321_intr_calculate_masks().

G/C unused members of struct intrq.

No functional changes intended.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/xscale/i80321_icu.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/xscale/i80321var.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/arm/xscale/i80321_icu.c
diff -u src/sys/arch/arm/xscale/i80321_icu.c:1.26 src/sys/arch/arm/xscale/i80321_icu.c:1.27
--- src/sys/arch/arm/xscale/i80321_icu.c:1.26	Fri Nov 20 18:49:45 2020
+++ src/sys/arch/arm/xscale/i80321_icu.c	Fri Aug  6 09:01:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321_icu.c,v 1.26 2020/11/20 18:49:45 thorpej Exp $	*/
+/*	$NetBSD: i80321_icu.c,v 1.27 2021/08/06 09:01:36 rin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2006 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i80321_icu.c,v 1.26 2020/11/20 18:49:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i80321_icu.c,v 1.27 2021/08/06 09:01:36 rin Exp $");
 
 #ifndef EVBARM_SPL_NOINLINE
 #define	EVBARM_SPL_NOINLINE
@@ -166,26 +166,22 @@ i80321_intr_calculate_masks(void)
 	struct intrhand *ih;
 	int irq, ipl;
 
-	/* First, figure out which IPLs each IRQ has. */
+	/* Disable all IRQs. */
+	for (irq = 0; irq < NIRQ; irq++)
+		i80321_disable_irq(irq);
+
+	/* Figure out which IRQs are used by each IPL. */
+	for (ipl = 0; ipl < NIPL; ipl++)
+		i80321_imask[ipl] = 0;
 	for (irq = 0; irq < NIRQ; irq++) {
-		int levels = 0;
 		iq = [irq];
-		i80321_disable_irq(irq);
-		for (ih = TAILQ_FIRST(>iq_list); ih != NULL;
-		 ih = TAILQ_NEXT(ih, ih_list))
-			levels |= (1U << ih->ih_ipl);
-		iq->iq_levels = levels;
+		TAILQ_FOREACH(ih, >iq_list, ih_list)
+			i80321_imask[ih->ih_ipl] |= (1U << irq);
 	}
 
-	/* Next, figure out which IRQs are used by each IPL. */
-	for (ipl = 0; ipl < NIPL; ipl++) {
-		int irqs = 0;
-		for (irq = 0; irq < NIRQ; irq++) {
-			if (intrq[irq].iq_levels & (1U << ipl))
-irqs |= (1U << irq);
-		}
-		i80321_imask[ipl] = irqs;
-	}
+	/* All IPLs block everything blocked by any lower IPL. */
+	for (ipl = 1; ipl < NIPL; ipl++)
+		i80321_imask[ipl] |= i80321_imask[ipl - 1];
 
 	KASSERT(i80321_imask[IPL_NONE] == 0);
 	KASSERT(i80321_imask[IPL_SOFTCLOCK] == 0);
@@ -193,38 +189,11 @@ i80321_intr_calculate_masks(void)
 	KASSERT(i80321_imask[IPL_SOFTNET] == 0);
 	KASSERT(i80321_imask[IPL_SOFTSERIAL] == 0);
 
-	/*
-	 * Enforce a hierarchy that gives "slow" device (or devices with
-	 * limited input buffer space/"real-time" requirements) a better
-	 * chance at not dropping data.
-	 */
-
-#if 0
-	/*
-	 * This assert might be useful, but only after some interrupts
-	 * are configured.  As it stands now, it will always fire early
-	 * in the initialization phase.  If it's useful enough to re-
-	 * enable, it should be conditionalized on something else like
-	 * having at least something in the levels/irqs above.
-	 */
-	KASSERT(i80321_imask[IPL_VM] != 0);
-#endif
-	i80321_imask[IPL_SCHED] |= i80321_imask[IPL_VM];
-	i80321_imask[IPL_HIGH] |= i80321_imask[IPL_SCHED];
-
-	/*
-	 * Now compute which IRQs must be blocked when servicing any
-	 * given IRQ.
-	 */
+	/* Enable IRQs in use. */
 	for (irq = 0; irq < NIRQ; irq++) {
-		int irqs = (1U << irq);
 		iq = [irq];
-		if (TAILQ_FIRST(>iq_list) != NULL)
+		if (!TAILQ_EMPTY(>iq_list))
 			i80321_enable_irq(irq);
-		for (ih = TAILQ_FIRST(>iq_list); ih != NULL;
-		 ih = TAILQ_NEXT(ih, ih_list))
-			irqs |= i80321_imask[ih->ih_ipl];
-		iq->iq_mask = irqs;
 	}
 }
 

Index: src/sys/arch/arm/xscale/i80321var.h
diff -u src/sys/arch/arm/xscale/i80321var.h:1.13 src/sys/arch/arm/xscale/i80321var.h:1.14
--- src/sys/arch/arm/xscale/i80321var.h:1.13	Sun Feb 12 16:31:01 2012
+++ src/sys/arch/arm/xscale/i80321var.h	Fri Aug  6 09:01:36 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321var.h,v 1.13 2012/02/12 16:31:01 matt Exp $	*/
+/*	$NetBSD: i80321var.h,v 1.14 2021/08/06 09:01:36 rin Exp $	*/
 
 /*
  * Copyright (c) 2002, 2003 Wasabi Systems, Inc.
@@ -59,8 +59,6 @@ struct intrhand {
 struct intrq {
 	TAILQ_HEAD(, intrhand) iq_list;	/* handler list */
 	struct evcnt iq_ev;		/* event counter */
-	int iq_mask;			/* IRQs to mask while handling */
-	int iq_levels;			/* IPL_*'s this IRQ has */
 	int iq_ist;			/* share type */
 };
 



CVS commit: src/sys/arch/arm/xscale

2021-08-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  6 09:01:36 UTC 2021

Modified Files:
src/sys/arch/arm/xscale: i80321_icu.c i80321var.h

Log Message:
Simplify i80321_intr_calculate_masks().

G/C unused members of struct intrq.

No functional changes intended.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/xscale/i80321_icu.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/xscale/i80321var.h

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



CVS commit: src/sys/arch/arm/xscale

2021-08-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  6 08:58:42 UTC 2021

Modified Files:
src/sys/arch/arm/xscale: i80321_intr.h

Log Message:
Do *NOT* lower IPL in i80321_splraise().

Fix various strange crashes for DIAGNOSTIC kernel on evbarm/HDL_G,
including one worked around by if_wm.c rev 1.706:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/pci/if_wm.c#rev1.706


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/xscale/i80321_intr.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/arm/xscale/i80321_intr.h
diff -u src/sys/arch/arm/xscale/i80321_intr.h:1.12 src/sys/arch/arm/xscale/i80321_intr.h:1.13
--- src/sys/arch/arm/xscale/i80321_intr.h:1.12	Wed Jan 24 09:04:45 2018
+++ src/sys/arch/arm/xscale/i80321_intr.h	Fri Aug  6 08:58:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: i80321_intr.h,v 1.12 2018/01/24 09:04:45 skrll Exp $	*/
+/*	$NetBSD: i80321_intr.h,v 1.13 2021/08/06 08:58:42 rin Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2006 Wasabi Systems, Inc.
@@ -95,10 +95,15 @@ static inline int __attribute__((__unuse
 i80321_splraise(int ipl)
 {
 	int old = curcpl();
-	set_curcpl(ipl);
 
-	/* Don't let the compiler re-order this code with subsequent code */
-	__insn_barrier();
+	if (ipl > old) {
+		set_curcpl(ipl);
+		/*
+		 * Don't let the compiler re-order this code with
+		 * subsequent code
+		 */
+		__insn_barrier();
+	}
 
 	return (old);
 }



CVS commit: src/sys/arch/arm/xscale

2021-08-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Aug  6 08:58:42 UTC 2021

Modified Files:
src/sys/arch/arm/xscale: i80321_intr.h

Log Message:
Do *NOT* lower IPL in i80321_splraise().

Fix various strange crashes for DIAGNOSTIC kernel on evbarm/HDL_G,
including one worked around by if_wm.c rev 1.706:

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/pci/if_wm.c#rev1.706


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/xscale/i80321_intr.h

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



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

2021-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  6 08:44:31 UTC 2021

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

Log Message:
Fix copy+pasto (wrong dir for t_lint2)


To generate a diff of this commit:
cvs rdiff -u -r1.1104 -r1.1105 src/distrib/sets/lists/tests/mi

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



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

2021-08-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Fri Aug  6 08:44:31 UTC 2021

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

Log Message:
Fix copy+pasto (wrong dir for t_lint2)


To generate a diff of this commit:
cvs rdiff -u -r1.1104 -r1.1105 src/distrib/sets/lists/tests/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/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1104 src/distrib/sets/lists/tests/mi:1.1105
--- src/distrib/sets/lists/tests/mi:1.1104	Thu Aug  5 22:36:07 2021
+++ src/distrib/sets/lists/tests/mi	Fri Aug  6 08:44:31 2021
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1104 2021/08/05 22:36:07 rillig Exp $
+# $NetBSD: mi,v 1.1105 2021/08/06 08:44:31 martin Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -7064,7 +7064,7 @@
 ./usr/tests/usr.bin/xlint/lint2/msg_017.ln			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint2/msg_018.exp			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/xlint/lint2/msg_018.ln			tests-usr.bin-tests	compattestfile,atf
-./usr/tests/usr.bin/xlint/lint1/t_lint2tests-usr.bin-tests	compattestfile,atf
+./usr/tests/usr.bin/xlint/lint2/t_lint2tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/ztesttests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/ztest/Atffile			tests-usr.bin-tests	compattestfile,atf
 ./usr/tests/usr.bin/ztest/Kyuafile			tests-usr.bin-tests	compattestfile,atf,kyua



CVS commit: src

2021-08-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Aug  6 07:55:13 UTC 2021

Modified Files:
src: build.sh
src/sys/netinet: tcp_input.c
src/usr.sbin/installboot: evboards.c

Log Message:
fix various typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.353 -r1.354 src/build.sh
cvs rdiff -u -r1.429 -r1.430 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/installboot/evboards.c

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.353 src/build.sh:1.354
--- src/build.sh:1.353	Mon Jun  7 17:11:16 2021
+++ src/build.sh	Fri Aug  6 07:55:13 2021
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.353 2021/06/07 17:11:16 christos Exp $
+#	$NetBSD: build.sh,v 1.354 2021/08/06 07:55:13 andvar Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -851,7 +851,7 @@ validatearch()
 
 # listarch -- list valid MACHINE/MACHINE_ARCH/ALIAS values,
 # optionally restricted to those where the MACHINE and/or MACHINE_ARCH
-# match specifed glob patterns.
+# match specified glob patterns.
 #
 listarch()
 {
@@ -1965,7 +1965,7 @@ createmakewrapper()
 	eval cat <
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.429 2021/07/31 20:29:37 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.430 2021/08/06 07:55:13 andvar Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -4044,7 +4044,7 @@ syn_cache_get(struct sockaddr *src, stru
 	tp->rcv_up = sc->sc_irs + 1;
 
 	/*
-	 * This is what whould have happened in tcp_output() when
+	 * This is what would have happened in tcp_output() when
 	 * the SYN,ACK was sent.
 	 */
 	tp->snd_up = tp->snd_una;
@@ -4302,7 +4302,7 @@ syn_cache_add(struct sockaddr *src, stru
 		 * With the default sbmax of 256K, a scale factor
 		 * of 3 will be chosen by this algorithm.  Those who
 		 * choose a larger sbmax should watch out
-		 * for the compatiblity problems mentioned above.
+		 * for the compatibility problems mentioned above.
 		 *
 		 * RFC1323: The Window field in a SYN (i.e., a 
 		 * or ) segment itself is never scaled.
@@ -4392,7 +4392,7 @@ syn_cache_respond(struct syn_cache *sc)
 		return EAFNOSUPPORT;
 	}
 
-	/* Worst case scanario, since we don't know the option size yet. */
+	/* Worst case scenario, since we don't know the option size yet. */
 	tlen = hlen + sizeof(struct tcphdr) + MAX_TCPOPTLEN;
 	KASSERT(max_linkhdr + tlen <= MCLBYTES);
 
@@ -4539,7 +4539,7 @@ syn_cache_respond(struct syn_cache *sc)
 
 	/*
 	 * Send ECN SYN-ACK setup packet.
-	 * Routes can be asymetric, so, even if we receive a packet
+	 * Routes can be assymetric, so, even if we receive a packet
 	 * with ECE and CWR set, we must not assume no one will block
 	 * the ECE packet we are about to send.
 	 */

Index: src/usr.sbin/installboot/evboards.c
diff -u src/usr.sbin/installboot/evboards.c:1.5 src/usr.sbin/installboot/evboards.c:1.6
--- src/usr.sbin/installboot/evboards.c:1.5	Sun Jun  7 00:58:58 2020
+++ src/usr.sbin/installboot/evboards.c	Fri Aug  6 07:55:13 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: evboards.c,v 1.5 2020/06/07 00:58:58 thorpej Exp $	*/
+/*	$NetBSD: evboards.c,v 1.6 2021/08/06 07:55:13 andvar Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if !defined(__lint)
-__RCSID("$NetBSD: evboards.c,v 1.5 2020/06/07 00:58:58 thorpej Exp $");
+__RCSID("$NetBSD: evboards.c,v 1.6 2021/08/06 07:55:13 andvar Exp $");
 #endif  /* !__lint */
 
 #include 
@@ -153,7 +153,7 @@ __RCSID("$NetBSD: evboards.c,v 1.5 2020/
  *	/usr/pkg/share/u-boot
  *
  * This can be overridden with the INSTALLBOOT_UBOOT_PATHS environment
- * variable, which contains a colon-sparated list of directories, e.g.:
+ * variable, which contains a colon-separated list of directories, e.g.:
  *
  *	/usr/pkg/share/u-boot:/home/jmcneill/hackityhack/u-boot
  *
@@ -194,7 +194,7 @@ __RCSID("$NetBSD: evboards.c,v 1.5 2020/
  *		  -- At least one of these objects is required.  If the
  *		  -- board uses a single set of steps for all boot media
  *		  -- types, then it should provide just "u-boot-install".
- *		  -- Otherwise, it whould provide one or more objects
+ *		  -- Otherwise, it would provide one or more objects
  *		  -- with names reflecting the media type, e.g.:
  *		  --
  *		  --	"u-boot-install-sdmmc"	(for SD cards)
@@ -321,13 +321,13 @@ __RCSID("$NetBSD: evboards.c,v 1.5 2020/
  *			file-offset
  *			512
  *
- *			
+ *			
  *			image-offset
  *			512
  *		
  *	
  *
- * There are some addditional directives for installing on raw flash devices:
+ * There are some additional directives for installing on raw flash devices:
  *
  *	u-boot-install-spi
  *	
@@ -348,9 +348,9 @@ __RCSID("$NetBSD: evboards.c,v 1.5 2020/
  *			2048
  *
  *			
@@ -873,7 +873,7 @@ evb_db_load_overlays(ib_params *params)
 	fts_close(fts);
 
 	/*
-	 * If the user specifed a stage1 loader, 

CVS commit: src

2021-08-06 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Fri Aug  6 07:55:13 UTC 2021

Modified Files:
src: build.sh
src/sys/netinet: tcp_input.c
src/usr.sbin/installboot: evboards.c

Log Message:
fix various typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.353 -r1.354 src/build.sh
cvs rdiff -u -r1.429 -r1.430 src/sys/netinet/tcp_input.c
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/installboot/evboards.c

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