CVS commit: src

2023-08-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Aug  2 05:44:27 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: decl_arg.c
src/usr.bin/xlint/lint1: decl.c

Log Message:
lint: simplify handling of old-style arguments


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/decl_arg.c
cvs rdiff -u -r1.372 -r1.373 src/usr.bin/xlint/lint1/decl.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/usr.bin/xlint/lint1/decl_arg.c
diff -u src/tests/usr.bin/xlint/lint1/decl_arg.c:1.10 src/tests/usr.bin/xlint/lint1/decl_arg.c:1.11
--- src/tests/usr.bin/xlint/lint1/decl_arg.c:1.10	Sun Jul  9 11:18:55 2023
+++ src/tests/usr.bin/xlint/lint1/decl_arg.c	Wed Aug  2 05:44:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl_arg.c,v 1.10 2023/07/09 11:18:55 rillig Exp $	*/
+/*	$NetBSD: decl_arg.c,v 1.11 2023/08/02 05:44:27 rillig Exp $	*/
 # 3 "decl_arg.c"
 
 /*
@@ -133,5 +133,23 @@ void cover_asm_or_symbolrename_asm(void)
 void cover_asm_or_symbolrename_symbolrename(void)
 __symbolrename(alternate_name);
 
+
+double
+f(e, s, r, a, t, n)
+	/* expect+1: error: only 'register' is valid as storage class in parameter [9] */
+	extern double e;
+	/* expect+1: error: only 'register' is valid as storage class in parameter [9] */
+	static double s;
+	register double r;
+	/* expect+1: error: only 'register' is valid as storage class in parameter [9] */
+	auto double a;
+	/* expect+1: error: only 'register' is valid as storage class in parameter [9] */
+	typedef double t;
+	double n;
+{
+	return e + s + r + a + t + n;
+}
+
+
 // FIXME: internal error in decl.c:906 near decl_arg.c:134: length(0)
 //void cover_abstract_declarator_typeof(void (*)(typeof(no_args)));

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.372 src/usr.bin/xlint/lint1/decl.c:1.373
--- src/usr.bin/xlint/lint1/decl.c:1.372	Tue Aug  1 19:57:38 2023
+++ src/usr.bin/xlint/lint1/decl.c	Wed Aug  2 05:44:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.372 2023/08/01 19:57:38 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.373 2023/08/02 05:44:27 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.372 2023/08/01 19:57:38 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.373 2023/08/02 05:44:27 rillig Exp $");
 #endif
 
 #include 
@@ -1482,14 +1482,10 @@ declarator_name(sym_t *sym)
 	case DLK_PROTO_PARAMS:
 		sym->s_arg = true;
 		/* FALLTHROUGH */
-	case DLK_OLD_STYLE_ARGS:
-		if ((sc = dcs->d_scl) == NOSCL)
-			sc = AUTO;
-		else {
-			lint_assert(sc == REG);
-			sym->s_register = true;
-			sc = AUTO;
-		}
+	case DLK_OLD_STYLE_ARGS:;
+		lint_assert(dcs->d_scl == NOSCL || dcs->d_scl == REG);
+		sym->s_register = dcs->d_scl == REG;
+		sc = AUTO;
 		sym->s_def = DEF;
 		break;
 	case DLK_AUTO:



CVS commit: src

2023-08-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Wed Aug  2 05:44:27 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: decl_arg.c
src/usr.bin/xlint/lint1: decl.c

Log Message:
lint: simplify handling of old-style arguments


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/tests/usr.bin/xlint/lint1/decl_arg.c
cvs rdiff -u -r1.372 -r1.373 src/usr.bin/xlint/lint1/decl.c

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



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

2023-08-01 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Aug  1 23:41:55 UTC 2023

Modified Files:
src/tests/lib/libc/sys: t_pollts.c

Log Message:
t_pollts.c: fix typo in a description string (NFC)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_pollts.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_pollts.c
diff -u src/tests/lib/libc/sys/t_pollts.c:1.1 src/tests/lib/libc/sys/t_pollts.c:1.2
--- src/tests/lib/libc/sys/t_pollts.c:1.1	Fri Jul 17 15:34:17 2020
+++ src/tests/lib/libc/sys/t_pollts.c	Tue Aug  1 23:41:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_pollts.c,v 1.1 2020/07/17 15:34:17 kamil Exp $	*/
+/*	$NetBSD: t_pollts.c,v 1.2 2023/08/01 23:41:54 gutteridge Exp $	*/
 
 /*-
  * Copyright (c) 2011, 2020 The NetBSD Foundation, Inc.
@@ -50,7 +50,7 @@ ATF_TC_HEAD(basic, tc)
 {
 	atf_tc_set_md_var(tc, "timeout", "10");
 	atf_tc_set_md_var(tc, "descr",
-	"Basis functionality test for ppoll(2)/pollts(2)");
+	"Basic functionality test for ppoll(2)/pollts(2)");
 }
 
 ATF_TC_BODY(basic, tc)



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

2023-08-01 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Aug  1 23:41:55 UTC 2023

Modified Files:
src/tests/lib/libc/sys: t_pollts.c

Log Message:
t_pollts.c: fix typo in a description string (NFC)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_pollts.c

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



CVS commit: src/lib/libc/sys

2023-08-01 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Aug  1 23:33:05 UTC 2023

Modified Files:
src/lib/libc/sys: select.2

Log Message:
select.2: note when pselect(2) was added


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/lib/libc/sys/select.2

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/sys/select.2
diff -u src/lib/libc/sys/select.2:1.44 src/lib/libc/sys/select.2:1.45
--- src/lib/libc/sys/select.2:1.44	Fri Jul  7 01:31:25 2023
+++ src/lib/libc/sys/select.2	Tue Aug  1 23:33:04 2023
@@ -1,4 +1,4 @@
-.\"	$NetBSD: select.2,v 1.44 2023/07/07 01:31:25 riastradh Exp $
+.\"	$NetBSD: select.2,v 1.45 2023/08/01 23:33:04 gutteridge Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)select.2	8.2 (Berkeley) 3/25/94
 .\"
-.Dd November 28, 2013
+.Dd August 1, 2023
 .Dt SELECT 2
 .Os
 .Sh NAME
@@ -273,6 +273,10 @@ The
 .Fn select
 function call appeared in
 .Bx 4.2 .
+The
+.Fn pselect
+function call first appeared in
+.Nx 3.0 .
 .Sh BUGS
 Although the provision of
 .Xr getdtablesize 3



CVS commit: src/lib/libc/sys

2023-08-01 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Aug  1 23:33:05 UTC 2023

Modified Files:
src/lib/libc/sys: select.2

Log Message:
select.2: note when pselect(2) was added


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/lib/libc/sys/select.2

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



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

2023-08-01 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Tue Aug  1 22:06:23 UTC 2023

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

Log Message:
Include compat config for NetBSD-10.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/conf/GENERIC.common

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

Modified files:

Index: src/sys/arch/riscv/conf/GENERIC.common
diff -u src/sys/arch/riscv/conf/GENERIC.common:1.5 src/sys/arch/riscv/conf/GENERIC.common:1.6
--- src/sys/arch/riscv/conf/GENERIC.common:1.5	Sun Jul 16 07:30:54 2023
+++ src/sys/arch/riscv/conf/GENERIC.common	Tue Aug  1 22:06:23 2023
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC.common,v 1.5 2023/07/16 07:30:54 skrll Exp $
+#	$NetBSD: GENERIC.common,v 1.6 2023/08/01 22:06:23 rjs Exp $
 #
 #	GENERIC common RISC-V kernel config items shared between 32 and 64
 #	kernels
@@ -57,7 +57,7 @@ options 	DDB_HISTORY_SIZE=512	# enable h
 #options 	SYSCALL_TIMES_HASCOUNTER	# use 'broken' rdtsc (soekris)
 
 # Compatibility options
-#include 	"conf/compat_netbsd90.config"
+include 	"conf/compat_netbsd100.config"
 
 # Wedge support
 options 	DKWEDGE_AUTODISCOVER	# Automatically add dk(4) instances



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

2023-08-01 Thread Robert Swindells
Module Name:src
Committed By:   rjs
Date:   Tue Aug  1 22:06:23 UTC 2023

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

Log Message:
Include compat config for NetBSD-10.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/conf/GENERIC.common

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



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

2023-08-01 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Aug  1 21:30:14 UTC 2023

Modified Files:
src/sys/arch/riscv/conf: INSTALL

Log Message:
INSTALL: add a basic comment and missing RCS ID

(This isn't actually in use at present, but make it look like other
examples.)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/conf/INSTALL

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/riscv/conf/INSTALL
diff -u src/sys/arch/riscv/conf/INSTALL:1.1 src/sys/arch/riscv/conf/INSTALL:1.2
--- src/sys/arch/riscv/conf/INSTALL:1.1	Sat Mar 28 16:13:56 2015
+++ src/sys/arch/riscv/conf/INSTALL	Tue Aug  1 21:30:14 2023
@@ -1,5 +1,6 @@
+# $NetBSD: INSTALL,v 1.2 2023/08/01 21:30:14 gutteridge Exp $
 #
-#
+# riscv INSTALL kernel.
 #
 include "arch/riscv/conf/GENERIC"
 include "arch/riscv/conf/INSTALL.config"



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

2023-08-01 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Tue Aug  1 21:30:14 UTC 2023

Modified Files:
src/sys/arch/riscv/conf: INSTALL

Log Message:
INSTALL: add a basic comment and missing RCS ID

(This isn't actually in use at present, but make it look like other
examples.)


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/riscv/conf/INSTALL

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



CVS commit: src/sys

2023-08-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug  1 21:26:28 UTC 2023

Modified Files:
src/sys/arch/alpha/pci: lca_dma.c
src/sys/arch/amiga/dev: if_le.c
src/sys/arch/arm/imx: imxcspireg.h imxecspireg.h
src/sys/arch/atari/dev: ncr5380.c
src/sys/arch/atari/pci: pci_machdep.c
src/sys/arch/i386/gdbscripts: stack
src/sys/arch/i386/stand/mbr: mbr.S
src/sys/arch/mac68k/dev: ncr5380.c
src/sys/dev/ic: aic7xxx_osm.c
src/sys/dev/pci: if_bnx.c
src/sys/dev/qbus: qd.c
src/sys/sys: exec.h

Log Message:
fix various typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/alpha/pci/lca_dma.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/amiga/dev/if_le.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imxcspireg.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imxecspireg.h
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/atari/dev/ncr5380.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/atari/pci/pci_machdep.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/gdbscripts/stack
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/stand/mbr/mbr.S
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/mac68k/dev/ncr5380.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/ic/aic7xxx_osm.c
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/pci/if_bnx.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/qbus/qd.c
cvs rdiff -u -r1.161 -r1.162 src/sys/sys/exec.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/alpha/pci/lca_dma.c
diff -u src/sys/arch/alpha/pci/lca_dma.c:1.27 src/sys/arch/alpha/pci/lca_dma.c:1.28
--- src/sys/arch/alpha/pci/lca_dma.c:1.27	Sun Jul  4 22:42:36 2021
+++ src/sys/arch/alpha/pci/lca_dma.c	Tue Aug  1 21:26:27 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lca_dma.c,v 1.27 2021/07/04 22:42:36 thorpej Exp $ */
+/* $NetBSD: lca_dma.c,v 1.28 2023/08/01 21:26:27 andvar Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: lca_dma.c,v 1.27 2021/07/04 22:42:36 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lca_dma.c,v 1.28 2023/08/01 21:26:27 andvar Exp $");
 
 #include 
 #include 
@@ -180,7 +180,7 @@ lca_dma_init(struct lca_config *lcp)
 	REGVAL64(LCA_IOC_W_T_BASE0) = lcp->lc_sgmap.aps_ptpa;
 	alpha_mb();
 
-	/* Enble the scatter/gather TLB. */
+	/* Enable the scatter/gather TLB. */
 	REGVAL64(LCA_IOC_TB_ENA) = IOC_TB_ENA_TEN;
 	alpha_mb();
 

Index: src/sys/arch/amiga/dev/if_le.c
diff -u src/sys/arch/amiga/dev/if_le.c:1.46 src/sys/arch/amiga/dev/if_le.c:1.47
--- src/sys/arch/amiga/dev/if_le.c:1.46	Wed Jan 22 00:25:16 2014
+++ src/sys/arch/amiga/dev/if_le.c	Tue Aug  1 21:26:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_le.c,v 1.46 2014/01/22 00:25:16 christos Exp $ */
+/*	$NetBSD: if_le.c,v 1.47 2023/08/01 21:26:27 andvar Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
 #include "opt_inet.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.46 2014/01/22 00:25:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_le.c,v 1.47 2023/08/01 21:26:27 andvar Exp $");
 
 
 #include 
@@ -282,7 +282,7 @@ ariadne_hwinit(struct lance_softc *sc)
 	ariadne_wribcr(sc, LE_BCR_LED3, 0x0084);
 
 	/*
-	 * Enabel/Disable auto selection
+	 * Enable/Disable auto selection
 	 */
 	if (sc->sc_initmodemedia == 2)
 		ariadne_autoselect(sc, 1);

Index: src/sys/arch/arm/imx/imxcspireg.h
diff -u src/sys/arch/arm/imx/imxcspireg.h:1.2 src/sys/arch/arm/imx/imxcspireg.h:1.3
--- src/sys/arch/arm/imx/imxcspireg.h:1.2	Fri Sep 27 02:59:21 2019
+++ src/sys/arch/arm/imx/imxcspireg.h	Tue Aug  1 21:26:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxcspireg.h,v 1.2 2019/09/27 02:59:21 hkenken Exp $	*/
+/*	$NetBSD: imxcspireg.h,v 1.3 2023/08/01 21:26:27 andvar Exp $	*/
 
 /*
  * Copyright (c) 2014  Genetec Corporation.  All rights reserved.
@@ -51,7 +51,7 @@
 #define	 CSPI_CON_MODE		__BIT(1)	/* MODE */
 #define	 CSPI_CON_ENABLE	__BIT(0)	/* EN */
 #define	CSPI_INTREG		0x0c
-#define	 CSPI_INTR_ALL_EN	0x01ff	/* All Intarruption Enabled */
+#define	 CSPI_INTR_ALL_EN	0x01ff	/* All Interrupts Enabled */
 #define	 CSPI_IMX31_INTR_TC_EN	__BIT(8)	/* TX Complete */
 #define	 CSPI_IMX31_INTR_BO_EN	__BIT(7)	/* Bit Counter Overflow */
 #define	 CSPI_IMX35_INTR_TC_EN	__BIT(7)	/* TX Complete */

Index: src/sys/arch/arm/imx/imxecspireg.h
diff -u src/sys/arch/arm/imx/imxecspireg.h:1.3 src/sys/arch/arm/imx/imxecspireg.h:1.4
--- src/sys/arch/arm/imx/imxecspireg.h:1.3	Thu Dec 26 04:53:11 2019
+++ src/sys/arch/arm/imx/imxecspireg.h	Tue Aug  1 21:26:27 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: imxecspireg.h,v 1.3 2019/12/26 04:53:11 msaitoh Exp $	*/
+/*	$NetBSD: imxecspireg.h,v 1.4 2023/08/01 21:26:27 andvar Exp $	*/
 
 /*
  * Copyright (c) 2012  Genetec Corporation.  All rights reserved.
@@ -51,7 +51,7 @@
 #define	 ECSPI_CONFIG_SCLK_POL	__BITS( 7, 4)	/* SCLK POL */
 #define	 

CVS commit: src/sys

2023-08-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug  1 21:26:28 UTC 2023

Modified Files:
src/sys/arch/alpha/pci: lca_dma.c
src/sys/arch/amiga/dev: if_le.c
src/sys/arch/arm/imx: imxcspireg.h imxecspireg.h
src/sys/arch/atari/dev: ncr5380.c
src/sys/arch/atari/pci: pci_machdep.c
src/sys/arch/i386/gdbscripts: stack
src/sys/arch/i386/stand/mbr: mbr.S
src/sys/arch/mac68k/dev: ncr5380.c
src/sys/dev/ic: aic7xxx_osm.c
src/sys/dev/pci: if_bnx.c
src/sys/dev/qbus: qd.c
src/sys/sys: exec.h

Log Message:
fix various typos in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/alpha/pci/lca_dma.c
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/amiga/dev/if_le.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imxcspireg.h
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/imx/imxecspireg.h
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/atari/dev/ncr5380.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/atari/pci/pci_machdep.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/i386/gdbscripts/stack
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/i386/stand/mbr/mbr.S
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/mac68k/dev/ncr5380.c
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/ic/aic7xxx_osm.c
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/pci/if_bnx.c
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/qbus/qd.c
cvs rdiff -u -r1.161 -r1.162 src/sys/sys/exec.h

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

2023-08-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug  1 20:52:44 UTC 2023

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

Log Message:
s/diabling/disabling/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/mx98905.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/mx98905.c
diff -u src/sys/dev/ic/mx98905.c:1.16 src/sys/dev/ic/mx98905.c:1.17
--- src/sys/dev/ic/mx98905.c:1.16	Mon Sep  3 16:29:31 2018
+++ src/sys/dev/ic/mx98905.c	Tue Aug  1 20:52:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: mx98905.c,v 1.16 2018/09/03 16:29:31 riastradh Exp $	*/
+/*	$NetBSD: mx98905.c,v 1.17 2023/08/01 20:52:43 andvar Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -53,13 +53,13 @@
  * and that chipset has a bug in it, in that it the MSB remote DMA
  * register does not work.  There is a workaround for this which
  * should be around soon.  In fact, I think only the buffer ram test
- * ever transfers more than 256 bytes across the DMA channel, so diabling
+ * ever transfers more than 256 bytes across the DMA channel, so disabling
  * it will make the mx stuff work.
  */
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: mx98905.c,v 1.16 2018/09/03 16:29:31 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mx98905.c,v 1.17 2023/08/01 20:52:43 andvar Exp $");
 
 #include 
 #include 



CVS commit: src/sys/dev/ic

2023-08-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug  1 20:52:44 UTC 2023

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

Log Message:
s/diabling/disabling/ in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/mx98905.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

2023-08-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug  1 20:50:11 UTC 2023

Modified Files:
src/sys/dev/ic: aic79xx.c
src/sys/dev/pci: if_ntwoc_pci.c tdvfb.c

Log Message:
s/diable/disable/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/ic/aic79xx.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/if_ntwoc_pci.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/tdvfb.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/aic79xx.c
diff -u src/sys/dev/ic/aic79xx.c:1.68 src/sys/dev/ic/aic79xx.c:1.69
--- src/sys/dev/ic/aic79xx.c:1.68	Mon May 23 19:52:35 2022
+++ src/sys/dev/ic/aic79xx.c	Tue Aug  1 20:50:11 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: aic79xx.c,v 1.68 2022/05/23 19:52:35 andvar Exp $	*/
+/*	$NetBSD: aic79xx.c,v 1.69 2023/08/01 20:50:11 andvar Exp $	*/
 
 /*
  * Core routines and tables shareable across OS platforms.
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.68 2022/05/23 19:52:35 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aic79xx.c,v 1.69 2023/08/01 20:50:11 andvar Exp $");
 
 #include 
 #include 
@@ -6153,7 +6153,7 @@ ahd_init(struct ahd_softc *ahd)
 		goto init_done;
 	}
 
-	/* Diable current sensing. */
+	/* Disable current sensing. */
 	ahd_write_flexport(ahd, FLXADDR_ROMSTAT_CURSENSECTL, 0);
 
 #ifdef AHD_DEBUG

Index: src/sys/dev/pci/if_ntwoc_pci.c
diff -u src/sys/dev/pci/if_ntwoc_pci.c:1.32 src/sys/dev/pci/if_ntwoc_pci.c:1.33
--- src/sys/dev/pci/if_ntwoc_pci.c:1.32	Tue May 24 06:28:01 2022
+++ src/sys/dev/pci/if_ntwoc_pci.c	Tue Aug  1 20:50:11 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ntwoc_pci.c,v 1.32 2022/05/24 06:28:01 andvar Exp $	*/
+/*	$NetBSD: if_ntwoc_pci.c,v 1.33 2023/08/01 20:50:11 andvar Exp $	*/
 
 /*
  * Copyright (c) 1998 Vixie Enterprises
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ntwoc_pci.c,v 1.32 2022/05/24 06:28:01 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ntwoc_pci.c,v 1.33 2023/08/01 20:50:11 andvar Exp $");
 
 #include 
 #include 
@@ -323,7 +323,7 @@ ntwoc_pci_attach(device_t parent, device
 
 	/*
 	 * enable the RS422 tristate transmit
-	 * diable clock output (use receiver clock for both)
+	 * disable clock output (use receiver clock for both)
 	 */
 	frontend_cr |= (NTWOC_FECR_TE0 | NTWOC_FECR_TE1);
 	frontend_cr &= ~(NTWOC_FECR_ETC0 | NTWOC_FECR_ETC1);

Index: src/sys/dev/pci/tdvfb.c
diff -u src/sys/dev/pci/tdvfb.c:1.10 src/sys/dev/pci/tdvfb.c:1.11
--- src/sys/dev/pci/tdvfb.c:1.10	Sat Aug  7 16:19:14 2021
+++ src/sys/dev/pci/tdvfb.c	Tue Aug  1 20:50:11 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: tdvfb.c,v 1.10 2021/08/07 16:19:14 thorpej Exp $	*/
+/*	$NetBSD: tdvfb.c,v 1.11 2023/08/01 20:50:11 andvar Exp $	*/
 
 /*
  * Copyright (c) 2012 The NetBSD Foundation, Inc.   
@@ -49,7 +49,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tdvfb.c,v 1.10 2021/08/07 16:19:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tdvfb.c,v 1.11 2023/08/01 20:50:11 andvar Exp $");
 
 #include 
 #include 
@@ -434,7 +434,7 @@ tdvfb_videomode_set(struct tdvfb_softc *
 	tdvfb_cvg_unset(sc, TDV_OFF_FBIINIT0, TDV_FBIINIT0_FBI_RST |
 	TDV_FBIINIT0_FIFO_RST);
 	tdvfb_cvg_set(sc, TDV_OFF_FBIINIT2, TDV_FBIINIT2_DRAM_REFR);
-	/* diable access to FBIINIT regs */
+	/* disable access to FBIINIT regs */
 	pci_conf_write(sc->sc_pc, sc->sc_pcitag, TDV_INITENABLE_REG, 
 	TDV_INITENABLE_EN_FIFO);
 	tdvfb_wait(sc);	



CVS commit: src/sys/dev

2023-08-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug  1 20:50:11 UTC 2023

Modified Files:
src/sys/dev/ic: aic79xx.c
src/sys/dev/pci: if_ntwoc_pci.c tdvfb.c

Log Message:
s/diable/disable/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/dev/ic/aic79xx.c
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/pci/if_ntwoc_pci.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/tdvfb.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/pci

2023-08-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug  1 20:46:01 UTC 2023

Modified Files:
src/sys/dev/pci: if_bge.c if_et.c

Log Message:
s/diabled/disabled/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.388 -r1.389 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pci/if_et.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/pci

2023-08-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug  1 20:46:01 UTC 2023

Modified Files:
src/sys/dev/pci: if_bge.c if_et.c

Log Message:
s/diabled/disabled/ in comments.


To generate a diff of this commit:
cvs rdiff -u -r1.388 -r1.389 src/sys/dev/pci/if_bge.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/pci/if_et.c

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

Modified files:

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.388 src/sys/dev/pci/if_bge.c:1.389
--- src/sys/dev/pci/if_bge.c:1.388	Tue Oct 11 22:03:37 2022
+++ src/sys/dev/pci/if_bge.c	Tue Aug  1 20:46:01 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.388 2022/10/11 22:03:37 andvar Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.389 2023/08/01 20:46:01 andvar Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.388 2022/10/11 22:03:37 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.389 2023/08/01 20:46:01 andvar Exp $");
 
 #include 
 #include 
@@ -2663,7 +2663,7 @@ bge_blockinit(struct bge_softc *sc)
 	/* 57XX step 48 */
 	/*
 	 * Disable all receive return rings by setting the
-	 * 'ring diabled' bit in the flags field of all the receive
+	 * 'ring disabled' bit in the flags field of all the receive
 	 * return ring control blocks, located in NIC memory.
 	 */
 	if (BGE_IS_5717_PLUS(sc)) {

Index: src/sys/dev/pci/if_et.c
diff -u src/sys/dev/pci/if_et.c:1.35 src/sys/dev/pci/if_et.c:1.36
--- src/sys/dev/pci/if_et.c:1.35	Fri Sep 10 14:56:26 2021
+++ src/sys/dev/pci/if_et.c	Tue Aug  1 20:46:01 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_et.c,v 1.35 2021/09/10 14:56:26 jakllsch Exp $	*/
+/*	$NetBSD: if_et.c,v 1.36 2023/08/01 20:46:01 andvar Exp $	*/
 /*	$OpenBSD: if_et.c,v 1.12 2008/07/11 09:29:02 kevlo $	*/
 /*
  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.35 2021/09/10 14:56:26 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_et.c,v 1.36 2023/08/01 20:46:01 andvar Exp $");
 
 #include 
 #include 
@@ -1687,7 +1687,7 @@ et_init_txmac(struct et_softc *sc)
 	/* No flow control yet */
 	CSR_WRITE_4(sc, ET_TXMAC_FLOWCTRL, 0);
 
-	/* Enable TX MAC but leave FC(?) diabled */
+	/* Enable TX MAC but leave FC(?) disabled */
 	CSR_WRITE_4(sc, ET_TXMAC_CTRL,
 		ET_TXMAC_CTRL_ENABLE | ET_TXMAC_CTRL_FC_DISABLE);
 }



CVS commit: src/share/man/man4

2023-08-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug  1 20:41:48 UTC 2023

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

Log Message:
s/diabled/disabled/.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/gpiopps.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/gpiopps.4
diff -u src/share/man/man4/gpiopps.4:1.3 src/share/man/man4/gpiopps.4:1.4
--- src/share/man/man4/gpiopps.4:1.3	Sat Aug  7 19:41:13 2021
+++ src/share/man/man4/gpiopps.4	Tue Aug  1 20:41:48 2023
@@ -1,4 +1,4 @@
-.\" $NetBSD: gpiopps.4,v 1.3 2021/08/07 19:41:13 andvar Exp $
+.\" $NetBSD: gpiopps.4,v 1.4 2023/08/01 20:41:48 andvar Exp $
 .\"
 .\" Copyright (c) 2016 Brad Spencer 
 .\"
@@ -61,7 +61,7 @@ If a single pin is specified,
 .Nm
 uses double-edge triggering to support ASSERT and CLEAR PPS signals.
 If the underlying GPIO hardware does not support double-edge triggering,
-or if this feature is diabled in the
+or if this feature is disabled in the
 .Ar flag
 locator, then only ASSERT will be signaled on the specified edge.
 .Pp



CVS commit: src/share/man/man4

2023-08-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug  1 20:41:48 UTC 2023

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

Log Message:
s/diabled/disabled/.


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

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



CVS commit: src/share/man/man4

2023-08-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug  1 20:39:16 UTC 2023

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

Log Message:
s/intrerrupt/interrupt/.


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

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



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

2023-08-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug  1 20:11:13 UTC 2023

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

Log Message:
xen: Fix previous commit, forgot to amend it before committing.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/xen/xen_clock.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/xen/xen

2023-08-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug  1 20:11:13 UTC 2023

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

Log Message:
xen: Fix previous commit, forgot to amend it before committing.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/xen/xen_clock.c

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

Modified files:

Index: src/sys/arch/xen/xen/xen_clock.c
diff -u src/sys/arch/xen/xen/xen_clock.c:1.16 src/sys/arch/xen/xen/xen_clock.c:1.17
--- src/sys/arch/xen/xen/xen_clock.c:1.16	Tue Aug  1 19:36:57 2023
+++ src/sys/arch/xen/xen/xen_clock.c	Tue Aug  1 20:11:13 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_clock.c,v 1.16 2023/08/01 19:36:57 riastradh Exp $	*/
+/*	$NetBSD: xen_clock.c,v 1.17 2023/08/01 20:11:13 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_clock.c,v 1.16 2023/08/01 19:36:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_clock.c,v 1.17 2023/08/01 20:11:13 riastradh Exp $");
 
 #include 
 #include 
@@ -834,9 +834,7 @@ again:
 		 * Warn if we violate timecounter(9) contract: with a
 		 * k-bit timeocunter (here k = 32), and timecounter
 		 * frequency f (here f = 1 GHz), the maximum period
-		 * between hardclock calls is 2^k / f.  This comes out
-		 * to 2^32 ns, in what is conveneintly already the
-		 * correct unit for the Xen systime clock.
+		 * between hardclock calls is 2^k / f.
 		 */
 		if (delta > xen_timecounter.tc_counter_mask) {
 			printf("WARNING: hardclock skipped %"PRIu64"ns"
@@ -911,6 +909,9 @@ xen_initclocks(void)
 	evcnt_attach_dynamic(>ci_xen_timecounter_backwards_evcnt,
 	EVCNT_TYPE_INTR, NULL, device_xname(ci->ci_dev),
 	"timecounter went backwards");
+	evcnt_attach_dynamic(>ci_xen_timecounter_jump_evcnt,
+	EVCNT_TYPE_INTR, NULL, device_xname(ci->ci_dev),
+	"hardclock jumped past timecounter max");
 
 	/* Fire up the clocks.  */
 	xen_resumeclocks(ci);



CVS commit: src

2023-08-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug  1 20:09:12 UTC 2023

Modified Files:
src/lib/csu/arch/hppa: crtbegin.h
src/sys/arch/alpha/alpha: qemu.c
src/tests/lib/libc/sys: t_swapcontext.c
src/usr.sbin/npf/npfctl: npf_show.c

Log Message:
fix RCSIDs.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/hppa/crtbegin.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/alpha/alpha/qemu.c
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sys/t_swapcontext.c
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/npf/npfctl/npf_show.c

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

Modified files:

Index: src/lib/csu/arch/hppa/crtbegin.h
diff -u src/lib/csu/arch/hppa/crtbegin.h:1.1 src/lib/csu/arch/hppa/crtbegin.h:1.2
--- src/lib/csu/arch/hppa/crtbegin.h:1.1	Sat Jul 13 18:52:35 2013
+++ src/lib/csu/arch/hppa/crtbegin.h	Tue Aug  1 20:09:12 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD*/
+/*	$NetBSD: crtbegin.h,v 1.2 2023/08/01 20:09:12 andvar Exp $*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.

Index: src/sys/arch/alpha/alpha/qemu.c
diff -u src/sys/arch/alpha/alpha/qemu.c:1.5 src/sys/arch/alpha/alpha/qemu.c:1.6
--- src/sys/arch/alpha/alpha/qemu.c:1.5	Sun Oct 11 18:39:48 2020
+++ src/sys/arch/alpha/alpha/qemu.c	Tue Aug  1 20:09:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: qemu.c,v 1.5 2020/10/11 18:39:48 thorpej Exp $ */
+/* $NetBSD: qemu.c,v 1.6 2023/08/01 20:09:12 andvar Exp $ */
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD");
+__KERNEL_RCSID(0, "$NetBSD: qemu.c,v 1.6 2023/08/01 20:09:12 andvar Exp $");
 
 #include 
 #include 

Index: src/tests/lib/libc/sys/t_swapcontext.c
diff -u src/tests/lib/libc/sys/t_swapcontext.c:1.3 src/tests/lib/libc/sys/t_swapcontext.c:1.4
--- src/tests/lib/libc/sys/t_swapcontext.c:1.3	Sun May  5 10:28:11 2013
+++ src/tests/lib/libc/sys/t_swapcontext.c	Tue Aug  1 20:09:12 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: t_swapcontext.c,v 1.3 2013/05/05 10:28:11 skrll Exp $ */
+/* $NetBSD: t_swapcontext.c,v 1.4 2023/08/01 20:09:12 andvar Exp $ */
 
 /*
  * Copyright (c) 2012 Emmanuel Dreyfus. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD");
+__RCSID("$NetBSD: t_swapcontext.c,v 1.4 2023/08/01 20:09:12 andvar Exp $");
 
 #include 
 #include 

Index: src/usr.sbin/npf/npfctl/npf_show.c
diff -u src/usr.sbin/npf/npfctl/npf_show.c:1.32 src/usr.sbin/npf/npfctl/npf_show.c:1.33
--- src/usr.sbin/npf/npfctl/npf_show.c:1.32	Sat May 30 14:16:56 2020
+++ src/usr.sbin/npf/npfctl/npf_show.c	Tue Aug  1 20:09:12 2023
@@ -34,7 +34,7 @@
  */
 
 #include 
-__RCSID("$NetBSD");
+__RCSID("$NetBSD: npf_show.c,v 1.33 2023/08/01 20:09:12 andvar Exp $");
 
 #include 
 #define	__FAVOR_BSD



CVS commit: src

2023-08-01 Thread Andrius Varanavicius
Module Name:src
Committed By:   andvar
Date:   Tue Aug  1 20:09:12 UTC 2023

Modified Files:
src/lib/csu/arch/hppa: crtbegin.h
src/sys/arch/alpha/alpha: qemu.c
src/tests/lib/libc/sys: t_swapcontext.c
src/usr.sbin/npf/npfctl: npf_show.c

Log Message:
fix RCSIDs.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/lib/csu/arch/hppa/crtbegin.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/alpha/alpha/qemu.c
cvs rdiff -u -r1.3 -r1.4 src/tests/lib/libc/sys/t_swapcontext.c
cvs rdiff -u -r1.32 -r1.33 src/usr.sbin/npf/npfctl/npf_show.c

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



CVS commit: src/usr.bin/xlint/lint1

2023-08-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug  1 19:57:38 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: decl.c lint1.h

Log Message:
lint: clear global variable 'dcs' after use

Having unnecessarily set members is confusing during debugging.


To generate a diff of this commit:
cvs rdiff -u -r1.371 -r1.372 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.197 -r1.198 src/usr.bin/xlint/lint1/lint1.h

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

Modified files:

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.371 src/usr.bin/xlint/lint1/decl.c:1.372
--- src/usr.bin/xlint/lint1/decl.c:1.371	Tue Aug  1 16:08:58 2023
+++ src/usr.bin/xlint/lint1/decl.c	Tue Aug  1 19:57:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.371 2023/08/01 16:08:58 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.372 2023/08/01 19:57:38 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.371 2023/08/01 16:08:58 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.372 2023/08/01 19:57:38 rillig Exp $");
 #endif
 
 #include 
@@ -609,12 +609,18 @@ dcs_begin_type(void)
 	dcs->d_rank_mod = NO_TSPEC;
 	dcs->d_scl = NOSCL;
 	dcs->d_type = NULL;
+	dcs->d_redeclared_symbol = NULL;
 	dcs->d_qual = (type_qualifiers) { .tq_const = false };
 	dcs->d_inline = false;
 	dcs->d_multiple_storage_classes = false;
 	dcs->d_invalid_type_combination = false;
 	dcs->d_nonempty_decl = false;
 	dcs->d_no_type_specifier = false;
+	dcs->d_packed = false;
+	dcs->d_used = false;
+	dcs->d_func_args = NULL;
+	dcs->d_func_def_pos = (pos_t){ NULL, 0, 0 };
+	dcs->d_func_proto_syms = NULL;
 }
 
 static void
@@ -1380,6 +1386,7 @@ add_function(sym_t *decl, struct paramet
 	decl->s_type == dcs->d_enclosing->d_type) {
 		dcs->d_enclosing->d_func_proto_syms = dcs->d_first_dlsym;
 		dcs->d_enclosing->d_func_args = params.first;
+		debug_dcs_all();
 	}
 
 	/*

Index: src/usr.bin/xlint/lint1/lint1.h
diff -u src/usr.bin/xlint/lint1/lint1.h:1.197 src/usr.bin/xlint/lint1/lint1.h:1.198
--- src/usr.bin/xlint/lint1/lint1.h:1.197	Sat Jul 29 10:34:24 2023
+++ src/usr.bin/xlint/lint1/lint1.h	Tue Aug  1 19:57:38 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: lint1.h,v 1.197 2023/07/29 10:34:24 rillig Exp $ */
+/* $NetBSD: lint1.h,v 1.198 2023/08/01 19:57:38 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -390,13 +390,15 @@ typedef	struct decl_level {
 	bool	d_used:1;
 	type_t	*d_tag_type;	/* during a member declaration, the tag type to
  * which the member belongs */
-	sym_t	*d_func_args;	/* during a function declaration, the list of
- * arguments */
+	sym_t	*d_func_args;	/* during a function declaration, the
+ * parameters, stored in the enclosing level */
 	pos_t	d_func_def_pos;	/* position of the function definition */
 	sym_t	*d_first_dlsym;	/* first symbol declared at this level */
 	sym_t	**d_last_dlsym;	/* points to s_level_next in the last symbol
    declaration at this level */
-	sym_t	*d_func_proto_syms; /* symbols defined in prototype */
+	sym_t	*d_func_proto_syms;	/* symbols defined in prototype, such
+	 * as tagged types or parameter names,
+	 * may overlap d_func_args */
 	struct decl_level *d_enclosing; /* the enclosing declaration level */
 } decl_level;
 



CVS commit: src/usr.bin/xlint/lint1

2023-08-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug  1 19:57:38 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: decl.c lint1.h

Log Message:
lint: clear global variable 'dcs' after use

Having unnecessarily set members is confusing during debugging.


To generate a diff of this commit:
cvs rdiff -u -r1.371 -r1.372 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.197 -r1.198 src/usr.bin/xlint/lint1/lint1.h

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



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

2023-08-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug  1 19:52:16 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: d_packed_structs.c decl.c

Log Message:
tests/lint: test packed and in-parameter declarations


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/d_packed_structs.c
cvs rdiff -u -r1.25 -r1.26 src/tests/usr.bin/xlint/lint1/decl.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/usr.bin/xlint/lint1/d_packed_structs.c
diff -u src/tests/usr.bin/xlint/lint1/d_packed_structs.c:1.4 src/tests/usr.bin/xlint/lint1/d_packed_structs.c:1.5
--- src/tests/usr.bin/xlint/lint1/d_packed_structs.c:1.4	Tue Mar 28 14:44:34 2023
+++ src/tests/usr.bin/xlint/lint1/d_packed_structs.c	Tue Aug  1 19:52:15 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: d_packed_structs.c,v 1.4 2023/03/28 14:44:34 rillig Exp $	*/
+/*	$NetBSD: d_packed_structs.c,v 1.5 2023/08/01 19:52:15 rillig Exp $	*/
 # 3 "d_packed_structs.c"
 
 /* packed tests */
@@ -39,3 +39,8 @@ struct y {
 };
 
 int a[sizeof(struct y) - sizeof(struct x) - 1];
+
+/* expect+1: error: negative array dimension (-9) [20] */
+typedef int sizeof_x[-(int)sizeof(struct x)];
+/* expect+1: error: negative array dimension (-16) [20] */
+typedef int sizeof_y[-(int)sizeof(struct y)];

Index: src/tests/usr.bin/xlint/lint1/decl.c
diff -u src/tests/usr.bin/xlint/lint1/decl.c:1.25 src/tests/usr.bin/xlint/lint1/decl.c:1.26
--- src/tests/usr.bin/xlint/lint1/decl.c:1.25	Mon Jul 31 20:52:26 2023
+++ src/tests/usr.bin/xlint/lint1/decl.c	Tue Aug  1 19:52:15 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: decl.c,v 1.25 2023/07/31 20:52:26 rillig Exp $	*/
+/*	$NetBSD: decl.c,v 1.26 2023/08/01 19:52:15 rillig Exp $	*/
 # 3 "decl.c"
 
 /*
@@ -229,3 +229,15 @@ symbol_type_in_unnamed_bit_field_member(
 		int named_member;
 	};
 }
+
+// Symbols that are defined in the parameter list of a function definition can
+// be accessed in the body of the function, even if they are nested.
+int
+get_x(struct point3d { struct point3d_number { int v; } x, y, z; } arg)
+{
+/* expect-1: warning: dubious tag declaration 'struct point3d' [85] */
+/* expect-2: warning: dubious tag declaration 'struct point3d_number' [85] */
+	static struct point3d local;
+	static struct point3d_number z;
+	return arg.x.v + local.x.v + z.v;
+}



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

2023-08-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug  1 19:52:16 UTC 2023

Modified Files:
src/tests/usr.bin/xlint/lint1: d_packed_structs.c decl.c

Log Message:
tests/lint: test packed and in-parameter declarations


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/usr.bin/xlint/lint1/d_packed_structs.c
cvs rdiff -u -r1.25 -r1.26 src/tests/usr.bin/xlint/lint1/decl.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

2023-08-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug  1 19:36:57 UTC 2023

Modified Files:
src/sys/arch/x86/include: cpu.h
src/sys/arch/xen/xen: xen_clock.c

Log Message:
xen: Report when hardclock jump exceeds timecounter(9) limit.


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/xen/xen/xen_clock.c

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

Modified files:

Index: src/sys/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.135 src/sys/arch/x86/include/cpu.h:1.136
--- src/sys/arch/x86/include/cpu.h:1.135	Thu Jul 13 13:34:15 2023
+++ src/sys/arch/x86/include/cpu.h	Tue Aug  1 19:36:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.135 2023/07/13 13:34:15 riastradh Exp $	*/
+/*	$NetBSD: cpu.h,v 1.136 2023/08/01 19:36:57 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -326,6 +326,7 @@ struct cpu_info {
 	struct evcnt	ci_xen_systime_backwards_hardclock_evcnt;
 	struct evcnt	ci_xen_missed_hardclock_evcnt;
 	struct evcnt	ci_xen_timecounter_backwards_evcnt;
+	struct evcnt	ci_xen_timecounter_jump_evcnt;
 #endif	/* XEN */
 
 #if defined(GPROF) && defined(MULTIPROCESSOR)

Index: src/sys/arch/xen/xen/xen_clock.c
diff -u src/sys/arch/xen/xen/xen_clock.c:1.15 src/sys/arch/xen/xen/xen_clock.c:1.16
--- src/sys/arch/xen/xen/xen_clock.c:1.15	Fri Jul 28 10:39:14 2023
+++ src/sys/arch/xen/xen/xen_clock.c	Tue Aug  1 19:36:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_clock.c,v 1.15 2023/07/28 10:39:14 riastradh Exp $	*/
+/*	$NetBSD: xen_clock.c,v 1.16 2023/08/01 19:36:57 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2017, 2018 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_clock.c,v 1.15 2023/07/28 10:39:14 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_clock.c,v 1.16 2023/08/01 19:36:57 riastradh Exp $");
 
 #include 
 #include 
@@ -829,6 +829,24 @@ again:
 	if (__predict_false(delta >= 2*ns_per_tick)) {
 		SDT_PROBE3(sdt, xen, hardclock, jump,
 		last, now, delta/ns_per_tick);
+
+		/*
+		 * Warn if we violate timecounter(9) contract: with a
+		 * k-bit timeocunter (here k = 32), and timecounter
+		 * frequency f (here f = 1 GHz), the maximum period
+		 * between hardclock calls is 2^k / f.  This comes out
+		 * to 2^32 ns, in what is conveneintly already the
+		 * correct unit for the Xen systime clock.
+		 */
+		if (delta > xen_timecounter.tc_counter_mask) {
+			printf("WARNING: hardclock skipped %"PRIu64"ns"
+			" (%"PRIu64" -> %"PRIu64"),"
+			" exceeding maximum of %"PRIu32"ns"
+			" for timecounter(9)\n",
+			last, now, delta,
+			xen_timecounter.tc_counter_mask);
+			ci->ci_xen_timecounter_jump_evcnt.ev_count++;
+		}
 	}
 	while (delta >= ns_per_tick) {
 		ci->ci_xen_hardclock_systime_ns += ns_per_tick;



CVS commit: src/sys/arch

2023-08-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug  1 19:36:57 UTC 2023

Modified Files:
src/sys/arch/x86/include: cpu.h
src/sys/arch/xen/xen: xen_clock.c

Log Message:
xen: Report when hardclock jump exceeds timecounter(9) limit.


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/xen/xen/xen_clock.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/i2c

2023-08-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug  1 19:36:46 UTC 2023

Modified Files:
src/sys/dev/i2c: ihidev.c

Log Message:
ihidev(4): Use iic_use_direct_match as intended.

This appears to have been a mistake; there's no obvious explanation
in the commit history for why this is different from all other
iic_use_direct_match users.

Patch from Vladimir 'phcoder' Serbinenko , thanks!

(If it really is intended to ues I2C_MATCH_DIRECT_COMPATIBLE here, we
need a clear explanation of why, written down in a nearby comment.)


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/i2c/ihidev.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/i2c/ihidev.c
diff -u src/sys/dev/i2c/ihidev.c:1.28 src/sys/dev/i2c/ihidev.c:1.29
--- src/sys/dev/i2c/ihidev.c:1.28	Sat Feb 12 03:24:35 2022
+++ src/sys/dev/i2c/ihidev.c	Tue Aug  1 19:36:45 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: ihidev.c,v 1.28 2022/02/12 03:24:35 riastradh Exp $ */
+/* $NetBSD: ihidev.c,v 1.29 2023/08/01 19:36:45 riastradh Exp $ */
 /* $OpenBSD ihidev.c,v 1.13 2017/04/08 02:57:23 deraadt Exp $ */
 
 /*-
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.28 2022/02/12 03:24:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ihidev.c,v 1.29 2023/08/01 19:36:45 riastradh Exp $");
 
 #include 
 #include 
@@ -141,7 +141,7 @@ ihidev_match(device_t parent, cfdata_t m
 	int match_result;
 
 	if (iic_use_direct_match(ia, match, compat_data, _result))
-		return I2C_MATCH_DIRECT_COMPATIBLE;
+		return match_result;
 
 	return 0;
 }



CVS commit: src/sys/dev/i2c

2023-08-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Aug  1 19:36:46 UTC 2023

Modified Files:
src/sys/dev/i2c: ihidev.c

Log Message:
ihidev(4): Use iic_use_direct_match as intended.

This appears to have been a mistake; there's no obvious explanation
in the commit history for why this is different from all other
iic_use_direct_match users.

Patch from Vladimir 'phcoder' Serbinenko , thanks!

(If it really is intended to ues I2C_MATCH_DIRECT_COMPATIBLE here, we
need a clear explanation of why, written down in a nearby comment.)


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

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



Re: CVS commit: src

2023-08-01 Thread Christos Zoulas
Bumped.

christos

> On Aug 1, 2023, at 2:17 AM, matthew green  wrote:
> 
> "Christos Zoulas" writes:
>> Module Name: src
>> Committed By:christos
>> Date:Mon Jul 31 17:38:28 UTC 2023
>> 
>> Modified Files:
>>  src/distrib/sets/lists/comp: mi
>>  src/include: wchar.h
>>  src/lib/libc/string: Makefile.inc wmemchr.3
>> Added Files:
>>  src/lib/libc/string: wmempcpy.c
>> 
>> Log Message:
>> new gdb needs wmempcpy, give it to it.
> 
> libc bump missing with this change.
> 
> 
> .mrg.



signature.asc
Description: Message signed with OpenPGP


CVS commit: src

2023-08-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug  1 17:51:25 UTC 2023

Modified Files:
src/distrib/sets/lists/comp: mi
src/include: string.h
src/lib/libc: shlib_version
src/lib/libc/string: Makefile.inc memcpy.3
Added Files:
src/lib/libc/string: mempcpy.c

Log Message:
Add companion mempcpy to wmempcpy, bump.


To generate a diff of this commit:
cvs rdiff -u -r1.2440 -r1.2441 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.53 -r1.54 src/include/string.h
cvs rdiff -u -r1.294 -r1.295 src/lib/libc/shlib_version
cvs rdiff -u -r1.86 -r1.87 src/lib/libc/string/Makefile.inc
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/string/memcpy.3
cvs rdiff -u -r0 -r1.1 src/lib/libc/string/mempcpy.c

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



CVS commit: src

2023-08-01 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug  1 17:51:25 UTC 2023

Modified Files:
src/distrib/sets/lists/comp: mi
src/include: string.h
src/lib/libc: shlib_version
src/lib/libc/string: Makefile.inc memcpy.3
Added Files:
src/lib/libc/string: mempcpy.c

Log Message:
Add companion mempcpy to wmempcpy, bump.


To generate a diff of this commit:
cvs rdiff -u -r1.2440 -r1.2441 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.53 -r1.54 src/include/string.h
cvs rdiff -u -r1.294 -r1.295 src/lib/libc/shlib_version
cvs rdiff -u -r1.86 -r1.87 src/lib/libc/string/Makefile.inc
cvs rdiff -u -r1.13 -r1.14 src/lib/libc/string/memcpy.3
cvs rdiff -u -r0 -r1.1 src/lib/libc/string/mempcpy.c

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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2440 src/distrib/sets/lists/comp/mi:1.2441
--- src/distrib/sets/lists/comp/mi:1.2440	Tue Aug  1 02:35:55 2023
+++ src/distrib/sets/lists/comp/mi	Tue Aug  1 13:51:24 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2440 2023/08/01 06:35:55 mrg Exp $
+#	$NetBSD: mi,v 1.2441 2023/08/01 17:51:24 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -9199,6 +9199,7 @@
 ./usr/share/man/cat3/memmem.0			comp-c-catman		.cat
 ./usr/share/man/cat3/memmove.0			comp-c-catman		.cat
 ./usr/share/man/cat3/memory.0			comp-c-catman		.cat
+./usr/share/man/cat3/mempcpy.0			comp-c-catman		.cat
 ./usr/share/man/cat3/memrchr.0			comp-c-catman		.cat
 ./usr/share/man/cat3/memset.0			comp-c-catman		.cat
 ./usr/share/man/cat3/menu_attributes.0		comp-c-catman		.cat
@@ -17622,6 +17623,7 @@
 ./usr/share/man/html3/memmem.html		comp-c-htmlman		html
 ./usr/share/man/html3/memmove.html		comp-c-htmlman		html
 ./usr/share/man/html3/memory.html		comp-c-htmlman		html
+./usr/share/man/html3/mempcpy.html		comp-c-htmlman		html
 ./usr/share/man/html3/memrchr.html		comp-c-htmlman		html
 ./usr/share/man/html3/memset.html		comp-c-htmlman		html
 ./usr/share/man/html3/menu_attributes.html	comp-c-htmlman		html
@@ -26052,6 +26054,7 @@
 ./usr/share/man/man3/memmem.3			comp-c-man		.man
 ./usr/share/man/man3/memmove.3			comp-c-man		.man
 ./usr/share/man/man3/memory.3			comp-c-man		.man
+./usr/share/man/man3/mempcpy.3			comp-c-man		.man
 ./usr/share/man/man3/memrchr.3			comp-c-man		.man
 ./usr/share/man/man3/memset.3			comp-c-man		.man
 ./usr/share/man/man3/menu_attributes.3		comp-c-man		.man

Index: src/include/string.h
diff -u src/include/string.h:1.53 src/include/string.h:1.54
--- src/include/string.h:1.53	Mon Aug  9 16:49:08 2021
+++ src/include/string.h	Tue Aug  1 13:51:24 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: string.h,v 1.53 2021/08/09 20:49:08 andvar Exp $	*/
+/*	$NetBSD: string.h,v 1.54 2023/08/01 17:51:24 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -106,6 +106,7 @@ char	*strsep(char **, const char *);
 char	*stresep(char **, const char *, int);
 char	*strnstr(const char *, const char *, size_t);
 void	*memrchr(const void *, int, size_t);
+void	*mempcpy(void * __restrict, const void * __restrict, size_t);
 void	*explicit_memset(void *, int, size_t);
 int	consttime_memequal(const void *, const void *, size_t);
 __END_DECLS

Index: src/lib/libc/shlib_version
diff -u src/lib/libc/shlib_version:1.294 src/lib/libc/shlib_version:1.295
--- src/lib/libc/shlib_version:1.294	Sat Jul  1 20:52:04 2023
+++ src/lib/libc/shlib_version	Tue Aug  1 13:51:24 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: shlib_version,v 1.294 2023/07/02 00:52:04 dholland Exp $
+#	$NetBSD: shlib_version,v 1.295 2023/08/01 17:51:24 christos Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
 # things we wish to do on next major version bump:
@@ -55,4 +55,4 @@
 # - remove tzsetwall(3), upstream has removed it
 # - move *rand48* to libcompat
 major=12
-minor=220
+minor=221

Index: src/lib/libc/string/Makefile.inc
diff -u src/lib/libc/string/Makefile.inc:1.86 src/lib/libc/string/Makefile.inc:1.87
--- src/lib/libc/string/Makefile.inc:1.86	Mon Jul 31 13:38:28 2023
+++ src/lib/libc/string/Makefile.inc	Tue Aug  1 13:51:25 2023
@@ -1,5 +1,5 @@
 #	from: @(#)Makefile.inc	8.1 (Berkeley) 6/4/93
-#	$NetBSD: Makefile.inc,v 1.86 2023/07/31 17:38:28 christos Exp $
+#	$NetBSD: Makefile.inc,v 1.87 2023/08/01 17:51:25 christos Exp $
 
 # string sources
 .PATH: ${ARCHDIR}/string ${.CURDIR}/string
@@ -21,7 +21,7 @@ SRCS+=	strncat.c strncmp.c strncpy.c str
 SRCS+=	strspn.c strstr.c swab.c strnstr.c
 SRCS+=	explicit_memset.c consttime_memequal.c
 
-SRCS+=	memccpy.c memcpy.c memmem.c memmove.c
+SRCS+=	memccpy.c memcpy.c memmem.c memmove.c mempcpy.c
 SRCS+=	strchr.c strrchr.c strchrnul.c
 SRCS+=	popcount32.c popcount64.c
 
@@ -67,6 +67,7 @@ MLINKS+=strstr.3 strcasestr.3
 MLINKS+=strstr.3 strnstr.3
 MLINKS+=strchr.3 strchrnul.3
 MLINKS+=memchr.3 memrchr.3
+MLINKS+=memcpy.3 mempcpy.3
 

CVS commit: [netbsd-9] src/doc

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:36:58 UTC 2023

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

Log Message:
Tickets #1686 - #1697


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.84 -r1.1.2.85 src/doc/CHANGES-9.4

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



CVS commit: [netbsd-9] src/doc

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:36:58 UTC 2023

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

Log Message:
Tickets #1686 - #1697


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.84 -r1.1.2.85 src/doc/CHANGES-9.4

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.4
diff -u src/doc/CHANGES-9.4:1.1.2.84 src/doc/CHANGES-9.4:1.1.2.85
--- src/doc/CHANGES-9.4:1.1.2.84	Mon Jul 31 18:02:32 2023
+++ src/doc/CHANGES-9.4	Tue Aug  1 17:36:58 2023
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.4,v 1.1.2.84 2023/07/31 18:02:32 martin Exp $
+# $NetBSD: CHANGES-9.4,v 1.1.2.85 2023/08/01 17:36:58 martin Exp $
 
 A complete list of changes from the NetBSD 9.3 release to the NetBSD 9.4
 release:
@@ -1788,3 +1788,78 @@ sys/kern/uipc_domain.c1.109
 	sockaddr(9): fix uninitialized buffer in DIAGNOSTIC checks.
 	[riastradh, ticket #1685]
 
+sys/dev/spkr.c	1.25 (patch)
+
+	spkr(4): Avoid some overflow issues.
+	[riastradh, ticket #1686]
+
+sys/dev/usb/xhci.c1.176
+sys/dev/usb/xhcivar.h1.23
+
+	xhci(4): PR 57326: defer root intr xfers while polling.
+	[riastradh, ticket #1687]
+
+sys/kern/subr_autoconf.c			1.308
+
+	autoconf(9): fix potential memory corruption in rare ABA case.
+	[riastradh, ticket #1688]
+
+sys/dev/isapnp/sb_isapnp.c			1.54
+sys/dev/ofisa/sb_ofisa.c			1.24
+
+	sb(4): PR 57363: fix missing mutex initialization at isapnp and ofisa.
+	[riastradh, ticket #1689]
+
+libexec/ld.elf_so/rtld.c			1.213
+
+	dlopen(3): Read _rtld_objtail under the lock.
+	[riastradh, ticket #1690]
+
+sys/fs/tmpfs/tmpfs_subr.c			1.116,1.117
+
+	tmpfs: protect against unreasonable file resizing.
+	[riastradh, ticket #1691]
+
+sys/dev/acpi/acpica/acpi_func.h			1.7 (patch)
+
+	acpi(4): fix membars in ACPI_ACQUIRE/RELEASE_GLOBAL_LOCK.
+	[riastradh, ticket #1692]
+
+distrib/sets/lists/comp/mi			1.2417 (patch)
+external/bsd/libarchive/lib/libarchive/Makefile	1.14
+external/bsd/libarchive/lib/libarchive/libarchive.pc.in 1.1
+external/public-domain/xz/lib/Makefile		1.11
+
+	Build and install pkgconfig files for liblzma and libarchive.
+	[tsutsui, ticket #1693]
+
+sys/external/bsd/drm2/linux/linux_ww_mutex.c	1.16
+
+	drm/linux_ww_mutex: fix ww acquire context ordering.
+	[riastradh, ticket #1694]
+
+sys/external/bsd/drm2/linux/linux_ww_mutex.c	1.10 (patch)
+
+	drm: fix ww_mutex return values on signal.
+	[riastradh, ticket #1695]
+
+sys/external/bsd/drm2/linux/linux_ww_mutex.c	1.15
+
+	drm: PR 57537: fix mistake in ww_mutex wait loops.
+	[riastradh, ticket #1696]
+
+usr.sbin/tprof/tprof.8  1.16,1.22,1.25,1.29 via patch
+usr.sbin/tprof/tprof_analyze.c  1.4
+usr.sbin/tprof/arch/tprof_x86.c 1.13-1.19
+sys/dev/tprof/tprof.c   1.23 via patch
+sys/dev/tprof/tprof_x86_amd.c   1.7-1.8 via patch
+sys/dev/tprof/tprof_x86_intel.c 1.8 via patch
+
+- Add AMD family 19h (zen3 and zen4) support.
+- Add Intel Comet Lake support.
+- Add support for Intel Skylake-X and Cascade Lake.
+- Print the path that we failed to open on error.
+- Use lowercase consistently for hexadecimal numbers.
+- KNF
+	[msaitoh, ticket #1697]
+



CVS commit: [netbsd-9] src

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:34:33 UTC 2023

Modified Files:
src/sys/dev/tprof [netbsd-9]: tprof.c tprof_x86_amd.c tprof_x86_intel.c
src/usr.sbin/tprof [netbsd-9]: tprof.8 tprof_analyze.c
src/usr.sbin/tprof/arch [netbsd-9]: tprof_x86.c

Log Message:
Pull up the following revisions, requested by msaitoh in ticket #1697:

usr.sbin/tprof/tprof.8  1.16,1.22,1.25,1.29 via 
patch
usr.sbin/tprof/tprof_analyze.c  1.4
usr.sbin/tprof/arch/tprof_x86.c 1.13-1.19
sys/dev/tprof/tprof.c   1.23 via patch
sys/dev/tprof/tprof_x86_amd.c   1.7-1.8 via patch
sys/dev/tprof/tprof_x86_intel.c 1.8 via patch

- Add AMD family 19h (zen3 and zen4) support.
- Add Intel Comet Lake support.
- Add support for Intel Skylake-X and Cascade Lake.
- Print the path that we failed to open on error.
- Use lowercase consistently for hexadecimal numbers.
- KNF


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.6.1 src/sys/dev/tprof/tprof.c
cvs rdiff -u -r1.4.2.1 -r1.4.2.2 src/sys/dev/tprof/tprof_x86_amd.c
cvs rdiff -u -r1.3.2.1 -r1.3.2.2 src/sys/dev/tprof/tprof_x86_intel.c
cvs rdiff -u -r1.14.2.1 -r1.14.2.2 src/usr.sbin/tprof/tprof.8
cvs rdiff -u -r1.3 -r1.3.6.1 src/usr.sbin/tprof/tprof_analyze.c
cvs rdiff -u -r1.8.4.2 -r1.8.4.3 src/usr.sbin/tprof/arch/tprof_x86.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/tprof/tprof.c
diff -u src/sys/dev/tprof/tprof.c:1.14 src/sys/dev/tprof/tprof.c:1.14.6.1
--- src/sys/dev/tprof/tprof.c:1.14	Fri Jul 13 07:56:29 2018
+++ src/sys/dev/tprof/tprof.c	Tue Aug  1 17:34:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: tprof.c,v 1.14 2018/07/13 07:56:29 maxv Exp $	*/
+/*	$NetBSD: tprof.c,v 1.14.6.1 2023/08/01 17:34:33 martin Exp $	*/
 
 /*-
  * Copyright (c)2008,2009,2010 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tprof.c,v 1.14 2018/07/13 07:56:29 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tprof.c,v 1.14.6.1 2023/08/01 17:34:33 martin Exp $");
 
 #include 
 #include 
@@ -178,7 +178,7 @@ tprof_worker(struct work *wk, void *dumm
 	KASSERT(dummy == NULL);
 
 	/*
-	 * get a per cpu buffer.
+	 * Get a per cpu buffer.
 	 */
 	buf = tprof_buf_refresh();
 
@@ -208,12 +208,11 @@ tprof_worker(struct work *wk, void *dumm
 		tprof_stat.ts_dropbuf++;
 	}
 	mutex_exit(_lock);
-	if (buf) {
+	if (buf)
 		tprof_buf_free(buf);
-	}
-	if (!shouldstop) {
+
+	if (!shouldstop)
 		callout_schedule(>c_callout, hz);
-	}
 }
 
 static void
@@ -239,9 +238,9 @@ tprof_stop1(void)
 		tprof_buf_t *old;
 
 		old = tprof_buf_switch(c, NULL);
-		if (old != NULL) {
+		if (old != NULL)
 			tprof_buf_free(old);
-		}
+
 		callout_destroy(>c_callout);
 	}
 	workqueue_destroy(tprof_wq);
@@ -256,9 +255,8 @@ tprof_getinfo(struct tprof_info *info)
 
 	memset(info, 0, sizeof(*info));
 	info->ti_version = TPROF_VERSION;
-	if ((tb = tprof_backend) != NULL) {
+	if ((tb = tprof_backend) != NULL)
 		info->ti_ident = tb->tb_ops->tbo_ident();
-	}
 }
 
 static int
@@ -351,9 +349,9 @@ tprof_stop(void)
 	mutex_enter(_lock);
 	tprof_running = false;
 	cv_broadcast(_reader_cv);
-	while (tprof_nworker > 0) {
+	while (tprof_nworker > 0)
 		cv_wait(_cv, _lock);
-	}
+
 	mutex_exit(_lock);
 
 	tprof_stop1();
@@ -451,9 +449,8 @@ tprof_backend_register(const char *name,
 {
 	tprof_backend_t *tb;
 
-	if (vers != TPROF_BACKEND_VERSION) {
+	if (vers != TPROF_BACKEND_VERSION)
 		return EINVAL;
-	}
 
 	mutex_enter(_startstop_lock);
 	tb = tprof_backend_lookup(name);
@@ -504,9 +501,8 @@ tprof_backend_unregister(const char *nam
 		return EBUSY;
 	}
 #if 1 /* XXX for now */
-	if (tprof_backend == tb) {
+	if (tprof_backend == tb)
 		tprof_backend = NULL;
-	}
 #endif
 	LIST_REMOVE(tb, tb_list);
 	mutex_exit(_startstop_lock);
@@ -522,9 +518,9 @@ static int
 tprof_open(dev_t dev, int flags, int type, struct lwp *l)
 {
 
-	if (minor(dev) != 0) {
+	if (minor(dev) != 0)
 		return EXDEV;
-	}
+
 	mutex_enter(_lock);
 	if (tprof_owner != NULL) {
 		mutex_exit(_lock);
@@ -566,7 +562,7 @@ tprof_read(dev_t dev, struct uio *uio, i
 	mutex_enter(_reader_lock);
 	while (uio->uio_resid > 0 && error == 0) {
 		/*
-		 * take the first buffer from the list.
+		 * Take the first buffer from the list.
 		 */
 		mutex_enter(_lock);
 		buf = STAILQ_FIRST(_list);
@@ -588,7 +584,7 @@ tprof_read(dev_t dev, struct uio *uio, i
 		mutex_exit(_lock);
 
 		/*
-		 * copy it out.
+		 * Copy it out.
 		 */
 		bytes = MIN(buf->b_used * sizeof(tprof_sample_t) -
 		tprof_reader_offset, uio->uio_resid);
@@ -599,7 +595,7 @@ tprof_read(dev_t dev, struct uio *uio, i
 		tprof_reader_offset += done;
 
 		/*
-		 * if we didn't consume the whole buffer,
+		 * If we didn't consume the whole buffer,
 		 * put it back to the list.
 		 */
 		if (tprof_reader_offset <

CVS commit: [netbsd-9] src

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:34:33 UTC 2023

Modified Files:
src/sys/dev/tprof [netbsd-9]: tprof.c tprof_x86_amd.c tprof_x86_intel.c
src/usr.sbin/tprof [netbsd-9]: tprof.8 tprof_analyze.c
src/usr.sbin/tprof/arch [netbsd-9]: tprof_x86.c

Log Message:
Pull up the following revisions, requested by msaitoh in ticket #1697:

usr.sbin/tprof/tprof.8  1.16,1.22,1.25,1.29 via 
patch
usr.sbin/tprof/tprof_analyze.c  1.4
usr.sbin/tprof/arch/tprof_x86.c 1.13-1.19
sys/dev/tprof/tprof.c   1.23 via patch
sys/dev/tprof/tprof_x86_amd.c   1.7-1.8 via patch
sys/dev/tprof/tprof_x86_intel.c 1.8 via patch

- Add AMD family 19h (zen3 and zen4) support.
- Add Intel Comet Lake support.
- Add support for Intel Skylake-X and Cascade Lake.
- Print the path that we failed to open on error.
- Use lowercase consistently for hexadecimal numbers.
- KNF


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.6.1 src/sys/dev/tprof/tprof.c
cvs rdiff -u -r1.4.2.1 -r1.4.2.2 src/sys/dev/tprof/tprof_x86_amd.c
cvs rdiff -u -r1.3.2.1 -r1.3.2.2 src/sys/dev/tprof/tprof_x86_intel.c
cvs rdiff -u -r1.14.2.1 -r1.14.2.2 src/usr.sbin/tprof/tprof.8
cvs rdiff -u -r1.3 -r1.3.6.1 src/usr.sbin/tprof/tprof_analyze.c
cvs rdiff -u -r1.8.4.2 -r1.8.4.3 src/usr.sbin/tprof/arch/tprof_x86.c

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



Re: CVS commit: src

2023-08-01 Thread Christos Zoulas
I am looking into it. With new code that restores the old names it should all 
work, unless I have typo that I have not found yet.

christos




signature.asc
Description: Message signed with OpenPGP


CVS commit: [netbsd-8] src/doc

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:31:33 UTC 2023

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

Log Message:
Tickets #1868 - #1876


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.187 -r1.1.2.188 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.187 src/doc/CHANGES-8.3:1.1.2.188
--- src/doc/CHANGES-8.3:1.1.2.187	Mon Jul 31 16:53:36 2023
+++ src/doc/CHANGES-8.3	Tue Aug  1 17:31:33 2023
@@ -1,4 +1,4 @@
- $NetBSD: CHANGES-8.3,v 1.1.2.187 2023/07/31 16:53:36 martin Exp $
+ $NetBSD: CHANGES-8.3,v 1.1.2.188 2023/08/01 17:31:33 martin Exp $
 
 A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3
 release:
@@ -3693,3 +3693,50 @@ sys/kern/uipc_domain.c1.109
 	sockaddr(9): fix uninitialized buffer in DIAGNOSTIC checks.
 	[riastradh, ticket #1867]
 
+sys/dev/spkr.c	1.25 (patch)
+
+	spkr(4): Avoid some overflow issues.
+	[riastradh, ticket #1868]
+
+sys/dev/usb/xhci.c1.176
+sys/dev/usb/xhcivar.h1.23
+
+	xhci(4): PR 57326: defer root intr xfers while polling.
+	[riastradh, ticket #1869]
+
+sys/dev/isapnp/sb_isapnp.c			1.54
+sys/dev/ofisa/sb_ofisa.c			1.24
+
+	sb(4): PR 57363: fix missing mutex initialization at isapnp and ofisa.
+	[riastradh, ticket #1870]
+
+libexec/ld.elf_so/rtld.c			1.213
+
+	dlopen(3): Read _rtld_objtail under the lock.
+	[riastradh, ticket #1871]
+
+sys/fs/tmpfs/tmpfs_subr.c			1.116,1.117
+
+	tmpfs: protect against unreasonable file resizing.
+	[riastradh, ticket #1872]
+
+sys/dev/acpi/acpica/acpi_func.h			1.7 (patch)
+
+	acpi(4): fix membars in ACPI_ACQUIRE/RELEASE_GLOBAL_LOCK.
+	[riastradh, ticket #1873]
+
+sys/external/bsd/drm2/linux/linux_ww_mutex.c	1.16
+
+	drm/linux_ww_mutex: fix ww acquire context ordering.
+	[riastradh, ticket #1874]
+
+sys/external/bsd/drm2/linux/linux_ww_mutex.c	1.10 (patch)
+
+	drm: fix ww_mutex return values on signal.
+	[riastradh, ticket #1875]
+
+sys/external/bsd/drm2/linux/linux_ww_mutex.c	1.15
+
+	drm: PR 57537: fix mistake in ww_mutex wait loops.
+	[riastradh, ticket #1876]
+



CVS commit: [netbsd-8] src/doc

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:31:33 UTC 2023

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

Log Message:
Tickets #1868 - #1876


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.187 -r1.1.2.188 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/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:29:15 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-8]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1876):

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.15

drm/linux_ww_mutex: Fix wait loops.

If cv_wait_sig returns because a signal is delivered, we may
nonetheless have been granted the lock.  It is harmless for us to
ignore this fact in three of the four paths, but in
ww_mutex_state_wait_sig, we may now have ownership of the lock and
MUST NOT return failure because the caller MUST release the lock
before destroying the ww_acquire_ctx.

While here, restructure the other three loops for clarity, so they
match the structure of the fourth and so they have a little less
impenetrable negation.

PR kern/57537


To generate a diff of this commit:
cvs rdiff -u -r1.2.10.5 -r1.2.10.6 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_ww_mutex.c
diff -u src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.5 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.6
--- src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.5	Tue Aug  1 17:19:57 2023
+++ src/sys/external/bsd/drm2/linux/linux_ww_mutex.c	Tue Aug  1 17:29:15 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_ww_mutex.c,v 1.2.10.5 2023/08/01 17:19:57 martin Exp $	*/
+/*	$NetBSD: linux_ww_mutex.c,v 1.2.10.6 2023/08/01 17:29:15 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.2.10.5 2023/08/01 17:19:57 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.2.10.6 2023/08/01 17:29:15 martin Exp $");
 
 #include 
 #include 
@@ -271,8 +271,14 @@ ww_mutex_state_wait(struct ww_mutex *mut
 
 	KASSERT(mutex_owned(>wwm_lock));
 	KASSERT(mutex->wwm_state == state);
-	do cv_wait(>wwm_cv, >wwm_lock);
-	while (mutex->wwm_state == state);
+
+	for (;;) {
+		cv_wait(>wwm_cv, >wwm_lock);
+		if (mutex->wwm_state != state)
+			break;
+	}
+
+	KASSERT(mutex->wwm_state != state);
 }
 
 /*
@@ -295,18 +301,26 @@ ww_mutex_state_wait_sig(struct ww_mutex 
 
 	KASSERT(mutex_owned(>wwm_lock));
 	KASSERT(mutex->wwm_state == state);
-	do {
+
+	for (;;) {
 		/* XXX errno NetBSD->Linux */
 		ret = -cv_wait_sig(>wwm_cv, >wwm_lock);
+		if (mutex->wwm_state != state) {
+			ret = 0;
+			break;
+		}
 		if (ret) {
 			KASSERTMSG((ret == -EINTR || ret == -ERESTART),
 			"ret=%d", ret);
 			ret = -EINTR;
 			break;
 		}
-	} while (mutex->wwm_state == state);
+	}
 
 	KASSERTMSG((ret == 0 || ret == -EINTR), "ret=%d", ret);
+	KASSERTMSG(ret != 0 || mutex->wwm_state != state,
+	"ret=%d mutex=%p mutex->wwm_state=%d state=%d",
+	ret, mutex, mutex->wwm_state, state);
 	return ret;
 }
 
@@ -348,12 +362,18 @@ ww_mutex_lock_wait(struct ww_mutex *mute
 	"ticket number reused: %"PRId64" (%p) %"PRId64" (%p)",
 	ctx->wwx_ticket, ctx, collision->wwx_ticket, collision);
 
-	do cv_wait(>wwm_cv, >wwm_lock);
-	while (!(((mutex->wwm_state == WW_CTX) ||
-		(mutex->wwm_state == WW_WANTOWN)) &&
-		 (mutex->wwm_u.ctx == ctx)));
+	for (;;) {
+		cv_wait(>wwm_cv, >wwm_lock);
+		if ((mutex->wwm_state == WW_CTX ||
+			mutex->wwm_state == WW_WANTOWN) &&
+		mutex->wwm_u.ctx == ctx)
+			break;
+	}
 
 	rb_tree_remove_node(>wwm_waiters, ctx);
+
+	KASSERT(mutex->wwm_state == WW_CTX || mutex->wwm_state == WW_WANTOWN);
+	KASSERT(mutex->wwm_u.ctx == ctx);
 }
 
 /*
@@ -396,21 +416,29 @@ ww_mutex_lock_wait_sig(struct ww_mutex *
 	"ticket number reused: %"PRId64" (%p) %"PRId64" (%p)",
 	ctx->wwx_ticket, ctx, collision->wwx_ticket, collision);
 
-	do {
+	for (;;) {
 		/* XXX errno NetBSD->Linux */
 		ret = -cv_wait_sig(>wwm_cv, >wwm_lock);
+		if ((mutex->wwm_state == WW_CTX ||
+			mutex->wwm_state == WW_WANTOWN) &&
+		mutex->wwm_u.ctx == ctx) {
+			ret = 0;
+			break;
+		}
 		if (ret) {
 			KASSERTMSG((ret == -EINTR || ret == -ERESTART),
 			"ret=%d", ret);
 			ret = -EINTR;
-			goto out;
+			break;
 		}
-	} while (!(((mutex->wwm_state == WW_CTX) ||
-		(mutex->wwm_state == WW_WANTOWN)) &&
-		(mutex->wwm_u.ctx == ctx)));
+	}
+
+	rb_tree_remove_node(>wwm_waiters, ctx);
 
-out:	rb_tree_remove_node(>wwm_waiters, ctx);
 	KASSERTMSG((ret == 0 || ret == -EINTR), "ret=%d", ret);
+	KASSERT(ret != 0 ||
+	mutex->wwm_state == WW_CTX || mutex->wwm_state == WW_WANTOWN);
+	KASSERT(ret != 0 || mutex->wwm_u.ctx == ctx);
 	return ret;
 }
 



CVS commit: [netbsd-8] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:29:15 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-8]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1876):

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.15

drm/linux_ww_mutex: Fix wait loops.

If cv_wait_sig returns because a signal is delivered, we may
nonetheless have been granted the lock.  It is harmless for us to
ignore this fact in three of the four paths, but in
ww_mutex_state_wait_sig, we may now have ownership of the lock and
MUST NOT return failure because the caller MUST release the lock
before destroying the ww_acquire_ctx.

While here, restructure the other three loops for clarity, so they
match the structure of the fourth and so they have a little less
impenetrable negation.

PR kern/57537


To generate a diff of this commit:
cvs rdiff -u -r1.2.10.5 -r1.2.10.6 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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



CVS commit: [netbsd-9] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:26:28 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-9]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1696):

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.15

drm/linux_ww_mutex: Fix wait loops.

If cv_wait_sig returns because a signal is delivered, we may
nonetheless have been granted the lock.  It is harmless for us to
ignore this fact in three of the four paths, but in
ww_mutex_state_wait_sig, we may now have ownership of the lock and
MUST NOT return failure because the caller MUST release the lock
before destroying the ww_acquire_ctx.

While here, restructure the other three loops for clarity, so they
match the structure of the fourth and so they have a little less
impenetrable negation.

PR kern/57537


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.2 -r1.7.2.3 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_ww_mutex.c
diff -u src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.7.2.2 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.7.2.3
--- src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.7.2.2	Tue Aug  1 17:16:26 2023
+++ src/sys/external/bsd/drm2/linux/linux_ww_mutex.c	Tue Aug  1 17:26:28 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_ww_mutex.c,v 1.7.2.2 2023/08/01 17:16:26 martin Exp $	*/
+/*	$NetBSD: linux_ww_mutex.c,v 1.7.2.3 2023/08/01 17:26:28 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.7.2.2 2023/08/01 17:16:26 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.7.2.3 2023/08/01 17:26:28 martin Exp $");
 
 #include 
 #include 
@@ -271,8 +271,14 @@ ww_mutex_state_wait(struct ww_mutex *mut
 
 	KASSERT(mutex_owned(>wwm_lock));
 	KASSERT(mutex->wwm_state == state);
-	do cv_wait(>wwm_cv, >wwm_lock);
-	while (mutex->wwm_state == state);
+
+	for (;;) {
+		cv_wait(>wwm_cv, >wwm_lock);
+		if (mutex->wwm_state != state)
+			break;
+	}
+
+	KASSERT(mutex->wwm_state != state);
 }
 
 /*
@@ -295,18 +301,26 @@ ww_mutex_state_wait_sig(struct ww_mutex 
 
 	KASSERT(mutex_owned(>wwm_lock));
 	KASSERT(mutex->wwm_state == state);
-	do {
+
+	for (;;) {
 		/* XXX errno NetBSD->Linux */
 		ret = -cv_wait_sig(>wwm_cv, >wwm_lock);
+		if (mutex->wwm_state != state) {
+			ret = 0;
+			break;
+		}
 		if (ret) {
 			KASSERTMSG((ret == -EINTR || ret == -ERESTART),
 			"ret=%d", ret);
 			ret = -EINTR;
 			break;
 		}
-	} while (mutex->wwm_state == state);
+	}
 
 	KASSERTMSG((ret == 0 || ret == -EINTR), "ret=%d", ret);
+	KASSERTMSG(ret != 0 || mutex->wwm_state != state,
+	"ret=%d mutex=%p mutex->wwm_state=%d state=%d",
+	ret, mutex, mutex->wwm_state, state);
 	return ret;
 }
 
@@ -348,12 +362,18 @@ ww_mutex_lock_wait(struct ww_mutex *mute
 	"ticket number reused: %"PRId64" (%p) %"PRId64" (%p)",
 	ctx->wwx_ticket, ctx, collision->wwx_ticket, collision);
 
-	do cv_wait(>wwm_cv, >wwm_lock);
-	while (!(((mutex->wwm_state == WW_CTX) ||
-		(mutex->wwm_state == WW_WANTOWN)) &&
-		 (mutex->wwm_u.ctx == ctx)));
+	for (;;) {
+		cv_wait(>wwm_cv, >wwm_lock);
+		if ((mutex->wwm_state == WW_CTX ||
+			mutex->wwm_state == WW_WANTOWN) &&
+		mutex->wwm_u.ctx == ctx)
+			break;
+	}
 
 	rb_tree_remove_node(>wwm_waiters, ctx);
+
+	KASSERT(mutex->wwm_state == WW_CTX || mutex->wwm_state == WW_WANTOWN);
+	KASSERT(mutex->wwm_u.ctx == ctx);
 }
 
 /*
@@ -396,21 +416,29 @@ ww_mutex_lock_wait_sig(struct ww_mutex *
 	"ticket number reused: %"PRId64" (%p) %"PRId64" (%p)",
 	ctx->wwx_ticket, ctx, collision->wwx_ticket, collision);
 
-	do {
+	for (;;) {
 		/* XXX errno NetBSD->Linux */
 		ret = -cv_wait_sig(>wwm_cv, >wwm_lock);
+		if ((mutex->wwm_state == WW_CTX ||
+			mutex->wwm_state == WW_WANTOWN) &&
+		mutex->wwm_u.ctx == ctx) {
+			ret = 0;
+			break;
+		}
 		if (ret) {
 			KASSERTMSG((ret == -EINTR || ret == -ERESTART),
 			"ret=%d", ret);
 			ret = -EINTR;
-			goto out;
+			break;
 		}
-	} while (!(((mutex->wwm_state == WW_CTX) ||
-		(mutex->wwm_state == WW_WANTOWN)) &&
-		(mutex->wwm_u.ctx == ctx)));
+	}
+
+	rb_tree_remove_node(>wwm_waiters, ctx);
 
-out:	rb_tree_remove_node(>wwm_waiters, ctx);
 	KASSERTMSG((ret == 0 || ret == -EINTR), "ret=%d", ret);
+	KASSERT(ret != 0 ||
+	mutex->wwm_state == WW_CTX || mutex->wwm_state == WW_WANTOWN);
+	KASSERT(ret != 0 || mutex->wwm_u.ctx == ctx);
 	return ret;
 }
 



CVS commit: [netbsd-9] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:26:28 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-9]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1696):

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.15

drm/linux_ww_mutex: Fix wait loops.

If cv_wait_sig returns because a signal is delivered, we may
nonetheless have been granted the lock.  It is harmless for us to
ignore this fact in three of the four paths, but in
ww_mutex_state_wait_sig, we may now have ownership of the lock and
MUST NOT return failure because the caller MUST release the lock
before destroying the ww_acquire_ctx.

While here, restructure the other three loops for clarity, so they
match the structure of the fourth and so they have a little less
impenetrable negation.

PR kern/57537


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.2 -r1.7.2.3 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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



CVS commit: [netbsd-8] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:19:57 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-8]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1875):

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.10

drm: Spruce up ww_mutex comments.  Audit return values.


To generate a diff of this commit:
cvs rdiff -u -r1.2.10.4 -r1.2.10.5 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_ww_mutex.c
diff -u src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.4 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.5
--- src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.4	Tue Aug  1 16:58:07 2023
+++ src/sys/external/bsd/drm2/linux/linux_ww_mutex.c	Tue Aug  1 17:19:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_ww_mutex.c,v 1.2.10.4 2023/08/01 16:58:07 martin Exp $	*/
+/*	$NetBSD: linux_ww_mutex.c,v 1.2.10.5 2023/08/01 17:19:57 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.2.10.4 2023/08/01 16:58:07 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.2.10.5 2023/08/01 17:19:57 martin Exp $");
 
 #include 
 #include 
@@ -168,6 +168,13 @@ static lockops_t ww_lockops = {
 };
 #endif
 
+/*
+ * ww_mutex_init(mutex, class)
+ *
+ *	Initialize mutex in the given class.  Must precede any other
+ *	ww_mutex_* operations.  After done, mutex must be destroyed
+ *	with ww_mutex_destroy.
+ */
 void
 ww_mutex_init(struct ww_mutex *mutex, struct ww_class *class)
 {
@@ -187,6 +194,13 @@ ww_mutex_init(struct ww_mutex *mutex, st
 #endif
 }
 
+/*
+ * ww_mutex_destroy(mutex)
+ *
+ *	Destroy mutex initialized by ww_mutex_init.  Caller must not be
+ *	with any other ww_mutex_* operations except after
+ *	reinitializing with ww_mutex_init.
+ */
 void
 ww_mutex_destroy(struct ww_mutex *mutex)
 {
@@ -205,9 +219,15 @@ ww_mutex_destroy(struct ww_mutex *mutex)
 }
 
 /*
- * XXX WARNING: This returns true if it is locked by ANYONE.  Does not
- * mean `Do I hold this lock?' (answering which really requires an
- * acquire context).
+ * ww_mutex_is_locked(mutex)
+ *
+ *	True if anyone holds mutex locked at the moment, false if not.
+ *	Answer is stale as soon returned unless mutex is held by
+ *	caller.
+ *
+ *	XXX WARNING: This returns true if it is locked by ANYONE.  Does
+ *	not mean `Do I hold this lock?' (answering which really
+ *	requires an acquire context).
  */
 bool
 ww_mutex_is_locked(struct ww_mutex *mutex)
@@ -233,33 +253,78 @@ ww_mutex_is_locked(struct ww_mutex *mute
 	return locked;
 }
 
+/*
+ * ww_mutex_state_wait(mutex, state)
+ *
+ *	Wait for mutex, which must be in the given state, to transition
+ *	to another state.  Uninterruptible; never fails.
+ *
+ *	Caller must hold mutex's internal lock.
+ *
+ *	May sleep.
+ *
+ *	Internal subroutine.
+ */
 static void
 ww_mutex_state_wait(struct ww_mutex *mutex, enum ww_mutex_state state)
 {
 
+	KASSERT(mutex_owned(>wwm_lock));
 	KASSERT(mutex->wwm_state == state);
 	do cv_wait(>wwm_cv, >wwm_lock);
 	while (mutex->wwm_state == state);
 }
 
+/*
+ * ww_mutex_state_wait_sig(mutex, state)
+ *
+ *	Wait for mutex, which must be in the given state, to transition
+ *	to another state, or fail if interrupted by a signal.  Return 0
+ *	on success, -EINTR if interrupted by a signal.
+ *
+ *	Caller must hold mutex's internal lock.
+ *
+ *	May sleep.
+ *
+ *	Internal subroutine.
+ */
 static int
 ww_mutex_state_wait_sig(struct ww_mutex *mutex, enum ww_mutex_state state)
 {
 	int ret;
 
+	KASSERT(mutex_owned(>wwm_lock));
 	KASSERT(mutex->wwm_state == state);
 	do {
 		/* XXX errno NetBSD->Linux */
 		ret = -cv_wait_sig(>wwm_cv, >wwm_lock);
-		if (ret == -ERESTART)
-			ret = -ERESTARTSYS;
-		if (ret)
+		if (ret) {
+			KASSERTMSG((ret == -EINTR || ret == -ERESTART),
+			"ret=%d", ret);
+			ret = -EINTR;
 			break;
+		}
 	} while (mutex->wwm_state == state);
 
+	KASSERTMSG((ret == 0 || ret == -EINTR), "ret=%d", ret);
 	return ret;
 }
 
+/*
+ * ww_mutex_lock_wait(mutex, ctx)
+ *
+ *	With mutex locked and in the WW_CTX or WW_WANTOWN state, owned
+ *	by another thread with an acquire context, wait to acquire
+ *	mutex.  While waiting, record ctx in the tree of waiters.  Does
+ *	not update the mutex state otherwise.
+ *
+ *	Caller must not already hold mutex.  Caller must hold mutex's
+ *	internal lock.  Uninterruptible; never fails.
+ *
+ *	May sleep.
+ *
+ *	Internal subroutine.
+ */
 static void
 ww_mutex_lock_wait(struct ww_mutex *mutex, struct ww_acquire_ctx *ctx)
 {
@@ -291,6 +356,22 @@ ww_mutex_lock_wait(struct ww_mutex *mute
 	rb_tree_remove_node(>wwm_waiters, ctx);
 }
 
+/*
+ * ww_mutex_lock_wait_sig(mutex, ctx)
+ *
+ *	With mutex locked and in the WW_CTX or 

CVS commit: [netbsd-8] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:19:57 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-8]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1875):

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.10

drm: Spruce up ww_mutex comments.  Audit return values.


To generate a diff of this commit:
cvs rdiff -u -r1.2.10.4 -r1.2.10.5 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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



CVS commit: [netbsd-9] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:16:26 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-9]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1695):
sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.10
drm: Spruce up ww_mutex comments.  Audit return values.


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_ww_mutex.c
diff -u src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.7.2.1 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.7.2.2
--- src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.7.2.1	Tue Aug  1 16:56:55 2023
+++ src/sys/external/bsd/drm2/linux/linux_ww_mutex.c	Tue Aug  1 17:16:26 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_ww_mutex.c,v 1.7.2.1 2023/08/01 16:56:55 martin Exp $	*/
+/*	$NetBSD: linux_ww_mutex.c,v 1.7.2.2 2023/08/01 17:16:26 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.7.2.1 2023/08/01 16:56:55 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.7.2.2 2023/08/01 17:16:26 martin Exp $");
 
 #include 
 #include 
@@ -168,6 +168,13 @@ static lockops_t ww_lockops = {
 };
 #endif
 
+/*
+ * ww_mutex_init(mutex, class)
+ *
+ *	Initialize mutex in the given class.  Must precede any other
+ *	ww_mutex_* operations.  After done, mutex must be destroyed
+ *	with ww_mutex_destroy.
+ */
 void
 ww_mutex_init(struct ww_mutex *mutex, struct ww_class *class)
 {
@@ -187,6 +194,13 @@ ww_mutex_init(struct ww_mutex *mutex, st
 #endif
 }
 
+/*
+ * ww_mutex_destroy(mutex)
+ *
+ *	Destroy mutex initialized by ww_mutex_init.  Caller must not be
+ *	with any other ww_mutex_* operations except after
+ *	reinitializing with ww_mutex_init.
+ */
 void
 ww_mutex_destroy(struct ww_mutex *mutex)
 {
@@ -205,9 +219,15 @@ ww_mutex_destroy(struct ww_mutex *mutex)
 }
 
 /*
- * XXX WARNING: This returns true if it is locked by ANYONE.  Does not
- * mean `Do I hold this lock?' (answering which really requires an
- * acquire context).
+ * ww_mutex_is_locked(mutex)
+ *
+ *	True if anyone holds mutex locked at the moment, false if not.
+ *	Answer is stale as soon returned unless mutex is held by
+ *	caller.
+ *
+ *	XXX WARNING: This returns true if it is locked by ANYONE.  Does
+ *	not mean `Do I hold this lock?' (answering which really
+ *	requires an acquire context).
  */
 bool
 ww_mutex_is_locked(struct ww_mutex *mutex)
@@ -233,33 +253,78 @@ ww_mutex_is_locked(struct ww_mutex *mute
 	return locked;
 }
 
+/*
+ * ww_mutex_state_wait(mutex, state)
+ *
+ *	Wait for mutex, which must be in the given state, to transition
+ *	to another state.  Uninterruptible; never fails.
+ *
+ *	Caller must hold mutex's internal lock.
+ *
+ *	May sleep.
+ *
+ *	Internal subroutine.
+ */
 static void
 ww_mutex_state_wait(struct ww_mutex *mutex, enum ww_mutex_state state)
 {
 
+	KASSERT(mutex_owned(>wwm_lock));
 	KASSERT(mutex->wwm_state == state);
 	do cv_wait(>wwm_cv, >wwm_lock);
 	while (mutex->wwm_state == state);
 }
 
+/*
+ * ww_mutex_state_wait_sig(mutex, state)
+ *
+ *	Wait for mutex, which must be in the given state, to transition
+ *	to another state, or fail if interrupted by a signal.  Return 0
+ *	on success, -EINTR if interrupted by a signal.
+ *
+ *	Caller must hold mutex's internal lock.
+ *
+ *	May sleep.
+ *
+ *	Internal subroutine.
+ */
 static int
 ww_mutex_state_wait_sig(struct ww_mutex *mutex, enum ww_mutex_state state)
 {
 	int ret;
 
+	KASSERT(mutex_owned(>wwm_lock));
 	KASSERT(mutex->wwm_state == state);
 	do {
 		/* XXX errno NetBSD->Linux */
 		ret = -cv_wait_sig(>wwm_cv, >wwm_lock);
-		if (ret == -ERESTART)
-			ret = -ERESTARTSYS;
-		if (ret)
+		if (ret) {
+			KASSERTMSG((ret == -EINTR || ret == -ERESTART),
+			"ret=%d", ret);
+			ret = -EINTR;
 			break;
+		}
 	} while (mutex->wwm_state == state);
 
+	KASSERTMSG((ret == 0 || ret == -EINTR), "ret=%d", ret);
 	return ret;
 }
 
+/*
+ * ww_mutex_lock_wait(mutex, ctx)
+ *
+ *	With mutex locked and in the WW_CTX or WW_WANTOWN state, owned
+ *	by another thread with an acquire context, wait to acquire
+ *	mutex.  While waiting, record ctx in the tree of waiters.  Does
+ *	not update the mutex state otherwise.
+ *
+ *	Caller must not already hold mutex.  Caller must hold mutex's
+ *	internal lock.  Uninterruptible; never fails.
+ *
+ *	May sleep.
+ *
+ *	Internal subroutine.
+ */
 static void
 ww_mutex_lock_wait(struct ww_mutex *mutex, struct ww_acquire_ctx *ctx)
 {
@@ -291,6 +356,22 @@ ww_mutex_lock_wait(struct ww_mutex *mute
 	rb_tree_remove_node(>wwm_waiters, ctx);
 }
 
+/*
+ * ww_mutex_lock_wait_sig(mutex, ctx)
+ *
+ *	With mutex locked and in the WW_CTX or WW_WANTOWN 

CVS commit: [netbsd-9] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:16:26 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-9]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1695):
sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.10
drm: Spruce up ww_mutex comments.  Audit return values.


To generate a diff of this commit:
cvs rdiff -u -r1.7.2.1 -r1.7.2.2 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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



CVS commit: [netbsd-10] src/doc

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:05:58 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Tickets #280 - #300


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.93 -r1.1.2.94 src/doc/CHANGES-10.0

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



CVS commit: [netbsd-10] src/doc

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:05:58 UTC 2023

Modified Files:
src/doc [netbsd-10]: CHANGES-10.0

Log Message:
Tickets #280 - #300


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.93 -r1.1.2.94 src/doc/CHANGES-10.0

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-10.0
diff -u src/doc/CHANGES-10.0:1.1.2.93 src/doc/CHANGES-10.0:1.1.2.94
--- src/doc/CHANGES-10.0:1.1.2.93	Mon Jul 31 16:55:56 2023
+++ src/doc/CHANGES-10.0	Tue Aug  1 17:05:58 2023
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-10.0,v 1.1.2.93 2023/07/31 16:55:56 martin Exp $
+# $NetBSD: CHANGES-10.0,v 1.1.2.94 2023/08/01 17:05:58 martin Exp $
 
 A complete list of changes from the initial NetBSD 10.0 branch on 2022-12-16
 until the 10.0 release:
@@ -3357,6 +3357,207 @@ sys/netatalk/ddp_output.c			1.22
 
 sys/dev/spkr.c	1.25
 
-	spkr(4): Avoid some overflow issues.
+	spkr(4): avoid some overflow issues.
 	[riastradh, ticket #279]
 
+sys/dev/usb/xhci.c1.176
+sys/dev/usb/xhcivar.h1.23
+
+	xhci(4): PR 57326: defer root intr xfers while polling.
+	[riastradh, ticket #280]
+
+sys/dev/usb/xhci.c1.177,1.180
+sys/dev/usb/xhcivar.h1.24
+
+	xhci(4): avoid crash in suspend/resume/resume if first resume fails.
+	[riastradh, ticket #281]
+
+sys/arch/amd64/conf/GENERIC			1.602
+sys/arch/x86/pci/files.pci			1.27
+sys/arch/x86/pci/ichlpcib.c			1.59
+sys/arch/x86/pci/tco.c1.10
+sys/arch/x86/pci/tco.h1.5
+sys/dev/ic/i82801lpcreg.h			1.17
+sys/dev/pci/files.pci1.446
+sys/dev/pci/ichsmb.c1.82
+
+	ichsmb(4), tco(4): add support for TCO on newer Intel chipsets.
+	[riastradh, ticket #282]
+
+sys/arch/powerpc/powerpc/db_disasm.c		1.30,1.31
+sys/arch/powerpc/powerpc/db_trace.c		1.61-1.63
+usr.sbin/crash/Makefile1.47
+usr.sbin/crash/arch/generic.c			1.2
+usr.sbin/crash/arch/powerpc.c			1.1
+usr.sbin/crash/arch/powerpc64.c			1.1
+usr.sbin/crash/crash.c1.15
+
+	crash(8): add powerpc support.
+	[riastradh, ticket #283]
+
+sys/dev/dkwedge/dk.c1.125-1.158
+sys/kern/subr_disk.c1.135-1.137
+sys/sys/disk.h	1.78
+
+	dk(4), disk(9): fix various races and locking errors.
+	[riastradh, ticket #284]
+
+sys/kern/subr_autoconf.c			1.308
+
+	autoconf(9): fix potential memory corruption in rare ABA case.
+	[riastradh, ticket #285]
+
+sys/dev/isapnp/sb_isapnp.c			1.54
+sys/dev/ofisa/sb_ofisa.c			1.24
+
+	sb(4): PR 57363: fix missing mutex initialization at isapnp and ofisa.
+	[riastradh, ticket #286]
+
+sys/kern/vfs_vnops.c1.238
+
+	readdir(2), lseek(2): fix races in access to struct file::f_offset.
+	[riastradh, ticket #287]
+
+libexec/ld.elf_so/rtld.c			1.213
+
+	dlopen(3): Read _rtld_objtail under the lock.
+	[riastradh, ticket #288]
+
+sys/fs/tmpfs/tmpfs_subr.c			1.116,1.117
+
+	tmpfs: protect against unreasonable file resizing.
+	[riastradh, ticket #289]
+
+sys/dev/acpi/acpica/acpi_func.h			1.7
+
+	acpi(4): fix membars in ACPI_ACQUIRE/RELEASE_GLOBAL_LOCK.
+	[riastradh, ticket #290]
+
+sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_busy.c 1.4
+
+	i915: PR 57402: fix crash from null pointer dereference under load.
+	[riastradh, ticket #291]
+
+sys/arch/arm/arm/efi_runtime.c			1.11
+sys/arch/x86/x86/efi_machdep.c			1.5,1.6
+sys/dev/efi.c	1.5-1.9
+sys/dev/efi/efi.h1.3
+sys/dev/efivar.h1.2
+sys/sys/efiio.h	1.3
+
+	efi(4): PR 57076: implement EFI runtime table ioctls.
+	[riastradh, ticket #292]
+
+sys/arch/i386/conf/ALL1.507
+sys/arch/i386/conf/GENERIC			1.1247
+
+	i386: enable EFI runtime support.
+	[riastradh, ticket #293]
+
+sys/kern/kern_entropy.c1.60,1.61
+
+	entropy(9): fix races in changes to entropy source flags.
+	[riastradh, ticket #294]
+
+sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c 1.19
+
+	amdgpu: fix mostly harmless merge botch.
+	[riastradh, ticket #295]
+
+lib/libpthread/arch/aarch64/pthread_md.h	1.2
+lib/libpthread/arch/arm/pthread_md.h		1.12,1.13
+lib/libpthread/arch/i386/pthread_md.h		1.21
+lib/libpthread/arch/x86_64/pthread_md.h		1.13
+lib/libpthread/pthread_int.h			1.110,1.111
+lib/libpthread/pthread_spin.c			1.11
+
+	libpthread: PR 57437: reduce spin lock hangs on arm.
+	[riastradh, ticket #296]
+
+distrib/sets/lists/debug/mi			1.400-.406 (patch)
+distrib/sets/lists/debug/shl.mi			1.306-1.314 (patch)
+distrib/sets/lists/tests/mi			1.1265 (patch)
+distrib/sets/lists/tests/shl.mi			1.12-1.16 (patch)
+libexec/ld.elf_so/README.TLS			1.6 (patch)
+libexec/ld.elf_so/arch/aarch64/mdreloc.c	1.18 (patch)
+libexec/ld.elf_so/arch/alpha/alpha_reloc.c	1.44 (patch)
+libexec/ld.elf_so/arch/arm/mdreloc.c		1.46 (patch)
+libexec/ld.elf_so/arch/hppa/hppa_reloc.c	1.50 (patch)
+libexec/ld.elf_so/arch/i386/mdreloc.c		1.42,1.43 (patch)
+libexec/ld.elf_so/arch/m68k/mdreloc.c		1.34 (patch)
+libexec/ld.elf_so/arch/mips/mips_reloc.c	1.75 (patch)
+libexec/ld.elf_so/arch/or1k/mdreloc.c		1.4 (patch)
+libexec/ld.elf_so/arch/powerpc/ppc_reloc.c	1.63 

CVS commit: [netbsd-10] src

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:03:54 UTC 2023

Modified Files:
src/distrib/sets/lists/debug [netbsd-10]: mi
src/distrib/sets/lists/tests [netbsd-10]: mi
src/libexec/ld.elf_so [netbsd-10]: Makefile reloc.c rtld.c rtld.h
symbol.c
src/tests/libexec/ld.elf_so [netbsd-10]: Makefile
Added Files:
src/libexec/ld.elf_so [netbsd-10]: hash.c hash.h
src/tests/libexec/ld.elf_so [netbsd-10]: t_hash.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #300):

libexec/ld.elf_so/rtld.h: revision 1.145
libexec/ld.elf_so/symbol.c: revision 1.74
libexec/ld.elf_so/rtld.h: revision 1.147
libexec/ld.elf_so/symbol.c: revision 1.75
libexec/ld.elf_so/symbol.c: revision 1.76
tests/libexec/ld.elf_so/t_hash.c: revision 1.1
libexec/ld.elf_so/Makefile: revision 1.145
libexec/ld.elf_so/Makefile: revision 1.146
libexec/ld.elf_so/Makefile: revision 1.147
libexec/ld.elf_so/reloc.c: revision 1.118
distrib/sets/lists/tests/mi: revision 1.1280
libexec/ld.elf_so/rtld.c: revision 1.215
tests/libexec/ld.elf_so/Makefile: revision 1.21
libexec/ld.elf_so/hash.c: revision 1.1
libexec/ld.elf_so/hash.h: revision 1.1
distrib/sets/lists/debug/mi: revision 1.409

The SysV ABI specifies that the symbol hash function should return only 32
bits of hash. Unfortunately due to an implementation bug and the fact that
the return type is unsigned long which is 64 bits in LP64, this can fail
in some cases: "\xff\x0f\x0f\x0f\x0f\x0f\x12". See:
"https://maskray.me/blog/2023-04-12-elf-hash-function
>From Ed Maste @ FreeBSD:

https://cgit.freebsd.org/src/commit/?id=29e3a06510823edbb91667d21f530d3ec778116d

Need to write Unit Tests for this.

Oops wrong mask.

ld.elf_so: Split SRCS onto multiple lines.
Makes updates easier.
No functional change intended.

ld.elf_so: Sort SRCS.
No functional change intended.

ld.elf_so: Split hash functions into a separate file.
This way we can test them in isolation.
No functional change intended.

ld.elf_so: Add some known-answer tests for hash functions.

Make sure the testing mechanism detects the traditional overflow bug.


To generate a diff of this commit:
cvs rdiff -u -r1.394.2.1 -r1.394.2.2 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1238.2.1 -r1.1238.2.2 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.144 -r1.144.2.1 src/libexec/ld.elf_so/Makefile
cvs rdiff -u -r0 -r1.1.2.2 src/libexec/ld.elf_so/hash.c \
src/libexec/ld.elf_so/hash.h
cvs rdiff -u -r1.117 -r1.117.2.1 src/libexec/ld.elf_so/reloc.c
cvs rdiff -u -r1.212.2.2 -r1.212.2.3 src/libexec/ld.elf_so/rtld.c
cvs rdiff -u -r1.144.2.1 -r1.144.2.2 src/libexec/ld.elf_so/rtld.h
cvs rdiff -u -r1.73 -r1.73.8.1 src/libexec/ld.elf_so/symbol.c
cvs rdiff -u -r1.12.4.1 -r1.12.4.2 src/tests/libexec/ld.elf_so/Makefile
cvs rdiff -u -r0 -r1.1.2.2 src/tests/libexec/ld.elf_so/t_hash.c

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/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.394.2.1 src/distrib/sets/lists/debug/mi:1.394.2.2
--- src/distrib/sets/lists/debug/mi:1.394.2.1	Tue Aug  1 16:34:57 2023
+++ src/distrib/sets/lists/debug/mi	Tue Aug  1 17:03:54 2023
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.394.2.1 2023/08/01 16:34:57 martin Exp $
+# $NetBSD: mi,v 1.394.2.2 2023/08/01 17:03:54 martin Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -2401,8 +2401,9 @@
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_dlerror-false.debug	tests-libexec-debug	debug,atf,pic,compattestfile
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_dlinfo.debug		tests-libexec-debug	debug,atf,pic,compattestfile
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_dlvsym.debug		tests-libexec-debug	debug,atf,pic,compattestfile
-./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_rtld_r_debug.debug	tests-libexec-debug	debug,atf,pic,compattestfile
+./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_hash.debug		tests-libexec-debug	debug,atf,pic,compattestfile
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_ifunc.debug	tests-libexec-debug	debug,atf,pic,compattestfile
+./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_rtld_r_debug.debug	tests-libexec-debug	debug,atf,pic,compattestfile
 ./usr/libdata/debug/usr/tests/libexec/ld.elf_so/t_tls_extern.debug	tests-libexec-debug	debug,atf,pic,compattestfile
 ./usr/libdata/debug/usr/tests/net/bpf/t_bpf.debug		tests-net-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/net/bpf/t_div-by-zero.debug		tests-net-debug		debug,atf,rump

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.1238.2.1 src/distrib/sets/lists/tests/mi:1.1238.2.2
--- 

CVS commit: [netbsd-10] src

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 17:03:54 UTC 2023

Modified Files:
src/distrib/sets/lists/debug [netbsd-10]: mi
src/distrib/sets/lists/tests [netbsd-10]: mi
src/libexec/ld.elf_so [netbsd-10]: Makefile reloc.c rtld.c rtld.h
symbol.c
src/tests/libexec/ld.elf_so [netbsd-10]: Makefile
Added Files:
src/libexec/ld.elf_so [netbsd-10]: hash.c hash.h
src/tests/libexec/ld.elf_so [netbsd-10]: t_hash.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #300):

libexec/ld.elf_so/rtld.h: revision 1.145
libexec/ld.elf_so/symbol.c: revision 1.74
libexec/ld.elf_so/rtld.h: revision 1.147
libexec/ld.elf_so/symbol.c: revision 1.75
libexec/ld.elf_so/symbol.c: revision 1.76
tests/libexec/ld.elf_so/t_hash.c: revision 1.1
libexec/ld.elf_so/Makefile: revision 1.145
libexec/ld.elf_so/Makefile: revision 1.146
libexec/ld.elf_so/Makefile: revision 1.147
libexec/ld.elf_so/reloc.c: revision 1.118
distrib/sets/lists/tests/mi: revision 1.1280
libexec/ld.elf_so/rtld.c: revision 1.215
tests/libexec/ld.elf_so/Makefile: revision 1.21
libexec/ld.elf_so/hash.c: revision 1.1
libexec/ld.elf_so/hash.h: revision 1.1
distrib/sets/lists/debug/mi: revision 1.409

The SysV ABI specifies that the symbol hash function should return only 32
bits of hash. Unfortunately due to an implementation bug and the fact that
the return type is unsigned long which is 64 bits in LP64, this can fail
in some cases: "\xff\x0f\x0f\x0f\x0f\x0f\x12". See:
"https://maskray.me/blog/2023-04-12-elf-hash-function
>From Ed Maste @ FreeBSD:

https://cgit.freebsd.org/src/commit/?id=29e3a06510823edbb91667d21f530d3ec778116d

Need to write Unit Tests for this.

Oops wrong mask.

ld.elf_so: Split SRCS onto multiple lines.
Makes updates easier.
No functional change intended.

ld.elf_so: Sort SRCS.
No functional change intended.

ld.elf_so: Split hash functions into a separate file.
This way we can test them in isolation.
No functional change intended.

ld.elf_so: Add some known-answer tests for hash functions.

Make sure the testing mechanism detects the traditional overflow bug.


To generate a diff of this commit:
cvs rdiff -u -r1.394.2.1 -r1.394.2.2 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.1238.2.1 -r1.1238.2.2 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.144 -r1.144.2.1 src/libexec/ld.elf_so/Makefile
cvs rdiff -u -r0 -r1.1.2.2 src/libexec/ld.elf_so/hash.c \
src/libexec/ld.elf_so/hash.h
cvs rdiff -u -r1.117 -r1.117.2.1 src/libexec/ld.elf_so/reloc.c
cvs rdiff -u -r1.212.2.2 -r1.212.2.3 src/libexec/ld.elf_so/rtld.c
cvs rdiff -u -r1.144.2.1 -r1.144.2.2 src/libexec/ld.elf_so/rtld.h
cvs rdiff -u -r1.73 -r1.73.8.1 src/libexec/ld.elf_so/symbol.c
cvs rdiff -u -r1.12.4.1 -r1.12.4.2 src/tests/libexec/ld.elf_so/Makefile
cvs rdiff -u -r0 -r1.1.2.2 src/tests/libexec/ld.elf_so/t_hash.c

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



CVS commit: [netbsd-8] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:58:07 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-8]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1874):

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.16

drm/linux_ww_mutex: Fix ww acquire context ordering.


To generate a diff of this commit:
cvs rdiff -u -r1.2.10.3 -r1.2.10.4 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_ww_mutex.c
diff -u src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.3 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.4
--- src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.2.10.3	Tue Apr 23 10:16:52 2019
+++ src/sys/external/bsd/drm2/linux/linux_ww_mutex.c	Tue Aug  1 16:58:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_ww_mutex.c,v 1.2.10.3 2019/04/23 10:16:52 martin Exp $	*/
+/*	$NetBSD: linux_ww_mutex.c,v 1.2.10.4 2023/08/01 16:58:07 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.2.10.3 2019/04/23 10:16:52 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.2.10.4 2023/08/01 16:58:07 martin Exp $");
 
 #include 
 #include 
@@ -62,7 +62,7 @@ ww_acquire_ctx_compare(void *cookie __un
 	if (ctx_a->wwx_ticket < ctx_b->wwx_ticket)
 		return -1;
 	if (ctx_a->wwx_ticket > ctx_b->wwx_ticket)
-		return -1;
+		return +1;
 	return 0;
 }
 
@@ -76,7 +76,7 @@ ww_acquire_ctx_compare_key(void *cookie 
 	if (ctx->wwx_ticket < ticket)
 		return -1;
 	if (ctx->wwx_ticket > ticket)
-		return -1;
+		return +1;
 	return 0;
 }
 



CVS commit: [netbsd-8] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:58:07 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-8]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1874):

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.16

drm/linux_ww_mutex: Fix ww acquire context ordering.


To generate a diff of this commit:
cvs rdiff -u -r1.2.10.3 -r1.2.10.4 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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



CVS commit: [netbsd-9] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:56:55 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-9]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1694):

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.16

drm/linux_ww_mutex: Fix ww acquire context ordering.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.2.1 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_ww_mutex.c
diff -u src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.7 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.7.2.1
--- src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.7	Thu May  9 05:00:31 2019
+++ src/sys/external/bsd/drm2/linux/linux_ww_mutex.c	Tue Aug  1 16:56:55 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_ww_mutex.c,v 1.7 2019/05/09 05:00:31 ozaki-r Exp $	*/
+/*	$NetBSD: linux_ww_mutex.c,v 1.7.2.1 2023/08/01 16:56:55 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.7 2019/05/09 05:00:31 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.7.2.1 2023/08/01 16:56:55 martin Exp $");
 
 #include 
 #include 
@@ -62,7 +62,7 @@ ww_acquire_ctx_compare(void *cookie __un
 	if (ctx_a->wwx_ticket < ctx_b->wwx_ticket)
 		return -1;
 	if (ctx_a->wwx_ticket > ctx_b->wwx_ticket)
-		return -1;
+		return +1;
 	return 0;
 }
 
@@ -76,7 +76,7 @@ ww_acquire_ctx_compare_key(void *cookie 
 	if (ctx->wwx_ticket < ticket)
 		return -1;
 	if (ctx->wwx_ticket > ticket)
-		return -1;
+		return +1;
 	return 0;
 }
 



CVS commit: [netbsd-9] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:56:55 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-9]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1694):

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.16

drm/linux_ww_mutex: Fix ww acquire context ordering.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.2.1 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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



CVS commit: [netbsd-10] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:55:03 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-10]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #299):

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.16

drm/linux_ww_mutex: Fix ww acquire context ordering.


To generate a diff of this commit:
cvs rdiff -u -r1.14.4.1 -r1.14.4.2 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_ww_mutex.c
diff -u src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.14.4.1 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.14.4.2
--- src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.14.4.1	Tue Aug  1 16:53:18 2023
+++ src/sys/external/bsd/drm2/linux/linux_ww_mutex.c	Tue Aug  1 16:55:03 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_ww_mutex.c,v 1.14.4.1 2023/08/01 16:53:18 martin Exp $	*/
+/*	$NetBSD: linux_ww_mutex.c,v 1.14.4.2 2023/08/01 16:55:03 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.14.4.1 2023/08/01 16:53:18 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.14.4.2 2023/08/01 16:55:03 martin Exp $");
 
 #include 
 #include 
@@ -62,7 +62,7 @@ ww_acquire_ctx_compare(void *cookie __un
 	if (ctx_a->wwx_ticket < ctx_b->wwx_ticket)
 		return -1;
 	if (ctx_a->wwx_ticket > ctx_b->wwx_ticket)
-		return -1;
+		return +1;
 	return 0;
 }
 
@@ -76,7 +76,7 @@ ww_acquire_ctx_compare_key(void *cookie 
 	if (ctx->wwx_ticket < ticket)
 		return -1;
 	if (ctx->wwx_ticket > ticket)
-		return -1;
+		return +1;
 	return 0;
 }
 



CVS commit: [netbsd-10] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:55:03 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-10]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #299):

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.16

drm/linux_ww_mutex: Fix ww acquire context ordering.


To generate a diff of this commit:
cvs rdiff -u -r1.14.4.1 -r1.14.4.2 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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



CVS commit: [netbsd-10] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:53:18 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-10]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #298):

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.15

drm/linux_ww_mutex: Fix wait loops.

If cv_wait_sig returns because a signal is delivered, we may
nonetheless have been granted the lock.  It is harmless for us to
ignore this fact in three of the four paths, but in
ww_mutex_state_wait_sig, we may now have ownership of the lock and
MUST NOT return failure because the caller MUST release the lock
before destroying the ww_acquire_ctx.

While here, restructure the other three loops for clarity, so they
match the structure of the fourth and so they have a little less
impenetrable negation.

PR kern/57537


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.4.1 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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

Modified files:

Index: src/sys/external/bsd/drm2/linux/linux_ww_mutex.c
diff -u src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.14 src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.14.4.1
--- src/sys/external/bsd/drm2/linux/linux_ww_mutex.c:1.14	Fri Mar 18 23:33:41 2022
+++ src/sys/external/bsd/drm2/linux/linux_ww_mutex.c	Tue Aug  1 16:53:18 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_ww_mutex.c,v 1.14 2022/03/18 23:33:41 riastradh Exp $	*/
+/*	$NetBSD: linux_ww_mutex.c,v 1.14.4.1 2023/08/01 16:53:18 martin Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.14 2022/03/18 23:33:41 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_ww_mutex.c,v 1.14.4.1 2023/08/01 16:53:18 martin Exp $");
 
 #include 
 #include 
@@ -286,8 +286,14 @@ ww_mutex_state_wait(struct ww_mutex *mut
 
 	KASSERT(mutex_owned(>wwm_lock));
 	KASSERT(mutex->wwm_state == state);
-	do cv_wait(>wwm_cv, >wwm_lock);
-	while (mutex->wwm_state == state);
+
+	for (;;) {
+		cv_wait(>wwm_cv, >wwm_lock);
+		if (mutex->wwm_state != state)
+			break;
+	}
+
+	KASSERT(mutex->wwm_state != state);
 }
 
 /*
@@ -310,18 +316,26 @@ ww_mutex_state_wait_sig(struct ww_mutex 
 
 	KASSERT(mutex_owned(>wwm_lock));
 	KASSERT(mutex->wwm_state == state);
-	do {
+
+	for (;;) {
 		/* XXX errno NetBSD->Linux */
 		ret = -cv_wait_sig(>wwm_cv, >wwm_lock);
+		if (mutex->wwm_state != state) {
+			ret = 0;
+			break;
+		}
 		if (ret) {
 			KASSERTMSG((ret == -EINTR || ret == -ERESTART),
 			"ret=%d", ret);
 			ret = -EINTR;
 			break;
 		}
-	} while (mutex->wwm_state == state);
+	}
 
 	KASSERTMSG((ret == 0 || ret == -EINTR), "ret=%d", ret);
+	KASSERTMSG(ret != 0 || mutex->wwm_state != state,
+	"ret=%d mutex=%p mutex->wwm_state=%d state=%d",
+	ret, mutex, mutex->wwm_state, state);
 	return ret;
 }
 
@@ -363,12 +377,18 @@ ww_mutex_lock_wait(struct ww_mutex *mute
 	"ticket number reused: %"PRId64" (%p) %"PRId64" (%p)",
 	ctx->wwx_ticket, ctx, collision->wwx_ticket, collision);
 
-	do cv_wait(>wwm_cv, >wwm_lock);
-	while (!(((mutex->wwm_state == WW_CTX) ||
-		(mutex->wwm_state == WW_WANTOWN)) &&
-		 (mutex->wwm_u.ctx == ctx)));
+	for (;;) {
+		cv_wait(>wwm_cv, >wwm_lock);
+		if ((mutex->wwm_state == WW_CTX ||
+			mutex->wwm_state == WW_WANTOWN) &&
+		mutex->wwm_u.ctx == ctx)
+			break;
+	}
 
 	rb_tree_remove_node(>wwm_waiters, ctx);
+
+	KASSERT(mutex->wwm_state == WW_CTX || mutex->wwm_state == WW_WANTOWN);
+	KASSERT(mutex->wwm_u.ctx == ctx);
 }
 
 /*
@@ -411,21 +431,29 @@ ww_mutex_lock_wait_sig(struct ww_mutex *
 	"ticket number reused: %"PRId64" (%p) %"PRId64" (%p)",
 	ctx->wwx_ticket, ctx, collision->wwx_ticket, collision);
 
-	do {
+	for (;;) {
 		/* XXX errno NetBSD->Linux */
 		ret = -cv_wait_sig(>wwm_cv, >wwm_lock);
+		if ((mutex->wwm_state == WW_CTX ||
+			mutex->wwm_state == WW_WANTOWN) &&
+		mutex->wwm_u.ctx == ctx) {
+			ret = 0;
+			break;
+		}
 		if (ret) {
 			KASSERTMSG((ret == -EINTR || ret == -ERESTART),
 			"ret=%d", ret);
 			ret = -EINTR;
-			goto out;
+			break;
 		}
-	} while (!(((mutex->wwm_state == WW_CTX) ||
-		(mutex->wwm_state == WW_WANTOWN)) &&
-		(mutex->wwm_u.ctx == ctx)));
+	}
+
+	rb_tree_remove_node(>wwm_waiters, ctx);
 
-out:	rb_tree_remove_node(>wwm_waiters, ctx);
 	KASSERTMSG((ret == 0 || ret == -EINTR), "ret=%d", ret);
+	KASSERT(ret != 0 ||
+	mutex->wwm_state == WW_CTX || mutex->wwm_state == WW_WANTOWN);
+	KASSERT(ret != 0 || mutex->wwm_u.ctx == ctx);
 	return ret;
 }
 



CVS commit: [netbsd-10] src/sys/external/bsd/drm2/linux

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:53:18 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/linux [netbsd-10]: linux_ww_mutex.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #298):

sys/external/bsd/drm2/linux/linux_ww_mutex.c: revision 1.15

drm/linux_ww_mutex: Fix wait loops.

If cv_wait_sig returns because a signal is delivered, we may
nonetheless have been granted the lock.  It is harmless for us to
ignore this fact in three of the four paths, but in
ww_mutex_state_wait_sig, we may now have ownership of the lock and
MUST NOT return failure because the caller MUST release the lock
before destroying the ww_acquire_ctx.

While here, restructure the other three loops for clarity, so they
match the structure of the fourth and so they have a little less
impenetrable negation.

PR kern/57537


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.14.4.1 \
src/sys/external/bsd/drm2/linux/linux_ww_mutex.c

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



CVS commit: [netbsd-10] src/sys/dev/usb

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:49:54 UTC 2023

Modified Files:
src/sys/dev/usb [netbsd-10]: xhci.c xhcivar.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #281):

sys/dev/usb/xhci.c: revision 1.177
sys/dev/usb/xhci.c: revision 1.180
sys/dev/usb/xhcivar.h: revision 1.24

xhci(4): Avoid crash in suspend/resume/resume if first resume fails.
Rather than try to recover from this, just make new commands fail so
at least we don't deadlock.

xhci(4): Don't panic on suspend if previous suspend/resume failed.
Trying to resume again probably won't make the situation much worse,
but panicking can definitely make it worse.


To generate a diff of this commit:
cvs rdiff -u -r1.175.2.1 -r1.175.2.2 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.22.2.1 -r1.22.2.2 src/sys/dev/usb/xhcivar.h

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

Modified files:

Index: src/sys/dev/usb/xhci.c
diff -u src/sys/dev/usb/xhci.c:1.175.2.1 src/sys/dev/usb/xhci.c:1.175.2.2
--- src/sys/dev/usb/xhci.c:1.175.2.1	Tue Aug  1 13:43:34 2023
+++ src/sys/dev/usb/xhci.c	Tue Aug  1 16:49:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhci.c,v 1.175.2.1 2023/08/01 13:43:34 martin Exp $	*/
+/*	$NetBSD: xhci.c,v 1.175.2.2 2023/08/01 16:49:54 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.175.2.1 2023/08/01 13:43:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.175.2.2 2023/08/01 16:49:54 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -895,11 +895,13 @@ xhci_suspend(device_t self, const pmf_qu
 out:	mutex_exit(>sc_rhlock);
 	if (!ok) {
 		/*
-		 * If suspend failed, resume command issuance.
+		 * If suspend failed, stop holding up command issuance
+		 * and make it fail instead.
 		 */
 		mutex_enter(>sc_lock);
 		KASSERT(sc->sc_suspender == curlwp);
 		sc->sc_suspender = NULL;
+		sc->sc_suspendresume_failed = true;
 		cv_broadcast(>sc_cmdbusy_cv);
 		mutex_exit(>sc_lock);
 	}
@@ -917,7 +919,18 @@ xhci_resume(device_t self, const pmf_qua
 
 	XHCIHIST_FUNC(); XHCIHIST_CALLED();
 
+	/*
+	 * If resume had previously failed, just try again.  Can't make
+	 * things worse, probably.
+	 */
+	mutex_enter(>sc_lock);
+	if (sc->sc_suspendresume_failed) {
+		KASSERT(sc->sc_suspender == NULL);
+		sc->sc_suspender = curlwp;
+		sc->sc_suspendresume_failed = false;
+	}
 	KASSERT(sc->sc_suspender);
+	mutex_exit(>sc_lock);
 
 	/*
 	 * Block roothub xfers which might touch portsc registers until
@@ -,6 +1124,7 @@ out:	/*
 	mutex_enter(>sc_lock);
 	KASSERT(sc->sc_suspender);
 	sc->sc_suspender = NULL;
+	sc->sc_suspendresume_failed = !ok;
 	cv_broadcast(>sc_cmdbusy_cv);
 	mutex_exit(>sc_lock);
 
@@ -3217,6 +3231,8 @@ xhci_do_command_locked(struct xhci_softc
 	while (sc->sc_command_addr != 0 ||
 	(sc->sc_suspender != NULL && sc->sc_suspender != curlwp))
 		cv_wait(>sc_cmdbusy_cv, >sc_lock);
+	if (sc->sc_suspendresume_failed)
+		return USBD_IOERROR;
 
 	/*
 	 * If enqueue pointer points at last of ring, it's Link TRB,

Index: src/sys/dev/usb/xhcivar.h
diff -u src/sys/dev/usb/xhcivar.h:1.22.2.1 src/sys/dev/usb/xhcivar.h:1.22.2.2
--- src/sys/dev/usb/xhcivar.h:1.22.2.1	Tue Aug  1 13:43:34 2023
+++ src/sys/dev/usb/xhcivar.h	Tue Aug  1 16:49:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: xhcivar.h,v 1.22.2.1 2023/08/01 13:43:34 martin Exp $	*/
+/*	$NetBSD: xhcivar.h,v 1.22.2.2 2023/08/01 16:49:54 martin Exp $	*/
 
 /*
  * Copyright (c) 2013 Jonathan A. Kollasch
@@ -140,6 +140,7 @@ struct xhci_softc {
 	bool sc_resultpending;
 
 	bool sc_dying;
+	bool sc_suspendresume_failed;
 	struct lwp *sc_suspender;
 
 	void (*sc_vendor_init)(struct xhci_softc *);



CVS commit: [netbsd-10] src/sys/dev/usb

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:49:54 UTC 2023

Modified Files:
src/sys/dev/usb [netbsd-10]: xhci.c xhcivar.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #281):

sys/dev/usb/xhci.c: revision 1.177
sys/dev/usb/xhci.c: revision 1.180
sys/dev/usb/xhcivar.h: revision 1.24

xhci(4): Avoid crash in suspend/resume/resume if first resume fails.
Rather than try to recover from this, just make new commands fail so
at least we don't deadlock.

xhci(4): Don't panic on suspend if previous suspend/resume failed.
Trying to resume again probably won't make the situation much worse,
but panicking can definitely make it worse.


To generate a diff of this commit:
cvs rdiff -u -r1.175.2.1 -r1.175.2.2 src/sys/dev/usb/xhci.c
cvs rdiff -u -r1.22.2.1 -r1.22.2.2 src/sys/dev/usb/xhcivar.h

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



CVS commit: [netbsd-10] src

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:35:00 UTC 2023

Modified Files:
src/distrib/sets/lists/debug [netbsd-10]: mi shl.mi
src/distrib/sets/lists/tests [netbsd-10]: mi shl.mi
src/libexec/ld.elf_so [netbsd-10]: README.TLS map_object.c rtld.c
rtld.h tls.c
src/libexec/ld.elf_so/arch/aarch64 [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/alpha [netbsd-10]: alpha_reloc.c
src/libexec/ld.elf_so/arch/arm [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/hppa [netbsd-10]: hppa_reloc.c
src/libexec/ld.elf_so/arch/i386 [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/m68k [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/mips [netbsd-10]: mips_reloc.c
src/libexec/ld.elf_so/arch/or1k [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/powerpc [netbsd-10]: ppc_reloc.c
src/libexec/ld.elf_so/arch/riscv [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/sh3 [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/sparc [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/sparc64 [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/x86_64 [netbsd-10]: mdreloc.c
src/tests/libexec/ld.elf_so [netbsd-10]: Makefile
src/tests/libexec/ld.elf_so/helper_dso1 [netbsd-10]: Makefile
src/tests/libexec/ld.elf_so/helper_dso2 [netbsd-10]: Makefile
src/tests/libexec/ld.elf_so/helper_dso3 [netbsd-10]: Makefile
src/tests/libexec/ld.elf_so/helper_ifunc_dso [netbsd-10]: Makefile
src/tests/libexec/ld.elf_so/helper_symver_dso0 [netbsd-10]: Makefile
src/tests/libexec/ld.elf_so/helper_symver_dso1 [netbsd-10]: Makefile
src/tests/libexec/ld.elf_so/helper_symver_dso2 [netbsd-10]: Makefile
Added Files:
src/tests/libexec/ld.elf_so [netbsd-10]: helper.mk t_tls_extern.c
src/tests/libexec/ld.elf_so/helper_abuse_dynamic [netbsd-10]: Makefile
h_abuse_dynamic.c
src/tests/libexec/ld.elf_so/helper_abuse_static [netbsd-10]: Makefile
h_abuse_static.c
src/tests/libexec/ld.elf_so/helper_def_dynamic [netbsd-10]: Makefile
h_def_dynamic.c
src/tests/libexec/ld.elf_so/helper_def_static [netbsd-10]: Makefile
h_def_static.c
src/tests/libexec/ld.elf_so/helper_onlyctor_dynamic [netbsd-10]:
Makefile h_onlyctor_dynamic.c
src/tests/libexec/ld.elf_so/helper_onlydef [netbsd-10]: Makefile
h_onlydef.c
src/tests/libexec/ld.elf_so/helper_onlydef_static [netbsd-10]: Makefile
h_onlydef_static.c
src/tests/libexec/ld.elf_so/helper_onlyuse_dynamic [netbsd-10]:
Makefile h_onlyuse_dynamic.c
src/tests/libexec/ld.elf_so/helper_onlyuse_static [netbsd-10]: Makefile
h_onlyuse_static.c
src/tests/libexec/ld.elf_so/helper_use_dynamic [netbsd-10]: Makefile
h_use_dynamic.c
src/tests/libexec/ld.elf_so/helper_use_static [netbsd-10]: Makefile
h_use_static.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #297):

distrib/sets/lists/tests/shl.mi: revision 1.14
distrib/sets/lists/tests/shl.mi: revision 1.15
distrib/sets/lists/tests/shl.mi: revision 1.16
tests/libexec/ld.elf_so/helper_def_static/h_def_static.c: revision 1.1
tests/libexec/ld.elf_so/helper_def_dynamic/Makefile: revision 1.1
tests/libexec/ld.elf_so/helper_def_dynamic/Makefile: revision 1.2
tests/libexec/ld.elf_so/helper_onlyuse_static/Makefile: revision 1.1
tests/libexec/ld.elf_so/helper_onlyuse_static/Makefile: revision 1.2
libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.75
distrib/sets/lists/tests/mi: revision 1.1265
libexec/ld.elf_so/arch/sh3/mdreloc.c: revision 1.36
libexec/ld.elf_so/rtld.c: revision 1.214
tests/libexec/ld.elf_so/helper_onlydef_static/Makefile: revision 1.1
distrib/sets/lists/debug/mi: revision 1.400
tests/libexec/ld.elf_so/helper_onlydef_static/Makefile: revision 1.2
distrib/sets/lists/debug/mi: revision 1.401
distrib/sets/lists/debug/mi: revision 1.402
tests/libexec/ld.elf_so/helper_dso2/Makefile: revision 1.2
distrib/sets/lists/debug/mi: revision 1.403
tests/libexec/ld.elf_so/helper_symver_dso0/Makefile: revision 1.2
libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.48
distrib/sets/lists/debug/mi: revision 1.406
tests/libexec/ld.elf_so/helper_use_dynamic/Makefile: revision 1.1
tests/libexec/ld.elf_so/helper_use_dynamic/Makefile: revision 1.2
tests/libexec/ld.elf_so/helper_ifunc_dso/Makefile: revision 1.2
libexec/ld.elf_so/arch/sparc64/mdreloc.c: revision 1.70
libexec/ld.elf_so/arch/aarch64/mdreloc.c: revision 1.18
tests/libexec/ld.elf_so/helper_abuse_dynamic/Makefile: revision 1.1

CVS commit: [netbsd-10] src

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:35:00 UTC 2023

Modified Files:
src/distrib/sets/lists/debug [netbsd-10]: mi shl.mi
src/distrib/sets/lists/tests [netbsd-10]: mi shl.mi
src/libexec/ld.elf_so [netbsd-10]: README.TLS map_object.c rtld.c
rtld.h tls.c
src/libexec/ld.elf_so/arch/aarch64 [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/alpha [netbsd-10]: alpha_reloc.c
src/libexec/ld.elf_so/arch/arm [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/hppa [netbsd-10]: hppa_reloc.c
src/libexec/ld.elf_so/arch/i386 [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/m68k [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/mips [netbsd-10]: mips_reloc.c
src/libexec/ld.elf_so/arch/or1k [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/powerpc [netbsd-10]: ppc_reloc.c
src/libexec/ld.elf_so/arch/riscv [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/sh3 [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/sparc [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/sparc64 [netbsd-10]: mdreloc.c
src/libexec/ld.elf_so/arch/x86_64 [netbsd-10]: mdreloc.c
src/tests/libexec/ld.elf_so [netbsd-10]: Makefile
src/tests/libexec/ld.elf_so/helper_dso1 [netbsd-10]: Makefile
src/tests/libexec/ld.elf_so/helper_dso2 [netbsd-10]: Makefile
src/tests/libexec/ld.elf_so/helper_dso3 [netbsd-10]: Makefile
src/tests/libexec/ld.elf_so/helper_ifunc_dso [netbsd-10]: Makefile
src/tests/libexec/ld.elf_so/helper_symver_dso0 [netbsd-10]: Makefile
src/tests/libexec/ld.elf_so/helper_symver_dso1 [netbsd-10]: Makefile
src/tests/libexec/ld.elf_so/helper_symver_dso2 [netbsd-10]: Makefile
Added Files:
src/tests/libexec/ld.elf_so [netbsd-10]: helper.mk t_tls_extern.c
src/tests/libexec/ld.elf_so/helper_abuse_dynamic [netbsd-10]: Makefile
h_abuse_dynamic.c
src/tests/libexec/ld.elf_so/helper_abuse_static [netbsd-10]: Makefile
h_abuse_static.c
src/tests/libexec/ld.elf_so/helper_def_dynamic [netbsd-10]: Makefile
h_def_dynamic.c
src/tests/libexec/ld.elf_so/helper_def_static [netbsd-10]: Makefile
h_def_static.c
src/tests/libexec/ld.elf_so/helper_onlyctor_dynamic [netbsd-10]:
Makefile h_onlyctor_dynamic.c
src/tests/libexec/ld.elf_so/helper_onlydef [netbsd-10]: Makefile
h_onlydef.c
src/tests/libexec/ld.elf_so/helper_onlydef_static [netbsd-10]: Makefile
h_onlydef_static.c
src/tests/libexec/ld.elf_so/helper_onlyuse_dynamic [netbsd-10]:
Makefile h_onlyuse_dynamic.c
src/tests/libexec/ld.elf_so/helper_onlyuse_static [netbsd-10]: Makefile
h_onlyuse_static.c
src/tests/libexec/ld.elf_so/helper_use_dynamic [netbsd-10]: Makefile
h_use_dynamic.c
src/tests/libexec/ld.elf_so/helper_use_static [netbsd-10]: Makefile
h_use_static.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #297):

distrib/sets/lists/tests/shl.mi: revision 1.14
distrib/sets/lists/tests/shl.mi: revision 1.15
distrib/sets/lists/tests/shl.mi: revision 1.16
tests/libexec/ld.elf_so/helper_def_static/h_def_static.c: revision 1.1
tests/libexec/ld.elf_so/helper_def_dynamic/Makefile: revision 1.1
tests/libexec/ld.elf_so/helper_def_dynamic/Makefile: revision 1.2
tests/libexec/ld.elf_so/helper_onlyuse_static/Makefile: revision 1.1
tests/libexec/ld.elf_so/helper_onlyuse_static/Makefile: revision 1.2
libexec/ld.elf_so/arch/mips/mips_reloc.c: revision 1.75
distrib/sets/lists/tests/mi: revision 1.1265
libexec/ld.elf_so/arch/sh3/mdreloc.c: revision 1.36
libexec/ld.elf_so/rtld.c: revision 1.214
tests/libexec/ld.elf_so/helper_onlydef_static/Makefile: revision 1.1
distrib/sets/lists/debug/mi: revision 1.400
tests/libexec/ld.elf_so/helper_onlydef_static/Makefile: revision 1.2
distrib/sets/lists/debug/mi: revision 1.401
distrib/sets/lists/debug/mi: revision 1.402
tests/libexec/ld.elf_so/helper_dso2/Makefile: revision 1.2
distrib/sets/lists/debug/mi: revision 1.403
tests/libexec/ld.elf_so/helper_symver_dso0/Makefile: revision 1.2
libexec/ld.elf_so/arch/x86_64/mdreloc.c: revision 1.48
distrib/sets/lists/debug/mi: revision 1.406
tests/libexec/ld.elf_so/helper_use_dynamic/Makefile: revision 1.1
tests/libexec/ld.elf_so/helper_use_dynamic/Makefile: revision 1.2
tests/libexec/ld.elf_so/helper_ifunc_dso/Makefile: revision 1.2
libexec/ld.elf_so/arch/sparc64/mdreloc.c: revision 1.70
libexec/ld.elf_so/arch/aarch64/mdreloc.c: revision 1.18
tests/libexec/ld.elf_so/helper_abuse_dynamic/Makefile: revision 1.1

CVS commit: src/sys/sys

2023-08-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Aug  1 16:33:43 UTC 2023

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

Log Message:
vnode_impl.h: clarify comment, from freenode


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/sys/vnode_impl.h

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



CVS commit: src/sys/sys

2023-08-01 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Aug  1 16:33:43 UTC 2023

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

Log Message:
vnode_impl.h: clarify comment, from freenode


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/sys/vnode_impl.h

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

Modified files:

Index: src/sys/sys/vnode_impl.h
diff -u src/sys/sys/vnode_impl.h:1.26 src/sys/sys/vnode_impl.h:1.27
--- src/sys/sys/vnode_impl.h:1.26	Sat Apr 29 10:07:05 2023
+++ src/sys/sys/vnode_impl.h	Tue Aug  1 16:33:43 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode_impl.h,v 1.26 2023/04/29 10:07:05 riastradh Exp $	*/
+/*	$NetBSD: vnode_impl.h,v 1.27 2023/08/01 16:33:43 dholland Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2019, 2020 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ struct vcache_key {
  *	l	vi_nc_listlock
  *	m	mnt_vnodelock
  *	n	vi_nc_lock
- *	n,l	vi_nc_lock + vi_nc_listlock to modify
+ *	n,l	both vi_nc_lock + vi_nc_listlock to modify, either to read
  *	s	syncer_data_lock
  */
 struct vnode_impl {



CVS commit: [netbsd-10] src/lib/libpthread

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:21:07 UTC 2023

Modified Files:
src/lib/libpthread [netbsd-10]: pthread_int.h pthread_spin.c
src/lib/libpthread/arch/aarch64 [netbsd-10]: pthread_md.h
src/lib/libpthread/arch/arm [netbsd-10]: pthread_md.h
src/lib/libpthread/arch/i386 [netbsd-10]: pthread_md.h
src/lib/libpthread/arch/x86_64 [netbsd-10]: pthread_md.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #296):

lib/libpthread/arch/x86_64/pthread_md.h: revision 1.13
lib/libpthread/pthread_int.h: revision 1.110
lib/libpthread/pthread_int.h: revision 1.111
lib/libpthread/arch/i386/pthread_md.h: revision 1.21
lib/libpthread/arch/arm/pthread_md.h: revision 1.12
lib/libpthread/arch/arm/pthread_md.h: revision 1.13
lib/libpthread/pthread_spin.c: revision 1.11
lib/libpthread/arch/aarch64/pthread_md.h: revision 1.2

libpthread: Use __nothing, not /* nothing */, for empty macros.

No functional change intended -- just safer to do it this way in case
the macros are used in if branches or comma expressions.

PR port-arm/57437 (pthread__smt_pause/wake issue)

libpthread: New pthread__smt_wait to put CPU in low power for spin.

This is now distinct from pthread__smt_pause, which is for spin lock
backoff with no paired wakeup.

On Arm, there is a single-bit event register per CPU, and there are two
instructions to manage it:
- wfe, wait for event -- if event register is clear, enter low power
  mode and wait until event register is set; then exit low power mode
  and clear event register
- sev, signal event -- sets event register on all CPUs (other
  circumstances like interrupts also set the event register and cause
  wfe to wake)

These can be used to reduce the power consumption of spinning for a
lock, but only if they are actually paired -- if there's no sev, wfe
might hang indefinitely.  Currently only pthread_spin(3) actually
pairs them; the other lock primitives (internal lock, mutex, rwlock)
do not -- they have spin lock backoff loops, but no corresponding
wakeup to cancel a wfe.

It may be worthwhile to teach the other lock primitives to pair
wfe/sev, but that requires some performance measurement to verify
it's actually worthwhile.  So for now, we just make sure not to use
wfe when there's no sev, and keep everything else the same -- this
should fix severe performance degredation in libpthread on Arm
without hurting anything else.

No change in the generated code on amd64 and i386.  No change in the
generated code for pthread_spin.c on arm and aarch64 -- changes only
the generated code for pthread_lock.c, pthread_mutex.c, and
pthread_rwlock.c, as intended.

PR port-arm/57437


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.109.2.1 src/lib/libpthread/pthread_int.h
cvs rdiff -u -r1.10 -r1.10.2.1 src/lib/libpthread/pthread_spin.c
cvs rdiff -u -r1.1 -r1.1.36.1 src/lib/libpthread/arch/aarch64/pthread_md.h
cvs rdiff -u -r1.11 -r1.11.10.1 src/lib/libpthread/arch/arm/pthread_md.h
cvs rdiff -u -r1.20 -r1.20.42.1 src/lib/libpthread/arch/i386/pthread_md.h
cvs rdiff -u -r1.12 -r1.12.54.1 src/lib/libpthread/arch/x86_64/pthread_md.h

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



CVS commit: [netbsd-10] src/lib/libpthread

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:21:07 UTC 2023

Modified Files:
src/lib/libpthread [netbsd-10]: pthread_int.h pthread_spin.c
src/lib/libpthread/arch/aarch64 [netbsd-10]: pthread_md.h
src/lib/libpthread/arch/arm [netbsd-10]: pthread_md.h
src/lib/libpthread/arch/i386 [netbsd-10]: pthread_md.h
src/lib/libpthread/arch/x86_64 [netbsd-10]: pthread_md.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #296):

lib/libpthread/arch/x86_64/pthread_md.h: revision 1.13
lib/libpthread/pthread_int.h: revision 1.110
lib/libpthread/pthread_int.h: revision 1.111
lib/libpthread/arch/i386/pthread_md.h: revision 1.21
lib/libpthread/arch/arm/pthread_md.h: revision 1.12
lib/libpthread/arch/arm/pthread_md.h: revision 1.13
lib/libpthread/pthread_spin.c: revision 1.11
lib/libpthread/arch/aarch64/pthread_md.h: revision 1.2

libpthread: Use __nothing, not /* nothing */, for empty macros.

No functional change intended -- just safer to do it this way in case
the macros are used in if branches or comma expressions.

PR port-arm/57437 (pthread__smt_pause/wake issue)

libpthread: New pthread__smt_wait to put CPU in low power for spin.

This is now distinct from pthread__smt_pause, which is for spin lock
backoff with no paired wakeup.

On Arm, there is a single-bit event register per CPU, and there are two
instructions to manage it:
- wfe, wait for event -- if event register is clear, enter low power
  mode and wait until event register is set; then exit low power mode
  and clear event register
- sev, signal event -- sets event register on all CPUs (other
  circumstances like interrupts also set the event register and cause
  wfe to wake)

These can be used to reduce the power consumption of spinning for a
lock, but only if they are actually paired -- if there's no sev, wfe
might hang indefinitely.  Currently only pthread_spin(3) actually
pairs them; the other lock primitives (internal lock, mutex, rwlock)
do not -- they have spin lock backoff loops, but no corresponding
wakeup to cancel a wfe.

It may be worthwhile to teach the other lock primitives to pair
wfe/sev, but that requires some performance measurement to verify
it's actually worthwhile.  So for now, we just make sure not to use
wfe when there's no sev, and keep everything else the same -- this
should fix severe performance degredation in libpthread on Arm
without hurting anything else.

No change in the generated code on amd64 and i386.  No change in the
generated code for pthread_spin.c on arm and aarch64 -- changes only
the generated code for pthread_lock.c, pthread_mutex.c, and
pthread_rwlock.c, as intended.

PR port-arm/57437


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.109.2.1 src/lib/libpthread/pthread_int.h
cvs rdiff -u -r1.10 -r1.10.2.1 src/lib/libpthread/pthread_spin.c
cvs rdiff -u -r1.1 -r1.1.36.1 src/lib/libpthread/arch/aarch64/pthread_md.h
cvs rdiff -u -r1.11 -r1.11.10.1 src/lib/libpthread/arch/arm/pthread_md.h
cvs rdiff -u -r1.20 -r1.20.42.1 src/lib/libpthread/arch/i386/pthread_md.h
cvs rdiff -u -r1.12 -r1.12.54.1 src/lib/libpthread/arch/x86_64/pthread_md.h

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

Modified files:

Index: src/lib/libpthread/pthread_int.h
diff -u src/lib/libpthread/pthread_int.h:1.109 src/lib/libpthread/pthread_int.h:1.109.2.1
--- src/lib/libpthread/pthread_int.h:1.109	Tue Apr 19 20:32:17 2022
+++ src/lib/libpthread/pthread_int.h	Tue Aug  1 16:21:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_int.h,v 1.109 2022/04/19 20:32:17 rillig Exp $	*/
+/*	$NetBSD: pthread_int.h,v 1.109.2.1 2023/08/01 16:21:07 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008, 2020
@@ -301,10 +301,13 @@ int	pthread__checkpri(int) PTHREAD_HIDE;
 int	pthread__add_specific(pthread_t, pthread_key_t, const void *) PTHREAD_HIDE;
 
 #ifndef pthread__smt_pause
-#define	pthread__smt_pause()	/* nothing */
+#define	pthread__smt_pause()	__nothing
+#endif
+#ifndef pthread__smt_wait
+#define	pthread__smt_wait()	__nothing
 #endif
 #ifndef pthread__smt_wake
-#define	pthread__smt_wake()	/* nothing */
+#define	pthread__smt_wake()	__nothing
 #endif
 
 /*

Index: src/lib/libpthread/pthread_spin.c
diff -u src/lib/libpthread/pthread_spin.c:1.10 src/lib/libpthread/pthread_spin.c:1.10.2.1
--- src/lib/libpthread/pthread_spin.c:1.10	Sun Apr 10 10:38:33 2022
+++ src/lib/libpthread/pthread_spin.c	Tue Aug  1 16:21:07 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_spin.c,v 1.10 2022/04/10 10:38:33 riastradh Exp $	*/
+/*	$NetBSD: pthread_spin.c,v 1.10.2.1 2023/08/01 16:21:07 martin Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_spin.c,v 1.10 2022/04/10 10:38:33 riastradh Exp $");
+__RCSID("$NetBSD: pthread_spin.c,v 1.10.2.1 2023/08/01 

CVS commit: [netbsd-10] src/sys/external/bsd/drm2/dist/drm/amd/amdgpu

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:14:59 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu [netbsd-10]:
amdgpu_device.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #295):

sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c: revision 1.19

amdgpu: Fix mostly harmless merge botch.

Avoids confusing error message that should have been confined to an
error branch.


To generate a diff of this commit:
cvs rdiff -u -r1.17.4.1 -r1.17.4.2 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c
diff -u src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c:1.17.4.1 src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c:1.17.4.2
--- src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c:1.17.4.1	Fri Feb 24 14:11:29 2023
+++ src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c	Tue Aug  1 16:14:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdgpu_device.c,v 1.17.4.1 2023/02/24 14:11:29 martin Exp $	*/
+/*	$NetBSD: amdgpu_device.c,v 1.17.4.2 2023/08/01 16:14:59 martin Exp $	*/
 
 /*
  * Copyright 2008 Advanced Micro Devices, Inc.
@@ -28,7 +28,7 @@
  *  Jerome Glisse
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdgpu_device.c,v 1.17.4.1 2023/02/24 14:11:29 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdgpu_device.c,v 1.17.4.2 2023/08/01 16:14:59 martin Exp $");
 
 #include 
 #include 
@@ -3085,7 +3085,6 @@ int amdgpu_device_init(struct amdgpu_dev
 	}
 #ifdef __NetBSD__
 	if (i == DEVICE_COUNT_RESOURCE)
-		DRM_ERROR("Unable to find PCI I/O BAR\n");
 #else
 	if (adev->rio_mem == NULL)
 #endif



CVS commit: [netbsd-10] src/sys/external/bsd/drm2/dist/drm/amd/amdgpu

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:14:59 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu [netbsd-10]:
amdgpu_device.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #295):

sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c: revision 1.19

amdgpu: Fix mostly harmless merge botch.

Avoids confusing error message that should have been confined to an
error branch.


To generate a diff of this commit:
cvs rdiff -u -r1.17.4.1 -r1.17.4.2 \
src/sys/external/bsd/drm2/dist/drm/amd/amdgpu/amdgpu_device.c

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



CVS commit: [netbsd-10] src/sys/kern

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:10:59 UTC 2023

Modified Files:
src/sys/kern [netbsd-10]: kern_entropy.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #294):

sys/kern/kern_entropy.c: revision 1.60
sys/kern/kern_entropy.c: revision 1.61

entropy(9): On flags change, cancel any scheduled consolidation.

We've been instructed to lose confidence in existing entropy sources,
so let's make sure to re-gather enough entropy before the next
consolidation can happen, in case some of what would be counted in
consolidation is from those entropy sources.

entropy(9): Avoid race between rnd_add_data and ioctl(RNDCTL).


To generate a diff of this commit:
cvs rdiff -u -r1.57.4.2 -r1.57.4.3 src/sys/kern/kern_entropy.c

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

Modified files:

Index: src/sys/kern/kern_entropy.c
diff -u src/sys/kern/kern_entropy.c:1.57.4.2 src/sys/kern/kern_entropy.c:1.57.4.3
--- src/sys/kern/kern_entropy.c:1.57.4.2	Mon Jul 31 15:57:43 2023
+++ src/sys/kern/kern_entropy.c	Tue Aug  1 16:10:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_entropy.c,v 1.57.4.2 2023/07/31 15:57:43 martin Exp $	*/
+/*	$NetBSD: kern_entropy.c,v 1.57.4.3 2023/08/01 16:10:59 martin Exp $	*/
 
 /*-
  * Copyright (c) 2019 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.57.4.2 2023/07/31 15:57:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.57.4.3 2023/08/01 16:10:59 martin Exp $");
 
 #include 
 #include 
@@ -1910,6 +1910,14 @@ rnd_add_data(struct krndsource *rs, cons
 		return;
 	}
 
+	/*
+	 * Hold up the reset xcall before it zeroes the entropy counts
+	 * on this CPU or globally.  Otherwise, we might leave some
+	 * nonzero entropy attributed to an untrusted source in the
+	 * event of a race with a change to flags.
+	 */
+	kpreempt_disable();
+
 	/* Load a snapshot of the flags.  Ioctl may change them under us.  */
 	flags = atomic_load_relaxed(>flags);
 
@@ -1922,7 +1930,7 @@ rnd_add_data(struct krndsource *rs, cons
 	if (!atomic_load_relaxed(_collection) ||
 	ISSET(flags, RND_FLAG_NO_COLLECT) ||
 	!ISSET(flags, RND_FLAG_COLLECT_VALUE|RND_FLAG_COLLECT_TIME))
-		return;
+		goto out;
 
 	/* If asked, ignore the estimate.  */
 	if (ISSET(flags, RND_FLAG_NO_ESTIMATE))
@@ -1939,6 +1947,9 @@ rnd_add_data(struct krndsource *rs, cons
 		rnd_add_data_1(rs, , sizeof extra, 0,
 		RND_FLAG_COLLECT_TIME);
 	}
+
+out:	/* Allow concurrent changes to flags to finish.  */
+	kpreempt_enable();
 }
 
 static unsigned
@@ -2414,6 +2425,7 @@ entropy_ioctl(unsigned long cmd, void *d
 			E->pending = 0;
 			atomic_store_relaxed(>needed,
 			ENTROPY_CAPACITY*NBBY);
+			E->consolidate = false;
 			mutex_exit(>lock);
 		}
 



CVS commit: [netbsd-10] src/sys/kern

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:10:59 UTC 2023

Modified Files:
src/sys/kern [netbsd-10]: kern_entropy.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #294):

sys/kern/kern_entropy.c: revision 1.60
sys/kern/kern_entropy.c: revision 1.61

entropy(9): On flags change, cancel any scheduled consolidation.

We've been instructed to lose confidence in existing entropy sources,
so let's make sure to re-gather enough entropy before the next
consolidation can happen, in case some of what would be counted in
consolidation is from those entropy sources.

entropy(9): Avoid race between rnd_add_data and ioctl(RNDCTL).


To generate a diff of this commit:
cvs rdiff -u -r1.57.4.2 -r1.57.4.3 src/sys/kern/kern_entropy.c

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



CVS commit: src/usr.bin/xlint/lint1

2023-08-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug  1 16:08:58 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: cgram.y debug.c decl.c externs1.h lex.c

Log Message:
lint: improve debug logging for declarators


To generate a diff of this commit:
cvs rdiff -u -r1.466 -r1.467 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.58 -r1.59 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.370 -r1.371 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.203 -r1.204 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.189 -r1.190 src/usr.bin/xlint/lint1/lex.c

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

Modified files:

Index: src/usr.bin/xlint/lint1/cgram.y
diff -u src/usr.bin/xlint/lint1/cgram.y:1.466 src/usr.bin/xlint/lint1/cgram.y:1.467
--- src/usr.bin/xlint/lint1/cgram.y:1.466	Fri Jul 28 21:50:03 2023
+++ src/usr.bin/xlint/lint1/cgram.y	Tue Aug  1 16:08:58 2023
@@ -1,5 +1,5 @@
 %{
-/* $NetBSD: cgram.y,v 1.466 2023/07/28 21:50:03 rillig Exp $ */
+/* $NetBSD: cgram.y,v 1.467 2023/08/01 16:08:58 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: cgram.y,v 1.466 2023/07/28 21:50:03 rillig Exp $");
+__RCSID("$NetBSD: cgram.y,v 1.467 2023/08/01 16:08:58 rillig Exp $");
 #endif
 
 #include 
@@ -163,7 +163,11 @@ is_either(const char *s, const char *a, 
 		fprintf(yyo, "%Lg", $$->u.floating);
 } 
 %printer { fprintf(yyo, "'%s'", $$ != NULL ? $$->sb_name : ""); } 
-%printer { debug_sym("", $$, ""); } 
+%printer {
+	bool indented = debug_push_indented(true);
+	debug_sym("", $$, "");
+	debug_pop_indented(indented);
+} 
 %printer { fprintf(yyo, "%s", op_name($$)); } 
 %printer { fprintf(yyo, "%s", scl_name($$)); } 
 %printer { fprintf(yyo, "%s", tspec_name($$)); } 

Index: src/usr.bin/xlint/lint1/debug.c
diff -u src/usr.bin/xlint/lint1/debug.c:1.58 src/usr.bin/xlint/lint1/debug.c:1.59
--- src/usr.bin/xlint/lint1/debug.c:1.58	Sun Jul 30 22:27:21 2023
+++ src/usr.bin/xlint/lint1/debug.c	Tue Aug  1 16:08:58 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.58 2023/07/30 22:27:21 rillig Exp $ */
+/* $NetBSD: debug.c,v 1.59 2023/08/01 16:08:58 rillig Exp $ */
 
 /*-
  * Copyright (c) 2021 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: debug.c,v 1.58 2023/07/30 22:27:21 rillig Exp $");
+__RCSID("$NetBSD: debug.c,v 1.59 2023/08/01 16:08:58 rillig Exp $");
 #endif
 
 #include 
@@ -108,6 +108,20 @@ debug_indent_dec(void)
 	debug_indentation--;
 }
 
+bool
+debug_push_indented(bool indented)
+{
+	bool prev = did_indentation;
+	did_indentation = indented;
+	return prev;
+}
+
+void
+debug_pop_indented(bool indented)
+{
+	did_indentation = indented;
+}
+
 void
 debug_step(const char *fmt, ...)
 {
@@ -426,7 +440,7 @@ static void
 debug_decl_level(const decl_level *dl)
 {
 
-	debug_printf("decl_level: %s", decl_level_kind_name(dl->d_kind));
+	debug_printf("kind=%s", decl_level_kind_name(dl->d_kind));
 	if (dl->d_scl != NOSCL)
 		debug_printf(" %s", scl_name(dl->d_scl));
 	if (dl->d_type != NULL)
@@ -477,15 +491,19 @@ debug_decl_level(const decl_level *dl)
 }
 
 void
-debug_dcs(bool all)
+debug_dcs(void)
+{
+	debug_printf("dcs ");
+	debug_decl_level(dcs);
+}
+
+void
+debug_dcs_all(void)
 {
-	int prev_indentation = debug_indentation;
+	size_t i = 0;
 	for (const decl_level *dl = dcs; dl != NULL; dl = dl->d_enclosing) {
+		debug_printf("dcs[%zu] ", i++);
 		debug_decl_level(dl);
-		if (!all)
-			return;
-		debug_indentation++;
 	}
-	debug_indentation = prev_indentation;
 }
 #endif

Index: src/usr.bin/xlint/lint1/decl.c
diff -u src/usr.bin/xlint/lint1/decl.c:1.370 src/usr.bin/xlint/lint1/decl.c:1.371
--- src/usr.bin/xlint/lint1/decl.c:1.370	Mon Jul 31 20:31:58 2023
+++ src/usr.bin/xlint/lint1/decl.c	Tue Aug  1 16:08:58 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: decl.c,v 1.370 2023/07/31 20:31:58 rillig Exp $ */
+/* $NetBSD: decl.c,v 1.371 2023/08/01 16:08:58 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include 
 #if defined(__RCSID)
-__RCSID("$NetBSD: decl.c,v 1.370 2023/07/31 20:31:58 rillig Exp $");
+__RCSID("$NetBSD: decl.c,v 1.371 2023/08/01 16:08:58 rillig Exp $");
 #endif
 
 #include 
@@ -216,8 +216,8 @@ dcs_add_storage_class(scl_t sc)
 		dcs->d_scl = STATIC;	/* ignore thread_local */
 	else
 		dcs->d_multiple_storage_classes = true;
-	debug_step("%s:", __func__);
-	debug_dcs(false);
+	debug_printf("%s: ", __func__);
+	debug_dcs();
 }
 
 /* Merge the signedness into the abstract type. */
@@ -315,7 +315,7 @@ dcs_add_type(type_t *tp)
 {
 
 	debug_step("%s: %s", __func__, type_name(tp));
-	debug_dcs(false);
+	debug_dcs();
 	if (tp->t_typedef) {
 		/*
 		 * something like "typedef int a; int a b;"
@@ -344,7 +344,7 @@ dcs_add_type(type_t *tp)
 			dcs->d_rank_mod = NO_TSPEC;
 		}
 		dcs->d_type = tp;
-		debug_dcs(false);
+		debug_dcs();

CVS commit: src/usr.bin/xlint/lint1

2023-08-01 Thread Roland Illig
Module Name:src
Committed By:   rillig
Date:   Tue Aug  1 16:08:58 UTC 2023

Modified Files:
src/usr.bin/xlint/lint1: cgram.y debug.c decl.c externs1.h lex.c

Log Message:
lint: improve debug logging for declarators


To generate a diff of this commit:
cvs rdiff -u -r1.466 -r1.467 src/usr.bin/xlint/lint1/cgram.y
cvs rdiff -u -r1.58 -r1.59 src/usr.bin/xlint/lint1/debug.c
cvs rdiff -u -r1.370 -r1.371 src/usr.bin/xlint/lint1/decl.c
cvs rdiff -u -r1.203 -r1.204 src/usr.bin/xlint/lint1/externs1.h
cvs rdiff -u -r1.189 -r1.190 src/usr.bin/xlint/lint1/lex.c

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



CVS commit: [netbsd-10] src/sys/arch/i386/conf

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:07:20 UTC 2023

Modified Files:
src/sys/arch/i386/conf [netbsd-10]: ALL GENERIC

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #293):

sys/arch/i386/conf/ALL: revision 1.507
sys/arch/i386/conf/GENERIC: revision 1.1247

i386/ALL: Enable EFI runtime support.
PR kern/57076

i386/GENERIC: Enable EFI runtime support.
PR kern/57076


To generate a diff of this commit:
cvs rdiff -u -r1.503.4.1 -r1.503.4.2 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1243 -r1.1243.2.1 src/sys/arch/i386/conf/GENERIC

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/i386/conf/ALL
diff -u src/sys/arch/i386/conf/ALL:1.503.4.1 src/sys/arch/i386/conf/ALL:1.503.4.2
--- src/sys/arch/i386/conf/ALL:1.503.4.1	Sun Jul 30 12:01:54 2023
+++ src/sys/arch/i386/conf/ALL	Tue Aug  1 16:07:19 2023
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.503.4.1 2023/07/30 12:01:54 martin Exp $
+# $NetBSD: ALL,v 1.503.4.2 2023/08/01 16:07:19 martin Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.503.4.1 $"
+#ident		"ALL-$Revision: 1.503.4.2 $"
 
 maxusers	64		# estimated number of users
 
@@ -1806,9 +1806,9 @@ pseudo-device	pad
 # userland interface to drivers, including autoconf and properties retrieval
 pseudo-device	drvctl
 
-# EFI runtime support -- doesn't build yet
-#options 	EFI_RUNTIME
-#pseudo-device 	efi			# /dev/efi
+# EFI runtime support
+options 	EFI_RUNTIME
+pseudo-device 	efi			# /dev/efi
 
 # Pass-to-Userspace Transporter
 pseudo-device	putter

Index: src/sys/arch/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1243 src/sys/arch/i386/conf/GENERIC:1.1243.2.1
--- src/sys/arch/i386/conf/GENERIC:1.1243	Sun Dec 11 04:20:52 2022
+++ src/sys/arch/i386/conf/GENERIC	Tue Aug  1 16:07:19 2023
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1243 2022/12/11 04:20:52 tsutsui Exp $
+# $NetBSD: GENERIC,v 1.1243.2.1 2023/08/01 16:07:19 martin Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1243 $"
+#ident		"GENERIC-$Revision: 1.1243.2.1 $"
 
 maxusers	64		# estimated number of users
 
@@ -1508,9 +1508,9 @@ pseudo-device	cmos
 # userland interface to drivers, including autoconf and properties retrieval
 pseudo-device	drvctl
 
-# EFI runtime support -- not yet tested
-#options 	EFI_RUNTIME
-#pseudo-device 	efi			# /dev/efi
+# EFI runtime support
+options 	EFI_RUNTIME
+pseudo-device 	efi			# /dev/efi
 
 include "dev/veriexec.config"
 



CVS commit: [netbsd-10] src/sys/arch/i386/conf

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:07:20 UTC 2023

Modified Files:
src/sys/arch/i386/conf [netbsd-10]: ALL GENERIC

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #293):

sys/arch/i386/conf/ALL: revision 1.507
sys/arch/i386/conf/GENERIC: revision 1.1247

i386/ALL: Enable EFI runtime support.
PR kern/57076

i386/GENERIC: Enable EFI runtime support.
PR kern/57076


To generate a diff of this commit:
cvs rdiff -u -r1.503.4.1 -r1.503.4.2 src/sys/arch/i386/conf/ALL
cvs rdiff -u -r1.1243 -r1.1243.2.1 src/sys/arch/i386/conf/GENERIC

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



CVS commit: [netbsd-10] src/sys

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:05:12 UTC 2023

Modified Files:
src/sys/arch/arm/arm [netbsd-10]: efi_runtime.c
src/sys/arch/x86/x86 [netbsd-10]: efi_machdep.c
src/sys/dev [netbsd-10]: efi.c efivar.h
src/sys/dev/efi [netbsd-10]: efi.h
src/sys/sys [netbsd-10]: efiio.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #292):

sys/arch/arm/arm/efi_runtime.c: revision 1.11
sys/dev/efi/efi.h: revision 1.3
sys/arch/x86/x86/efi_machdep.c: revision 1.5
sys/arch/x86/x86/efi_machdep.c: revision 1.6
sys/dev/efi.c: revision 1.5
sys/dev/efi.c: revision 1.6
sys/dev/efi.c: revision 1.7
sys/dev/efi.c: revision 1.8
sys/dev/efi.c: revision 1.9
sys/dev/efivar.h: revision 1.2
sys/sys/efiio.h: revision 1.3

efi(4): Parenthesize EFIERR argument out of paranoia.
PR kern/57076

efi(4): Move error macros to efi.h.
PR kern/57076

efi(4): Implement MI parts of EFIIOC_GET_TABLE.
Intended to be compatible with FreeBSD.
Not yet supported on any architectures.
PR kern/57076

efi(4): Implement EFIIOC_GET_TABLE on x86.
PR kern/57076

efi(4): Translate between size_t and unsigned long.
Fixes i386 build.
PR kern/57076

efi(4): Fix logic to handle buffer sizing.

Can't KASSERT(datasize <= databufsize) because the caller is allowed
to pass in a too-small size and get ERR_BUFFER_TOO_SMALL back, with
the actual size returned so it can resize its buffer.  So just clamp
the size to the smaller of what the caller provided and what the
firwmare provided, instead of asserting anything.

PR kern/57076


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.2.1 src/sys/arch/arm/arm/efi_runtime.c
cvs rdiff -u -r1.3 -r1.3.4.1 src/sys/arch/x86/x86/efi_machdep.c
cvs rdiff -u -r1.4 -r1.4.4.1 src/sys/dev/efi.c
cvs rdiff -u -r1.1 -r1.1.4.1 src/sys/dev/efivar.h
cvs rdiff -u -r1.2 -r1.2.4.1 src/sys/dev/efi/efi.h
cvs rdiff -u -r1.2 -r1.2.4.1 src/sys/sys/efiio.h

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



CVS commit: [netbsd-10] src/sys

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:05:12 UTC 2023

Modified Files:
src/sys/arch/arm/arm [netbsd-10]: efi_runtime.c
src/sys/arch/x86/x86 [netbsd-10]: efi_machdep.c
src/sys/dev [netbsd-10]: efi.c efivar.h
src/sys/dev/efi [netbsd-10]: efi.h
src/sys/sys [netbsd-10]: efiio.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #292):

sys/arch/arm/arm/efi_runtime.c: revision 1.11
sys/dev/efi/efi.h: revision 1.3
sys/arch/x86/x86/efi_machdep.c: revision 1.5
sys/arch/x86/x86/efi_machdep.c: revision 1.6
sys/dev/efi.c: revision 1.5
sys/dev/efi.c: revision 1.6
sys/dev/efi.c: revision 1.7
sys/dev/efi.c: revision 1.8
sys/dev/efi.c: revision 1.9
sys/dev/efivar.h: revision 1.2
sys/sys/efiio.h: revision 1.3

efi(4): Parenthesize EFIERR argument out of paranoia.
PR kern/57076

efi(4): Move error macros to efi.h.
PR kern/57076

efi(4): Implement MI parts of EFIIOC_GET_TABLE.
Intended to be compatible with FreeBSD.
Not yet supported on any architectures.
PR kern/57076

efi(4): Implement EFIIOC_GET_TABLE on x86.
PR kern/57076

efi(4): Translate between size_t and unsigned long.
Fixes i386 build.
PR kern/57076

efi(4): Fix logic to handle buffer sizing.

Can't KASSERT(datasize <= databufsize) because the caller is allowed
to pass in a too-small size and get ERR_BUFFER_TOO_SMALL back, with
the actual size returned so it can resize its buffer.  So just clamp
the size to the smaller of what the caller provided and what the
firwmare provided, instead of asserting anything.

PR kern/57076


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.10.2.1 src/sys/arch/arm/arm/efi_runtime.c
cvs rdiff -u -r1.3 -r1.3.4.1 src/sys/arch/x86/x86/efi_machdep.c
cvs rdiff -u -r1.4 -r1.4.4.1 src/sys/dev/efi.c
cvs rdiff -u -r1.1 -r1.1.4.1 src/sys/dev/efivar.h
cvs rdiff -u -r1.2 -r1.2.4.1 src/sys/dev/efi/efi.h
cvs rdiff -u -r1.2 -r1.2.4.1 src/sys/sys/efiio.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/arm/efi_runtime.c
diff -u src/sys/arch/arm/arm/efi_runtime.c:1.10 src/sys/arch/arm/arm/efi_runtime.c:1.10.2.1
--- src/sys/arch/arm/arm/efi_runtime.c:1.10	Sat Oct 15 11:19:23 2022
+++ src/sys/arch/arm/arm/efi_runtime.c	Tue Aug  1 16:05:11 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: efi_runtime.c,v 1.10 2022/10/15 11:19:23 jmcneill Exp $ */
+/* $NetBSD: efi_runtime.c,v 1.10.2.1 2023/08/01 16:05:11 martin Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
 #include "efi.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: efi_runtime.c,v 1.10 2022/10/15 11:19:23 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efi_runtime.c,v 1.10.2.1 2023/08/01 16:05:11 martin Exp $");
 
 #include 
 #include 
@@ -45,15 +45,6 @@ __KERNEL_RCSID(0, "$NetBSD: efi_runtime.
 #include 
 #include 
 
-#ifdef _LP64
-#define	EFIERR(x)	(0x8000 | x)
-#else
-#define	EFIERR(x)	(0x8000 | x)
-#endif
-
-#define	EFI_UNSUPPORTED		EFIERR(3)
-#define	EFI_DEVICE_ERROR	EFIERR(7)
-
 static kmutex_t efi_lock;
 static struct efi_rt *RT;
 #if BYTE_ORDER == LITTLE_ENDIAN

Index: src/sys/arch/x86/x86/efi_machdep.c
diff -u src/sys/arch/x86/x86/efi_machdep.c:1.3 src/sys/arch/x86/x86/efi_machdep.c:1.3.4.1
--- src/sys/arch/x86/x86/efi_machdep.c:1.3	Sat Sep 24 15:01:54 2022
+++ src/sys/arch/x86/x86/efi_machdep.c	Tue Aug  1 16:05:12 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: efi_machdep.c,v 1.3 2022/09/24 15:01:54 riastradh Exp $	*/
+/*	$NetBSD: efi_machdep.c,v 1.3.4.1 2023/08/01 16:05:12 martin Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: efi_machdep.c,v 1.3 2022/09/24 15:01:54 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: efi_machdep.c,v 1.3.4.1 2023/08/01 16:05:12 martin Exp $");
 
 #include "efi.h"
 #include "opt_efi.h"
@@ -582,18 +582,6 @@ efi_get_e820memmap(void)
 #ifdef EFI_RUNTIME
 
 /*
- * XXX move to sys/dev/efi/efi.h
- */
-#ifdef _LP64
-#define	EFIERR(x)	(0x8000ul | (x))
-#else
-#define	EFIERR(x)	(0x8000ul | (x))
-#endif
-
-#define	EFI_UNSUPPORTED		EFIERR(3)
-#define	EFI_DEVICE_ERROR	EFIERR(7)
-
-/*
  * efi_runtime_init()
  *
  *	Set up kernel access to EFI runtime services:
@@ -985,12 +973,29 @@ efi_runtime_setvar(efi_char *name, struc
 	return status;
 }
 
+static efi_status
+efi_runtime_gettab(const struct uuid *vendor, uint64_t *addrp)
+{
+	struct efi_cfgtbl *cfgtbl = efi_getcfgtblhead();
+	paddr_t pa;
+
+	if (cfgtbl == NULL)
+		return EFI_UNSUPPORTED;
+
+	pa = efi_getcfgtblpa(vendor);
+	if (pa == 0)
+		return EFI_NOT_FOUND;
+	*addrp = pa;
+	return EFI_SUCCESS;
+}
+
 static struct efi_ops efi_runtime_ops = {
 	.efi_gettime = efi_runtime_gettime,
 	.efi_settime = efi_runtime_settime,
 	.efi_getvar = efi_runtime_getvar,
 	.efi_setvar = efi_runtime_setvar,
 	

CVS commit: [netbsd-10] src/sys/external/bsd/drm2/dist/drm/i915/gem

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:00:57 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem [netbsd-10]:
i915_gem_busy.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #291):

sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_busy.c: revision 1.4

i915: Avoid dereferencing null fence if resv has changed.
PR kern/57402


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.4.1 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_busy.c

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



CVS commit: [netbsd-10] src/sys/external/bsd/drm2/dist/drm/i915/gem

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 16:00:57 UTC 2023

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915/gem [netbsd-10]:
i915_gem_busy.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #291):

sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_busy.c: revision 1.4

i915: Avoid dereferencing null fence if resv has changed.
PR kern/57402


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.3.4.1 \
src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_busy.c

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

Modified files:

Index: src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_busy.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_busy.c:1.3 src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_busy.c:1.3.4.1
--- src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_busy.c:1.3	Sun Dec 19 11:20:25 2021
+++ src/sys/external/bsd/drm2/dist/drm/i915/gem/i915_gem_busy.c	Tue Aug  1 16:00:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_gem_busy.c,v 1.3 2021/12/19 11:20:25 riastradh Exp $	*/
+/*	$NetBSD: i915_gem_busy.c,v 1.3.4.1 2023/08/01 16:00:57 martin Exp $	*/
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i915_gem_busy.c,v 1.3 2021/12/19 11:20:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_gem_busy.c,v 1.3.4.1 2023/08/01 16:00:57 martin Exp $");
 
 #include "gt/intel_engine.h"
 
@@ -130,6 +130,8 @@ retry:
 			struct dma_fence *fence =
 rcu_dereference(list->shared[i]);
 
+			if (read_seqcount_retry(>base.resv->seq, seq))
+goto retry;
 			args->busy |= busy_check_reader(fence);
 		}
 	}



CVS commit: [netbsd-9] src

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:46:26 UTC 2023

Modified Files:
src/distrib/sets/lists/comp [netbsd-9]: mi
src/external/bsd/libarchive/lib/libarchive [netbsd-9]: Makefile
src/external/public-domain/xz/lib [netbsd-9]: Makefile
Added Files:
src/external/bsd/libarchive/lib/libarchive [netbsd-9]: libarchive.pc.in

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1693):

external/public-domain/xz/lib/Makefile: revision 1.11
external/bsd/libarchive/lib/libarchive/libarchive.pc.in: revision 1.1
distrib/sets/lists/comp/mi: revision 1.2417 (patch)
external/bsd/libarchive/lib/libarchive/Makefile: revision 1.14

Build and install pkgconfig files for liblzma and libarchive


To generate a diff of this commit:
cvs rdiff -u -r1.2278.2.5 -r1.2278.2.6 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.10.2.1 -r1.10.2.2 \
src/external/bsd/libarchive/lib/libarchive/Makefile
cvs rdiff -u -r0 -r1.1.4.2 \
src/external/bsd/libarchive/lib/libarchive/libarchive.pc.in
cvs rdiff -u -r1.10 -r1.10.2.1 src/external/public-domain/xz/lib/Makefile

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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2278.2.5 src/distrib/sets/lists/comp/mi:1.2278.2.6
--- src/distrib/sets/lists/comp/mi:1.2278.2.5	Sun Dec  8 14:26:38 2019
+++ src/distrib/sets/lists/comp/mi	Tue Aug  1 15:46:25 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2278.2.5 2019/12/08 14:26:38 martin Exp $
+#	$NetBSD: mi,v 1.2278.2.6 2023/08/01 15:46:25 martin Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -3862,7 +3862,9 @@
 ./usr/lib/pkgconfig/atf.pc			comp-obsolete		obsolete
 ./usr/lib/pkgconfig/expat.pc			comp-c-lib
 ./usr/lib/pkgconfig/kyua-testers.pc		comp-kyua-lib		kyua,share
+./usr/lib/pkgconfig/libarchive.pc		comp-c-lib		share
 ./usr/lib/pkgconfig/libcrypto.pc		comp-crypto-lib		share
+./usr/lib/pkgconfig/liblzma.pc		comp-c-lib		share
 ./usr/lib/pkgconfig/libssl.pc			comp-crypto-lib		share
 ./usr/lib/pkgconfig/lutok.pc			comp-crypto-lib		kyua,share
 ./usr/lib/pkgconfig/openssl.pc			comp-crypto-lib		share

Index: src/external/bsd/libarchive/lib/libarchive/Makefile
diff -u src/external/bsd/libarchive/lib/libarchive/Makefile:1.10.2.1 src/external/bsd/libarchive/lib/libarchive/Makefile:1.10.2.2
--- src/external/bsd/libarchive/lib/libarchive/Makefile:1.10.2.1	Tue Jan 21 15:48:52 2020
+++ src/external/bsd/libarchive/lib/libarchive/Makefile	Tue Aug  1 15:46:25 2023
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10.2.1 2020/01/21 15:48:52 martin Exp $
+#	$NetBSD: Makefile,v 1.10.2.2 2023/08/01 15:46:25 martin Exp $
 
 .include 
 
@@ -458,4 +458,21 @@ COPTS.archive_read_support_format_mtree.
 COPTS.target.c+=	${GCC_NO_STRINGOP_TRUNCATION}
 COPTS.archive_write_set_format_iso9660.c+=	${GCC_NO_STRINGOP_TRUNCATION}
 
+FILES+=libarchive.pc
+FILESOWN_libarchive.pc=		${BINOWN}
+FILESGRP_libarchive.pc=		${BINGRP}
+FILESMODE_libarchive.pc=	${NONBINMODE}
+FILESDIR_libarchive.pc=		/usr/lib/pkgconfig
+
+CLEANFILES+=libarchive.pc
+
 .include 
+
+all: libarchive.pc
+dependall: all
+
+libarchive.pc: archive.h libarchive.pc.in
+	@(V=$$( (echo '#include '; echo ARCHIVE_VERSION_ONLY_STRING) | \
+	${CC} ${CPPFLAGS} -E -I${.CURDIR} - | tail -1 | tr -d '"') && \
+	${TOOL_SED} -e s/@VERSION@/$$V/ < ${.CURDIR}/libarchive.pc.in \
+	> ${.TARGET})

Index: src/external/public-domain/xz/lib/Makefile
diff -u src/external/public-domain/xz/lib/Makefile:1.10 src/external/public-domain/xz/lib/Makefile:1.10.2.1
--- src/external/public-domain/xz/lib/Makefile:1.10	Tue Sep 25 05:42:08 2018
+++ src/external/public-domain/xz/lib/Makefile	Tue Aug  1 15:46:25 2023
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.10 2018/09/25 05:42:08 joerg Exp $
+# $NetBSD: Makefile,v 1.10.2.1 2023/08/01 15:46:25 martin Exp $
 
 .include 
 
@@ -80,6 +80,9 @@ SRCS+=	price_table.c
 SRCS+=	simple_coder.c simple_encoder.c simple_decoder.c \
 	arm.c armthumb.c ia64.c powerpc.c sparc.c x86.c
 
+FILES+=			liblzma.pc
+FILESDIR_liblzma.pc=	/usr/lib/pkgconfig
+
 liblzma.pc:	${XZSRCDIR}/src/liblzma/liblzma.pc.in
 	${_MKTARGET_CREATE}
 	rm -f ${.TARGET}
@@ -88,9 +91,9 @@ liblzma.pc:	${XZSRCDIR}/src/liblzma/libl
 	-e 's,@exec_prefix@,/usr,' \
 	-e 's,@libdir@,/usr/lib,' \
 	-e 's,@includedir@,/usr/include,' \
-	-e 's,@PACKAGE_HOMEPAGE@,${XZHOMEPAGE:Q},' \
+	-e 's,@PACKAGE_URL@,${XZHOMEPAGE:Q},' \
 	-e 's,@PACKAGE_VERSION@,${XZVERSION:Q},' \
-	-e 's,@PTHREAD_CFLAGS@ @PTHREAD_LIBS@,-lpthread,' \
+	-e 's,@PTHREAD_CFLAGS@ @LIBS@,-lpthread,' \
 	< ${XZSRCDIR}/src/liblzma/liblzma.pc.in \
 	> ${.TARGET}.tmp && \
 	mv -f ${.TARGET}.tmp ${.TARGET}
@@ -109,3 +112,5 @@ LIBDPLIBS+=	pthread ${NETBSDSRCDIR}/lib/
 .include 
 .endif
 
+all: liblzma.pc
+dependall: all


CVS commit: [netbsd-9] src

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:46:26 UTC 2023

Modified Files:
src/distrib/sets/lists/comp [netbsd-9]: mi
src/external/bsd/libarchive/lib/libarchive [netbsd-9]: Makefile
src/external/public-domain/xz/lib [netbsd-9]: Makefile
Added Files:
src/external/bsd/libarchive/lib/libarchive [netbsd-9]: libarchive.pc.in

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #1693):

external/public-domain/xz/lib/Makefile: revision 1.11
external/bsd/libarchive/lib/libarchive/libarchive.pc.in: revision 1.1
distrib/sets/lists/comp/mi: revision 1.2417 (patch)
external/bsd/libarchive/lib/libarchive/Makefile: revision 1.14

Build and install pkgconfig files for liblzma and libarchive


To generate a diff of this commit:
cvs rdiff -u -r1.2278.2.5 -r1.2278.2.6 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.10.2.1 -r1.10.2.2 \
src/external/bsd/libarchive/lib/libarchive/Makefile
cvs rdiff -u -r0 -r1.1.4.2 \
src/external/bsd/libarchive/lib/libarchive/libarchive.pc.in
cvs rdiff -u -r1.10 -r1.10.2.1 src/external/public-domain/xz/lib/Makefile

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



CVS commit: [netbsd-8] src/sys/dev/acpi/acpica

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:40:09 UTC 2023

Modified Files:
src/sys/dev/acpi/acpica [netbsd-8]: acpi_func.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1873):

sys/dev/acpi/acpica/acpi_func.h: revision 1.7 (patch)

acpi(4): Fix membars in ACPI_ACQUIRE/RELEASE_GLOBAL_LOCK.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.52.1 src/sys/dev/acpi/acpica/acpi_func.h

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

Modified files:

Index: src/sys/dev/acpi/acpica/acpi_func.h
diff -u src/sys/dev/acpi/acpica/acpi_func.h:1.4 src/sys/dev/acpi/acpica/acpi_func.h:1.4.52.1
--- src/sys/dev/acpi/acpica/acpi_func.h:1.4	Sat Jul 24 21:53:54 2010
+++ src/sys/dev/acpi/acpica/acpi_func.h	Tue Aug  1 15:40:09 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_func.h,v 1.4 2010/07/24 21:53:54 jruoho Exp $	*/
+/*	$NetBSD: acpi_func.h,v 1.4.52.1 2023/08/01 15:40:09 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Michael Smith
@@ -62,6 +62,7 @@ acpi_acquire_global_lock(uint32_t *lock)
 		((old >> 1) & GL_BIT_PENDING);
 		val = atomic_cas_32(lock, old, new);
 	} while (__predict_false(val != old));
+	membar_enter();		/* XXX expensive for acquire semantics */
 
 	return ((new < GL_BIT_MASK) ? GL_ACQUIRED : GL_BUSY);
 }
@@ -71,6 +72,7 @@ acpi_release_global_lock(uint32_t *lock)
 {
 	uint32_t new, old, val;
 
+	membar_exit();		/* release semantics */
 	do {
 		old = *lock;
 		new = old & ~GL_BIT_MASK;



CVS commit: [netbsd-8] src/sys/dev/acpi/acpica

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:40:09 UTC 2023

Modified Files:
src/sys/dev/acpi/acpica [netbsd-8]: acpi_func.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1873):

sys/dev/acpi/acpica/acpi_func.h: revision 1.7 (patch)

acpi(4): Fix membars in ACPI_ACQUIRE/RELEASE_GLOBAL_LOCK.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.52.1 src/sys/dev/acpi/acpica/acpi_func.h

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



CVS commit: [netbsd-9] src/sys/dev/acpi/acpica

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:38:23 UTC 2023

Modified Files:
src/sys/dev/acpi/acpica [netbsd-9]: acpi_func.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1692):

sys/dev/acpi/acpica/acpi_func.h: revision 1.7 (patch)

acpi(4): Fix membars in ACPI_ACQUIRE/RELEASE_GLOBAL_LOCK.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/dev/acpi/acpica/acpi_func.h

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

Modified files:

Index: src/sys/dev/acpi/acpica/acpi_func.h
diff -u src/sys/dev/acpi/acpica/acpi_func.h:1.6 src/sys/dev/acpi/acpica/acpi_func.h:1.6.4.1
--- src/sys/dev/acpi/acpica/acpi_func.h:1.6	Fri Oct 12 21:36:24 2018
+++ src/sys/dev/acpi/acpica/acpi_func.h	Tue Aug  1 15:38:22 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_func.h,v 1.6 2018/10/12 21:36:24 jmcneill Exp $	*/
+/*	$NetBSD: acpi_func.h,v 1.6.4.1 2023/08/01 15:38:22 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Michael Smith
@@ -62,6 +62,7 @@ acpi_acquire_global_lock(uint32_t *lock)
 		((old >> 1) & GL_BIT_PENDING);
 		val = atomic_cas_32(lock, old, new);
 	} while (__predict_false(val != old));
+	membar_enter();		/* XXX expensive for acquire semantics */
 
 	return ((new < GL_BIT_MASK) ? GL_ACQUIRED : GL_BUSY);
 }
@@ -71,6 +72,7 @@ acpi_release_global_lock(uint32_t *lock)
 {
 	uint32_t new, old, val;
 
+	membar_exit();		/* release semantics */
 	do {
 		old = *lock;
 		new = old & ~GL_BIT_MASK;



CVS commit: [netbsd-9] src/sys/dev/acpi/acpica

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:38:23 UTC 2023

Modified Files:
src/sys/dev/acpi/acpica [netbsd-9]: acpi_func.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1692):

sys/dev/acpi/acpica/acpi_func.h: revision 1.7 (patch)

acpi(4): Fix membars in ACPI_ACQUIRE/RELEASE_GLOBAL_LOCK.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.4.1 src/sys/dev/acpi/acpica/acpi_func.h

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



CVS commit: [netbsd-10] src/sys/dev/acpi/acpica

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:35:38 UTC 2023

Modified Files:
src/sys/dev/acpi/acpica [netbsd-10]: acpi_func.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #290):

sys/dev/acpi/acpica/acpi_func.h: revision 1.7

acpi(4): Fix membars in ACPI_ACQUIRE/RELEASE_GLOBAL_LOCK.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.30.1 src/sys/dev/acpi/acpica/acpi_func.h

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

Modified files:

Index: src/sys/dev/acpi/acpica/acpi_func.h
diff -u src/sys/dev/acpi/acpica/acpi_func.h:1.6 src/sys/dev/acpi/acpica/acpi_func.h:1.6.30.1
--- src/sys/dev/acpi/acpica/acpi_func.h:1.6	Fri Oct 12 21:36:24 2018
+++ src/sys/dev/acpi/acpica/acpi_func.h	Tue Aug  1 15:35:38 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_func.h,v 1.6 2018/10/12 21:36:24 jmcneill Exp $	*/
+/*	$NetBSD: acpi_func.h,v 1.6.30.1 2023/08/01 15:35:38 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000 Michael Smith
@@ -62,6 +62,7 @@ acpi_acquire_global_lock(uint32_t *lock)
 		((old >> 1) & GL_BIT_PENDING);
 		val = atomic_cas_32(lock, old, new);
 	} while (__predict_false(val != old));
+	membar_acquire();
 
 	return ((new < GL_BIT_MASK) ? GL_ACQUIRED : GL_BUSY);
 }
@@ -71,6 +72,7 @@ acpi_release_global_lock(uint32_t *lock)
 {
 	uint32_t new, old, val;
 
+	membar_release();
 	do {
 		old = *lock;
 		new = old & ~GL_BIT_MASK;



CVS commit: [netbsd-10] src/sys/dev/acpi/acpica

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:35:38 UTC 2023

Modified Files:
src/sys/dev/acpi/acpica [netbsd-10]: acpi_func.h

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #290):

sys/dev/acpi/acpica/acpi_func.h: revision 1.7

acpi(4): Fix membars in ACPI_ACQUIRE/RELEASE_GLOBAL_LOCK.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.6.30.1 src/sys/dev/acpi/acpica/acpi_func.h

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



CVS commit: [netbsd-8] src/sys/fs/tmpfs

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:32:23 UTC 2023

Modified Files:
src/sys/fs/tmpfs [netbsd-8]: tmpfs_subr.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1872):

sys/fs/tmpfs/tmpfs_subr.c: revision 1.116
sys/fs/tmpfs/tmpfs_subr.c: revision 1.117

tmpfs: Refuse sizes that overflow round_page.

tmpfs: Assert no arithmetic overflow in directory node tn_size.
Need >2^57 directory entries before this is a problem.  If we created
a million per second, this would take over 4000 years.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.102.8.1 src/sys/fs/tmpfs/tmpfs_subr.c

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

Modified files:

Index: src/sys/fs/tmpfs/tmpfs_subr.c
diff -u src/sys/fs/tmpfs/tmpfs_subr.c:1.102 src/sys/fs/tmpfs/tmpfs_subr.c:1.102.8.1
--- src/sys/fs/tmpfs/tmpfs_subr.c:1.102	Wed Jan  4 10:06:43 2017
+++ src/sys/fs/tmpfs/tmpfs_subr.c	Tue Aug  1 15:32:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_subr.c,v 1.102 2017/01/04 10:06:43 hannken Exp $	*/
+/*	$NetBSD: tmpfs_subr.c,v 1.102.8.1 2023/08/01 15:32:23 martin Exp $	*/
 
 /*
  * Copyright (c) 2005-2013 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.102 2017/01/04 10:06:43 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.102.8.1 2023/08/01 15:32:23 martin Exp $");
 
 #include 
 #include 
@@ -514,6 +514,7 @@ tmpfs_dir_attach(tmpfs_node_t *dnode, tm
 
 	/* Insert the entry to the directory (parent of inode). */
 	TAILQ_INSERT_TAIL(>tn_spec.tn_dir.tn_dir, de, td_entries);
+	KASSERT(dnode->tn_size <= __type_max(off_t) - sizeof(tmpfs_dirent_t));
 	dnode->tn_size += sizeof(tmpfs_dirent_t);
 	uvm_vnp_setsize(dvp, dnode->tn_size);
 
@@ -580,6 +581,7 @@ tmpfs_dir_detach(tmpfs_node_t *dnode, tm
 		dnode->tn_spec.tn_dir.tn_readdir_lastp = NULL;
 	}
 	TAILQ_REMOVE(>tn_spec.tn_dir.tn_dir, de, td_entries);
+	KASSERT(dnode->tn_size >= sizeof(tmpfs_dirent_t));
 	dnode->tn_size -= sizeof(tmpfs_dirent_t);
 	tmpfs_dir_putseq(dnode, de);
 
@@ -908,6 +910,9 @@ tmpfs_reg_resize(struct vnode *vp, off_t
 	KASSERT(vp->v_type == VREG);
 	KASSERT(newsize >= 0);
 
+	if (newsize > __type_max(off_t) - PAGE_SIZE + 1)
+		return EFBIG;
+
 	oldsize = node->tn_size;
 	oldpages = round_page(oldsize) >> PAGE_SHIFT;
 	newpages = round_page(newsize) >> PAGE_SHIFT;



CVS commit: [netbsd-8] src/sys/fs/tmpfs

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:32:23 UTC 2023

Modified Files:
src/sys/fs/tmpfs [netbsd-8]: tmpfs_subr.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1872):

sys/fs/tmpfs/tmpfs_subr.c: revision 1.116
sys/fs/tmpfs/tmpfs_subr.c: revision 1.117

tmpfs: Refuse sizes that overflow round_page.

tmpfs: Assert no arithmetic overflow in directory node tn_size.
Need >2^57 directory entries before this is a problem.  If we created
a million per second, this would take over 4000 years.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.102.8.1 src/sys/fs/tmpfs/tmpfs_subr.c

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



CVS commit: [netbsd-9] src/sys/fs/tmpfs

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:30:40 UTC 2023

Modified Files:
src/sys/fs/tmpfs [netbsd-9]: tmpfs_subr.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1691):

sys/fs/tmpfs/tmpfs_subr.c: revision 1.116
sys/fs/tmpfs/tmpfs_subr.c: revision 1.117

tmpfs: Refuse sizes that overflow round_page.

tmpfs: Assert no arithmetic overflow in directory node tn_size.
Need >2^57 directory entries before this is a problem.  If we created
a million per second, this would take over 4000 years.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.104.4.1 src/sys/fs/tmpfs/tmpfs_subr.c

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

Modified files:

Index: src/sys/fs/tmpfs/tmpfs_subr.c
diff -u src/sys/fs/tmpfs/tmpfs_subr.c:1.104 src/sys/fs/tmpfs/tmpfs_subr.c:1.104.4.1
--- src/sys/fs/tmpfs/tmpfs_subr.c:1.104	Tue Jan  1 10:06:54 2019
+++ src/sys/fs/tmpfs/tmpfs_subr.c	Tue Aug  1 15:30:40 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_subr.c,v 1.104 2019/01/01 10:06:54 hannken Exp $	*/
+/*	$NetBSD: tmpfs_subr.c,v 1.104.4.1 2023/08/01 15:30:40 martin Exp $	*/
 
 /*
  * Copyright (c) 2005-2013 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.104 2019/01/01 10:06:54 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.104.4.1 2023/08/01 15:30:40 martin Exp $");
 
 #include 
 #include 
@@ -514,6 +514,7 @@ tmpfs_dir_attach(tmpfs_node_t *dnode, tm
 
 	/* Insert the entry to the directory (parent of inode). */
 	TAILQ_INSERT_TAIL(>tn_spec.tn_dir.tn_dir, de, td_entries);
+	KASSERT(dnode->tn_size <= __type_max(off_t) - sizeof(tmpfs_dirent_t));
 	dnode->tn_size += sizeof(tmpfs_dirent_t);
 	uvm_vnp_setsize(dvp, dnode->tn_size);
 
@@ -580,6 +581,7 @@ tmpfs_dir_detach(tmpfs_node_t *dnode, tm
 		dnode->tn_spec.tn_dir.tn_readdir_lastp = NULL;
 	}
 	TAILQ_REMOVE(>tn_spec.tn_dir.tn_dir, de, td_entries);
+	KASSERT(dnode->tn_size >= sizeof(tmpfs_dirent_t));
 	dnode->tn_size -= sizeof(tmpfs_dirent_t);
 	tmpfs_dir_putseq(dnode, de);
 
@@ -908,6 +910,9 @@ tmpfs_reg_resize(struct vnode *vp, off_t
 	KASSERT(vp->v_type == VREG);
 	KASSERT(newsize >= 0);
 
+	if (newsize > __type_max(off_t) - PAGE_SIZE + 1)
+		return EFBIG;
+
 	oldsize = node->tn_size;
 	oldpages = round_page(oldsize) >> PAGE_SHIFT;
 	newpages = round_page(newsize) >> PAGE_SHIFT;



CVS commit: [netbsd-9] src/sys/fs/tmpfs

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:30:40 UTC 2023

Modified Files:
src/sys/fs/tmpfs [netbsd-9]: tmpfs_subr.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1691):

sys/fs/tmpfs/tmpfs_subr.c: revision 1.116
sys/fs/tmpfs/tmpfs_subr.c: revision 1.117

tmpfs: Refuse sizes that overflow round_page.

tmpfs: Assert no arithmetic overflow in directory node tn_size.
Need >2^57 directory entries before this is a problem.  If we created
a million per second, this would take over 4000 years.


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.104.4.1 src/sys/fs/tmpfs/tmpfs_subr.c

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



CVS commit: [netbsd-10] src/sys/fs/tmpfs

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:29:24 UTC 2023

Modified Files:
src/sys/fs/tmpfs [netbsd-10]: tmpfs_subr.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #289):

sys/fs/tmpfs/tmpfs_subr.c: revision 1.116
sys/fs/tmpfs/tmpfs_subr.c: revision 1.117

tmpfs: Refuse sizes that overflow round_page.

tmpfs: Assert no arithmetic overflow in directory node tn_size.
Need >2^57 directory entries before this is a problem.  If we created
a million per second, this would take over 4000 years.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.114.4.1 src/sys/fs/tmpfs/tmpfs_subr.c

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

Modified files:

Index: src/sys/fs/tmpfs/tmpfs_subr.c
diff -u src/sys/fs/tmpfs/tmpfs_subr.c:1.114 src/sys/fs/tmpfs/tmpfs_subr.c:1.114.4.1
--- src/sys/fs/tmpfs/tmpfs_subr.c:1.114	Wed Oct 20 03:08:17 2021
+++ src/sys/fs/tmpfs/tmpfs_subr.c	Tue Aug  1 15:29:23 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: tmpfs_subr.c,v 1.114 2021/10/20 03:08:17 thorpej Exp $	*/
+/*	$NetBSD: tmpfs_subr.c,v 1.114.4.1 2023/08/01 15:29:23 martin Exp $	*/
 
 /*
  * Copyright (c) 2005-2020 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.114 2021/10/20 03:08:17 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tmpfs_subr.c,v 1.114.4.1 2023/08/01 15:29:23 martin Exp $");
 
 #include 
 #include 
@@ -522,6 +522,7 @@ tmpfs_dir_attach(tmpfs_node_t *dnode, tm
 
 	/* Insert the entry to the directory (parent of inode). */
 	TAILQ_INSERT_TAIL(>tn_spec.tn_dir.tn_dir, de, td_entries);
+	KASSERT(dnode->tn_size <= __type_max(off_t) - sizeof(tmpfs_dirent_t));
 	dnode->tn_size += sizeof(tmpfs_dirent_t);
 	uvm_vnp_setsize(dvp, dnode->tn_size);
 
@@ -580,6 +581,7 @@ tmpfs_dir_detach(tmpfs_node_t *dnode, tm
 		dnode->tn_spec.tn_dir.tn_readdir_lastp = NULL;
 	}
 	TAILQ_REMOVE(>tn_spec.tn_dir.tn_dir, de, td_entries);
+	KASSERT(dnode->tn_size >= sizeof(tmpfs_dirent_t));
 	dnode->tn_size -= sizeof(tmpfs_dirent_t);
 	tmpfs_dir_putseq(dnode, de);
 
@@ -907,6 +909,9 @@ tmpfs_reg_resize(struct vnode *vp, off_t
 	KASSERT(vp->v_type == VREG);
 	KASSERT(newsize >= 0);
 
+	if (newsize > __type_max(off_t) - PAGE_SIZE + 1)
+		return EFBIG;
+
 	oldsize = node->tn_size;
 	oldpages = round_page(oldsize) >> PAGE_SHIFT;
 	newpages = round_page(newsize) >> PAGE_SHIFT;



CVS commit: [netbsd-10] src/sys/fs/tmpfs

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:29:24 UTC 2023

Modified Files:
src/sys/fs/tmpfs [netbsd-10]: tmpfs_subr.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #289):

sys/fs/tmpfs/tmpfs_subr.c: revision 1.116
sys/fs/tmpfs/tmpfs_subr.c: revision 1.117

tmpfs: Refuse sizes that overflow round_page.

tmpfs: Assert no arithmetic overflow in directory node tn_size.
Need >2^57 directory entries before this is a problem.  If we created
a million per second, this would take over 4000 years.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.114.4.1 src/sys/fs/tmpfs/tmpfs_subr.c

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



CVS commit: [netbsd-8] src/libexec/ld.elf_so

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:19:02 UTC 2023

Modified Files:
src/libexec/ld.elf_so [netbsd-8]: rtld.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1871):

libexec/ld.elf_so/rtld.c: revision 1.213

dlopen(3): Read _rtld_objtail under the lock.


To generate a diff of this commit:
cvs rdiff -u -r1.183.4.2 -r1.183.4.3 src/libexec/ld.elf_so/rtld.c

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



CVS commit: [netbsd-8] src/libexec/ld.elf_so

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:19:02 UTC 2023

Modified Files:
src/libexec/ld.elf_so [netbsd-8]: rtld.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1871):

libexec/ld.elf_so/rtld.c: revision 1.213

dlopen(3): Read _rtld_objtail under the lock.


To generate a diff of this commit:
cvs rdiff -u -r1.183.4.2 -r1.183.4.3 src/libexec/ld.elf_so/rtld.c

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

Modified files:

Index: src/libexec/ld.elf_so/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.183.4.2 src/libexec/ld.elf_so/rtld.c:1.183.4.3
--- src/libexec/ld.elf_so/rtld.c:1.183.4.2	Tue Aug 29 09:43:17 2017
+++ src/libexec/ld.elf_so/rtld.c	Tue Aug  1 15:19:02 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.183.4.2 2017/08/29 09:43:17 bouyer Exp $	 */
+/*	$NetBSD: rtld.c,v 1.183.4.3 2023/08/01 15:19:02 martin Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.183.4.2 2017/08/29 09:43:17 bouyer Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.183.4.3 2023/08/01 15:19:02 martin Exp $");
 #endif /* not lint */
 
 #include 
@@ -979,7 +979,7 @@ __strong_alias(__dlopen,dlopen)
 void *
 dlopen(const char *name, int mode)
 {
-	Obj_Entry **old_obj_tail = _rtld_objtail;
+	Obj_Entry **old_obj_tail;
 	Obj_Entry *obj = NULL;
 	int flags = _RTLD_DLOPEN;
 	bool nodelete;
@@ -991,6 +991,8 @@ dlopen(const char *name, int mode)
 
 	_rtld_exclusive_enter();
 
+	old_obj_tail = _rtld_objtail;
+
 	flags |= (mode & RTLD_GLOBAL) ? _RTLD_GLOBAL : 0;
 	flags |= (mode & RTLD_NOLOAD) ? _RTLD_NOLOAD : 0;
 



CVS commit: [netbsd-9] src/libexec/ld.elf_so

2023-08-01 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug  1 15:17:44 UTC 2023

Modified Files:
src/libexec/ld.elf_so [netbsd-9]: rtld.c

Log Message:
Pull up following revision(s) (requested by riastradh in ticket #1690):

libexec/ld.elf_so/rtld.c: revision 1.213

dlopen(3): Read _rtld_objtail under the lock.


To generate a diff of this commit:
cvs rdiff -u -r1.197.2.5 -r1.197.2.6 src/libexec/ld.elf_so/rtld.c

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

Modified files:

Index: src/libexec/ld.elf_so/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.197.2.5 src/libexec/ld.elf_so/rtld.c:1.197.2.6
--- src/libexec/ld.elf_so/rtld.c:1.197.2.5	Sat Apr  1 16:08:05 2023
+++ src/libexec/ld.elf_so/rtld.c	Tue Aug  1 15:17:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.197.2.5 2023/04/01 16:08:05 martin Exp $	 */
+/*	$NetBSD: rtld.c,v 1.197.2.6 2023/08/01 15:17:44 martin Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: rtld.c,v 1.197.2.5 2023/04/01 16:08:05 martin Exp $");
+__RCSID("$NetBSD: rtld.c,v 1.197.2.6 2023/08/01 15:17:44 martin Exp $");
 #endif /* not lint */
 
 #include 
@@ -1024,7 +1024,7 @@ __strong_alias(__dlopen,dlopen)
 void *
 dlopen(const char *name, int mode)
 {
-	Obj_Entry **old_obj_tail = _rtld_objtail;
+	Obj_Entry **old_obj_tail;
 	Obj_Entry *obj = NULL;
 	int flags = _RTLD_DLOPEN;
 	bool nodelete;
@@ -1036,6 +1036,8 @@ dlopen(const char *name, int mode)
 
 	_rtld_exclusive_enter();
 
+	old_obj_tail = _rtld_objtail;
+
 	flags |= (mode & RTLD_GLOBAL) ? _RTLD_GLOBAL : 0;
 	flags |= (mode & RTLD_NOLOAD) ? _RTLD_NOLOAD : 0;
 



  1   2   >