CVS commit: src/sys/arch

2020-05-30 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun May 31 04:56:35 UTC 2020

Modified Files:
src/sys/arch/evbmips/cavium: autoconf.c
src/sys/arch/evbmips/conf: ERLITE
src/sys/arch/mips/cavium: octeon1p_iobus.c
src/sys/arch/mips/cavium/dev: octeon_dwctwo.c octeon_gmx.c octeon_mpi.c
octeon_rnm.c octeon_uart.c
src/sys/arch/mips/conf: files.octeon

Log Message:
Clean up Cavium Octeon device names.  Rename devices from "octeon_foo"
to "octfoo" - this follows the naming conventions used by many other
MIPS CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbmips/cavium/autoconf.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/evbmips/conf/ERLITE
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/octeon1p_iobus.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c \
src/sys/arch/mips/cavium/dev/octeon_gmx.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_mpi.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/cavium/dev/octeon_rnm.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/cavium/dev/octeon_uart.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/conf/files.octeon

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/evbmips/cavium/autoconf.c
diff -u src/sys/arch/evbmips/cavium/autoconf.c:1.4 src/sys/arch/evbmips/cavium/autoconf.c:1.5
--- src/sys/arch/evbmips/cavium/autoconf.c:1.4	Mon Apr  1 06:12:51 2019
+++ src/sys/arch/evbmips/cavium/autoconf.c	Sun May 31 04:56:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.4 2019/04/01 06:12:51 msaitoh Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.5 2020/05/31 04:56:35 simonb Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.4 2019/04/01 06:12:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.5 2020/05/31 04:56:35 simonb Exp $");
 
 #include 
 #include 
@@ -180,7 +180,7 @@ device_register(device_t dev, void *aux)
 
 	if (device_is_a(dev, "cnmac")) {
 		prop_set_cnmac(dev);
-	} else if (device_is_a(dev, "octeon_gmx")) {
+	} else if (device_is_a(dev, "octgmx")) {
 		prop_set_octeon_gmx(dev);
 	}
 }

Index: src/sys/arch/evbmips/conf/ERLITE
diff -u src/sys/arch/evbmips/conf/ERLITE:1.24 src/sys/arch/evbmips/conf/ERLITE:1.25
--- src/sys/arch/evbmips/conf/ERLITE:1.24	Sun Jan 19 01:25:05 2020
+++ src/sys/arch/evbmips/conf/ERLITE	Sun May 31 04:56:35 2020
@@ -1,11 +1,11 @@
-#	$NetBSD: ERLITE,v 1.24 2020/01/19 01:25:05 thorpej Exp $
+#	$NetBSD: ERLITE,v 1.25 2020/05/31 04:56:35 simonb Exp $
 
 include 	"arch/mips/conf/std.octeon"
 include 	"arch/evbmips/conf/files.octeon"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"ERLITE-$Revision: 1.24 $"
+#ident 		"ERLITE-$Revision: 1.25 $"
 
 maxusers	32
 
@@ -120,10 +120,10 @@ bootbus0	at mainbus?
 
 com*		at iobus?
 
-octeon_rnm*	at iobus?
+octrnm*		at iobus?
 
-octeon_gmx*	at iobus?
-cnmac*		at octeon_gmx?
+octgmx*		at iobus?
+cnmac*		at octgmx?
 
 dwctwo*		at iobus?
 usb*		at dwctwo?

Index: src/sys/arch/mips/cavium/octeon1p_iobus.c
diff -u src/sys/arch/mips/cavium/octeon1p_iobus.c:1.2 src/sys/arch/mips/cavium/octeon1p_iobus.c:1.3
--- src/sys/arch/mips/cavium/octeon1p_iobus.c:1.2	Fri May  1 07:23:47 2015
+++ src/sys/arch/mips/cavium/octeon1p_iobus.c	Sun May 31 04:56:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: octeon1p_iobus.c,v 1.2 2015/05/01 07:23:47 hikaru Exp $	*/
+/*	$NetBSD: octeon1p_iobus.c,v 1.3 2020/05/31 04:56:35 simonb Exp $	*/
 
 /*
  * Copyright (c) 2007 Internet Initiative Japan, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: octeon1p_iobus.c,v 1.2 2015/05/01 07:23:47 hikaru Exp $");
+__KERNEL_RCSID(0, "$NetBSD: octeon1p_iobus.c,v 1.3 2020/05/31 04:56:35 simonb Exp $");
 
 #include 
 #include 
@@ -68,7 +68,7 @@ static const struct iobus_unit iobus_uni
 };
 
 static const struct iobus_dev iobus_dev_octeon_rnm = {
-	.name = "octeon_rnm",
+	.name = "octrnm",
 	.nunits = RNM_NUNITS,
 	.units = iobus_units_octeon_rnm
 };
@@ -83,7 +83,7 @@ static const struct iobus_unit iobus_uni
 };
 
 static const struct iobus_dev iobus_dev_octeon_twsi = {
-	.name = "octeon_twsi",
+	.name = "octtwsi",
 	.nunits = MIO_TWS_NUNITS,
 	.units = iobus_units_octeon_twsi
 };
@@ -98,7 +98,7 @@ static const struct iobus_unit	iobus_uni
 };
 
 static const struct iobus_dev iobus_dev_octeon_mpi = {
-	.name = "octeon_mpi",
+	.name = "octmpi",
 	.nunits = MPI_NUNITS,
 	.units = iobus_units_octeon_mpi
 };
@@ -112,7 +112,7 @@ static const struct iobus_unit	iobus_uni
 };
 
 static const struct iobus_dev iobus_dev_octeon_gmx = {
-	.name = "octeon_gmx",
+	.name = "octgmx",
 	.nunits = GMX_IF_NUNITS,
 	.units = iobus_units_octeon_gmx
 };

Index: src/sys/arch/mips/cavium/dev/octeon_dwctwo.c
diff -u src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.9 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c:1.10
--- 

CVS commit: src/sys/arch

2020-05-30 Thread Simon Burge
Module Name:src
Committed By:   simonb
Date:   Sun May 31 04:56:35 UTC 2020

Modified Files:
src/sys/arch/evbmips/cavium: autoconf.c
src/sys/arch/evbmips/conf: ERLITE
src/sys/arch/mips/cavium: octeon1p_iobus.c
src/sys/arch/mips/cavium/dev: octeon_dwctwo.c octeon_gmx.c octeon_mpi.c
octeon_rnm.c octeon_uart.c
src/sys/arch/mips/conf: files.octeon

Log Message:
Clean up Cavium Octeon device names.  Rename devices from "octeon_foo"
to "octfoo" - this follows the naming conventions used by many other
MIPS CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/evbmips/cavium/autoconf.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/evbmips/conf/ERLITE
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/octeon1p_iobus.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/mips/cavium/dev/octeon_dwctwo.c \
src/sys/arch/mips/cavium/dev/octeon_gmx.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/cavium/dev/octeon_mpi.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/cavium/dev/octeon_rnm.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/cavium/dev/octeon_uart.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/conf/files.octeon

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



CVS commit: src/sys/dev/acpi

2020-05-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun May 31 01:39:33 UTC 2020

Modified Files:
src/sys/dev/acpi: acpi_cpu_cstate.c

Log Message:
Disable read of the ACPI timer during idle, fixing performance degradation
observed with acpicpu.  C1 (MWAIT) is the deepest sleep currently enabled so
there should be no functional change.  Also, the computed nap time is run
through hztoms() which seems incorrect as the ACPI timer is running in the
MHz range.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/acpi/acpi_cpu_cstate.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/acpi

2020-05-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun May 31 01:39:33 UTC 2020

Modified Files:
src/sys/dev/acpi: acpi_cpu_cstate.c

Log Message:
Disable read of the ACPI timer during idle, fixing performance degradation
observed with acpicpu.  C1 (MWAIT) is the deepest sleep currently enabled so
there should be no functional change.  Also, the computed nap time is run
through hztoms() which seems incorrect as the ACPI timer is running in the
MHz range.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/acpi/acpi_cpu_cstate.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/acpi/acpi_cpu_cstate.c
diff -u src/sys/dev/acpi/acpi_cpu_cstate.c:1.60 src/sys/dev/acpi/acpi_cpu_cstate.c:1.61
--- src/sys/dev/acpi/acpi_cpu_cstate.c:1.60	Sun Feb  3 03:19:27 2019
+++ src/sys/dev/acpi/acpi_cpu_cstate.c	Sun May 31 01:39:33 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu_cstate.c,v 1.60 2019/02/03 03:19:27 mrg Exp $ */
+/* $NetBSD: acpi_cpu_cstate.c,v 1.61 2020/05/31 01:39:33 ad Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen 
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.60 2019/02/03 03:19:27 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu_cstate.c,v 1.61 2020/05/31 01:39:33 ad Exp $");
 
 #include 
 #include 
@@ -739,9 +739,18 @@ static void
 acpicpu_cstate_idle_enter(struct acpicpu_softc *sc, int state)
 {
 	struct acpicpu_cstate *cs = >sc_cstate[state];
-	uint32_t end, start, val;
+	uint32_t val;
 
+#ifdef notyet
+	/*
+	 * XXX This has a significant performance impact because the ACPI
+	 * timer seems very slow and with many CPUs becomes a chokepoint. 
+	 * Better to use the TSC (if invariant) or APIC timer instead. 
+	 * Proably even getbintime().  Disabled for now as no functional
+	 * change - only C1 sleep is enabled.
+	 */
 	start = acpitimer_read_fast(NULL);
+#endif
 
 	switch (cs->cs_method) {
 
@@ -756,8 +765,15 @@ acpicpu_cstate_idle_enter(struct acpicpu
 	}
 
 	cs->cs_evcnt.ev_count++;
+
+#ifdef notyet
+	/*
+	 * XXX As above.  Also, hztoms() seems incorrect as the ACPI timer
+	 * is running the MHz region.
+	 */
 	end = acpitimer_read_fast(NULL);
 	sc->sc_cstate_sleep = hztoms(acpitimer_delta(end, start)) * 1000;
+#endif
 }
 
 static bool



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

2020-05-30 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat May 30 23:52:10 UTC 2020

Modified Files:
src/external/bsd/ntp/dist/include: ntp_config.h
src/external/bsd/ntp/dist/ntpd: ntp_config.c

Log Message:
Don't define psl as common symbol, move it into the only file using it.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/external/bsd/ntp/dist/include/ntp_config.h
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/ntp/dist/ntpd/ntp_config.c

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

Modified files:

Index: src/external/bsd/ntp/dist/include/ntp_config.h
diff -u src/external/bsd/ntp/dist/include/ntp_config.h:1.12 src/external/bsd/ntp/dist/include/ntp_config.h:1.13
--- src/external/bsd/ntp/dist/include/ntp_config.h:1.12	Mon May 25 20:47:19 2020
+++ src/external/bsd/ntp/dist/include/ntp_config.h	Sat May 30 23:52:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntp_config.h,v 1.12 2020/05/25 20:47:19 christos Exp $	*/
+/*	$NetBSD: ntp_config.h,v 1.13 2020/05/30 23:52:09 joerg Exp $	*/
 
 #ifndef NTP_CONFIG_H
 #define NTP_CONFIG_H
@@ -277,17 +277,6 @@ typedef struct settrap_parms_tag {
 	int		ifaddr_nonnull;
 } settrap_parms;
 
-
-/*
- * Poll Skew List
- */
-
-psl_item psl[17-3+1];		/* values for polls 3-17 */
-/* To simplify the runtime code we */
-/* don't want to have to special-case */
-/* dealing with a default */
-
-
 /*
 ** Data Minimization Items
 */

Index: src/external/bsd/ntp/dist/ntpd/ntp_config.c
diff -u src/external/bsd/ntp/dist/ntpd/ntp_config.c:1.23 src/external/bsd/ntp/dist/ntpd/ntp_config.c:1.24
--- src/external/bsd/ntp/dist/ntpd/ntp_config.c:1.23	Wed May 27 23:52:19 2020
+++ src/external/bsd/ntp/dist/ntpd/ntp_config.c	Sat May 30 23:52:09 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ntp_config.c,v 1.23 2020/05/27 23:52:19 christos Exp $	*/
+/*	$NetBSD: ntp_config.c,v 1.24 2020/05/30 23:52:09 joerg Exp $	*/
 
 /* ntp_config.c
  *
@@ -69,6 +69,16 @@ extern int yyparse(void);
 # include 
 #endif
 
+/*
+ * Poll Skew List
+ */
+
+static psl_item psl[17-3+1];	/* values for polls 3-17 */
+/* To simplify the runtime code we */
+/* don't want to have to special-case */
+/* dealing with a default */
+
+
 /* list of servers from command line for config_peers() */
 int	cmdline_server_count;
 char **	cmdline_servers;



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

2020-05-30 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat May 30 23:52:10 UTC 2020

Modified Files:
src/external/bsd/ntp/dist/include: ntp_config.h
src/external/bsd/ntp/dist/ntpd: ntp_config.c

Log Message:
Don't define psl as common symbol, move it into the only file using it.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/external/bsd/ntp/dist/include/ntp_config.h
cvs rdiff -u -r1.23 -r1.24 src/external/bsd/ntp/dist/ntpd/ntp_config.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

2020-05-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat May 30 22:39:41 UTC 2020

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

Log Message:
Use device_xname() to access dv_xname


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/if_rge.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_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.13 src/sys/dev/pci/if_rge.c:1.14
--- src/sys/dev/pci/if_rge.c:1.13	Sat May 30 22:01:05 2020
+++ src/sys/dev/pci/if_rge.c	Sat May 30 22:39:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rge.c,v 1.13 2020/05/30 22:01:05 sevan Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.14 2020/05/30 22:39:40 sevan Exp $	*/
 /*	$OpenBSD: if_rge.c,v 1.3 2020/03/27 15:15:24 krw Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.13 2020/05/30 22:01:05 sevan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.14 2020/05/30 22:39:40 sevan Exp $");
 
 /* #include "vlan.h" Sevan */
 
@@ -234,7 +234,7 @@ rge_attach(device_t parent, device_t sel
 	}
 	intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
 	sc->sc_ih = pci_intr_establish_xname(pc, ih, IPL_NET, rge_intr,
-	sc, sc->sc_dev.dv_xname);
+	sc, device_xname(sc->sc_dev));
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(sc->sc_dev, ": couldn't establish interrupt");
 		if (intrstr != NULL)
@@ -298,7 +298,7 @@ rge_attach(device_t parent, device_t sel
 
 	ifp = >sc_ec.ec_if;
 	ifp->if_softc = sc;
-	strlcpy(ifp->if_xname, sc->sc_dev.dv_xname, IFNAMSIZ);
+	strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 #ifdef RGE_MPSAFE
 	ifp->if_xflags = IFEF_MPSAFE;
@@ -1813,7 +1813,7 @@ rge_config_imtype(struct rge_softc *sc, 
 		sc->rge_tx_ack = RGE_ISR_PCS_TIMEOUT;
 		break;
 	default:
-		panic("%s: unknown imtype %d", sc->sc_dev.dv_xname, imtype);
+		panic("%s: unknown imtype %d", device_xname(sc->sc_dev), imtype);
 	}
 }
 
@@ -1848,7 +1848,7 @@ rge_setup_intr(struct rge_softc *sc, int
 		rge_setup_sim_im(sc);
 		break;
 	default:
-		panic("%s: unknown imtype %d", sc->sc_dev.dv_xname, imtype);
+		panic("%s: unknown imtype %d", device_xname(sc->sc_dev), imtype);
 	}
 }
 



CVS commit: src/sys/dev/pci

2020-05-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat May 30 22:39:41 UTC 2020

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

Log Message:
Use device_xname() to access dv_xname


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/pci/if_rge.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

2020-05-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat May 30 22:27:55 UTC 2020

Modified Files:
src/sys/dev/pci: if_rgereg.h

Log Message:
Use device_t for sc_dev


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

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

Modified files:

Index: src/sys/dev/pci/if_rgereg.h
diff -u src/sys/dev/pci/if_rgereg.h:1.3 src/sys/dev/pci/if_rgereg.h:1.4
--- src/sys/dev/pci/if_rgereg.h:1.3	Sun Jan 12 23:22:12 2020
+++ src/sys/dev/pci/if_rgereg.h	Sat May 30 22:27:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rgereg.h,v 1.3 2020/01/12 23:22:12 sevan Exp $	*/
+/*	$NetBSD: if_rgereg.h,v 1.4 2020/05/30 22:27:55 sevan Exp $	*/
 /*	$OpenBSD: if_rgereg.h,v 1.1 2019/11/18 03:03:37 kevlo Exp $	*/
 
 /*
@@ -272,7 +272,7 @@ enum rge_mac_type {
 #define RGE_RXCFG_CONFIG	0x40c00700
 
 struct rge_softc {
-	struct device		sc_dev;
+	device_t		sc_dev;
 	struct ethercom		sc_ec; 		/* Ethernet common data */
 	void			*sc_ih;		/* interrupt vectoring */
 	bus_space_handle_t	rge_bhandle;	/* bus space handle */



CVS commit: src/sys/dev/pci

2020-05-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat May 30 22:27:55 UTC 2020

Modified Files:
src/sys/dev/pci: if_rgereg.h

Log Message:
Use device_t for sc_dev


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/if_rgereg.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/pci

2020-05-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat May 30 22:01:05 UTC 2020

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

Log Message:
Switch from printf to aprintf_error/normal


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/if_rge.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_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.12 src/sys/dev/pci/if_rge.c:1.13
--- src/sys/dev/pci/if_rge.c:1.12	Sat May 30 21:39:49 2020
+++ src/sys/dev/pci/if_rge.c	Sat May 30 22:01:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rge.c,v 1.12 2020/05/30 21:39:49 sevan Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.13 2020/05/30 22:01:05 sevan Exp $	*/
 /*	$OpenBSD: if_rge.c,v 1.3 2020/03/27 15:15:24 krw Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.12 2020/05/30 21:39:49 sevan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.13 2020/05/30 22:01:05 sevan Exp $");
 
 /* #include "vlan.h" Sevan */
 
@@ -217,7 +217,7 @@ rge_attach(device_t parent, device_t sel
 			if (pci_mapreg_map(pa, RGE_PCI_BAR0, PCI_MAPREG_TYPE_IO,
 			0, >rge_btag, >rge_bhandle, NULL,
 			>rge_bsize)) {
-printf(": can't map mem or i/o space\n");
+aprint_error(": can't map mem or i/o space\n");
 return;
 			}
 		}
@@ -229,20 +229,20 @@ rge_attach(device_t parent, device_t sel
 	if (pci_intr_map(pa, ) == 0)
 		sc->rge_flags |= RGE_FLAG_MSI;
 	else if (pci_intr_map(pa, ) != 0) {
-		printf(": couldn't map interrupt\n");
+		aprint_error(": couldn't map interrupt\n");
 		return;
 	}
 	intrstr = pci_intr_string(pc, ih, intrbuf, sizeof(intrbuf));
 	sc->sc_ih = pci_intr_establish_xname(pc, ih, IPL_NET, rge_intr,
 	sc, sc->sc_dev.dv_xname);
 	if (sc->sc_ih == NULL) {
-		printf(": couldn't establish interrupt");
+		aprint_error_dev(sc->sc_dev, ": couldn't establish interrupt");
 		if (intrstr != NULL)
-			printf(" at %s", intrstr);
-		printf("\n");
+			aprint_error(" at %s\n", intrstr);
+		aprint_error("\n");
 		return;
 	}
-	printf(": %s", intrstr);
+	aprint_normal_dev(sc->sc_dev, "interrupting at %s\n", intrstr);
 
 	if (pci_dma64_available(pa))
 		sc->sc_dmat = pa->pa_dmat64;
@@ -262,7 +262,7 @@ rge_attach(device_t parent, device_t sel
 		sc->rge_type = MAC_CFG3;
 		break;
 	default:
-		printf(": unknown version 0x%08x\n", hwrev);
+		aprint_error(": unknown version 0x%08x\n", hwrev);
 		return;
 	}
 
@@ -285,7 +285,8 @@ rge_attach(device_t parent, device_t sel
 	rge_hw_init(sc);
 
 	rge_get_macaddr(sc, eaddr);
-	printf(", address %s\n", ether_sprintf(eaddr));
+	aprint_normal_dev(sc->sc_dev, "Ethernet address %s\n",
+	ether_sprintf(eaddr));
 
 	memcpy(sc->sc_enaddr, eaddr, ETHER_ADDR_LEN);
 
@@ -622,7 +623,7 @@ rge_watchdog(struct ifnet *ifp)
 {
 	struct rge_softc *sc = ifp->if_softc;
 
-	printf("%s: watchdog timeout\n", sc->sc_dev.dv_xname);
+	aprint_error_dev(sc->sc_dev, "watchdog timeout\n");
 	if_statinc(ifp, if_oerrors);
 
 	rge_init(ifp);
@@ -657,8 +658,8 @@ rge_init(struct ifnet *ifp)
 
 	/* Initialize RX descriptors list. */
 	if (rge_rx_list_init(sc) == ENOBUFS) {
-		printf("%s: init failed: no memory for RX buffers\n",
-		sc->sc_dev.dv_xname);
+		aprint_error_dev(sc->sc_dev,
+		"init failed: no memory for RX buffers\n");
 		rge_stop(ifp);
 		return (ENOBUFS);
 	}
@@ -903,7 +904,8 @@ rge_ifmedia_upd(struct ifnet *ifp)
 		ifp->if_baudrate = IF_Mbps(10);
 		break;
 	default:
-		printf("%s: unsupported media type\n", sc->sc_dev.dv_xname);
+		aprint_error_dev(sc->sc_dev,
+		"unsupported media type\n");
 		return (EINVAL);
 	}
 
@@ -960,14 +962,14 @@ rge_allocmem(struct rge_softc *sc)
 	error = bus_dmamap_create(sc->sc_dmat, RGE_TX_LIST_SZ, 1,
 	RGE_TX_LIST_SZ, 0, BUS_DMA_NOWAIT, >rge_ldata.rge_tx_list_map);
 	if (error) {
-		printf("%s: can't create TX list map\n", sc->sc_dev.dv_xname);
+		aprint_error_dev(sc->sc_dev, "can't create TX list map\n");
 		return (error);
 	}
 	error = bus_dmamem_alloc(sc->sc_dmat, RGE_TX_LIST_SZ, RGE_ALIGN, 0,
 	>rge_ldata.rge_tx_listseg, 1, >rge_ldata.rge_tx_listnseg,
 	BUS_DMA_NOWAIT); /* XXX OpenBSD adds BUS_DMA_ZERO */
 	if (error) {
-		printf("%s: can't alloc TX list\n", sc->sc_dev.dv_xname);
+		aprint_error_dev(sc->sc_dev, "can't alloc TX list\n");
 		return (error);
 	}
 
@@ -977,7 +979,7 @@ rge_allocmem(struct rge_softc *sc)
 	(void **) >rge_ldata.rge_tx_list,
 	BUS_DMA_NOWAIT); /* XXX OpenBSD adds BUS_DMA_COHERENT */
 	if (error) {
-		printf("%s: can't map TX dma buffers\n", sc->sc_dev.dv_xname);
+		aprint_error_dev(sc->sc_dev, "can't map TX dma buffers\n");
 		bus_dmamem_free(sc->sc_dmat, >rge_ldata.rge_tx_listseg,
 		sc->rge_ldata.rge_tx_listnseg);
 		return (error);
@@ -985,7 +987,7 @@ rge_allocmem(struct rge_softc *sc)
 	error = bus_dmamap_load(sc->sc_dmat, sc->rge_ldata.rge_tx_list_map,
 	sc->rge_ldata.rge_tx_list, RGE_TX_LIST_SZ, NULL, BUS_DMA_NOWAIT);
 	if (error) {
-		

CVS commit: src/sys/dev/pci

2020-05-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat May 30 22:01:05 UTC 2020

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

Log Message:
Switch from printf to aprintf_error/normal


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/if_rge.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

2020-05-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat May 30 21:39:49 UTC 2020

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

Log Message:
Initialise sc->sc_dev, otherwise unnamed interfaces show up and things go
downhill from there.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/if_rge.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

2020-05-30 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Sat May 30 21:39:49 UTC 2020

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

Log Message:
Initialise sc->sc_dev, otherwise unnamed interfaces show up and things go
downhill from there.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/pci/if_rge.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_rge.c
diff -u src/sys/dev/pci/if_rge.c:1.11 src/sys/dev/pci/if_rge.c:1.12
--- src/sys/dev/pci/if_rge.c:1.11	Wed May 20 20:18:37 2020
+++ src/sys/dev/pci/if_rge.c	Sat May 30 21:39:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_rge.c,v 1.11 2020/05/20 20:18:37 sevan Exp $	*/
+/*	$NetBSD: if_rge.c,v 1.12 2020/05/30 21:39:49 sevan Exp $	*/
 /*	$OpenBSD: if_rge.c,v 1.3 2020/03/27 15:15:24 krw Exp $	*/
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.11 2020/05/20 20:18:37 sevan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_rge.c,v 1.12 2020/05/30 21:39:49 sevan Exp $");
 
 /* #include "vlan.h" Sevan */
 
@@ -203,6 +203,8 @@ rge_attach(device_t parent, device_t sel
 
 	pci_set_powerstate(pa->pa_pc, pa->pa_tag, PCI_PMCSR_STATE_D0);
 
+	sc->sc_dev = self;
+
 	/*
 	 * Map control/status registers.
 	 */



Re: CVS commit: src

2020-05-30 Thread Joerg Sonnenberger
On Sat, May 30, 2020 at 04:48:00PM -0400, Christos Zoulas wrote:
> Module Name:  src
> Committed By: christos
> Date: Sat May 30 20:47:59 UTC 2020
> 
> Modified Files:
>   src/distrib/sets/lists/base: mi shl.mi
>   src/distrib/sets/lists/comp: mi shl.mi
>   src/distrib/sets/lists/debug: mi shl.mi
>   src/etc/mtree: NetBSD.dist.base
>   src/external/mit/libuv/lib: Makefile
>   src/external/mpl/bind: Makefile.inc
>   src/external/mpl/bind/lib/libisc: Makefile
>   src/external/mpl/dhcp: Makefile.inc
>   src/share/mk: bsd.README bsd.prog.mk
> Added Files:
>   src/external/mpl/bind/lib/libisc: isc.map
> 
> Log Message:
> Make libuv private, requested by joerg@

Thanks!

Joerg


CVS commit: src/usr.sbin/npf/npftest/libnpftest

2020-05-30 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat May 30 21:00:31 UTC 2020

Modified Files:
src/usr.sbin/npf/npftest/libnpftest: npf_test_subr.c

Log Message:
npftest -- npf_test_init(): add a workaround for NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 \
src/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c

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



CVS commit: src/usr.sbin/npf/npftest/libnpftest

2020-05-30 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat May 30 21:00:31 UTC 2020

Modified Files:
src/usr.sbin/npf/npftest/libnpftest: npf_test_subr.c

Log Message:
npftest -- npf_test_init(): add a workaround for NetBSD.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 \
src/usr.sbin/npf/npftest/libnpftest/npf_test_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/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c
diff -u src/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c:1.17 src/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c:1.18
--- src/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c:1.17	Sat May 30 14:16:57 2020
+++ src/usr.sbin/npf/npftest/libnpftest/npf_test_subr.c	Sat May 30 21:00:31 2020
@@ -64,6 +64,13 @@ npf_test_init(int (*pton_func)(int, cons
 {
 	npf_t *npf;
 
+#ifdef __NetBSD__
+	// XXX: Workaround for npf_init()
+	if ((npf = npf_getkernctx()) != NULL) {
+		npf_worker_discharge(npf);
+		npf_worker_sysfini();
+	}
+#endif
 	npfk_sysinit(0);
 	npf = npfk_create(0, _mbufops, _ifops, NULL);
 	npfk_thread_register(npf);



CVS commit: src/sys/net/npf

2020-05-30 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat May 30 20:54:54 UTC 2020

Modified Files:
src/sys/net/npf: npf_worker.c

Log Message:
npf_worker_sys{init,fini}: initialize/destroy the exit_cv condvar.


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

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

Modified files:

Index: src/sys/net/npf/npf_worker.c
diff -u src/sys/net/npf/npf_worker.c:1.8 src/sys/net/npf/npf_worker.c:1.9
--- src/sys/net/npf/npf_worker.c:1.8	Sat May 30 14:16:56 2020
+++ src/sys/net/npf/npf_worker.c	Sat May 30 20:54:54 2020
@@ -29,7 +29,7 @@
 
 #ifdef _KERNEL
 #include 
-__KERNEL_RCSID(0, "$NetBSD: npf_worker.c,v 1.8 2020/05/30 14:16:56 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf_worker.c,v 1.9 2020/05/30 20:54:54 rmind Exp $");
 
 #include 
 #include 
@@ -81,7 +81,8 @@ npf_worker_sysinit(unsigned nworkers)
 	winfo = kmem_zalloc(len, KM_SLEEP);
 	winfo->worker_count = nworkers;
 	mutex_init(>lock, MUTEX_DEFAULT, IPL_SOFTNET);
-	cv_init(>cv, "npfgccv");
+	cv_init(>exit_cv, "npfgcx");
+	cv_init(>cv, "npfgcw");
 	LIST_INIT(>instances);
 	worker_info = winfo;
 
@@ -121,6 +122,7 @@ npf_worker_sysfini(void)
 		}
 	}
 	cv_destroy(>cv);
+	cv_destroy(>exit_cv);
 	mutex_destroy(>lock);
 	kmem_free(winfo, offsetof(npf_workerinfo_t, worker[nworkers]));
 	worker_info = NULL;



CVS commit: src/sys/net/npf

2020-05-30 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat May 30 20:54:54 UTC 2020

Modified Files:
src/sys/net/npf: npf_worker.c

Log Message:
npf_worker_sys{init,fini}: initialize/destroy the exit_cv condvar.


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

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



CVS commit: src/external/mit/libuv/lib

2020-05-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 30 20:54:46 UTC 2020

Modified Files:
src/external/mit/libuv/lib: Makefile

Log Message:
Create pic lib and don't install pkgconfig file.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/mit/libuv/lib/Makefile

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



CVS commit: src/external/mit/libuv/lib

2020-05-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 30 20:54:46 UTC 2020

Modified Files:
src/external/mit/libuv/lib: Makefile

Log Message:
Create pic lib and don't install pkgconfig file.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/mit/libuv/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/external/mit/libuv/lib/Makefile
diff -u src/external/mit/libuv/lib/Makefile:1.2 src/external/mit/libuv/lib/Makefile:1.3
--- src/external/mit/libuv/lib/Makefile:1.2	Sat May 30 16:47:59 2020
+++ src/external/mit/libuv/lib/Makefile	Sat May 30 16:54:46 2020
@@ -1,7 +1,10 @@
-# $NetBSD: Makefile,v 1.2 2020/05/30 20:47:59 christos Exp $
+# $NetBSD: Makefile,v 1.3 2020/05/30 20:54:46 christos Exp $
 
 LIBISPRIVATE=yes
 
+LIBISPRIVATE=yes
+MKPICLIB=yes
+
 .include 
 
 MKLINT=	no
@@ -61,10 +64,12 @@ CPPFLAGS+=	-I${LIBUVDIR}/include -I${LIB
 
 LIBDPLIBS+=	kvm ${NETBSDSRCDIR}/lib/libkvm
 
+.if ${LIBISPRIVATE} != "yes"
 SHLIB_MAJOR=	1
 SHLIB_MINOR=	0
 
 PKGCONFIG=libuv
 .include "${.CURDIR}/../pkgconfig.mk"
+.endif
 
 .include 



CVS commit: src

2020-05-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 30 20:47:59 UTC 2020

Modified Files:
src/distrib/sets/lists/base: mi shl.mi
src/distrib/sets/lists/comp: mi shl.mi
src/distrib/sets/lists/debug: mi shl.mi
src/etc/mtree: NetBSD.dist.base
src/external/mit/libuv/lib: Makefile
src/external/mpl/bind: Makefile.inc
src/external/mpl/bind/lib/libisc: Makefile
src/external/mpl/dhcp: Makefile.inc
src/share/mk: bsd.README bsd.prog.mk
Added Files:
src/external/mpl/bind/lib/libisc: isc.map

Log Message:
Make libuv private, requested by joerg@


To generate a diff of this commit:
cvs rdiff -u -r1.1245 -r1.1246 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.889 -r1.890 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.2330 -r1.2331 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.333 -r1.334 src/distrib/sets/lists/comp/shl.mi
cvs rdiff -u -r1.312 -r1.313 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.250 -r1.251 src/distrib/sets/lists/debug/shl.mi
cvs rdiff -u -r1.216 -r1.217 src/etc/mtree/NetBSD.dist.base
cvs rdiff -u -r1.1 -r1.2 src/external/mit/libuv/lib/Makefile
cvs rdiff -u -r1.7 -r1.8 src/external/mpl/bind/Makefile.inc
cvs rdiff -u -r1.11 -r1.12 src/external/mpl/bind/lib/libisc/Makefile
cvs rdiff -u -r0 -r1.1 src/external/mpl/bind/lib/libisc/isc.map
cvs rdiff -u -r1.7 -r1.8 src/external/mpl/dhcp/Makefile.inc
cvs rdiff -u -r1.404 -r1.405 src/share/mk/bsd.README
cvs rdiff -u -r1.329 -r1.330 src/share/mk/bsd.prog.mk

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



CVS commit: src

2020-05-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 30 20:47:59 UTC 2020

Modified Files:
src/distrib/sets/lists/base: mi shl.mi
src/distrib/sets/lists/comp: mi shl.mi
src/distrib/sets/lists/debug: mi shl.mi
src/etc/mtree: NetBSD.dist.base
src/external/mit/libuv/lib: Makefile
src/external/mpl/bind: Makefile.inc
src/external/mpl/bind/lib/libisc: Makefile
src/external/mpl/dhcp: Makefile.inc
src/share/mk: bsd.README bsd.prog.mk
Added Files:
src/external/mpl/bind/lib/libisc: isc.map

Log Message:
Make libuv private, requested by joerg@


To generate a diff of this commit:
cvs rdiff -u -r1.1245 -r1.1246 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.889 -r1.890 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.2330 -r1.2331 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.333 -r1.334 src/distrib/sets/lists/comp/shl.mi
cvs rdiff -u -r1.312 -r1.313 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.250 -r1.251 src/distrib/sets/lists/debug/shl.mi
cvs rdiff -u -r1.216 -r1.217 src/etc/mtree/NetBSD.dist.base
cvs rdiff -u -r1.1 -r1.2 src/external/mit/libuv/lib/Makefile
cvs rdiff -u -r1.7 -r1.8 src/external/mpl/bind/Makefile.inc
cvs rdiff -u -r1.11 -r1.12 src/external/mpl/bind/lib/libisc/Makefile
cvs rdiff -u -r0 -r1.1 src/external/mpl/bind/lib/libisc/isc.map
cvs rdiff -u -r1.7 -r1.8 src/external/mpl/dhcp/Makefile.inc
cvs rdiff -u -r1.404 -r1.405 src/share/mk/bsd.README
cvs rdiff -u -r1.329 -r1.330 src/share/mk/bsd.prog.mk

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/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1245 src/distrib/sets/lists/base/mi:1.1246
--- src/distrib/sets/lists/base/mi:1.1245	Sun May 24 15:47:59 2020
+++ src/distrib/sets/lists/base/mi	Sat May 30 16:47:58 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1245 2020/05/24 19:47:59 christos Exp $
+# $NetBSD: mi,v 1.1246 2020/05/30 20:47:58 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -1303,7 +1303,7 @@
 ./usr/include/ufs/mfsbase-c-usr
 ./usr/include/ufs/ufsbase-c-usr
 ./usr/include/uvmbase-c-usr
-./usr/include/uvbase-c-usr
+./usr/include/uvbase-obsolete		obsolete
 ./usr/include/vmbase-obsolete		obsolete
 ./usr/lib	base-sys-usr		compatdir
 ./usr/lib/clang	base-sys-usr

Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.889 src/distrib/sets/lists/base/shl.mi:1.890
--- src/distrib/sets/lists/base/shl.mi:1.889	Thu May 28 13:06:24 2020
+++ src/distrib/sets/lists/base/shl.mi	Sat May 30 16:47:58 2020
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.889 2020/05/28 17:06:24 christos Exp $
+# $NetBSD: shl.mi,v 1.890 2020/05/30 20:47:58 christos Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -920,9 +920,9 @@
 ./usr/lib/libuutil.sobase-zfs-shlib		compatfile,zfs
 ./usr/lib/libuutil.so.0base-zfs-shlib		compatfile,zfs
 ./usr/lib/libuutil.so.0.0			base-zfs-shlib		compatfile,zfs
-./usr/lib/libuv.sobase-sys-shlib		compatfile
-./usr/lib/libuv.so.1base-sys-shlib		compatfile
-./usr/lib/libuv.so.1.0base-sys-shlib		compatfile
+./usr/lib/libuv.sobase-obsolete		compatfile,obsolete
+./usr/lib/libuv.so.1base-obsolete		compatfile,obsolete
+./usr/lib/libuv.so.1.0base-obsolete		compatfile,obsolete
 ./usr/lib/libwind.sobase-krb5-shlib		compatfile,kerberos
 ./usr/lib/libwind.so.1base-krb5-shlib		compatfile,kerberos
 ./usr/lib/libwind.so.1.0			base-krb5-shlib		compatfile,kerberos

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2330 src/distrib/sets/lists/comp/mi:1.2331
--- src/distrib/sets/lists/comp/mi:1.2330	Sun May 24 15:47:59 2020
+++ src/distrib/sets/lists/comp/mi	Sat May 30 16:47:58 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2330 2020/05/24 19:47:59 christos Exp $
+#	$NetBSD: mi,v 1.2331 2020/05/30 20:47:58 christos Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -3302,12 +3302,12 @@
 ./usr/include/utmp.hcomp-c-include
 ./usr/include/utmpx.hcomp-c-include
 ./usr/include/uuid.hcomp-c-include
-./usr/include/uv.hcomp-c-include
-./usr/include/uv/bsd.hcomp-c-include
-./usr/include/uv/errno.h			comp-c-include
-./usr/include/uv/threadpool.h			comp-c-include
-./usr/include/uv/unix.hcomp-c-include
-./usr/include/uv/version.h			comp-c-include
+./usr/include/uv.hcomp-c-obsolete		obsolete
+./usr/include/uv/bsd.hcomp-c-obsolete		obsolete
+./usr/include/uv/errno.h			comp-c-obsolete		obsolete
+./usr/include/uv/threadpool.h			comp-c-obsolete		obsolete
+./usr/include/uv/unix.hcomp-c-obsolete		obsolete
+./usr/include/uv/version.h			comp-c-obsolete		obsolete
 ./usr/include/uvm/uvm.hcomp-c-include
 

CVS commit: src/sys/kern

2020-05-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 30 20:23:25 UTC 2020

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

Log Message:
Fix merge error - adjust assertions.


To generate a diff of this commit:
cvs rdiff -u -r1.221 -r1.222 src/sys/kern/vfs_lookup.c

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



CVS commit: src/sys/kern

2020-05-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 30 20:23:25 UTC 2020

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

Log Message:
Fix merge error - adjust assertions.


To generate a diff of this commit:
cvs rdiff -u -r1.221 -r1.222 src/sys/kern/vfs_lookup.c

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

Modified files:

Index: src/sys/kern/vfs_lookup.c
diff -u src/sys/kern/vfs_lookup.c:1.221 src/sys/kern/vfs_lookup.c:1.222
--- src/sys/kern/vfs_lookup.c:1.221	Sat May 30 20:16:14 2020
+++ src/sys/kern/vfs_lookup.c	Sat May 30 20:23:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.221 2020/05/30 20:16:14 ad Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.222 2020/05/30 20:23:25 ad Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.221 2020/05/30 20:16:14 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.222 2020/05/30 20:23:25 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_magiclinks.h"
@@ -935,10 +935,10 @@ lookup_crossmount(struct namei_state *st
 	error = 0;
 
 	KASSERT((cnp->cn_flags & NOCROSSMOUNT) == 0);
-	KASSERT(searchdir != NULL);
 
 	/* First, unlock searchdir (oof). */
 	if (*searchdir_locked) {
+		KASSERT(searchdir != NULL);
 		lktype = VOP_ISLOCKED(searchdir);
 		VOP_UNLOCK(searchdir);
 		*searchdir_locked = false;
@@ -1608,7 +1608,8 @@ namei_oneroot(struct namei_state *state,
 			 * foundobj == NULL.
 			 */
 			/* lookup_once can't have dropped the searchdir */
-			KASSERT(searchdir != NULL);
+			KASSERT(searchdir != NULL ||
+			(cnp->cn_flags & ISLASTCN) != 0);
 			break;
 		}
 



CVS commit: src/sys

2020-05-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 30 20:16:14 UTC 2020

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

Log Message:
A couple of small changes to lookup that cut 5-10% system time from
"build.sh release" on my test system:

- Crossing mount points during lookup is slow because the set up for, and
  act of doing VFS_ROOT() is quite involved.  Use the name cache to help
  with this.  Cache an "impossible" zero-length name with covered vnodes,
  that points to the root of the file system mounted there.  Use it to cross
  mounts.  When cache_purge() is called on either of the vnodes involved the
  cache entry will disappear.  All of the needed calls for that are already
  in place (vnode reclaim, unmount, etc).

- In lookup_fastforward(), if the the last component has been found and the
  parent directory (searchdir) is not going to be returned, then don't get a
  reference to it.


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/kern/vfs_cache.c
cvs rdiff -u -r1.220 -r1.221 src/sys/kern/vfs_lookup.c
cvs rdiff -u -r1.57 -r1.58 src/sys/sys/namei.src

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

Modified files:

Index: src/sys/kern/vfs_cache.c
diff -u src/sys/kern/vfs_cache.c:1.145 src/sys/kern/vfs_cache.c:1.146
--- src/sys/kern/vfs_cache.c:1.145	Sat May 30 18:06:17 2020
+++ src/sys/kern/vfs_cache.c	Sat May 30 20:16:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_cache.c,v 1.145 2020/05/30 18:06:17 ad Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.146 2020/05/30 20:16:14 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -172,7 +172,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.145 2020/05/30 18:06:17 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.146 2020/05/30 20:16:14 ad Exp $");
 
 #define __NAMECACHE_PRIVATE
 #ifdef _KERNEL_OPT
@@ -269,6 +269,15 @@ int cache_stat_interval __read_mostly = 
 static struct	sysctllog *cache_sysctllog;
 
 /*
+ * This is a dummy name that cannot usually occur anywhere in the cache nor
+ * file system.  It's used when caching the root vnode of mounted file
+ * systems.  The name is attached to the directory that the file system is
+ * mounted on.
+ */
+static const char cache_mp_name[] = "";
+static const int cache_mp_nlen = sizeof(cache_mp_name) - 1;
+
+/*
  * Red-black tree stuff.
  */
 static const rb_tree_ops_t cache_rbtree_ops = {
@@ -507,6 +516,8 @@ cache_lookup(struct vnode *dvp, const ch
 	bool hit;
 	krw_t op;
 
+	KASSERT(namelen != cache_mp_nlen || name == cache_mp_name);
+
 	/* Establish default result values */
 	if (iswht_ret != NULL) {
 		*iswht_ret = 0;
@@ -630,6 +641,8 @@ cache_lookup_linked(struct vnode *dvp, c
 	uint64_t key;
 	int error;
 
+	KASSERT(namelen != cache_mp_nlen || name == cache_mp_name);
+
 	/* If disabled, or file system doesn't support this, bail out. */
 	if (__predict_false((dvp->v_mount->mnt_iflag & IMNT_NCLOOKUP) == 0)) {
 		return false;
@@ -714,6 +727,7 @@ cache_lookup_linked(struct vnode *dvp, c
 	}
 	if (ncp->nc_vp == NULL) {
 		/* found negative entry; vn is already null from above */
+		KASSERT(namelen != cache_mp_nlen && name != cache_mp_name);
 		COUNT(ncs_neghits);
 	} else {
 		COUNT(ncs_goodhits); /* XXX can be "badhits" */
@@ -797,6 +811,13 @@ cache_revlookup(struct vnode *vp, struct
 		nlen = ncp->nc_nlen;
 
 		/*
+		 * Ignore mountpoint entries.
+		 */
+		if (ncp->nc_nlen == cache_mp_nlen) {
+			continue;
+		}
+
+		/*
 		 * The queue is partially sorted.  Once we hit dots, nothing
 		 * else remains but dots and dotdots, so bail out.
 		 */
@@ -866,6 +887,8 @@ cache_enter(struct vnode *dvp, struct vn
 	struct namecache *ncp, *oncp;
 	int total;
 
+	KASSERT(namelen != cache_mp_nlen || name == cache_mp_name);
+
 	/* First, check whether we can/should add a cache entry. */
 	if ((cnflags & MAKEENTRY) == 0 ||
 	__predict_false(namelen > cache_maxlen)) {
@@ -1002,6 +1025,49 @@ cache_have_id(struct vnode *vp)
 }
 
 /*
+ * Enter a mount point.  cvp is the covered vnode, and rvp is the root of
+ * the mounted file system.
+ */
+void
+cache_enter_mount(struct vnode *cvp, struct vnode *rvp)
+{
+
+	KASSERT(vrefcnt(cvp) > 0);
+	KASSERT(vrefcnt(rvp) > 0);
+	KASSERT(cvp->v_type == VDIR);
+	KASSERT((rvp->v_vflag & VV_ROOT) != 0);
+
+	if (rvp->v_type == VDIR) {
+		cache_enter(cvp, rvp, cache_mp_name, cache_mp_nlen, MAKEENTRY);
+	}
+}
+
+/*
+ * Look up a cached mount point.  Used in the strongly locked path.
+ */
+bool
+cache_lookup_mount(struct vnode *dvp, struct vnode **vn_ret)
+{
+	bool ret;
+
+	ret = cache_lookup(dvp, cache_mp_name, cache_mp_nlen, LOOKUP,
+	MAKEENTRY, NULL, vn_ret);
+	KASSERT((*vn_ret != NULL) == ret);
+	return ret;
+}
+
+/*
+ * Try to cross a mount point.  For use with cache_lookup_linked().
+ */
+bool
+cache_cross_mount(struct vnode **dvp, krwlock_t **plock)
+{
+
+	return cache_lookup_linked(*dvp, 

CVS commit: src/sys

2020-05-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 30 20:16:34 UTC 2020

Modified Files:
src/sys/rump/include/rump: rump_namei.h
src/sys/sys: namei.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.112 -r1.113 src/sys/sys/namei.h

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



CVS commit: src/sys

2020-05-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 30 20:16:34 UTC 2020

Modified Files:
src/sys/rump/include/rump: rump_namei.h
src/sys/sys: namei.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.112 -r1.113 src/sys/sys/namei.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/rump/include/rump/rump_namei.h
diff -u src/sys/rump/include/rump/rump_namei.h:1.45 src/sys/rump/include/rump/rump_namei.h:1.46
--- src/sys/rump/include/rump/rump_namei.h:1.45	Wed May 27 02:04:38 2020
+++ src/sys/rump/include/rump/rump_namei.h	Sat May 30 20:16:34 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: rump_namei.h,v 1.45 2020/05/27 02:04:38 rin Exp $	*/
+/*	$NetBSD: rump_namei.h,v 1.46 2020/05/30 20:16:34 ad Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.57 2020/05/27 02:03:30 rin Exp 
+ *   from: NetBSD: namei.src,v 1.58 2020/05/30 20:16:14 ad Exp 
  */
 
 #ifndef _RUMP_RUMP_NAMEI_H_

Index: src/sys/sys/namei.h
diff -u src/sys/sys/namei.h:1.112 src/sys/sys/namei.h:1.113
--- src/sys/sys/namei.h:1.112	Wed May 27 02:04:37 2020
+++ src/sys/sys/namei.h	Sat May 30 20:16:34 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: namei.h,v 1.112 2020/05/27 02:04:37 rin Exp $	*/
+/*	$NetBSD: namei.h,v 1.113 2020/05/30 20:16:34 ad Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.57 2020/05/27 02:03:30 rin Exp 
+ *   from: NetBSD: namei.src,v 1.58 2020/05/30 20:16:14 ad Exp 
  */
 
 /*
@@ -308,6 +308,9 @@ bool	cache_have_id(struct vnode *);
 void	cache_vnode_init(struct vnode * );
 void	cache_vnode_fini(struct vnode * );
 void	cache_cpu_init(struct cpu_info *);
+void	cache_enter_mount(struct vnode *, struct vnode *);
+bool	cache_cross_mount(struct vnode **, krwlock_t **);
+bool	cache_lookup_mount(struct vnode *, struct vnode **);
 
 void	nchinit(void);
 void	namecache_count_pass2(void);



CVS commit: src/sys

2020-05-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 30 20:16:14 UTC 2020

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

Log Message:
A couple of small changes to lookup that cut 5-10% system time from
"build.sh release" on my test system:

- Crossing mount points during lookup is slow because the set up for, and
  act of doing VFS_ROOT() is quite involved.  Use the name cache to help
  with this.  Cache an "impossible" zero-length name with covered vnodes,
  that points to the root of the file system mounted there.  Use it to cross
  mounts.  When cache_purge() is called on either of the vnodes involved the
  cache entry will disappear.  All of the needed calls for that are already
  in place (vnode reclaim, unmount, etc).

- In lookup_fastforward(), if the the last component has been found and the
  parent directory (searchdir) is not going to be returned, then don't get a
  reference to it.


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/kern/vfs_cache.c
cvs rdiff -u -r1.220 -r1.221 src/sys/kern/vfs_lookup.c
cvs rdiff -u -r1.57 -r1.58 src/sys/sys/namei.src

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



CVS commit: src/share/mk

2020-05-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 30 19:51:32 UTC 2020

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

Log Message:
Allow LIBISPRIVATE to build a pic version of itself for embedding into
other shared libraries.


To generate a diff of this commit:
cvs rdiff -u -r1.381 -r1.382 src/share/mk/bsd.lib.mk

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



CVS commit: src/share/mk

2020-05-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May 30 19:51:32 UTC 2020

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

Log Message:
Allow LIBISPRIVATE to build a pic version of itself for embedding into
other shared libraries.


To generate a diff of this commit:
cvs rdiff -u -r1.381 -r1.382 src/share/mk/bsd.lib.mk

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

Modified files:

Index: src/share/mk/bsd.lib.mk
diff -u src/share/mk/bsd.lib.mk:1.381 src/share/mk/bsd.lib.mk:1.382
--- src/share/mk/bsd.lib.mk:1.381	Sun May 10 02:38:24 2020
+++ src/share/mk/bsd.lib.mk	Sat May 30 15:51:32 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.lib.mk,v 1.381 2020/05/10 06:38:24 maxv Exp $
+#	$NetBSD: bsd.lib.mk,v 1.382 2020/05/30 19:51:32 christos Exp $
 #	@(#)bsd.lib.mk	8.3 (Berkeley) 4/22/94
 
 .include 
@@ -30,7 +30,7 @@ MKLINT:=	no
 MKPICINSTALL:=	no
 . if defined(NOSTATICLIB) && ${MKPICLIB} != "no"
 MKSTATICLIB:=	no
-. else
+. elif ${MKPICLIB} == "no"
 MKPIC:=		no
 . endif
 MKPROFILE:=	no



CVS commit: src/sys/dev/usb

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 19:23:25 UTC 2020

Modified Files:
src/sys/dev/usb: if_bwfm_usb.c

Log Message:
catch up with changes - need bwfmreg.h before bwfmvar.h


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/usb/if_bwfm_usb.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/usb/if_bwfm_usb.c
diff -u src/sys/dev/usb/if_bwfm_usb.c:1.11 src/sys/dev/usb/if_bwfm_usb.c:1.12
--- src/sys/dev/usb/if_bwfm_usb.c:1.11	Wed Mar 25 03:44:45 2020
+++ src/sys/dev/usb/if_bwfm_usb.c	Sat May 30 19:23:25 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_usb.c,v 1.11 2020/03/25 03:44:45 thorpej Exp $ */
+/* $NetBSD: if_bwfm_usb.c,v 1.12 2020/05/30 19:23:25 jdolecek Exp $ */
 /* $OpenBSD: if_bwfm_usb.c,v 1.2 2017/10/15 14:55:13 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bwfm_usb.c,v 1.11 2020/03/25 03:44:45 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bwfm_usb.c,v 1.12 2020/05/30 19:23:25 jdolecek Exp $");
 
 #include 
 #include 
@@ -48,8 +48,8 @@ __KERNEL_RCSID(0, "$NetBSD: if_bwfm_usb.
 #include 
 #include 
 
-#include 
 #include 
+#include 
 
 static const struct bwfm_firmware_selector bwfm_usb_fwtab[] = {
 	BWFM_FW_ENTRY(BRCM_CC_43143_CHIP_ID,



CVS commit: src/sys/dev/usb

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 19:23:25 UTC 2020

Modified Files:
src/sys/dev/usb: if_bwfm_usb.c

Log Message:
catch up with changes - need bwfmreg.h before bwfmvar.h


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

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



Re: CVS commit: src/sys/dev

2020-05-30 Thread Alexander Nasonov
Jaromir Dolecek wrote:
> Index: src/sys/dev/ic/bwfmvar.h
> diff -u src/sys/dev/ic/bwfmvar.h:1.9 src/sys/dev/ic/bwfmvar.h:1.10
> --- src/sys/dev/ic/bwfmvar.h:1.9  Sat May 30 13:41:58 2020
> +++ src/sys/dev/ic/bwfmvar.h  Sat May 30 15:55:47 2020
> @@ -1,4 +1,4 @@
> -/* $NetBSD: bwfmvar.h,v 1.9 2020/05/30 13:41:58 jdolecek Exp $ */
> +/* $NetBSD: bwfmvar.h,v 1.10 2020/05/30 15:55:47 jdolecek Exp $ */
>  /* $OpenBSD: bwfmvar.h,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
>  /*
>   * Copyright (c) 2010-2016 Broadcom Corporation
> @@ -214,6 +214,11 @@ struct bwfm_softc {
>   enum ieee80211_state, int);
>  
>   int  sc_bcdc_reqid;
> +
> + union {
> + struct bwfm_bss_info bss_info;
> + uint8_t padding[BWFM_BSS_INFO_BUFLEN];
> + }   sc_bss_buf;
>  };

I think you miss 

#include 

where BWFM_BSS_INFO_BUFLEN is defined.

-- 
Alex


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

2020-05-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 30 19:16:53 UTC 2020

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

Log Message:
Fix a lock order reversal that caused hangs.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/rump/librump/rumpkern/lwproc.c

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



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

2020-05-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 30 19:16:53 UTC 2020

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

Log Message:
Fix a lock order reversal that caused hangs.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/rump/librump/rumpkern/lwproc.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/lwproc.c
diff -u src/sys/rump/librump/rumpkern/lwproc.c:1.50 src/sys/rump/librump/rumpkern/lwproc.c:1.51
--- src/sys/rump/librump/rumpkern/lwproc.c:1.50	Sat May 23 23:42:44 2020
+++ src/sys/rump/librump/rumpkern/lwproc.c	Sat May 30 19:16:53 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: lwproc.c,v 1.50 2020/05/23 23:42:44 ad Exp $	*/
+/*  $NetBSD: lwproc.c,v 1.51 2020/05/30 19:16:53 ad Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #define RUMP__CURLWP_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.50 2020/05/23 23:42:44 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.51 2020/05/30 19:16:53 ad Exp $");
 
 #include 
 #include 
@@ -343,12 +343,10 @@ lwproc_freelwp(struct lwp *l)
 
 extern kmutex_t unruntime_lock;
 
-/*
- * called with p_lock held, releases lock before return
- */
-static void
-lwproc_makelwp(struct proc *p, struct lwp *l, bool doswitch, bool procmake)
+static struct lwp *
+lwproc_makelwp(struct proc *p, bool doswitch, bool procmake)
 {
+	struct lwp *l = kmem_zalloc(sizeof(*l), KM_SLEEP);
 
 	/*
 	 * Account the new lwp to the owner of the process.
@@ -365,6 +363,9 @@ lwproc_makelwp(struct proc *p, struct lw
 	l->l_mutex = _lock;
 
 	proc_alloc_lwpid(p, l);
+
+	mutex_enter(p->p_lock);
+	KASSERT((p->p_sflag & PS_RUMP_LWPEXIT) == 0);
 	LIST_INSERT_HEAD(>p_lwps, l, l_sibling);
 
 	l->l_fd = p->p_fd;
@@ -392,12 +393,13 @@ lwproc_makelwp(struct proc *p, struct lw
 	mutex_enter(_lock);
 	LIST_INSERT_HEAD(, l, l_list);
 	mutex_exit(_lock);
+
+	return l;
 }
 
 struct lwp *
 rump__lwproc_alloclwp(struct proc *p)
 {
-	struct lwp *l;
 	bool newproc = false;
 
 	if (p == NULL) {
@@ -405,13 +407,7 @@ rump__lwproc_alloclwp(struct proc *p)
 		newproc = true;
 	}
 
-	l = kmem_zalloc(sizeof(*l), KM_SLEEP);
-
-	mutex_enter(p->p_lock);
-	KASSERT((p->p_sflag & PS_RUMP_LWPEXIT) == 0);
-	lwproc_makelwp(p, l, false, newproc);
-
-	return l;
+	return lwproc_makelwp(p, false, newproc);
 }
 
 int
@@ -435,8 +431,12 @@ rump_lwproc_newlwp(pid_t pid)
 		kmem_free(l, sizeof(*l));
 		return EBUSY;
 	}
+	mutex_exit(p->p_lock);
 	mutex_exit(_lock);
-	lwproc_makelwp(p, l, true, false);
+
+	/* XXX what holds proc? */
+
+	lwproc_makelwp(p, true, false);
 
 	return 0;
 }
@@ -445,17 +445,13 @@ int
 rump_lwproc_rfork_vmspace(struct vmspace *vm, int flags)
 {
 	struct proc *p;
-	struct lwp *l;
 
 	if (flags & ~(RUMP_RFFDG|RUMP_RFCFDG) ||
 	(~flags & (RUMP_RFFDG|RUMP_RFCFDG)) == 0)
 		return EINVAL;
 
 	p = lwproc_newproc(curproc, vm, flags);
-	l = kmem_zalloc(sizeof(*l), KM_SLEEP);
-	mutex_enter(p->p_lock);
-	KASSERT((p->p_sflag & PS_RUMP_LWPEXIT) == 0);
-	lwproc_makelwp(p, l, true, true);
+	lwproc_makelwp(p, true, true);
 
 	return 0;
 }



CVS commit: src/common/lib/libc/hash/sha3

2020-05-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat May 30 18:40:28 UTC 2020

Modified Files:
src/common/lib/libc/hash/sha3: sha3.c

Log Message:
Merge updates from upstream to reduce stack usage of SHA3_Selftest.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/hash/sha3/sha3.c

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

Modified files:

Index: src/common/lib/libc/hash/sha3/sha3.c
diff -u src/common/lib/libc/hash/sha3/sha3.c:1.1 src/common/lib/libc/hash/sha3/sha3.c:1.2
--- src/common/lib/libc/hash/sha3/sha3.c:1.1	Thu Nov 30 05:47:24 2017
+++ src/common/lib/libc/hash/sha3/sha3.c	Sat May 30 18:40:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sha3.c,v 1.1 2017/11/30 05:47:24 riastradh Exp $	*/
+/*	$NetBSD: sha3.c,v 1.2 2020/05/30 18:40:28 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2015 Taylor R. Campbell
@@ -38,14 +38,14 @@
 
 #if defined(_KERNEL) || defined(_STANDALONE)
 
-__KERNEL_RCSID(0, "$NetBSD: sha3.c,v 1.1 2017/11/30 05:47:24 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sha3.c,v 1.2 2020/05/30 18:40:28 riastradh Exp $");
 #include 
 
 #define	SHA3_ASSERT	KASSERT
 
 #else
 
-__RCSID("$NetBSD: sha3.c,v 1.1 2017/11/30 05:47:24 riastradh Exp $");
+__RCSID("$NetBSD: sha3.c,v 1.2 2020/05/30 18:40:28 riastradh Exp $");
 
 #include "namespace.h"
 
@@ -87,6 +87,7 @@ __weak_alias(SHAKE256_Final,_SHAKE256_Fi
 #endif	/* kernel/standalone */
 
 #define	MIN(a,b)	((a) < (b) ? (a) : (b))
+#define	arraycount(a)	(sizeof(a)/sizeof((a)[0]))
 
 /*
  * Common body.  All the SHA-3 functions share code structure.  They
@@ -428,19 +429,19 @@ sha3_selftest_prng(void *buf, size_t len
 int
 SHA3_Selftest(void)
 {
-	const uint8_t d224_0[] = { /* SHA3-224(0-bit) */
+	static const uint8_t d224_0[] = { /* SHA3-224(0-bit) */
 		0x6b,0x4e,0x03,0x42,0x36,0x67,0xdb,0xb7,
 		0x3b,0x6e,0x15,0x45,0x4f,0x0e,0xb1,0xab,
 		0xd4,0x59,0x7f,0x9a,0x1b,0x07,0x8e,0x3f,
 		0x5b,0x5a,0x6b,0xc7,
 	};
-	const uint8_t d256_0[] = { /* SHA3-256(0-bit) */
+	static const uint8_t d256_0[] = { /* SHA3-256(0-bit) */
 		0xa7,0xff,0xc6,0xf8,0xbf,0x1e,0xd7,0x66,
 		0x51,0xc1,0x47,0x56,0xa0,0x61,0xd6,0x62,
 		0xf5,0x80,0xff,0x4d,0xe4,0x3b,0x49,0xfa,
 		0x82,0xd8,0x0a,0x4b,0x80,0xf8,0x43,0x4a,
 	};
-	const uint8_t d384_0[] = { /* SHA3-384(0-bit) */
+	static const uint8_t d384_0[] = { /* SHA3-384(0-bit) */
 		0x0c,0x63,0xa7,0x5b,0x84,0x5e,0x4f,0x7d,
 		0x01,0x10,0x7d,0x85,0x2e,0x4c,0x24,0x85,
 		0xc5,0x1a,0x50,0xaa,0xaa,0x94,0xfc,0x61,
@@ -448,7 +449,7 @@ SHA3_Selftest(void)
 		0xc3,0x71,0x38,0x31,0x26,0x4a,0xdb,0x47,
 		0xfb,0x6b,0xd1,0xe0,0x58,0xd5,0xf0,0x04,
 	};
-	const uint8_t d512_0[] = { /* SHA3-512(0-bit) */
+	static const uint8_t d512_0[] = { /* SHA3-512(0-bit) */
 		0xa6,0x9f,0x73,0xcc,0xa2,0x3a,0x9a,0xc5,
 		0xc8,0xb5,0x67,0xdc,0x18,0x5a,0x75,0x6e,
 		0x97,0xc9,0x82,0x16,0x4f,0xe2,0x58,0x59,
@@ -458,14 +459,14 @@ SHA3_Selftest(void)
 		0xf5,0x00,0x19,0x9d,0x95,0xb6,0xd3,0xe3,
 		0x01,0x75,0x85,0x86,0x28,0x1d,0xcd,0x26,
 	};
-	const uint8_t shake128_0_41[] = { /* SHAKE128(0-bit, 41) */
+	static const uint8_t shake128_0_41[] = { /* SHAKE128(0-bit, 41) */
 		0x7f,0x9c,0x2b,0xa4,0xe8,0x8f,0x82,0x7d,
 		0x61,0x60,0x45,0x50,0x76,0x05,0x85,0x3e,
 		0xd7,0x3b,0x80,0x93,0xf6,0xef,0xbc,0x88,
 		0xeb,0x1a,0x6e,0xac,0xfa,0x66,0xef,0x26,
 		0x3c,0xb1,0xee,0xa9,0x88,0x00,0x4b,0x93,0x10,
 	};
-	const uint8_t shake256_0_73[] = { /* SHAKE256(0-bit, 73) */
+	static const uint8_t shake256_0_73[] = { /* SHAKE256(0-bit, 73) */
 		0x46,0xb9,0xdd,0x2b,0x0b,0xa8,0x8d,0x13,
 		0x23,0x3b,0x3f,0xeb,0x74,0x3e,0xeb,0x24,
 		0x3f,0xcd,0x52,0xea,0x62,0xb8,0x1b,0x82,
@@ -476,19 +477,19 @@ SHA3_Selftest(void)
 		0x40,0x29,0x2e,0xac,0xb3,0xb7,0xc4,0xbe,
 		0x14,0x1e,0x96,0x61,0x6f,0xb1,0x39,0x57,0x69,
 	};
-	const uint8_t d224_1600[] = { /* SHA3-224(200 * 0xa3) */
+	static const uint8_t d224_1600[] = { /* SHA3-224(200 * 0xa3) */
 		0x93,0x76,0x81,0x6a,0xba,0x50,0x3f,0x72,
 		0xf9,0x6c,0xe7,0xeb,0x65,0xac,0x09,0x5d,
 		0xee,0xe3,0xbe,0x4b,0xf9,0xbb,0xc2,0xa1,
 		0xcb,0x7e,0x11,0xe0,
 	};
-	const uint8_t d256_1600[] = { /* SHA3-256(200 * 0xa3) */
+	static const uint8_t d256_1600[] = { /* SHA3-256(200 * 0xa3) */
 		0x79,0xf3,0x8a,0xde,0xc5,0xc2,0x03,0x07,
 		0xa9,0x8e,0xf7,0x6e,0x83,0x24,0xaf,0xbf,
 		0xd4,0x6c,0xfd,0x81,0xb2,0x2e,0x39,0x73,
 		0xc6,0x5f,0xa1,0xbd,0x9d,0xe3,0x17,0x87,
 	};
-	const uint8_t d384_1600[] = { /* SHA3-384(200 * 0xa3) */
+	static const uint8_t d384_1600[] = { /* SHA3-384(200 * 0xa3) */
 		0x18,0x81,0xde,0x2c,0xa7,0xe4,0x1e,0xf9,
 		0x5d,0xc4,0x73,0x2b,0x8f,0x5f,0x00,0x2b,
 		0x18,0x9c,0xc1,0xe4,0x2b,0x74,0x16,0x8e,
@@ -496,7 +497,7 @@ SHA3_Selftest(void)
 		0x76,0x19,0x7a,0x31,0xfd,0x55,0xee,0x98,
 		0x9f,0x2d,0x70,0x50,0xdd,0x47,0x3e,0x8f,
 	};
-	const uint8_t d512_1600[] = { /* SHA3-512(200 * 0xa3) */
+	static const uint8_t d512_1600[] = { /* SHA3-512(200 * 0xa3) */
 		0xe7,0x6d,0xfa,0xd2,0x20,0x84,0xa8,0xb1,
 		

CVS commit: src/common/lib/libc/hash/sha3

2020-05-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat May 30 18:40:28 UTC 2020

Modified Files:
src/common/lib/libc/hash/sha3: sha3.c

Log Message:
Merge updates from upstream to reduce stack usage of SHA3_Selftest.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/hash/sha3/sha3.c

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



CVS commit: src/sys/kern

2020-05-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 30 18:06:17 UTC 2020

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

Log Message:
cache_lookup_linked():

- If the lookup fails return with the same lock held.  There's no bug here
  because either parent or child's lock is sufficient to prevent both from
  disappearing into thin air, but may as well be correct.

- if FSCRED is passed in then skip the auth check.


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

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

Modified files:

Index: src/sys/kern/vfs_cache.c
diff -u src/sys/kern/vfs_cache.c:1.144 src/sys/kern/vfs_cache.c:1.145
--- src/sys/kern/vfs_cache.c:1.144	Tue May 26 18:38:37 2020
+++ src/sys/kern/vfs_cache.c	Sat May 30 18:06:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_cache.c,v 1.144 2020/05/26 18:38:37 ad Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.145 2020/05/30 18:06:17 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -172,7 +172,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.144 2020/05/26 18:38:37 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.145 2020/05/30 18:06:17 ad Exp $");
 
 #define __NAMECACHE_PRIVATE
 #ifdef _KERNEL_OPT
@@ -626,12 +626,10 @@ cache_lookup_linked(struct vnode *dvp, c
 {
 	vnode_impl_t *dvi = VNODE_TO_VIMPL(dvp);
 	struct namecache *ncp;
+	krwlock_t *oldlock, *newlock;
 	uint64_t key;
 	int error;
 
-	/* Establish default results. */
-	*vn_ret = NULL;
-
 	/* If disabled, or file system doesn't support this, bail out. */
 	if (__predict_false((dvp->v_mount->mnt_iflag & IMNT_NCLOOKUP) == 0)) {
 		return false;
@@ -663,32 +661,42 @@ cache_lookup_linked(struct vnode *dvp, c
 	 * on the lock as child -> parent is the wrong direction.
 	 */
 	if (*plock != >vi_nc_lock) {
+		oldlock = *plock;
+		newlock = >vi_nc_lock;
 		if (!rw_tryenter(>vi_nc_lock, RW_READER)) {
 			return false;
 		}
-		if (*plock != NULL) {
-			rw_exit(*plock);
+	} else {
+		oldlock = NULL;
+		newlock = NULL;
+		if (*plock == NULL) {
+			KASSERT(vrefcnt(dvp) > 0);
 		}
-		*plock = >vi_nc_lock;
-	} else if (*plock == NULL) {
-		KASSERT(vrefcnt(dvp) > 0);
 	}
 
 	/*
 	 * First up check if the user is allowed to look up files in this
 	 * directory.
 	 */
-	if (dvi->vi_nc_mode == VNOVAL) {
-		return false;
-	}
-	KASSERT(dvi->vi_nc_uid != VNOVAL && dvi->vi_nc_gid != VNOVAL);
-	error = kauth_authorize_vnode(cred, KAUTH_ACCESS_ACTION(VEXEC,
-	dvp->v_type, dvi->vi_nc_mode & ALLPERMS), dvp, NULL,
-	genfs_can_access(dvp, cred, dvi->vi_nc_uid, dvi->vi_nc_gid,
-	dvi->vi_nc_mode & ALLPERMS, NULL, VEXEC));
-	if (error != 0) {
-		COUNT(ncs_denied);
-		return false;
+	if (cred != FSCRED) {
+		if (dvi->vi_nc_mode == VNOVAL) {
+			if (newlock != NULL) {
+rw_exit(newlock);
+			}
+			return false;
+		}
+		KASSERT(dvi->vi_nc_uid != VNOVAL && dvi->vi_nc_gid != VNOVAL);
+		error = kauth_authorize_vnode(cred, KAUTH_ACCESS_ACTION(VEXEC,
+		dvp->v_type, dvi->vi_nc_mode & ALLPERMS), dvp, NULL,
+		genfs_can_access(dvp, cred, dvi->vi_nc_uid, dvi->vi_nc_gid,
+		dvi->vi_nc_mode & ALLPERMS, NULL, VEXEC));
+		if (error != 0) {
+			if (newlock != NULL) {
+rw_exit(newlock);
+			}
+			COUNT(ncs_denied);
+			return false;
+		}
 	}
 
 	/*
@@ -696,6 +704,9 @@ cache_lookup_linked(struct vnode *dvp, c
 	 */
 	ncp = cache_lookup_entry(dvp, name, namelen, key);
 	if (__predict_false(ncp == NULL)) {
+		if (newlock != NULL) {
+			rw_exit(newlock);
+		}
 		COUNT(ncs_miss);
 		SDT_PROBE(vfs, namecache, lookup, miss, dvp,
 		name, namelen, 0, 0);
@@ -704,11 +715,9 @@ cache_lookup_linked(struct vnode *dvp, c
 	if (ncp->nc_vp == NULL) {
 		/* found negative entry; vn is already null from above */
 		COUNT(ncs_neghits);
-		SDT_PROBE(vfs, namecache, lookup, hit, dvp, name, namelen, 0, 0);
-		return true;
+	} else {
+		COUNT(ncs_goodhits); /* XXX can be "badhits" */
 	}
-
-	COUNT(ncs_goodhits); /* XXX can be "badhits" */
 	SDT_PROBE(vfs, namecache, lookup, hit, dvp, name, namelen, 0, 0);
 
 	/*
@@ -717,6 +726,12 @@ cache_lookup_linked(struct vnode *dvp, c
 	 * looking up the next component, or the caller will release it
 	 * manually when finished.
 	 */
+	if (oldlock) {
+		rw_exit(oldlock);
+	}
+	if (newlock) {
+		*plock = newlock;
+	}	
 	*vn_ret = ncp->nc_vp;
 	return true;
 }



CVS commit: src/sys/kern

2020-05-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 30 18:06:17 UTC 2020

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

Log Message:
cache_lookup_linked():

- If the lookup fails return with the same lock held.  There's no bug here
  because either parent or child's lock is sufficient to prevent both from
  disappearing into thin air, but may as well be correct.

- if FSCRED is passed in then skip the auth check.


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

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



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

2020-05-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May 30 17:50:39 UTC 2020

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

Log Message:
sctlr_el1 and ctr_el0 are 64-bit registers


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/aarch64/aarch64/cpu.c

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/cpu.c
diff -u src/sys/arch/aarch64/aarch64/cpu.c:1.45 src/sys/arch/aarch64/aarch64/cpu.c:1.46
--- src/sys/arch/aarch64/aarch64/cpu.c:1.45	Mon May 11 14:44:16 2020
+++ src/sys/arch/aarch64/aarch64/cpu.c	Sat May 30 17:50:39 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu.c,v 1.45 2020/05/11 14:44:16 riastradh Exp $ */
+/* $NetBSD: cpu.c,v 1.46 2020/05/30 17:50:39 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.45 2020/05/11 14:44:16 riastradh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: cpu.c,v 1.46 2020/05/30 17:50:39 jmcneill Exp $");
 
 #include "locators.h"
 #include "opt_arm_debug.h"
@@ -232,7 +232,7 @@ cpu_identify(device_t self, struct cpu_i
 static void
 cpu_identify1(device_t self, struct cpu_info *ci)
 {
-	uint32_t ctr, sctlr;	/* for cache */
+	uint64_t ctr, sctlr;	/* for cache */
 
 	/* SCTLR - System Control Register */
 	sctlr = reg_sctlr_el1_read();



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

2020-05-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May 30 17:50:39 UTC 2020

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

Log Message:
sctlr_el1 and ctr_el0 are 64-bit registers


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/aarch64/aarch64/cpu.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/usb

2020-05-30 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 30 17:19:45 UTC 2020

Modified Files:
src/sys/dev/usb: aubtfwl.c

Log Message:
aubtfwl(4): Use kmem_asprintf() for firmware file name creation.

A MAXPATHLEN+1 array of char on stack is "too much".


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/usb/aubtfwl.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/usb/aubtfwl.c
diff -u src/sys/dev/usb/aubtfwl.c:1.9 src/sys/dev/usb/aubtfwl.c:1.10
--- src/sys/dev/usb/aubtfwl.c:1.9	Sat Mar 14 02:35:33 2020
+++ src/sys/dev/usb/aubtfwl.c	Sat May 30 17:19:45 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: aubtfwl.c,v 1.9 2020/03/14 02:35:33 christos Exp $ */
+/* $NetBSD: aubtfwl.c,v 1.10 2020/05/30 17:19:45 jakllsch Exp $ */
 
 /*
  * Copyright (c) 2011 Jonathan A. Kollasch
@@ -27,9 +27,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: aubtfwl.c,v 1.9 2020/03/14 02:35:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aubtfwl.c,v 1.10 2020/05/30 17:19:45 jakllsch Exp $");
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -272,7 +273,7 @@ static void
 aubtfwl_attach_hook(device_t self)
 {
 	struct aubtfwl_softc * const sc = device_private(self);
-	char firmware_name[MAXPATHLEN+1];
+	char *fw_name;
 	struct ar3k_version ver;
 	uint8_t state;
 	int clock = 0;
@@ -292,9 +293,10 @@ aubtfwl_attach_hook(device_t self)
 		aprint_verbose_dev(self, "state is 0x%02x\n", state);
 
 		if (!(state & AR3K_STATE_IS_PATCHED)) {
-			snprintf(firmware_name, sizeof(firmware_name),
-"ar3k/AthrBT_0x%08x.dfu", ver.rom);
-			error = aubtfwl_firmware_load(self, firmware_name);
+			fw_name = kmem_asprintf("ar3k/AthrBT_0x%08x.dfu",
+			ver.rom);
+			error = aubtfwl_firmware_load(self, fw_name);
+			kmem_strfree(fw_name);
 
 			if (error)
 return;
@@ -312,9 +314,10 @@ aubtfwl_attach_hook(device_t self)
 			break;
 		}
 
-		snprintf(firmware_name, sizeof(firmware_name),
-			"ar3k/ramps_0x%08x_%d.dfu", ver.rom, clock);
-		aubtfwl_firmware_load(self, firmware_name);
+		fw_name = kmem_asprintf("ar3k/ramps_0x%08x_%d.dfu",
+		ver.rom, clock);
+		aubtfwl_firmware_load(self, fw_name);
+		kmem_strfree(fw_name);
 
 		if ((state & AR3K_STATE_MODE_MASK) != AR3K_STATE_MODE_NORMAL) {
 			error = aubtfwl_send_command(sc, AR3K_SET_NORMAL_MODE);



CVS commit: src/sys/dev/usb

2020-05-30 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sat May 30 17:19:45 UTC 2020

Modified Files:
src/sys/dev/usb: aubtfwl.c

Log Message:
aubtfwl(4): Use kmem_asprintf() for firmware file name creation.

A MAXPATHLEN+1 array of char on stack is "too much".


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/usb/aubtfwl.c

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



CVS commit: src/share/man/man9

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 17:18:22 UTC 2020

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

Log Message:
slightly improve sentence, no need to 'Note' when in NOTES section


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/share/man/man9/malloc.9

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

Modified files:

Index: src/share/man/man9/malloc.9
diff -u src/share/man/man9/malloc.9:1.56 src/share/man/man9/malloc.9:1.57
--- src/share/man/man9/malloc.9:1.56	Sat May 30 17:12:01 2020
+++ src/share/man/man9/malloc.9	Sat May 30 17:18:22 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: malloc.9,v 1.56 2020/05/30 17:12:01 jdolecek Exp $
+.\"	$NetBSD: malloc.9,v 1.57 2020/05/30 17:18:22 jdolecek Exp $
 .\"
 .\" Copyright (c) 1996, 2003 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -230,7 +230,7 @@ Other malloc types are defined by the co
 documentation for that subsystem for information its available malloc
 types.
 .Sh NOTES
-Note that the malloc type argument is actually unused on
+The malloc type argument is actually unused on
 .Nx ,
 the argument is only supported for easier source compatibility
 with



CVS commit: src/share/man/man9

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 17:18:22 UTC 2020

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

Log Message:
slightly improve sentence, no need to 'Note' when in NOTES section


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/share/man/man9/malloc.9

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



CVS commit: src/share/man/man9

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 17:12:01 UTC 2020

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

Log Message:
remove M_SOFTDEP from list of supported malloc types, it's long gone

also remove M_PCB - while it is used by SCTP, it's actually not defined
anywhere

in fact add new NOTES section explaining that the malloc types are
actually not used on NetBSD


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/share/man/man9/malloc.9

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



CVS commit: src/share/man/man9

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 17:12:01 UTC 2020

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

Log Message:
remove M_SOFTDEP from list of supported malloc types, it's long gone

also remove M_PCB - while it is used by SCTP, it's actually not defined
anywhere

in fact add new NOTES section explaining that the malloc types are
actually not used on NetBSD


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/share/man/man9/malloc.9

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

Modified files:

Index: src/share/man/man9/malloc.9
diff -u src/share/man/man9/malloc.9:1.55 src/share/man/man9/malloc.9:1.56
--- src/share/man/man9/malloc.9:1.55	Sun Oct 14 17:40:28 2018
+++ src/share/man/man9/malloc.9	Sat May 30 17:12:01 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: malloc.9,v 1.55 2018/10/14 17:40:28 jdolecek Exp $
+.\"	$NetBSD: malloc.9,v 1.56 2020/05/30 17:12:01 jdolecek Exp $
 .\"
 .\" Copyright (c) 1996, 2003 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd October 14, 2018
+.Dd May 30, 2020
 .Dt MALLOC 9
 .Os
 .Sh NAME
@@ -222,10 +222,6 @@ Device driver memory.
 structures.
 .It Dv M_FREE
 Should be on free list.
-.It Dv M_PCB
-Protocol control block.
-.It Dv M_SOFTINTR
-Softinterrupt structures.
 .It Dv M_TEMP
 Misc temporary data buffers.
 .El
@@ -233,6 +229,22 @@ Misc temporary data buffers.
 Other malloc types are defined by the corresponding subsystem; see the
 documentation for that subsystem for information its available malloc
 types.
+.Sh NOTES
+Note that the malloc type argument is actually unused on
+.Nx ,
+the argument is only supported for easier source compatibility
+with
+.Fx
+and
+.Ox .
+Likewise calls to
+.Fn MALLOC_DECLARE
+.Fn MALLOC_DEFINE ,
+.Fn malloc_type_attach ,
+and
+.Fn malloc_type_detach
+are defined out and have no effect on
+.Nx .
 .Sh RETURN VALUES
 .Fn malloc
 returns a kernel virtual address that is suitably aligned for storage of



CVS commit: src/sys/dev/pci

2020-05-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 30 16:35:02 UTC 2020

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

Log Message:
gem_pci_attach(): avoid allocating a 2K buffer on the stack.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/pci/if_gem_pci.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

2020-05-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 30 16:35:02 UTC 2020

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

Log Message:
gem_pci_attach(): avoid allocating a 2K buffer on the stack.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/pci/if_gem_pci.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_gem_pci.c
diff -u src/sys/dev/pci/if_gem_pci.c:1.50 src/sys/dev/pci/if_gem_pci.c:1.51
--- src/sys/dev/pci/if_gem_pci.c:1.50	Mon Mar  2 06:38:06 2020
+++ src/sys/dev/pci/if_gem_pci.c	Sat May 30 16:35:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gem_pci.c,v 1.50 2020/03/02 06:38:06 msaitoh Exp $ */
+/*	$NetBSD: if_gem_pci.c,v 1.51 2020/05/30 16:35:02 thorpej Exp $ */
 
 /*
  *
@@ -34,15 +34,15 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gem_pci.c,v 1.50 2020/03/02 06:38:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gem_pci.c,v 1.51 2020/05/30 16:35:02 thorpej Exp $");
 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -142,6 +142,8 @@ isserdes(u_int8_t* buf)
 	buf[3] == 'd' && buf[4] == 'e' && buf[5] == 's';
 }
 
+#define	GEM_TMP_BUFSIZE		0x0800
+
 void
 gem_pci_attach(device_t parent, device_t self, void *aux)
 {
@@ -150,9 +152,8 @@ gem_pci_attach(device_t parent, device_t
 	struct gem_softc *sc = >gsc_gem;
 	prop_data_t data;
 	uint8_t enaddr[ETHER_ADDR_LEN];
-	u_int8_t		*enp;
 	bus_space_handle_t	romh;
-	u_int8_t		buf[0x0800];
+	uint8_t			*buf;
 	int			dataoff, vpdoff, serdes;
 	int i, got_addr = 0;
 #ifdef GEM_DEBUG
@@ -230,6 +231,8 @@ gem_pci_attach(device_t parent, device_t
 		return;
 	}
 
+	buf = kmem_alloc(GEM_TMP_BUFSIZE, KM_SLEEP);
+
 	if ((data = prop_dictionary_get(device_properties(sc->sc_dev),
 	"mac-address")) != NULL) {
 		memcpy(enaddr, prop_data_data_nocopy(data), ETHER_ADDR_LEN);
@@ -252,7 +255,7 @@ gem_pci_attach(device_t parent, device_t
 		 * later) chapter 2 describes the data structure.
 		 */
 
-		enp = NULL;
+		uint8_t *enp = NULL;
 
 		if (sc->sc_variant == GEM_SUN_GEM &&
 		(bus_space_subregion(sc->sc_bustag, sc->sc_h1,
@@ -351,6 +354,9 @@ gem_pci_attach(device_t parent, device_t
 			got_addr = 1;
 		}
 	}
+
+	kmem_free(buf, GEM_TMP_BUFSIZE);
+
 	if (!got_addr) {
 		printf("%s: no Ethernet address found\n",
 		device_xname(sc->sc_dev));



CVS commit: src/sys/kern

2020-05-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 30 16:12:56 UTC 2020

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

Log Message:
coredump_note_elf{32,64}(): avoid allcating register state buffers on
the stack; they could be large.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/kern/core_elf32.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/core_elf32.c
diff -u src/sys/kern/core_elf32.c:1.63 src/sys/kern/core_elf32.c:1.64
--- src/sys/kern/core_elf32.c:1.63	Sat May 23 23:42:43 2020
+++ src/sys/kern/core_elf32.c	Sat May 30 16:12:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: core_elf32.c,v 1.63 2020/05/23 23:42:43 ad Exp $	*/
+/*	$NetBSD: core_elf32.c,v 1.64 2020/05/30 16:12:56 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.63 2020/05/23 23:42:43 ad Exp $");
+__KERNEL_RCSID(1, "$NetBSD: core_elf32.c,v 1.64 2020/05/30 16:12:56 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd32.h"
@@ -478,47 +478,58 @@ ELFNAMEEND(coredump_notes)(struct lwp *l
 	return error;
 }
 
-static int
-ELFNAMEEND(coredump_note)(struct lwp *l, struct note_state *ns)
-{
-	int error;
+struct elf_coredump_note_data {
 	char name[64];
 	elf_lwpstatus els;
 	elf_reg intreg;
 #ifdef PT_GETFPREGS
 	elf_fpreg freg;
+#endif
+};
+
+static int
+ELFNAMEEND(coredump_note)(struct lwp *l, struct note_state *ns)
+{
+	struct elf_coredump_note_data *d;
+#ifdef PT_GETFPREGS
 	size_t freglen;
 #endif
+	int error;
+
+	d = kmem_alloc(sizeof(*d), KM_SLEEP);
 
-	snprintf(name, sizeof(name), "%s@%d",
+	snprintf(d->name, sizeof(d->name), "%s@%d",
 	ELF_NOTE_NETBSD_CORE_NAME, l->l_lid);
 
-	elf_read_lwpstatus(l, );
+	elf_read_lwpstatus(l, >els);
 
-	ELFNAMEEND(coredump_savenote)(ns, PT_LWPSTATUS, name, ,
-	sizeof(els));
+	ELFNAMEEND(coredump_savenote)(ns, PT_LWPSTATUS, d->name, >els,
+	sizeof(d->els));
 
-	error = elf_process_read_regs(l, );
+	error = elf_process_read_regs(l, >intreg);
 	if (error)
-		return (error);
+		goto out;
 
-	ELFNAMEEND(coredump_savenote)(ns, PT_GETREGS, name, ,
-	sizeof(intreg));
+	ELFNAMEEND(coredump_savenote)(ns, PT_GETREGS, d->name, >intreg,
+	sizeof(d->intreg));
 
 #ifdef PT_GETFPREGS
-	freglen = sizeof(freg);
-	error = elf_process_read_fpregs(l, , );
+	freglen = sizeof(d->freg);
+	error = elf_process_read_fpregs(l, >freg, );
 	if (error)
-		return (error);
+		goto out;
 
-	ELFNAMEEND(coredump_savenote)(ns, PT_GETFPREGS, name, , freglen);
+	ELFNAMEEND(coredump_savenote)(ns, PT_GETFPREGS, d->name, >freg,
+	freglen);
 #endif
 
 #ifdef COREDUMP_MACHDEP_LWP_NOTES
-	COREDUMP_MACHDEP_LWP_NOTES(l, ns, name);
+	COREDUMP_MACHDEP_LWP_NOTES(l, ns, d->name);
 #endif
 
-	return (0);
+ out:
+	kmem_free(d, sizeof(*d));
+	return (error);
 }
 
 static void



CVS commit: src/sys/kern

2020-05-30 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat May 30 16:12:56 UTC 2020

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

Log Message:
coredump_note_elf{32,64}(): avoid allcating register state buffers on
the stack; they could be large.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/kern/core_elf32.c

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



CVS commit: src/lib/libterminfo

2020-05-30 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat May 30 16:03:58 UTC 2020

Modified Files:
src/lib/libterminfo: curterm.c

Log Message:
terminfo: test strlcpy result against space free, not string length

riastradh@ yep, looks good.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libterminfo/curterm.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/libterminfo/curterm.c
diff -u src/lib/libterminfo/curterm.c:1.13 src/lib/libterminfo/curterm.c:1.14
--- src/lib/libterminfo/curterm.c:1.13	Thu May  4 09:42:23 2017
+++ src/lib/libterminfo/curterm.c	Sat May 30 16:03:58 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: curterm.c,v 1.13 2017/05/04 09:42:23 roy Exp $ */
+/* $NetBSD: curterm.c,v 1.14 2020/05/30 16:03:58 roy Exp $ */
 
 /*
  * Copyright (c) 2009, 2011 The NetBSD Foundation, Inc.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: curterm.c,v 1.13 2017/05/04 09:42:23 roy Exp $");
+__RCSID("$NetBSD: curterm.c,v 1.14 2020/05/30 16:03:58 roy Exp $");
 
 #include 
 #include 
@@ -99,21 +99,21 @@ set_curterm(TERMINAL *nterm)
 
 		p = ttytype;
 		l = sizeof(ttytype);
-		if ((n = strlcpy(p, nterm->name, l)) == strlen(p)) {
+		if ((n = strlcpy(p, nterm->name, l)) < l) {
 			p += n;
 			l -= n;
 			*p++ = '|';
 			l--;
-			if (nterm->_alias  &&
-(n = strlcpy(p, nterm->_alias, l)) == strlen(p))
+			if (nterm->_alias != NULL &&
+			(n = strlcpy(p, nterm->_alias, l)) < l)
 			{
 p += n;
 l -= n;
 *p++ = '|';
 l--;
 			}
-			if (nterm->desc  &&
-(n = strlcpy(p, nterm->desc, l)) == strlen(p))
+			if (nterm->desc != NULL &&
+			(n = strlcpy(p, nterm->desc, l)) < l)
 			{
 p += n;
 l -= n;



CVS commit: src/lib/libterminfo

2020-05-30 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sat May 30 16:03:58 UTC 2020

Modified Files:
src/lib/libterminfo: curterm.c

Log Message:
terminfo: test strlcpy result against space free, not string length

riastradh@ yep, looks good.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/lib/libterminfo/curterm.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

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 15:55:47 UTC 2020

Modified Files:
src/sys/dev/ic: bwfm.c bwfmvar.h
src/sys/dev/pci: if_bwfm_pci.c
src/sys/dev/sdmmc: if_bwfm_sdio.c

Log Message:
discussed with thorpej@, and it seems it's better to allocate the bss
alignment buffer statically (as part of softc) just to be sure to not
affect performance


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/ic/bwfm.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/bwfmvar.h
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/if_bwfm_pci.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/sdmmc/if_bwfm_sdio.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

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 15:55:47 UTC 2020

Modified Files:
src/sys/dev/ic: bwfm.c bwfmvar.h
src/sys/dev/pci: if_bwfm_pci.c
src/sys/dev/sdmmc: if_bwfm_sdio.c

Log Message:
discussed with thorpej@, and it seems it's better to allocate the bss
alignment buffer statically (as part of softc) just to be sure to not
affect performance


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/ic/bwfm.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/bwfmvar.h
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/pci/if_bwfm_pci.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/sdmmc/if_bwfm_sdio.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/bwfm.c
diff -u src/sys/dev/ic/bwfm.c:1.24 src/sys/dev/ic/bwfm.c:1.25
--- src/sys/dev/ic/bwfm.c:1.24	Sat May 30 14:03:08 2020
+++ src/sys/dev/ic/bwfm.c	Sat May 30 15:55:47 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfm.c,v 1.24 2020/05/30 14:03:08 jdolecek Exp $ */
+/* $NetBSD: bwfm.c,v 1.25 2020/05/30 15:55:47 jdolecek Exp $ */
 /* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -38,8 +38,8 @@
 
 #include 
 
-#include 
 #include 
+#include 
 
 /* #define BWFM_DEBUG */
 #ifdef BWFM_DEBUG
@@ -2140,18 +2140,12 @@ bwfm_rx_event_cb(struct bwfm_softc *sc, 
 		bss = >bss_info[0];
 		for (i = 0; i < le16toh(res->bss_count); i++) {
 			/* Fix alignment of bss_info */
-			union {
-struct bwfm_bss_info bss_info;
-uint8_t padding[BWFM_BSS_INFO_BUFLEN];
-			} *bss_buf;
-			if (len > sizeof(*bss_buf)) {
+			if (len > sizeof(sc->sc_bss_buf)) {
 printf("%s: bss_info buffer too big\n", DEVNAME(sc));
 			} else {
-bss_buf = kmem_alloc(sizeof(*bss_buf),
-KM_SLEEP);
-memcpy(bss_buf, >bss_info[i], len);
-bwfm_scan_node(sc, _buf->bss_info, len);
-kmem_free(bss_buf, sizeof(*bss_buf));
+memcpy(>sc_bss_buf, >bss_info[i], len);
+bwfm_scan_node(sc, >sc_bss_buf.bss_info,
+len);
 			}
 			len -= sizeof(*bss) + le32toh(bss->length);
 			bss = (void *)(((uintptr_t)bss) + le32toh(bss->length));

Index: src/sys/dev/ic/bwfmvar.h
diff -u src/sys/dev/ic/bwfmvar.h:1.9 src/sys/dev/ic/bwfmvar.h:1.10
--- src/sys/dev/ic/bwfmvar.h:1.9	Sat May 30 13:41:58 2020
+++ src/sys/dev/ic/bwfmvar.h	Sat May 30 15:55:47 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfmvar.h,v 1.9 2020/05/30 13:41:58 jdolecek Exp $ */
+/* $NetBSD: bwfmvar.h,v 1.10 2020/05/30 15:55:47 jdolecek Exp $ */
 /* $OpenBSD: bwfmvar.h,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -214,6 +214,11 @@ struct bwfm_softc {
 enum ieee80211_state, int);
 
 	int			 sc_bcdc_reqid;
+
+	union {
+		struct bwfm_bss_info bss_info;
+		uint8_t padding[BWFM_BSS_INFO_BUFLEN];
+	}			sc_bss_buf;
 };
 
 void bwfm_attach(struct bwfm_softc *);

Index: src/sys/dev/pci/if_bwfm_pci.c
diff -u src/sys/dev/pci/if_bwfm_pci.c:1.8 src/sys/dev/pci/if_bwfm_pci.c:1.9
--- src/sys/dev/pci/if_bwfm_pci.c:1.8	Sat May 30 13:41:58 2020
+++ src/sys/dev/pci/if_bwfm_pci.c	Sat May 30 15:55:47 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bwfm_pci.c,v 1.8 2020/05/30 13:41:58 jdolecek Exp $	*/
+/*	$NetBSD: if_bwfm_pci.c,v 1.9 2020/05/30 15:55:47 jdolecek Exp $	*/
 /*	$OpenBSD: if_bwfm_pci.c,v 1.18 2018/02/08 05:00:38 patrick Exp $	*/
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -41,8 +41,8 @@
 #include 
 #include 
 
-#include 
 #include 
+#include 
 #include 
 
 #define BWFM_DMA_D2H_SCRATCH_BUF_LEN		8

Index: src/sys/dev/sdmmc/if_bwfm_sdio.c
diff -u src/sys/dev/sdmmc/if_bwfm_sdio.c:1.17 src/sys/dev/sdmmc/if_bwfm_sdio.c:1.18
--- src/sys/dev/sdmmc/if_bwfm_sdio.c:1.17	Sat May 30 13:41:58 2020
+++ src/sys/dev/sdmmc/if_bwfm_sdio.c	Sat May 30 15:55:47 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_sdio.c,v 1.17 2020/05/30 13:41:58 jdolecek Exp $ */
+/* $NetBSD: if_bwfm_sdio.c,v 1.18 2020/05/30 15:55:47 jdolecek Exp $ */
 /* $OpenBSD: if_bwfm_sdio.c,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -44,8 +44,8 @@
 #include 
 #include 
 
-#include 
 #include 
+#include 
 #include 
 
 #ifdef BWFM_DEBUG



CVS commit: src

2020-05-30 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Sat May 30 14:16:57 UTC 2020

Modified Files:
src/lib/libnpf: libnpf.3 npf.c npf.h
src/sys/net/npf: files.npf npf.c npf.h npf_alg.c npf_alg_icmp.c
npf_conf.c npf_conn.c npf_conn.h npf_conndb.c npf_connkey.c
npf_ctl.c npf_ext_log.c npf_ext_normalize.c npf_ext_rndblock.c
npf_handler.c npf_if.c npf_ifaddr.c npf_impl.h npf_inet.c
npf_mbuf.c npf_nat.c npf_os.c npf_params.c npf_portmap.c
npf_rproc.c npf_ruleset.c npf_sendpkt.c npf_state.c npf_state_tcp.c
npf_tableset.c npf_worker.c npfkern.h
src/usr.sbin/npf: npf-params.7
src/usr.sbin/npf/npfctl: Makefile npf.conf.5 npf_bpf_comp.c npf_build.c
npf_parse.y npf_scan.l npf_show.c npf_var.c npf_var.h npfctl.8
npfctl.c npfctl.h
src/usr.sbin/npf/npftest: npftest.c npftest.conf npftest.h
src/usr.sbin/npf/npftest/libnpftest: Makefile npf_mbuf_subr.c
npf_nat_test.c npf_state_test.c npf_test.h npf_test_subr.c
Added Files:
src/usr.sbin/npf/npfctl: npf_cmd.c
src/usr.sbin/npf/npftest/libnpftest: npf_gc_test.c
Removed Files:
src/usr.sbin/npf/npftest/libnpftest: npf_conn_test.c

Log Message:
Major NPF improvements (merge from upstream):

- Switch to the C11-style atomic primitives using atomic_loadstore(9).

- npfkern: introduce the 'state.key.interface' and 'state.key.direction'
  settings.  Users can now choose whether the connection state should be
  strictly per-interface or global at the configuration level.  Keep NAT
  logic to be always per-interface, though.

- npfkern: rewrite the G/C worker logic and make it self-tuning.

- npfkern and libnpf: multiple bug fixes; add param exporting; introduce
  more parameters.  Remove npf_nvlist_{copyin,copyout}() functions and
  refactor npfctl_load_nvlist() with others; add npfctl_run_op() to have
  a single entry point for operations.  Introduce npf_flow_t and clean up
  some code.

- npfctl: lots of fixes for the 'npfctl show' logic; make 'npfctl list'
  more informative; misc usability improvements and more user-friendly
  error messages.

- Amend and improve the manual pages.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/lib/libnpf/libnpf.3
cvs rdiff -u -r1.48 -r1.49 src/lib/libnpf/npf.c
cvs rdiff -u -r1.38 -r1.39 src/lib/libnpf/npf.h
cvs rdiff -u -r1.22 -r1.23 src/sys/net/npf/files.npf \
src/sys/net/npf/npf_state.c
cvs rdiff -u -r1.42 -r1.43 src/sys/net/npf/npf.c
cvs rdiff -u -r1.62 -r1.63 src/sys/net/npf/npf.h
cvs rdiff -u -r1.21 -r1.22 src/sys/net/npf/npf_alg.c \
src/sys/net/npf/npf_sendpkt.c
cvs rdiff -u -r1.32 -r1.33 src/sys/net/npf/npf_alg_icmp.c
cvs rdiff -u -r1.16 -r1.17 src/sys/net/npf/npf_conf.c \
src/sys/net/npf/npf_ext_log.c
cvs rdiff -u -r1.31 -r1.32 src/sys/net/npf/npf_conn.c
cvs rdiff -u -r1.19 -r1.20 src/sys/net/npf/npf_conn.h \
src/sys/net/npf/npf_rproc.c
cvs rdiff -u -r1.8 -r1.9 src/sys/net/npf/npf_conndb.c \
src/sys/net/npf/npf_ext_rndblock.c
cvs rdiff -u -r1.1 -r1.2 src/sys/net/npf/npf_connkey.c
cvs rdiff -u -r1.59 -r1.60 src/sys/net/npf/npf_ctl.c
cvs rdiff -u -r1.9 -r1.10 src/sys/net/npf/npf_ext_normalize.c
cvs rdiff -u -r1.48 -r1.49 src/sys/net/npf/npf_handler.c
cvs rdiff -u -r1.12 -r1.13 src/sys/net/npf/npf_if.c
cvs rdiff -u -r1.6 -r1.7 src/sys/net/npf/npf_ifaddr.c
cvs rdiff -u -r1.80 -r1.81 src/sys/net/npf/npf_impl.h
cvs rdiff -u -r1.56 -r1.57 src/sys/net/npf/npf_inet.c
cvs rdiff -u -r1.23 -r1.24 src/sys/net/npf/npf_mbuf.c
cvs rdiff -u -r1.49 -r1.50 src/sys/net/npf/npf_nat.c
cvs rdiff -u -r1.17 -r1.18 src/sys/net/npf/npf_os.c
cvs rdiff -u -r1.2 -r1.3 src/sys/net/npf/npf_params.c
cvs rdiff -u -r1.4 -r1.5 src/sys/net/npf/npf_portmap.c \
src/sys/net/npf/npfkern.h
cvs rdiff -u -r1.50 -r1.51 src/sys/net/npf/npf_ruleset.c
cvs rdiff -u -r1.20 -r1.21 src/sys/net/npf/npf_state_tcp.c
cvs rdiff -u -r1.34 -r1.35 src/sys/net/npf/npf_tableset.c
cvs rdiff -u -r1.7 -r1.8 src/sys/net/npf/npf_worker.c
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/npf/npf-params.7
cvs rdiff -u -r1.14 -r1.15 src/usr.sbin/npf/npfctl/Makefile
cvs rdiff -u -r1.90 -r1.91 src/usr.sbin/npf/npfctl/npf.conf.5
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/npf/npfctl/npf_bpf_comp.c
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/npf/npfctl/npf_build.c
cvs rdiff -u -r0 -r1.1 src/usr.sbin/npf/npfctl/npf_cmd.c
cvs rdiff -u -r1.50 -r1.51 src/usr.sbin/npf/npfctl/npf_parse.y
cvs rdiff -u -r1.31 -r1.32 src/usr.sbin/npf/npfctl/npf_scan.l \
src/usr.sbin/npf/npfctl/npf_show.c
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/npf/npfctl/npf_var.c
cvs rdiff -u -r1.9 -r1.10 src/usr.sbin/npf/npfctl/npf_var.h
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/npf/npfctl/npfctl.8
cvs rdiff -u -r1.63 -r1.64 src/usr.sbin/npf/npfctl/npfctl.c
cvs rdiff -u -r1.52 -r1.53 src/usr.sbin/npf/npfctl/npfctl.h
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/npf/npftest/npftest.c
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/npf/npftest/npftest.conf
cvs 

CVS commit: src/sys/dev/wsfb

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 14:15:43 UTC 2020

Modified Files:
src/sys/dev/wsfb: genfb.c

Log Message:
reduce stack usage in genfb_calc_hsize()


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/wsfb/genfb.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/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.72 src/sys/dev/wsfb/genfb.c:1.73
--- src/sys/dev/wsfb/genfb.c:1.72	Mon Apr 13 15:26:57 2020
+++ src/sys/dev/wsfb/genfb.c	Sat May 30 14:15:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb.c,v 1.72 2020/04/13 15:26:57 msaitoh Exp $ */
+/*	$NetBSD: genfb.c,v 1.73 2020/05/30 14:15:43 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.72 2020/04/13 15:26:57 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.73 2020/05/30 14:15:43 jdolecek Exp $");
 
 #include 
 #include 
@@ -632,18 +632,25 @@ genfb_calc_hsize(struct genfb_softc *sc)
 	device_t dev = sc->sc_dev;
 	prop_dictionary_t dict = device_properties(dev);
 	prop_data_t edid_data;
-	struct edid_info edid;
+	struct edid_info *edid;
 	const char *edid_ptr;
+	int hsize;
 
 	edid_data = prop_dictionary_get(dict, "EDID");
 	if (edid_data == NULL || prop_data_size(edid_data) < 128)
 		return 0;
 
+	edid = kmem_alloc(sizeof(*edid), KM_SLEEP);
+
 	edid_ptr = prop_data_data_nocopy(edid_data);
-	if (edid_parse(__UNCONST(edid_ptr), ) != 0)
-		return 0;
+	if (edid_parse(__UNCONST(edid_ptr), edid) == 0)
+		hsize = (int)edid->edid_max_hsize * 10;
+	else
+		hsize = 0;
+
+	kmem_free(edid, sizeof(*edid));
 
-	return (int)edid.edid_max_hsize * 10;
+	return hsize;
 }
 
 /* Return the minimum number of character columns based on DPI */



CVS commit: src/sys/dev/wsfb

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 14:15:43 UTC 2020

Modified Files:
src/sys/dev/wsfb: genfb.c

Log Message:
reduce stack usage in genfb_calc_hsize()


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/wsfb/genfb.c

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



CVS commit: src/sys/dev/ic

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 14:03:08 UTC 2020

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

Log Message:
reduce stack usage in bwfm_rx_event_cb(), can use KM_SLEEP because
this is called from workqueue handler (i.e. thread context)


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/ic/bwfm.c

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



CVS commit: src/sys/dev/ic

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 14:03:08 UTC 2020

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

Log Message:
reduce stack usage in bwfm_rx_event_cb(), can use KM_SLEEP because
this is called from workqueue handler (i.e. thread context)


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/ic/bwfm.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/bwfm.c
diff -u src/sys/dev/ic/bwfm.c:1.23 src/sys/dev/ic/bwfm.c:1.24
--- src/sys/dev/ic/bwfm.c:1.23	Sat May 30 13:41:58 2020
+++ src/sys/dev/ic/bwfm.c	Sat May 30 14:03:08 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfm.c,v 1.23 2020/05/30 13:41:58 jdolecek Exp $ */
+/* $NetBSD: bwfm.c,v 1.24 2020/05/30 14:03:08 jdolecek Exp $ */
 /* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -2143,12 +2143,15 @@ bwfm_rx_event_cb(struct bwfm_softc *sc, 
 			union {
 struct bwfm_bss_info bss_info;
 uint8_t padding[BWFM_BSS_INFO_BUFLEN];
-			} bss_buf;
-			if (len > sizeof(bss_buf)) {
+			} *bss_buf;
+			if (len > sizeof(*bss_buf)) {
 printf("%s: bss_info buffer too big\n", DEVNAME(sc));
 			} else {
-memcpy(_buf, >bss_info[i], len);
-bwfm_scan_node(sc, _buf.bss_info, len);
+bss_buf = kmem_alloc(sizeof(*bss_buf),
+KM_SLEEP);
+memcpy(bss_buf, >bss_info[i], len);
+bwfm_scan_node(sc, _buf->bss_info, len);
+kmem_free(bss_buf, sizeof(*bss_buf));
 			}
 			len -= sizeof(*bss) + le32toh(bss->length);
 			bss = (void *)(((uintptr_t)bss) + le32toh(bss->length));



CVS commit: src/sys/dev

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 13:41:58 UTC 2020

Modified Files:
src/sys/dev/ic: bwfm.c bwfmvar.h
src/sys/dev/pci: if_bwfm_pci.c
src/sys/dev/sdmmc: if_bwfm_sdio.c

Log Message:
constify, and make static where possible


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/ic/bwfm.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/bwfmvar.h
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/if_bwfm_pci.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/sdmmc/if_bwfm_sdio.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/bwfm.c
diff -u src/sys/dev/ic/bwfm.c:1.22 src/sys/dev/ic/bwfm.c:1.23
--- src/sys/dev/ic/bwfm.c:1.22	Wed Mar 25 04:53:11 2020
+++ src/sys/dev/ic/bwfm.c	Sat May 30 13:41:58 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfm.c,v 1.22 2020/03/25 04:53:11 thorpej Exp $ */
+/* $NetBSD: bwfm.c,v 1.23 2020/05/30 13:41:58 jdolecek Exp $ */
 /* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -119,15 +119,15 @@ void	 bwfm_rx_event(struct bwfm_softc *,
 void	 bwfm_rx_event_cb(struct bwfm_softc *, struct mbuf *);
 void	 bwfm_scan_node(struct bwfm_softc *, struct bwfm_bss_info *, size_t);
 
-uint8_t bwfm_2ghz_channels[] = {
+static const uint8_t bwfm_2ghz_channels[] = {
 	1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
 };
-uint8_t bwfm_5ghz_channels[] = {
+static const uint8_t bwfm_5ghz_channels[] = {
 	34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, 100, 104, 108, 112,
 	116, 120, 124, 128, 132, 136, 140, 144, 149, 153, 157, 161, 165,
 };
 
-struct bwfm_proto_ops bwfm_proto_bcdc_ops = {
+const struct bwfm_proto_ops bwfm_proto_bcdc_ops = {
 	.proto_query_dcmd = bwfm_proto_bcdc_query_dcmd,
 	.proto_set_dcmd = bwfm_proto_bcdc_set_dcmd,
 };

Index: src/sys/dev/ic/bwfmvar.h
diff -u src/sys/dev/ic/bwfmvar.h:1.8 src/sys/dev/ic/bwfmvar.h:1.9
--- src/sys/dev/ic/bwfmvar.h:1.8	Wed Mar 25 04:53:11 2020
+++ src/sys/dev/ic/bwfmvar.h	Sat May 30 13:41:58 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfmvar.h,v 1.8 2020/03/25 04:53:11 thorpej Exp $ */
+/* $NetBSD: bwfmvar.h,v 1.9 2020/05/30 13:41:58 jdolecek Exp $ */
 /* $OpenBSD: bwfmvar.h,v 1.1 2017/10/11 17:19:50 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -156,7 +156,7 @@ struct bwfm_proto_ops {
 	int (*proto_set_dcmd)(struct bwfm_softc *, int, int,
 	char *, size_t);
 };
-extern struct bwfm_proto_ops bwfm_proto_bcdc_ops;
+extern const struct bwfm_proto_ops bwfm_proto_bcdc_ops;
 
 enum bwfm_task_cmd {
 	BWFM_TASK_NEWSTATE,
@@ -195,9 +195,9 @@ struct bwfm_softc {
 	struct ethercom		 sc_ec;
 #define	sc_if			 sc_ec.ec_if
 
-	struct bwfm_bus_ops	*sc_bus_ops;
-	struct bwfm_buscore_ops	*sc_buscore_ops;
-	struct bwfm_proto_ops	*sc_proto_ops;
+	const struct bwfm_bus_ops	*sc_bus_ops;
+	const struct bwfm_buscore_ops	*sc_buscore_ops;
+	const struct bwfm_proto_ops	*sc_proto_ops;
 	struct bwfm_chip	 sc_chip;
 	uint8_t			 sc_io_type;
 #define		BWFM_IO_TYPE_D11N		1

Index: src/sys/dev/pci/if_bwfm_pci.c
diff -u src/sys/dev/pci/if_bwfm_pci.c:1.7 src/sys/dev/pci/if_bwfm_pci.c:1.8
--- src/sys/dev/pci/if_bwfm_pci.c:1.7	Wed Mar 25 03:44:45 2020
+++ src/sys/dev/pci/if_bwfm_pci.c	Sat May 30 13:41:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bwfm_pci.c,v 1.7 2020/03/25 03:44:45 thorpej Exp $	*/
+/*	$NetBSD: if_bwfm_pci.c,v 1.8 2020/05/30 13:41:58 jdolecek Exp $	*/
 /*	$OpenBSD: if_bwfm_pci.c,v 1.18 2018/02/08 05:00:38 patrick Exp $	*/
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -290,7 +290,7 @@ int		 bwfm_pci_msgbuf_query_dcmd(struct 
 int		 bwfm_pci_msgbuf_set_dcmd(struct bwfm_softc *, int,
 		int, char *, size_t);
 
-struct bwfm_buscore_ops bwfm_pci_buscore_ops = {
+static const struct bwfm_buscore_ops bwfm_pci_buscore_ops = {
 	.bc_read = bwfm_pci_buscore_read,
 	.bc_write = bwfm_pci_buscore_write,
 	.bc_prepare = bwfm_pci_buscore_prepare,
@@ -299,7 +299,7 @@ struct bwfm_buscore_ops bwfm_pci_buscore
 	.bc_activate = bwfm_pci_buscore_activate,
 };
 
-struct bwfm_bus_ops bwfm_pci_bus_ops = {
+static const struct bwfm_bus_ops bwfm_pci_bus_ops = {
 	.bs_init = NULL,
 	.bs_stop = bwfm_pci_stop,
 	.bs_txcheck = bwfm_pci_txcheck,
@@ -308,7 +308,7 @@ struct bwfm_bus_ops bwfm_pci_bus_ops = {
 	.bs_rxctl = NULL,
 };
 
-struct bwfm_proto_ops bwfm_pci_msgbuf_ops = {
+static const struct bwfm_proto_ops bwfm_pci_msgbuf_ops = {
 	.proto_query_dcmd = bwfm_pci_msgbuf_query_dcmd,
 	.proto_set_dcmd = bwfm_pci_msgbuf_set_dcmd,
 };

Index: src/sys/dev/sdmmc/if_bwfm_sdio.c
diff -u src/sys/dev/sdmmc/if_bwfm_sdio.c:1.16 src/sys/dev/sdmmc/if_bwfm_sdio.c:1.17
--- src/sys/dev/sdmmc/if_bwfm_sdio.c:1.16	Sun May 24 17:26:18 2020
+++ src/sys/dev/sdmmc/if_bwfm_sdio.c	Sat May 30 13:41:58 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bwfm_sdio.c,v 1.16 2020/05/24 17:26:18 riastradh Exp $ */
+/* $NetBSD: if_bwfm_sdio.c,v 1.17 2020/05/30 13:41:58 jdolecek Exp $ */
 /* $OpenBSD: 

CVS commit: src/sys/dev

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 13:41:58 UTC 2020

Modified Files:
src/sys/dev/ic: bwfm.c bwfmvar.h
src/sys/dev/pci: if_bwfm_pci.c
src/sys/dev/sdmmc: if_bwfm_sdio.c

Log Message:
constify, and make static where possible


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/ic/bwfm.c
cvs rdiff -u -r1.8 -r1.9 src/sys/dev/ic/bwfmvar.h
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/if_bwfm_pci.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/sdmmc/if_bwfm_sdio.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/amd64/conf

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 13:35:31 UTC 2020

Modified Files:
src/sys/arch/amd64/conf: ALL

Log Message:
add bwfm* at pci?, which is present in GENERIC


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/sys/arch/amd64/conf/ALL

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



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

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 13:35:31 UTC 2020

Modified Files:
src/sys/arch/amd64/conf: ALL

Log Message:
add bwfm* at pci?, which is present in GENERIC


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/sys/arch/amd64/conf/ALL

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

Modified files:

Index: src/sys/arch/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.151 src/sys/arch/amd64/conf/ALL:1.152
--- src/sys/arch/amd64/conf/ALL:1.151	Mon May 25 07:20:14 2020
+++ src/sys/arch/amd64/conf/ALL	Sat May 30 13:35:31 2020
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.151 2020/05/25 07:20:14 yamaguchi Exp $
+# $NetBSD: ALL,v 1.152 2020/05/30 13:35:31 jdolecek 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/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.151 $"
+#ident		"ALL-$Revision: 1.152 $"
 
 maxusers	64		# estimated number of users
 
@@ -964,6 +964,7 @@ bce*	at pci? dev ? function ?	# Broadcom
 bge*	at pci? dev ? function ?	# Broadcom 570x gigabit Ethernet
 bnx*	at pci? dev ? function ?	# Broadcom NetXtremeII gigabit Ethernet
 bwi*	at pci? dev ? function ?	# Broadcom BCM43xx wireless
+bwfm*	at pci? dev ? function ?	# Broadcom FullMAC
 cas*	at pci? dev ? function ?	# Sun Cassini/Cassini+ Ethernet
 dge*	at pci? dev ? function ?	# Intel 82597 10GbE LR
 ena*	at pci? dev ? function ?	# Amazon Elastic Network Adapter



Re: CVS commit: src/sys/dev/audio

2020-05-30 Thread nia
On Sat, May 30, 2020 at 09:48:36PM +0900, Tetsuya Isaki wrote:
> I will do it on next weekend.
> 
> Thanks,
> ---
> Tetsuya Isaki 

Thank you.


CVS commit: src/sys/dev/ic

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 13:23:14 UTC 2020

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

Log Message:
fix wdcprobe_with_reset() to avoid allocating big structures on stack


To generate a diff of this commit:
cvs rdiff -u -r1.301 -r1.302 src/sys/dev/ic/wdc.c

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



CVS commit: src/sys/dev/ic

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 13:23:14 UTC 2020

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

Log Message:
fix wdcprobe_with_reset() to avoid allocating big structures on stack


To generate a diff of this commit:
cvs rdiff -u -r1.301 -r1.302 src/sys/dev/ic/wdc.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/wdc.c
diff -u src/sys/dev/ic/wdc.c:1.301 src/sys/dev/ic/wdc.c:1.302
--- src/sys/dev/ic/wdc.c:1.301	Thu May 21 09:24:17 2020
+++ src/sys/dev/ic/wdc.c	Sat May 30 13:23:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: wdc.c,v 1.301 2020/05/21 09:24:17 jdolecek Exp $ */
+/*	$NetBSD: wdc.c,v 1.302 2020/05/30 13:23:14 jdolecek Exp $ */
 
 /*
  * Copyright (c) 1998, 2001, 2003 Manuel Bouyer.  All rights reserved.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.301 2020/05/21 09:24:17 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.302 2020/05/30 13:23:14 jdolecek Exp $");
 
 #include "opt_ata.h"
 #include "opt_wdc.h"
@@ -70,6 +70,7 @@ __KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.30
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -489,24 +490,28 @@ int
 wdcprobe_with_reset(struct wdc_regs *wdr,
 void (*do_reset)(struct ata_channel *, int))
 {
-	struct wdc_softc wdc;
-	struct ata_channel ch;
+	struct wdc_softc *wdc;
+	struct ata_channel *ch;
 	int rv;
 
-	memset(, 0, sizeof(wdc));
-	memset(, 0, sizeof(ch));
-	ata_channel_init();
-	ch.ch_atac = _atac;
-	wdc.regs = wdr;
+	wdc = kmem_zalloc(sizeof(*wdc), KM_SLEEP);
+	ch = kmem_zalloc(sizeof(*ch), KM_SLEEP);
+
+	ata_channel_init(ch);
+	ch->ch_atac = >sc_atac;
+	wdc->regs = wdr;
 
 	/* check the MD reset method */
-	wdc.reset = (do_reset != NULL) ? do_reset : wdc_do_reset;
+	wdc->reset = (do_reset != NULL) ? do_reset : wdc_do_reset;
+
+	ata_channel_lock(ch);
+	rv = wdcprobe1(ch, 1);
+	ata_channel_unlock(ch);
 
-	ata_channel_lock();
-	rv = wdcprobe1(, 1);
-	ata_channel_unlock();
+	ata_channel_destroy(ch);
 
-	ata_channel_destroy();
+	kmem_free(ch, sizeof(*ch));
+	kmem_free(wdc, sizeof(*wdc));
 
 	return rv;
 }



CVS commit: src/sys/dev/dtv

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 13:15:10 UTC 2020

Modified Files:
src/sys/dev/dtv: dtv_demux.c

Log Message:
allocate memory for dtv_ts_section using kmem_alloc() in dtv_demux_read(),
instead of on-stack

XXX compile-tested only


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/dtv/dtv_demux.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/dtv/dtv_demux.c
diff -u src/sys/dev/dtv/dtv_demux.c:1.10 src/sys/dev/dtv/dtv_demux.c:1.11
--- src/sys/dev/dtv/dtv_demux.c:1.10	Sun Feb 24 12:05:49 2019
+++ src/sys/dev/dtv/dtv_demux.c	Sat May 30 13:15:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: dtv_demux.c,v 1.10 2019/02/24 12:05:49 jmcneill Exp $ */
+/* $NetBSD: dtv_demux.c,v 1.11 2020/05/30 13:15:10 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill 
@@ -52,7 +52,7 @@
  */ 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dtv_demux.c,v 1.10 2019/02/24 12:05:49 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dtv_demux.c,v 1.11 2020/05/30 13:15:10 jdolecek Exp $");
 
 #include 
 #include 
@@ -492,7 +492,7 @@ dtv_demux_read(struct file *fp, off_t *o
 kauth_cred_t cred, int flags)
 {
 	struct dtv_demux *demux = fp->f_data;
-	struct dtv_ts_section sec;
+	struct dtv_ts_section *sec;
 	int error;
 
 	if (demux == NULL)
@@ -502,22 +502,25 @@ dtv_demux_read(struct file *fp, off_t *o
 	if (demux->dd_mode != DTV_DEMUX_MODE_SECTION)
 		return EIO;
 
+	sec = kmem_alloc(sizeof(*sec), KM_SLEEP);
+
 	/* Wait for a complete PSI section */
 	mutex_enter(>dd_lock);
 	while (demux->dd_secfilt.nsections == 0) {
 		if (flags & IO_NDELAY) {
 			mutex_exit(>dd_lock);
 			/* No data available */
-			return EWOULDBLOCK;
+			error = EWOULDBLOCK;
+			goto out;
 		}
 		error = cv_wait_sig(>dd_section_cv, >dd_lock);
 		if (error) {
 			mutex_exit(>dd_lock);
-			return error;
+			goto out;
 		}
 	}
 	/* Copy the completed PSI section */
-	sec = demux->dd_secfilt.section[demux->dd_secfilt.rp];
+	*sec = demux->dd_secfilt.section[demux->dd_secfilt.rp];
 	/* Update read pointer */
 	demux->dd_secfilt.rp++;
 	if (demux->dd_secfilt.rp >= __arraycount(demux->dd_secfilt.section))
@@ -540,7 +543,12 @@ dtv_demux_read(struct file *fp, off_t *o
 	 * it should not be an issue as PSI sections have a max size of 4KB
 	 * (and callers will generally provide a big enough buffer).
 	 */
-	return uiomove(sec.sec_buf, sec.sec_length, uio);
+	error = uiomove(sec->sec_buf, sec->sec_length, uio);
+
+out:
+	kmem_free(sec, sizeof(*sec));
+	return error;
+	
 }
 
 /*



CVS commit: src/sys/dev/dtv

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 13:15:10 UTC 2020

Modified Files:
src/sys/dev/dtv: dtv_demux.c

Log Message:
allocate memory for dtv_ts_section using kmem_alloc() in dtv_demux_read(),
instead of on-stack

XXX compile-tested only


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/dtv/dtv_demux.c

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



Re: CVS commit: src/sys/dev/audio

2020-05-30 Thread Tetsuya Isaki
At Fri, 29 May 2020 12:32:39 +,
nia wrote:
> OK... Can you request a pullup to ensure resuming with a stream
> playing doesn't panic on 9.1?

I will do it on next weekend.

Thanks,
---
Tetsuya Isaki 


CVS commit: src/distrib/evbarm/installimage

2020-05-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May 30 12:36:37 UTC 2020

Modified Files:
src/distrib/evbarm/installimage: Makefile

Log Message:
Make room for debug sets


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/evbarm/installimage/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/evbarm/installimage/Makefile
diff -u src/distrib/evbarm/installimage/Makefile:1.2 src/distrib/evbarm/installimage/Makefile:1.3
--- src/distrib/evbarm/installimage/Makefile:1.2	Thu May 28 19:20:57 2020
+++ src/distrib/evbarm/installimage/Makefile	Sat May 30 12:36:37 2020
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.2 2020/05/28 19:20:57 jmcneill Exp $
+#	$NetBSD: Makefile,v 1.3 2020/05/30 12:36:37 jmcneill Exp $
 
 .include 
 
 INSTIMGBASE=	NetBSD-${DISTRIBVER}-${MACHINE_ARCH}-install	# gives ${IMGBASE}.img
 
-INSTIMAGEMB?=	750			# for all installation binaries
+INSTIMAGEMB?=	1550			# for all installation binaries
 
 .if ${MACHINE_ARCH} == "aarch64"
 EFIBOOT=		${WORKDIR}/usr/mdec/bootaa64.efi



CVS commit: src/distrib/evbarm/installimage

2020-05-30 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat May 30 12:36:37 UTC 2020

Modified Files:
src/distrib/evbarm/installimage: Makefile

Log Message:
Make room for debug sets


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/evbarm/installimage/Makefile

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

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 10:43:46 UTC 2020

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

Log Message:
change pci_conf_print() to allocate memory for the regs dynamically
instead of on-stack


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.224 src/sys/dev/pci/pci_subr.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

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 10:43:46 UTC 2020

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

Log Message:
change pci_conf_print() to allocate memory for the regs dynamically
instead of on-stack


To generate a diff of this commit:
cvs rdiff -u -r1.223 -r1.224 src/sys/dev/pci/pci_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/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.223 src/sys/dev/pci/pci_subr.c:1.224
--- src/sys/dev/pci/pci_subr.c:1.223	Fri Apr 10 18:32:00 2020
+++ src/sys/dev/pci/pci_subr.c	Sat May 30 10:43:46 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.223 2020/04/10 18:32:00 christos Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.224 2020/05/30 10:43:46 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.223 2020/04/10 18:32:00 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.224 2020/05/30 10:43:46 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -52,6 +52,11 @@ __KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v
 #include 
 #include 
 #include 
+#include 
+
+#define MALLOC(sz)	kmem_alloc(sz, KM_SLEEP)
+#define FREE(p, sz)	kmem_free(p, sz)
+
 #else
 #include 
 #include 
@@ -59,6 +64,10 @@ __KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v
 #include 
 #include 
 #include 
+
+#define MALLOC(sz)	malloc(sz)
+#define FREE(p, sz)	free(p)
+
 #endif
 
 #include 
@@ -4810,7 +4819,7 @@ pci_conf_print(
 #endif
 )
 {
-	pcireg_t regs[o2i(PCI_EXTCONF_SIZE)];
+	pcireg_t *regs;
 	int off, capoff, endoff, hdrtype;
 	const char *type_name;
 #ifdef _KERNEL
@@ -4819,6 +4828,8 @@ pci_conf_print(
 	void (*type_printfn)(const pcireg_t *);
 #endif
 
+	regs = MALLOC(PCI_EXTCONF_SIZE);
+
 	printf("PCI configuration registers:\n");
 
 	for (off = 0; off < PCI_EXTCONF_SIZE; off += 4) {
@@ -4915,7 +4926,7 @@ pci_conf_print(
 
 	if (regs[o2i(PCI_EXTCAPLIST_BASE)] == 0x ||
 	regs[o2i(PCI_EXTCAPLIST_BASE)] == 0)
-		return;
+		goto out;
 
 	printf("\n");
 #ifdef _KERNEL
@@ -4928,4 +4939,7 @@ pci_conf_print(
 	/* Extended Configuration Space, if present */
 	printf("  Extended Configuration Space:\n");
 	pci_conf_print_regs(regs, PCI_EXTCAPLIST_BASE, PCI_EXTCONF_SIZE);
+
+out:
+	FREE(regs, PCI_EXTCONF_SIZE);
 }



CVS commit: src/sys/dev/pci

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 10:27:29 UTC 2020

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

Log Message:
remove #if 0'ed pci_conf_print() call


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/amdpm.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/amdpm.c
diff -u src/sys/dev/pci/amdpm.c:1.41 src/sys/dev/pci/amdpm.c:1.42
--- src/sys/dev/pci/amdpm.c:1.41	Thu Apr 30 03:40:53 2020
+++ src/sys/dev/pci/amdpm.c	Sat May 30 10:27:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdpm.c,v 1.41 2020/04/30 03:40:53 riastradh Exp $	*/
+/*	$NetBSD: amdpm.c,v 1.42 2020/05/30 10:27:29 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdpm.c,v 1.41 2020/04/30 03:40:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amdpm.c,v 1.42 2020/05/30 10:27:29 jdolecek Exp $");
 
 #include "opt_amdpm.h"
 
@@ -118,11 +118,6 @@ amdpm_attach(device_t parent, device_t s
 	sc->sc_iot = pa->pa_iot;
 	sc->sc_pa = pa;
 
-#if 0
-	aprint_normal_dev(self, "");
-	pci_conf_print(pa->pa_pc, pa->pa_tag, NULL);
-#endif
-
 	confreg = pci_conf_read(pa->pa_pc, pa->pa_tag, AMDPM_CONFREG);
 	/* enable pm i/o space for AMD-8111 and nForce */
 	if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_AMD_PBC8111_ACPI ||



CVS commit: src/sys/dev/pci

2020-05-30 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sat May 30 10:27:29 UTC 2020

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

Log Message:
remove #if 0'ed pci_conf_print() call


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/pci/amdpm.c

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



CVS commit: src/sys/uvm

2020-05-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 30 08:50:31 UTC 2020

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

Log Message:
Avoid passing file paths in panic strings, this results in extra long
output that is annoying and that syzbot classifies as independent reports
due to the instances having different build paths.


To generate a diff of this commit:
cvs rdiff -u -r1.383 -r1.384 src/sys/uvm/uvm_map.c

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

Modified files:

Index: src/sys/uvm/uvm_map.c
diff -u src/sys/uvm/uvm_map.c:1.383 src/sys/uvm/uvm_map.c:1.384
--- src/sys/uvm/uvm_map.c:1.383	Sat May  9 15:13:19 2020
+++ src/sys/uvm/uvm_map.c	Sat May 30 08:50:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.383 2020/05/09 15:13:19 thorpej Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.384 2020/05/30 08:50:31 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.383 2020/05/09 15:13:19 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.384 2020/05/30 08:50:31 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pax.h"
@@ -296,9 +296,8 @@ static struct vm_map_entry *
 static void	uvm_mapent_copy(struct vm_map_entry *, struct vm_map_entry *);
 static void	uvm_mapent_free(struct vm_map_entry *);
 #if defined(DEBUG)
-static void	_uvm_mapent_check(const struct vm_map_entry *, const char *,
-		int);
-#define	uvm_mapent_check(map)	_uvm_mapent_check(map, __FILE__, __LINE__)
+static void	_uvm_mapent_check(const struct vm_map_entry *, int);
+#define	uvm_mapent_check(map)	_uvm_mapent_check(map, __LINE__)
 #else /* defined(DEBUG) */
 #define	uvm_mapent_check(e)	/* nothing */
 #endif /* defined(DEBUG) */
@@ -827,7 +826,7 @@ uvm_mapent_copy(struct vm_map_entry *src
 
 #if defined(DEBUG)
 static void
-_uvm_mapent_check(const struct vm_map_entry *entry, const char *file, int line)
+_uvm_mapent_check(const struct vm_map_entry *entry, int line)
 {
 
 	if (entry->start >= entry->end) {
@@ -856,7 +855,7 @@ _uvm_mapent_check(const struct vm_map_en
 	return;
 
 bad:
-	panic("%s: bad entry %p (%s:%d)", __func__, entry, file, line);
+	panic("%s: bad entry %p, line %d", __func__, entry, line);
 }
 #endif /* defined(DEBUG) */
 



CVS commit: src/sys/uvm

2020-05-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 30 08:50:31 UTC 2020

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

Log Message:
Avoid passing file paths in panic strings, this results in extra long
output that is annoying and that syzbot classifies as independent reports
due to the instances having different build paths.


To generate a diff of this commit:
cvs rdiff -u -r1.383 -r1.384 src/sys/uvm/uvm_map.c

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



CVS commit: src/sys

2020-05-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 30 08:41:23 UTC 2020

Modified Files:
src/sys/arch/amd64/include: ptrace.h
src/sys/arch/i386/include: ptrace.h
src/sys/kern: sys_ptrace_common.c

Log Message:
Introduce PTRACE_REGS_ALIGN, and on x86, enforce a 16-byte alignment, due
to fpregs having fxsave which requires 16-byte alignment.

Reported-by: syzbot+f44d47e617ebf7fda...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amd64/include/ptrace.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/include/ptrace.h
cvs rdiff -u -r1.82 -r1.83 src/sys/kern/sys_ptrace_common.c

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

Modified files:

Index: src/sys/arch/amd64/include/ptrace.h
diff -u src/sys/arch/amd64/include/ptrace.h:1.21 src/sys/arch/amd64/include/ptrace.h:1.22
--- src/sys/arch/amd64/include/ptrace.h:1.21	Wed Jan  8 17:21:38 2020
+++ src/sys/arch/amd64/include/ptrace.h	Sat May 30 08:41:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.21 2020/01/08 17:21:38 mgorny Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.22 2020/05/30 08:41:22 maxv Exp $	*/
 
 /*
  * Copyright (c) 1993 Christopher G. Demetriou
@@ -101,6 +101,12 @@
 int process_machdep_doxstate(struct lwp *, struct lwp *, struct uio *);
 int process_machdep_validfpu(struct proc *);
 
+/*
+ * The fpregs structure contains an fxsave area, which must have 16-byte
+ * alignment.
+ */
+#define PTRACE_REGS_ALIGN __aligned(16)
+
 #include 
 MODULE_HOOK(netbsd32_process_doxmmregs_hook, int,
 (struct lwp *, struct lwp *, void *, bool));

Index: src/sys/arch/i386/include/ptrace.h
diff -u src/sys/arch/i386/include/ptrace.h:1.25 src/sys/arch/i386/include/ptrace.h:1.26
--- src/sys/arch/i386/include/ptrace.h:1.25	Thu Jan  9 10:46:31 2020
+++ src/sys/arch/i386/include/ptrace.h	Sat May 30 08:41:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ptrace.h,v 1.25 2020/01/09 10:46:31 kamil Exp $	*/
+/*	$NetBSD: ptrace.h,v 1.26 2020/05/30 08:41:23 maxv Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -187,6 +187,12 @@ int	procfs_machdep_doxmmregs(struct lwp 
 	struct pfsnode *, struct uio *);
 int	procfs_machdep_validxmmregs(struct lwp *, struct mount *);
 
+/*
+ * The fpregs structure contains an fxsave area, which must have 16-byte
+ * alignment.
+ */
+#define PTRACE_REGS_ALIGN __aligned(16)
+
 #endif /* _KERNEL */
 
 #endif /* _I386_PTRACE_H_ */

Index: src/sys/kern/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.82 src/sys/kern/sys_ptrace_common.c:1.83
--- src/sys/kern/sys_ptrace_common.c:1.82	Tue May 26 23:08:56 2020
+++ src/sys/kern/sys_ptrace_common.c	Sat May 30 08:41:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace_common.c,v 1.82 2020/05/26 23:08:56 kamil Exp $	*/
+/*	$NetBSD: sys_ptrace_common.c,v 1.83 2020/05/30 08:41:22 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.82 2020/05/26 23:08:56 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.83 2020/05/30 08:41:22 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -214,6 +214,10 @@ static kcondvar_t ptrace_cv;
 # define PT_REGISTERS
 #endif
 
+#ifndef PTRACE_REGS_ALIGN
+#define PTRACE_REGS_ALIGN /* nothing */
+#endif
+
 static int
 ptrace_listener_cb(kauth_cred_t cred, kauth_action_t action, void *cookie,
 void *arg0, void *arg1, void *arg2, void *arg3)
@@ -1591,7 +1595,7 @@ static int
 proc_regio(struct lwp *l, struct uio *uio, size_t ks, regrfunc_t r,
 regwfunc_t w)
 {
-	char buf[1024];
+	char buf[1024] PTRACE_REGS_ALIGN;
 	int error;
 	char *kv;
 	size_t kl;



CVS commit: src/sys

2020-05-30 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat May 30 08:41:23 UTC 2020

Modified Files:
src/sys/arch/amd64/include: ptrace.h
src/sys/arch/i386/include: ptrace.h
src/sys/kern: sys_ptrace_common.c

Log Message:
Introduce PTRACE_REGS_ALIGN, and on x86, enforce a 16-byte alignment, due
to fpregs having fxsave which requires 16-byte alignment.

Reported-by: syzbot+f44d47e617ebf7fda...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amd64/include/ptrace.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/i386/include/ptrace.h
cvs rdiff -u -r1.82 -r1.83 src/sys/kern/sys_ptrace_common.c

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