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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 05:02:49 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: sni_i2c.c

Log Message:
use correct compatible designation


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sociox/sni_i2c.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/arm/sociox/sni_i2c.c
diff -u src/sys/arch/arm/sociox/sni_i2c.c:1.1 src/sys/arch/arm/sociox/sni_i2c.c:1.2
--- src/sys/arch/arm/sociox/sni_i2c.c:1.1	Wed Mar 18 03:33:49 2020
+++ src/sys/arch/arm/sociox/sni_i2c.c	Wed Mar 18 05:02:48 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sni_i2c.c,v 1.1 2020/03/18 03:33:49 nisimura Exp $	*/
+/*	$NetBSD: sni_i2c.c,v 1.2 2020/03/18 05:02:48 nisimura Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sni_i2c.c,v 1.1 2020/03/18 03:33:49 nisimura Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sni_i2c.c,v 1.2 2020/03/18 05:02:48 nisimura Exp $");
 
 #include 
 #include 
@@ -71,8 +71,7 @@ static int
 sniiic_fdt_match(device_t parent, struct cfdata *match, void *aux)
 {
 	static const char * compatible[] = {
-		"socionext,synquacer-sdhci",
-		"fujitsu,mb86s70-sdhci-3.0",
+		"socionext,synquacer-i2c",
 		NULL
 	};
 	struct fdt_attach_args * const faa = aux;



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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 05:02:49 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: sni_i2c.c

Log Message:
use correct compatible designation


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/sociox/sni_i2c.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/usb

2020-03-17 Thread Robert Elz
Date:Tue, 17 Mar 2020 22:58:24 -0400
From:"Christos Zoulas" 
Message-ID:  <20200318025824.93b28f...@cvs.netbsd.org>

  | Log Message:
  | define un (pointed out by kre@)

The reason I didn't suggest that change, is that now un is unused
when USB_DEBUG is not defined.   At the very least it would need a
__debugused or whatever that #define for the relevant attribute is.

But for just a single use, it seemed simpler just to use the value
used to init the var that is (now) only used the once.

kre



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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 04:02:20 UTC 2020

Modified Files:
src/sys/arch/evbarm/conf: GENERIC64

Log Message:
sort Ethernet devices for ease to read


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/arch/evbarm/conf/GENERIC64

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/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.144 src/sys/arch/evbarm/conf/GENERIC64:1.145
--- src/sys/arch/evbarm/conf/GENERIC64:1.144	Wed Mar 18 03:26:14 2020
+++ src/sys/arch/evbarm/conf/GENERIC64	Wed Mar 18 04:02:20 2020
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.144 2020/03/18 03:26:14 nisimura Exp $
+#	$NetBSD: GENERIC64,v 1.145 2020/03/18 04:02:20 nisimura Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -325,12 +325,12 @@ pci*		at ppb?
 awge*		at fdt?# DesignWare Gigabit Ethernet
 emac*		at fdt?# Allwinner Gigabit Ethernet (EMAC)
 enet*		at fdt?# IMX FEC
-#scx*		at fdt?# Socionext Gigabit Ethernet
-#scx*		at acpi?
-aq*		at pci? dev ? function ?	# Aquantia AQC 10 gigabit
-ena*		at pci? dev ? function ?	# Amazon.com Elastic Network Adapter
 genet*		at acpi?			# Broadcom GENET v5
 genet*		at fdt?
+#scx*		at acpi?			# Socionext Gigabit Ethernet
+#scx*		at fdt?	
+aq*		at pci? dev ? function ?	# Aquantia AQC 10 gigabit
+ena*		at pci? dev ? function ?	# Amazon.com Elastic Network Adapter
 mcx*		at pci? dev ? function ?	# Mellanox 5th generation Ethernet
 mskc*		at pci? dev ? function ?	# Marvell Yukon 2 Gigabit Ethernet
 msk*		at mskc?



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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 04:02:20 UTC 2020

Modified Files:
src/sys/arch/evbarm/conf: GENERIC64

Log Message:
sort Ethernet devices for ease to read


To generate a diff of this commit:
cvs rdiff -u -r1.144 -r1.145 src/sys/arch/evbarm/conf/GENERIC64

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



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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 03:49:17 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: files.sociox

Log Message:
uncomment sniemmc and sniiic devices


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sociox/files.sociox

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

Modified files:

Index: src/sys/arch/arm/sociox/files.sociox
diff -u src/sys/arch/arm/sociox/files.sociox:1.5 src/sys/arch/arm/sociox/files.sociox:1.6
--- src/sys/arch/arm/sociox/files.sociox:1.5	Wed Mar 18 02:36:53 2020
+++ src/sys/arch/arm/sociox/files.sociox	Wed Mar 18 03:49:17 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sociox,v 1.5 2020/03/18 02:36:53 nisimura Exp $
+#	$NetBSD: files.sociox,v 1.6 2020/03/18 03:49:17 nisimura Exp $
 #
 # Configuration info for Socionext Unifier/SC2A11
 #
@@ -18,14 +18,14 @@ file	arch/arm/sociox/if_ave.c		ave
 
 # Socionext eMMC
 device	sniemmc: sdmmcbus
-#attach	sdhc at fdt with sniemmc_fdt
-#attach	sdhc at acpinodebus with sniemmc_acpi
+attach	sniemmc at fdt with sniemmc_fdt
+attach	sniemmc at acpinodebus with sniemmc_acpi
 file	arch/arm/sociox/sni_emmc.c		sniemmc
 
 # Socionext I2C
 device	sniiic: i2cbus
-#attach	sniiic at fdt with sniiic_fdt
-#attach	sniiic at acpinodebus with sniiic_acpi
+attach	sniiic at fdt with sniiic_fdt
+attach	sniiic at acpinodebus with sniiic_acpi
 file	arch/arm/sociox/sni_i2c.c		sniiic	needs-flag
 
 # Socionext GPIO



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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 03:49:17 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: files.sociox

Log Message:
uncomment sniemmc and sniiic devices


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/sociox/files.sociox

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



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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 03:33:50 UTC 2020

Added Files:
src/sys/arch/arm/sociox: sni_emmc.c sni_i2c.c

Log Message:
new skelton files for SC2A11 eMMC and I2C


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sociox/sni_emmc.c \
src/sys/arch/arm/sociox/sni_i2c.c

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

Added files:

Index: src/sys/arch/arm/sociox/sni_emmc.c
diff -u /dev/null src/sys/arch/arm/sociox/sni_emmc.c:1.1
--- /dev/null	Wed Mar 18 03:33:50 2020
+++ src/sys/arch/arm/sociox/sni_emmc.c	Wed Mar 18 03:33:49 2020
@@ -0,0 +1,121 @@
+/*	$NetBSD: sni_emmc.c,v 1.1 2020/03/18 03:33:49 nisimura Exp $	*/
+
+/*-
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Tohru Nishimura.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/*
+ * Socionext SC2A11 SynQuacer eMMC driver
+ */
+
+#include 
+__KERNEL_RCSID(0, "$NetBSD: sni_emmc.c,v 1.1 2020/03/18 03:33:49 nisimura Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+static int sniemmc_fdt_match(device_t, struct cfdata *, void *);
+static void sniemmc_fdt_attach(device_t, device_t, void *);
+static int sniemmc_acpi_match(device_t, struct cfdata *, void *);
+static void sniemmc_acpi_attach(device_t, device_t, void *);
+
+struct sniemmc_softc {
+	device_t sc_dev;
+};
+
+CFATTACH_DECL_NEW(sniemmc_fdt, sizeof(struct sniemmc_softc),
+sniemmc_fdt_match, sniemmc_fdt_attach, NULL, NULL);
+
+CFATTACH_DECL_NEW(sniemmc_acpi, sizeof(struct sniemmc_softc),
+sniemmc_acpi_match, sniemmc_acpi_attach, NULL, NULL);
+
+static int sniemmc_attach_i(struct sniemmc_softc *);
+
+static int
+sniemmc_fdt_match(device_t parent, struct cfdata *match, void *aux)
+{
+	static const char * compatible[] = {
+		"socionext,synquacer-sdhci",
+		"fujitsu,mb86s70-sdhci-3.0",
+		NULL
+	};
+	struct fdt_attach_args * const faa = aux;
+
+	return of_match_compatible(faa->faa_phandle, compatible);
+}
+
+static void
+sniemmc_fdt_attach(device_t parent, device_t self, void *aux)
+{
+	struct sniemmc_softc * const sc = device_private(self);
+	int error;
+
+	error = sniemmc_attach_i(sc);
+	(void)error;
+}
+
+static int
+sniemmc_acpi_match(device_t parent, struct cfdata *match, void *aux)
+{
+	static const char * compatible[] = {
+		"SCX0002",
+		NULL
+	};
+	struct acpi_attach_args *aa = aux;
+
+	if (aa->aa_node->ad_type != ACPI_TYPE_DEVICE)
+		return 0;
+	return acpi_match_hid(aa->aa_node->ad_devinfo, compatible);
+}
+
+static void
+sniemmc_acpi_attach(device_t parent, device_t self, void *aux)
+{
+	struct sniemmc_softc * const sc = device_private(self);
+	int error;
+
+	error = sniemmc_attach_i(sc);
+	(void)error;
+}
+
+static int
+sniemmc_attach_i(struct sniemmc_softc *sc)
+{
+	return 0;
+}
Index: src/sys/arch/arm/sociox/sni_i2c.c
diff -u /dev/null src/sys/arch/arm/sociox/sni_i2c.c:1.1
--- /dev/null	Wed Mar 18 03:33:50 2020
+++ src/sys/arch/arm/sociox/sni_i2c.c	Wed Mar 18 03:33:49 2020
@@ -0,0 +1,121 @@
+/*	$NetBSD: sni_i2c.c,v 1.1 2020/03/18 03:33:49 nisimura Exp $	*/
+
+/*-
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Tohru Nishimura.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *

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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 03:33:50 UTC 2020

Added Files:
src/sys/arch/arm/sociox: sni_emmc.c sni_i2c.c

Log Message:
new skelton files for SC2A11 eMMC and I2C


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/sociox/sni_emmc.c \
src/sys/arch/arm/sociox/sni_i2c.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/evbarm/conf

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 03:26:14 UTC 2020

Modified Files:
src/sys/arch/evbarm/conf: GENERIC64

Log Message:
add SC2A11 sniemmc and sniiic devices


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/arch/evbarm/conf/GENERIC64

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/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.143 src/sys/arch/evbarm/conf/GENERIC64:1.144
--- src/sys/arch/evbarm/conf/GENERIC64:1.143	Wed Mar 18 02:21:24 2020
+++ src/sys/arch/evbarm/conf/GENERIC64	Wed Mar 18 03:26:14 2020
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.143 2020/03/18 02:21:24 nisimura Exp $
+#	$NetBSD: GENERIC64,v 1.144 2020/03/18 03:26:14 nisimura Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -325,7 +325,7 @@ pci*		at ppb?
 awge*		at fdt?# DesignWare Gigabit Ethernet
 emac*		at fdt?# Allwinner Gigabit Ethernet (EMAC)
 enet*		at fdt?# IMX FEC
-#scx*		at fdt?# SocioNext Gigabit Ethernet
+#scx*		at fdt?# Socionext Gigabit Ethernet
 #scx*		at acpi?
 aq*		at pci? dev ? function ?	# Aquantia AQC 10 gigabit
 ena*		at pci? dev ? function ?	# Amazon.com Elastic Network Adapter
@@ -391,6 +391,8 @@ rkiic*		at fdt? pass 4		# Rockchip I2C
 sunxirsb*	at fdt?	pass 4		# Allwinner RSB
 sunxitwi*	at fdt?			# Allwinner TWI
 tegrai2c*	at fdt? pass 4		# NVIDIA Tegra I2C
+#sniiic*	at fdt?			# Socionext SC2A11 I2C
+#sniiic*	at acpi?
 iic*		at i2cbus?
 
 # I2C devices
@@ -431,6 +433,8 @@ rkemmcphy*	at fdt?			# Rockchip eMMC PHY
 sdhc*		at fdt?			# SD Host Controller Interface
 sdhc*		at acpi?
 sunximmc*	at fdt?			# Allwinner SD/MMC
+#sniemmc*	at fdt?			# Socionext SC2A11 eMMC
+#sniemmc*	at acpi?
 sdmmc*		at sdmmcbus?
 ld0		at sdmmc0
 ld1		at sdmmc1



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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 03:26:14 UTC 2020

Modified Files:
src/sys/arch/evbarm/conf: GENERIC64

Log Message:
add SC2A11 sniemmc and sniiic devices


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/arch/evbarm/conf/GENERIC64

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-03-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 18 02:58:24 UTC 2020

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

Log Message:
define un (pointed out by kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/dev/usb/if_aue.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-03-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Mar 18 02:58:24 UTC 2020

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

Log Message:
define un (pointed out by kre@)


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/dev/usb/if_aue.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_aue.c
diff -u src/sys/dev/usb/if_aue.c:1.168 src/sys/dev/usb/if_aue.c:1.169
--- src/sys/dev/usb/if_aue.c:1.168	Sun Mar 15 19:04:50 2020
+++ src/sys/dev/usb/if_aue.c	Tue Mar 17 22:58:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aue.c,v 1.168 2020/03/15 23:04:50 thorpej Exp $	*/
+/*	$NetBSD: if_aue.c,v 1.169 2020/03/18 02:58:24 christos Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.168 2020/03/15 23:04:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.169 2020/03/18 02:58:24 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1012,6 +1012,7 @@ aue_uno_init(struct ifnet *ifp)
 static int
 aue_uno_ioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
+	struct usbnet * const	un = ifp->if_softc;
 
 	AUEHIST_FUNC();
 	AUEHIST_CALLARGSN(5, "aue%jd: enter cmd %#jx data %#jx",



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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 02:36:53 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: files.sociox

Log Message:
more fdt/ACPI dual attach glue. SCX0002 and SCX0003 respectively


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/sociox/files.sociox

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



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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 02:36:53 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: files.sociox

Log Message:
more fdt/ACPI dual attach glue. SCX0002 and SCX0003 respectively


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/sociox/files.sociox

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

Modified files:

Index: src/sys/arch/arm/sociox/files.sociox
diff -u src/sys/arch/arm/sociox/files.sociox:1.4 src/sys/arch/arm/sociox/files.sociox:1.5
--- src/sys/arch/arm/sociox/files.sociox:1.4	Wed Mar 18 01:40:56 2020
+++ src/sys/arch/arm/sociox/files.sociox	Wed Mar 18 02:36:53 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sociox,v 1.4 2020/03/18 01:40:56 nisimura Exp $
+#	$NetBSD: files.sociox,v 1.5 2020/03/18 02:36:53 nisimura Exp $
 #
 # Configuration info for Socionext Unifier/SC2A11
 #
@@ -18,12 +18,14 @@ file	arch/arm/sociox/if_ave.c		ave
 
 # Socionext eMMC
 device	sniemmc: sdmmcbus
-attach	sdhc at fdt with sniemmc
+#attach	sdhc at fdt with sniemmc_fdt
+#attach	sdhc at acpinodebus with sniemmc_acpi
 file	arch/arm/sociox/sni_emmc.c		sniemmc
 
 # Socionext I2C
 device	sniiic: i2cbus
-attach	sniiic at fdt
+#attach	sniiic at fdt with sniiic_fdt
+#attach	sniiic at acpinodebus with sniiic_acpi
 file	arch/arm/sociox/sni_i2c.c		sniiic	needs-flag
 
 # Socionext GPIO



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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 02:21:24 UTC 2020

Modified Files:
src/sys/arch/evbarm/conf: GENERIC64

Log Message:
add ACPI attachment glue


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/evbarm/conf/GENERIC64

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/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.142 src/sys/arch/evbarm/conf/GENERIC64:1.143
--- src/sys/arch/evbarm/conf/GENERIC64:1.142	Mon Mar 16 08:48:05 2020
+++ src/sys/arch/evbarm/conf/GENERIC64	Wed Mar 18 02:21:24 2020
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.142 2020/03/16 08:48:05 nisimura Exp $
+#	$NetBSD: GENERIC64,v 1.143 2020/03/18 02:21:24 nisimura Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -326,6 +326,7 @@ awge*		at fdt?# DesignWare Gigabit E
 emac*		at fdt?# Allwinner Gigabit Ethernet (EMAC)
 enet*		at fdt?# IMX FEC
 #scx*		at fdt?# SocioNext Gigabit Ethernet
+#scx*		at acpi?
 aq*		at pci? dev ? function ?	# Aquantia AQC 10 gigabit
 ena*		at pci? dev ? function ?	# Amazon.com Elastic Network Adapter
 genet*		at acpi?			# Broadcom GENET v5
@@ -523,6 +524,7 @@ options 	FONT_BOLD16x32
 
 # GPU
 #nouveau*	at fdt?			# NVIDIA GPU
+#nouveau*	at pci?
 
 # Backlight
 pwmbacklight*	at fdt?			# PWM Backlight controls



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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 02:21:24 UTC 2020

Modified Files:
src/sys/arch/evbarm/conf: GENERIC64

Log Message:
add ACPI attachment glue


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/arch/evbarm/conf/GENERIC64

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



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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 01:40:56 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: files.sociox

Log Message:
add ACPI attachment glue.
SynQuacer/SC2A11 has UEFI/tainocore firmware which is able to select
either FDT format or ACPI format for device description.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sociox/files.sociox

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



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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Mar 18 01:40:56 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: files.sociox

Log Message:
add ACPI attachment glue.
SynQuacer/SC2A11 has UEFI/tainocore firmware which is able to select
either FDT format or ACPI format for device description.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/arm/sociox/files.sociox

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

Modified files:

Index: src/sys/arch/arm/sociox/files.sociox
diff -u src/sys/arch/arm/sociox/files.sociox:1.3 src/sys/arch/arm/sociox/files.sociox:1.4
--- src/sys/arch/arm/sociox/files.sociox:1.3	Tue Mar 17 23:01:15 2020
+++ src/sys/arch/arm/sociox/files.sociox	Wed Mar 18 01:40:56 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sociox,v 1.3 2020/03/17 23:01:15 nisimura Exp $
+#	$NetBSD: files.sociox,v 1.4 2020/03/18 01:40:56 nisimura Exp $
 #
 # Configuration info for Socionext Unifier/SC2A11
 #
@@ -7,11 +7,13 @@
 # SC2A11 SynQuacer NetSec GbE
 device	scx: ether, ifnet, arp, mii, bus_dma_generic
 attach	scx at fdt with scx_fdt
+attach	scx at acpinodebus with scx_acpi
 file	arch/arm/sociox/if_scx.c		scx
 
 # Unifier AVE GbE
 device	ave: ether, ifnet, arp, mii, bus_dma_generic
 attach	ave at fdt with ave_fdt
+attach	ave at acpinodebus with ave_acpi
 file	arch/arm/sociox/if_ave.c		ave
 
 # Socionext eMMC



CVS commit: src/lib

2020-03-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Wed Mar 18 00:37:30 UTC 2020

Modified Files:
src/lib: Makefile

Log Message:
libp2k still needs to be under MKRUMP


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/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/lib/Makefile
diff -u src/lib/Makefile:1.280 src/lib/Makefile:1.281
--- src/lib/Makefile:1.280	Tue Mar 17 22:20:48 2020
+++ src/lib/Makefile	Wed Mar 18 00:37:29 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.280 2020/03/17 22:20:48 christos Exp $
+#	$NetBSD: Makefile,v 1.281 2020/03/18 00:37:29 tnn Exp $
 #	from: @(#)Makefile	5.25.1.1 (Berkeley) 5/7/91
 
 .include 
@@ -283,7 +283,9 @@ SUBDIR+=	.WAIT
 SUBDIR+=	../external/bsd/pam-u2f/lib	# depends on libpam
 .endif
 
+.if (${MKRUMP} != "no")
 SUBDIR+=	libp2k		# depends on libukfs, librumpvfs, libpuffs
+.endif
 
 .if (${MKTPM} != "no")
 SUBDIR+=	../crypto/external/cpl/tpm-tools/lib	# depends on trousers



CVS commit: src/lib

2020-03-17 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Wed Mar 18 00:37:30 UTC 2020

Modified Files:
src/lib: Makefile

Log Message:
libp2k still needs to be under MKRUMP


To generate a diff of this commit:
cvs rdiff -u -r1.280 -r1.281 src/lib/Makefile

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



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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Mar 17 23:01:15 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: files.sociox

Log Message:
step forward to fdt/ACPI dual attach device


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sociox/files.sociox

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

Modified files:

Index: src/sys/arch/arm/sociox/files.sociox
diff -u src/sys/arch/arm/sociox/files.sociox:1.2 src/sys/arch/arm/sociox/files.sociox:1.3
--- src/sys/arch/arm/sociox/files.sociox:1.2	Mon Mar 16 08:10:20 2020
+++ src/sys/arch/arm/sociox/files.sociox	Tue Mar 17 23:01:15 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sociox,v 1.2 2020/03/16 08:10:20 nisimura Exp $
+#	$NetBSD: files.sociox,v 1.3 2020/03/17 23:01:15 nisimura Exp $
 #
 # Configuration info for Socionext Unifier/SC2A11
 #
@@ -6,12 +6,12 @@
 
 # SC2A11 SynQuacer NetSec GbE
 device	scx: ether, ifnet, arp, mii, bus_dma_generic
-attach	scx at fdt
+attach	scx at fdt with scx_fdt
 file	arch/arm/sociox/if_scx.c		scx
 
 # Unifier AVE GbE
 device	ave: ether, ifnet, arp, mii, bus_dma_generic
-attach	ave at fdt
+attach	ave at fdt with ave_fdt
 file	arch/arm/sociox/if_ave.c		ave
 
 # Socionext eMMC



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

2020-03-17 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Tue Mar 17 23:01:15 UTC 2020

Modified Files:
src/sys/arch/arm/sociox: files.sociox

Log Message:
step forward to fdt/ACPI dual attach device


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sociox/files.sociox

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



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

2020-03-17 Thread Andrew Doran
On Tue, Mar 17, 2020 at 10:38:14PM +, Andrew Doran wrote:

> Log Message:
> - Change some expensive checks DEBUG -> DIAGNOSTIC.

That was meant to be the other way around, oops.

Andrew


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

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 22:38:14 UTC 2020

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

Log Message:
- Change some expensive checks DEBUG -> DIAGNOSTIC.
- Mark some small functions inline.
- Add an assertion.


To generate a diff of this commit:
cvs rdiff -u -r1.375 -r1.376 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.375 src/sys/arch/x86/x86/pmap.c:1.376
--- src/sys/arch/x86/x86/pmap.c:1.375	Tue Mar 17 22:37:05 2020
+++ src/sys/arch/x86/x86/pmap.c	Tue Mar 17 22:38:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.375 2020/03/17 22:37:05 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.376 2020/03/17 22:38:14 ad Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.375 2020/03/17 22:37:05 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.376 2020/03/17 22:38:14 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -509,7 +509,7 @@ pmap_stats_update_bypte(struct pmap *pma
 /*
  * ptp_to_pmap: lookup pmap by ptp
  */
-static struct pmap *
+static inline struct pmap *
 ptp_to_pmap(struct vm_page *ptp)
 {
 	struct pmap *pmap;
@@ -556,7 +556,7 @@ pv_pte_embedded(struct pmap_page *pp)
 /*
  * pv_pte_first, pv_pte_next: PV list iterator.
  */
-static struct pv_pte *
+static inline struct pv_pte *
 pv_pte_first(struct pmap_page *pp)
 {
 
@@ -567,7 +567,7 @@ pv_pte_first(struct pmap_page *pp)
 	return pve_to_pvpte(LIST_FIRST(>pp_pvlist));
 }
 
-static struct pv_pte *
+static inline struct pv_pte *
 pv_pte_next(struct pmap_page *pp, struct pv_pte *pvpte)
 {
 
@@ -589,7 +589,7 @@ pmap_is_curpmap(struct pmap *pmap)
 	return ((pmap == pmap_kernel()) || (pmap == curcpu()->ci_pmap));
 }
 
-void
+inline void
 pmap_reference(struct pmap *pmap)
 {
 
@@ -1947,7 +1947,7 @@ static void
 pmap_check_pv(struct pmap *pmap, struct vm_page *ptp, struct pmap_page *pp,
 vaddr_t va, bool tracked)
 {
-#ifdef DIAGNOSTIC /* XXX too slow make this DEBUG before April 2020 */
+#ifdef DEBUG
 	struct pv_pte *pvpte;
 
 	PMAP_CHECK_PP(pp);
@@ -4157,6 +4157,7 @@ pmap_pp_remove(struct pmap_page *pp, pad
 		 */
 		ptp = pvpte->pte_ptp;
 		pmap = ptp_to_pmap(ptp);
+		KASSERT(pmap->pm_obj[0].uo_refs > 0);
 		if (ptp != NULL) {
 			pmap_reference(pmap);
 		}
@@ -4188,7 +4189,7 @@ pmap_pp_remove(struct pmap_page *pp, pad
 		KASSERTMSG(ptp == NULL || ptp->wire_count > 1,
 		"va %lx pmap %p ptp %p is empty", va, pmap, ptp);
 		
-#ifdef DIAGNOSTIC /* XXX Too expensive make DEBUG before April 2020 */
+#ifdef DEBUG
 		pmap_check_pv(pmap, ptp, pp, pvpte->pte_va, true);
 		rb_tree_t *tree = (ptp != NULL ?
 		_PAGE_TO_PP(ptp)->pp_rb : _kernel_rb);



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

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 22:38:14 UTC 2020

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

Log Message:
- Change some expensive checks DEBUG -> DIAGNOSTIC.
- Mark some small functions inline.
- Add an assertion.


To generate a diff of this commit:
cvs rdiff -u -r1.375 -r1.376 src/sys/arch/x86/x86/pmap.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/x86/x86

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 22:37:05 UTC 2020

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

Log Message:
- pmap_enter(): under low memory conditions, if PTP allocation succeeded and
  then PV entry allocation failed, PTP pages were being freed without their
  struct pmap_page being reset back to the non-PTP setup, which then caused
  havoc with pmap_page_removed().  Fix it.

- pmap_enter_pv(): don't do the PV check if memory allocation failed.

Reported-by: syzbot+d9b42238107c155ca...@syzkaller.appspotmail.com
Reported-by: syzbot+80cf4850dc1cf2990...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.374 -r1.375 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.374 src/sys/arch/x86/x86/pmap.c:1.375
--- src/sys/arch/x86/x86/pmap.c:1.374	Tue Mar 17 22:29:19 2020
+++ src/sys/arch/x86/x86/pmap.c	Tue Mar 17 22:37:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.374 2020/03/17 22:29:19 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.375 2020/03/17 22:37:05 ad Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.374 2020/03/17 22:29:19 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.375 2020/03/17 22:37:05 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -635,30 +635,6 @@ pmap_compare_key(void *context, const vo
 }
 
 /*
- * pmap_ptp_init: initialize new page table page
- */
-static inline void
-pmap_ptp_init(struct vm_page *ptp)
-{
-
-	ptp->uanon = (struct vm_anon *)(vaddr_t)~0L;
-	rb_tree_init(_PAGE_TO_PP(ptp)->pp_rb, _rbtree_ops);
-	PMAP_CHECK_PP(VM_PAGE_TO_PP(ptp));
-}
-
-/*
- * pmap_ptp_fini: finalize a page table page
- */
-static inline void
-pmap_ptp_fini(struct vm_page *ptp)
-{
-
-	KASSERT(RB_TREE_MIN(_PAGE_TO_PP(ptp)->pp_rb) == NULL);
-	PMAP_CHECK_PP(VM_PAGE_TO_PP(ptp));
-	ptp->uanon = NULL;
-}
-
-/*
  * pmap_ptp_range_set: abuse ptp->uanon to record minimum VA of PTE
  */
 static inline void
@@ -2158,7 +2134,9 @@ pmap_enter_pv(struct pmap *pmap, struct 
 		LIST_INSERT_HEAD(>pp_pvlist, pve, pve_list);
 	}
 	mutex_spin_exit(>pp_lock);
-	pmap_check_pv(pmap, ptp, pp, va, true);
+	if (error == 0) {
+		pmap_check_pv(pmap, ptp, pp, va, true);
+	}
 
 	return error;
 }
@@ -2252,13 +2230,15 @@ pmap_freepage(struct pmap *pmap, struct 
 	int lidx;
 
 	KASSERT(ptp->wire_count == 1);
+	PMAP_CHECK_PP(VM_PAGE_TO_PP(ptp));
 
 	lidx = level - 1;
 	pmap_stats_update(pmap, -1, 0);
 	if (pmap->pm_ptphint[lidx] == ptp)
 		pmap->pm_ptphint[lidx] = NULL;
 	ptp->wire_count = 0;
-	pmap_ptp_fini(ptp);
+	ptp->uanon = NULL;
+	KASSERT(RB_TREE_MIN(_PAGE_TO_PP(ptp)->pp_rb) == NULL);
 
 	/*
 	 * Enqueue the PTP to be freed by pmap_update().  We can't remove
@@ -2357,19 +2337,21 @@ pmap_get_ptp(struct pmap *pmap, struct p
 
 		if (pt->pg[i] == NULL) {
 			pt->pg[i] = uvm_pagealloc(obj, off, NULL, aflags);
-			pt->alloced[i] = true;
-			if (pt->pg[i] != NULL) {
-pmap_ptp_init(pt->pg[i]);
-			}
+			pt->alloced[i] = (pt->pg[i] != NULL);
 		} else if (pt->pg[i]->wire_count == 0) {
 			/* This page was queued to be freed; dequeue it. */
 			LIST_REMOVE(pt->pg[i], mdpage.mp_pp.pp_link);
-			pmap_ptp_init(pt->pg[i]);
+			pt->alloced[i] = true;
 		}
 		PMAP_DUMMY_UNLOCK(pmap);
 		if (pt->pg[i] == NULL) {
 			pmap_unget_ptp(pmap, pt);
 			return ENOMEM;
+		} else {
+			pt->pg[i]->uanon = (struct vm_anon *)(vaddr_t)~0L;
+			rb_tree_init(_PAGE_TO_PP(pt->pg[i])->pp_rb,
+			_rbtree_ops);
+			PMAP_CHECK_PP(VM_PAGE_TO_PP(pt->pg[i]));
 		}
 	}
 	ptp = pt->pg[2];
@@ -2464,22 +2446,12 @@ pmap_unget_ptp(struct pmap *pmap, struct
 	KASSERT(mutex_owned(>pm_lock));
 
 	for (i = PTP_LEVELS; i > 1; i--) {
-		if (pt->pg[i] == NULL) {
-			break;
-		}
 		if (!pt->alloced[i]) {
 			continue;
 		}
 		KASSERT(pt->pg[i]->wire_count == 0);
 		PMAP_CHECK_PP(VM_PAGE_TO_PP(pt->pg[i]));
-		/* pmap zeros all pages before freeing. */
-		pt->pg[i]->flags |= PG_ZERO; 
-		pmap_ptp_fini(pt->pg[i]);
-		PMAP_DUMMY_LOCK(pmap);
-		uvm_pagefree(pt->pg[i]);
-		PMAP_DUMMY_UNLOCK(pmap);
-		pt->pg[i] = NULL;
-		pmap->pm_ptphint[0] = NULL;
+		pmap_freepage(pmap, pt->pg[i], i - 1);
 	}
 }
 
@@ -5232,6 +5204,7 @@ pmap_update(struct pmap *pmap)
 		mutex_enter(>pm_lock);
 		while ((ptp = LIST_FIRST(>pm_gc_ptp)) != NULL) {
 			KASSERT(ptp->wire_count == 0);
+			KASSERT(ptp->uanon == NULL);
 			LIST_REMOVE(ptp, mdpage.mp_pp.pp_link);
 			pp = VM_PAGE_TO_PP(ptp);
 			LIST_INIT(>pp_pvlist);



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

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 22:37:05 UTC 2020

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

Log Message:
- pmap_enter(): under low memory conditions, if PTP allocation succeeded and
  then PV entry allocation failed, PTP pages were being freed without their
  struct pmap_page being reset back to the non-PTP setup, which then caused
  havoc with pmap_page_removed().  Fix it.

- pmap_enter_pv(): don't do the PV check if memory allocation failed.

Reported-by: syzbot+d9b42238107c155ca...@syzkaller.appspotmail.com
Reported-by: syzbot+80cf4850dc1cf2990...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.374 -r1.375 src/sys/arch/x86/x86/pmap.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/x86

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 22:29:19 UTC 2020

Modified Files:
src/sys/arch/x86/include: pmap.h pmap_pv.h
src/sys/arch/x86/x86: pmap.c

Log Message:
Hallelujah, the bug has been found.  Resurrect prior changes, to be fixed
with following commit.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/include/pmap_pv.h
cvs rdiff -u -r1.373 -r1.374 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/include/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.114 src/sys/arch/x86/include/pmap.h:1.115
--- src/sys/arch/x86/include/pmap.h:1.114	Tue Mar 17 21:02:56 2020
+++ src/sys/arch/x86/include/pmap.h	Tue Mar 17 22:29:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.114 2020/03/17 21:02:56 ad Exp $	*/
+/*	$NetBSD: pmap.h,v 1.115 2020/03/17 22:29:19 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -248,6 +248,8 @@ extern struct pool_cache pmap_cache;
  * (the other object locks are only used when uvm_pagealloc is called)
  */
 
+struct pv_page;
+
 struct pmap {
 	struct uvm_object pm_obj[PTP_LEVELS-1];/* objects for lvl >= 1) */
 	LIST_ENTRY(pmap) pm_list;	/* list of all pmaps */
@@ -256,11 +258,11 @@ struct pmap {
 	struct vm_page *pm_ptphint[PTP_LEVELS-1];
 	/* pointer to a PTP in our pmap */
 	struct pmap_statistics pm_stats;  /* pmap stats */
+	struct pv_entry *pm_pve;	/* spare pv_entry */
 
 #if !defined(__x86_64__)
 	vaddr_t pm_hiexec;		/* highest executable mapping */
 #endif /* !defined(__x86_64__) */
-	struct lwp *pm_remove_all;	/* who's emptying the pmap */
 
 	union descriptor *pm_ldt;	/* user-set LDT */
 	size_t pm_ldt_len;		/* size of LDT in bytes */

Index: src/sys/arch/x86/include/pmap_pv.h
diff -u src/sys/arch/x86/include/pmap_pv.h:1.16 src/sys/arch/x86/include/pmap_pv.h:1.17
--- src/sys/arch/x86/include/pmap_pv.h:1.16	Tue Mar 17 21:02:56 2020
+++ src/sys/arch/x86/include/pmap_pv.h	Tue Mar 17 22:29:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_pv.h,v 1.16 2020/03/17 21:02:56 ad Exp $	*/
+/*	$NetBSD: pmap_pv.h,v 1.17 2020/03/17 22:29:19 ad Exp $	*/
 
 /*-
  * Copyright (c)2008 YAMAMOTO Takashi,
@@ -34,6 +34,7 @@
 #include 
 
 struct vm_page;
+struct pmap_page;
 
 /*
  * structures to track P->V mapping
@@ -51,14 +52,14 @@ struct pv_pte {
 };
 
 /*
- * pv_entry: plug pv_pte into lists.
+ * pv_entry: plug pv_pte into lists.  32 bytes on i386, 64 on amd64.
  */
 
 struct pv_entry {
 	struct pv_pte pve_pte;		/* should be the first member */
 	LIST_ENTRY(pv_entry) pve_list;	/* on pmap_page::pp_pvlist */
 	rb_node_t pve_rb;		/* red-black tree node */
-	uintptr_t pve_padding;		/* unused */
+	struct pmap_page *pve_pp;	/* backpointer to mapped page */
 };
 #define	pve_next	pve_list.le_next
 
@@ -71,16 +72,13 @@ struct pmap_page {
 		/* PTPs */
 		rb_tree_t rb;
 
-		/* PTPs */
+		/* PTPs, when being freed */
 		LIST_ENTRY(vm_page) link;
 
-		/* Non-PTPs */
+		/* Non-PTPs (i.e. normal pages) */
 		struct {
-			/* PP_EMBEDDED */
 			struct pv_pte pte;
-
 			LIST_HEAD(, pv_entry) pvlist;
-			uint8_t flags;
 			uint8_t attrs;
 		} s;
 	} pp_u;
@@ -89,7 +87,6 @@ struct pmap_page {
 #define	pp_link		pp_u.link
 #define	pp_pte		pp_u.s.pte
 #define pp_pvlist	pp_u.s.pvlist
-#define	pp_pflags	pp_u.s.flags
 #define	pp_attrs	pp_u.s.attrs
 };
 
@@ -97,10 +94,6 @@ struct pmap_page {
 #define PP_ATTRS_A	0x02	/* Accessed */
 #define PP_ATTRS_W	0x04	/* Writable */
 
-/* pp_flags */
-#define	PP_EMBEDDED	1
-#define	PP_FREEING	2
-
 #define	PMAP_PAGE_INIT(pp) \
 do { \
 	LIST_INIT(&(pp)->pp_pvlist); \

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.373 src/sys/arch/x86/x86/pmap.c:1.374
--- src/sys/arch/x86/x86/pmap.c:1.373	Tue Mar 17 21:02:56 2020
+++ src/sys/arch/x86/x86/pmap.c	Tue Mar 17 22:29:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.373 2020/03/17 21:02:56 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.374 2020/03/17 22:29:19 ad Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.373 2020/03/17 21:02:56 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.374 2020/03/17 22:29:19 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -139,6 +139,8 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.3
 #include "opt_svs.h"
 #include "opt_kaslr.h"
 
+#define	__MUTEX_PRIVATE	/* for assertions */
+
 #include 
 #include 
 #include 
@@ -224,23 +226,39 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.3
 /*
  * Locking
  *
- * We have the following locks that we must contend with, listed in the
- * order that they must be acquired:
+ * We have the following locks that we must deal with, listed in the order
+ * that they are acquired:
+ *
+ * pg->uobject->vmobjlock, pg->uanon->an_lock
  *
- * 

CVS commit: src/sys/arch/x86

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 22:29:19 UTC 2020

Modified Files:
src/sys/arch/x86/include: pmap.h pmap_pv.h
src/sys/arch/x86/x86: pmap.c

Log Message:
Hallelujah, the bug has been found.  Resurrect prior changes, to be fixed
with following commit.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/x86/include/pmap_pv.h
cvs rdiff -u -r1.373 -r1.374 src/sys/arch/x86/x86/pmap.c

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



CVS commit: src/lib

2020-03-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 17 22:20:48 UTC 2020

Modified Files:
src/lib: Makefile

Log Message:
pam and tpm have nothing to do with rump, so limit them to the libraries that
need MKRUMP. (from Tobias Nygren)


To generate a diff of this commit:
cvs rdiff -u -r1.279 -r1.280 src/lib/Makefile

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



CVS commit: src/lib

2020-03-17 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Mar 17 22:20:48 UTC 2020

Modified Files:
src/lib: Makefile

Log Message:
pam and tpm have nothing to do with rump, so limit them to the libraries that
need MKRUMP. (from Tobias Nygren)


To generate a diff of this commit:
cvs rdiff -u -r1.279 -r1.280 src/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/lib/Makefile
diff -u src/lib/Makefile:1.279 src/lib/Makefile:1.280
--- src/lib/Makefile:1.279	Tue Mar  3 15:01:01 2020
+++ src/lib/Makefile	Tue Mar 17 18:20:48 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.279 2020/03/03 20:01:01 christos Exp $
+#	$NetBSD: Makefile,v 1.280 2020/03/17 22:20:48 christos Exp $
 #	from: @(#)Makefile	5.25.1.1 (Berkeley) 5/7/91
 
 .include 
@@ -260,7 +260,6 @@ SUBDIR+=	librumpvfs	# depends on librump
 SUBDIR+=	../crypto/external/bsd/libsaslc	# depends on heimdal, openssl
 SUBDIR+=	../external/bsd/mdocml/lib
 
-.if (${MKRUMP} != "no")
 # 4th library dependency barrier 
 SUBDIR+=	.WAIT
 
@@ -269,7 +268,9 @@ SUBDIR+=	libpam		# depends on heimdal, l
 .endif
 
 
+.if (${MKRUMP} != "no")
 SUBDIR+=	libukfs		# depends on librumpvfs, librump
+.endif
 
 .if (${MKTPM} != "no")
 SUBDIR+=	../crypto/external/cpl/trousers/lib
@@ -288,6 +289,7 @@ SUBDIR+=	libp2k		# depends on libukfs, l
 SUBDIR+=	../crypto/external/cpl/tpm-tools/lib	# depends on trousers
 .endif
 
+.if (${MKRUMP} != "no")
 .if !defined(BSD_MK_COMPAT_FILE)
 SUBDIR+=	../sys/rump/dev/lib
 SUBDIR+=	../sys/rump/fs/lib



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

2020-03-17 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Mar 17 22:03:41 UTC 2020

Modified Files:
src/external/bsd/mdocml/dist: main.c

Log Message:
mdocml: Comment out non-applicable warning.

We don't use makewhatis on NetBSD, we use makemandb.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/mdocml/dist/main.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/mdocml/dist/main.c
diff -u src/external/bsd/mdocml/dist/main.c:1.7 src/external/bsd/mdocml/dist/main.c:1.8
--- src/external/bsd/mdocml/dist/main.c:1.7	Mon Mar 11 17:59:28 2019
+++ src/external/bsd/mdocml/dist/main.c	Tue Mar 17 22:03:41 2020
@@ -750,8 +750,10 @@ fs_lookup(const struct manpaths *paths, 
 	return globres != -1;
 
 found:
+#if !defined(__NetBSD__)
 	warnx("outdated mandoc.db lacks %s(%s) entry, run %s %s",
 	name, sec, BINM_MAKEWHATIS, paths->paths[ipath]);
+#endif
 	if (res == NULL) {
 		free(file);
 		return 1;



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

2020-03-17 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Mar 17 22:03:41 UTC 2020

Modified Files:
src/external/bsd/mdocml/dist: main.c

Log Message:
mdocml: Comment out non-applicable warning.

We don't use makewhatis on NetBSD, we use makemandb.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/external/bsd/mdocml/dist/main.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/macppc/conf

2020-03-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Mar 17 21:28:45 UTC 2020

Modified Files:
src/sys/arch/macppc/conf: POWERMAC_G5 POWERMAC_G5_11_2

Log Message:
remove OFWOEA_WSCONS_NO_ROM_FONT


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/macppc/conf/POWERMAC_G5
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/macppc/conf/POWERMAC_G5_11_2

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

Modified files:

Index: src/sys/arch/macppc/conf/POWERMAC_G5
diff -u src/sys/arch/macppc/conf/POWERMAC_G5:1.41 src/sys/arch/macppc/conf/POWERMAC_G5:1.42
--- src/sys/arch/macppc/conf/POWERMAC_G5:1.41	Sat Apr 13 08:23:00 2019
+++ src/sys/arch/macppc/conf/POWERMAC_G5	Tue Mar 17 21:28:45 2020
@@ -191,7 +191,6 @@ wskbd*	at ukbd? console ?
 ums*	at uhidev? reportid ?# USB Mice
 wsmouse* at ums?
 
-options		OFWOEA_WSCONS_NO_ROM_FONT
 genfb*	at pci? dev ? function ?	# Generic Open Firmware Framebuffer
 radeonfb*	at pci? dev ? function ?
 options 	RADEONFB_ALWAYS_ACCEL_PUTCHAR

Index: src/sys/arch/macppc/conf/POWERMAC_G5_11_2
diff -u src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.14 src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.15
--- src/sys/arch/macppc/conf/POWERMAC_G5_11_2:1.14	Tue Nov 12 17:27:59 2019
+++ src/sys/arch/macppc/conf/POWERMAC_G5_11_2	Tue Mar 17 21:28:45 2020
@@ -184,7 +184,6 @@ pseudo-device	nsmb			# SMB requester
 pseudo-device   bpfilter8   # Berkeley packet filter
 #pseudo-device	npf			# NPF packet filter
 
-options		OFWOEA_WSCONS_NO_ROM_FONT
 options		EXSTORAGE_MAX=24
 
 # Enable the hooks used for initializing the ram-disk.



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

2020-03-17 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Tue Mar 17 21:28:45 UTC 2020

Modified Files:
src/sys/arch/macppc/conf: POWERMAC_G5 POWERMAC_G5_11_2

Log Message:
remove OFWOEA_WSCONS_NO_ROM_FONT


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/macppc/conf/POWERMAC_G5
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/macppc/conf/POWERMAC_G5_11_2

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



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

2020-03-17 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Mar 17 21:24:30 UTC 2020

Modified Files:
src/sys/arch/arm/samsung: exynos5410_clock.c exynos5422_clock.c
exynos_gpio.c exynos_i2c.c exynos_pinctrl.c exynos_uart.c

Log Message:
Traiing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos5410_clock.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/samsung/exynos5422_clock.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/samsung/exynos_gpio.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/samsung/exynos_i2c.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/samsung/exynos_pinctrl.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_uart.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/arm/samsung

2020-03-17 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Mar 17 21:24:30 UTC 2020

Modified Files:
src/sys/arch/arm/samsung: exynos5410_clock.c exynos5422_clock.c
exynos_gpio.c exynos_i2c.c exynos_pinctrl.c exynos_uart.c

Log Message:
Traiing whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/arm/samsung/exynos5410_clock.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/samsung/exynos5422_clock.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/arm/samsung/exynos_gpio.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/arm/samsung/exynos_i2c.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/arm/samsung/exynos_pinctrl.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/samsung/exynos_uart.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/arm/samsung/exynos5410_clock.c
diff -u src/sys/arch/arm/samsung/exynos5410_clock.c:1.5 src/sys/arch/arm/samsung/exynos5410_clock.c:1.6
--- src/sys/arch/arm/samsung/exynos5410_clock.c:1.5	Fri Oct 18 06:13:38 2019
+++ src/sys/arch/arm/samsung/exynos5410_clock.c	Tue Mar 17 21:24:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5410_clock.c,v 1.5 2019/10/18 06:13:38 skrll Exp $ */
+/* $NetBSD: exynos5410_clock.c,v 1.6 2020/03/17 21:24:30 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015-2017 Jared McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5410_clock.c,v 1.5 2019/10/18 06:13:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5410_clock.c,v 1.6 2020/03/17 21:24:30 skrll Exp $");
 
 #include 
 #include 
@@ -448,7 +448,7 @@ exynos5410_clock_attach(device_t parent,
 
 	sc->sc_dev = self;
 	sc->sc_bst = faa->faa_bst;
-	
+
 	error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh);
 	if (error) {
 		aprint_error(": couldn't map %#" PRIxBUSADDR ": %d",
@@ -583,7 +583,7 @@ exynos5410_clock_get_rate_pll(struct exy
 	_parent->base);
 
 	const uint32_t v = CLOCK_READ(sc, epll->con0_reg);
-	
+
 	return PLL_FREQ(rate_parent, v);
 }
 

Index: src/sys/arch/arm/samsung/exynos5422_clock.c
diff -u src/sys/arch/arm/samsung/exynos5422_clock.c:1.14 src/sys/arch/arm/samsung/exynos5422_clock.c:1.15
--- src/sys/arch/arm/samsung/exynos5422_clock.c:1.14	Fri Oct 18 06:13:38 2019
+++ src/sys/arch/arm/samsung/exynos5422_clock.c	Tue Mar 17 21:24:30 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: exynos5422_clock.c,v 1.14 2019/10/18 06:13:38 skrll Exp $ */
+/* $NetBSD: exynos5422_clock.c,v 1.15 2020/03/17 21:24:30 skrll Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill 
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.14 2019/10/18 06:13:38 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos5422_clock.c,v 1.15 2020/03/17 21:24:30 skrll Exp $");
 
 #include 
 #include 
@@ -625,7 +625,7 @@ exynos5422_clock_attach(device_t parent,
 
 	sc->sc_dev = self;
 	sc->sc_bst = faa->faa_bst;
-	
+
 	error = bus_space_map(sc->sc_bst, addr, size, 0, >sc_bsh);
 	if (error) {
 		aprint_error(": couldn't map %#" PRIxBUSADDR ": %d",
@@ -760,7 +760,7 @@ exynos5422_clock_get_rate_pll(struct exy
 	_parent->base);
 
 	const uint32_t v = CLOCK_READ(sc, epll->con0_reg);
-	
+
 	return PLL_FREQ(rate_parent, v);
 }
 

Index: src/sys/arch/arm/samsung/exynos_gpio.c
diff -u src/sys/arch/arm/samsung/exynos_gpio.c:1.25 src/sys/arch/arm/samsung/exynos_gpio.c:1.26
--- src/sys/arch/arm/samsung/exynos_gpio.c:1.25	Wed Jul  4 22:16:42 2018
+++ src/sys/arch/arm/samsung/exynos_gpio.c	Tue Mar 17 21:24:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_gpio.c,v 1.25 2018/07/04 22:16:42 jmcneill Exp $ */
+/*	$NetBSD: exynos_gpio.c,v 1.26 2020/03/17 21:24:30 skrll Exp $ */
 
 /*-
 * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #include "gpio.h"
 
 #include 
-__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.25 2018/07/04 22:16:42 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: exynos_gpio.c,v 1.26 2020/03/17 21:24:30 skrll Exp $");
 
 #include 
 #include 
@@ -292,7 +292,7 @@ exynos_gpio_bank_config(struct exynos_pi
 		result);
 		return NULL;
 	}
-	
+
 	sc->sc_dev = parent->sc_dev;
 	sc->sc_bst = _generic_bs_tag;
 	sc->sc_bsh = parent->sc_bsh;

Index: src/sys/arch/arm/samsung/exynos_i2c.c
diff -u src/sys/arch/arm/samsung/exynos_i2c.c:1.18 src/sys/arch/arm/samsung/exynos_i2c.c:1.19
--- src/sys/arch/arm/samsung/exynos_i2c.c:1.18	Sun Dec 22 23:50:43 2019
+++ src/sys/arch/arm/samsung/exynos_i2c.c	Tue Mar 17 21:24:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: exynos_i2c.c,v 1.18 2019/12/22 23:50:43 thorpej Exp $ */
+/*	$NetBSD: exynos_i2c.c,v 1.19 2020/03/17 21:24:30 skrll Exp $ */
 
 /*
  * Copyright (c) 2015 Jared D. McNeill 
@@ -31,7 +31,7 @@
 #include "opt_arm_debug.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.18 2019/12/22 23:50:43 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: exynos_i2c.c,v 1.19 2020/03/17 21:24:30 skrll Exp $");
 
 #include 
 #include 
@@ -169,7 +169,7 @@ exynos_i2c_attach(device_t parent, devic
 		return;
 	

CVS commit: src/sys/arch/x86

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 21:02:56 UTC 2020

Modified Files:
src/sys/arch/x86/include: pmap.h pmap_pv.h
src/sys/arch/x86/x86: pmap.c

Log Message:
Back out the recent pmap changes until I can figure out what is going on
with pmap_page_remove()  (to pmap.c rev 1.365).


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/include/pmap_pv.h
cvs rdiff -u -r1.372 -r1.373 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/include/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.113 src/sys/arch/x86/include/pmap.h:1.114
--- src/sys/arch/x86/include/pmap.h:1.113	Sat Mar 14 18:24:10 2020
+++ src/sys/arch/x86/include/pmap.h	Tue Mar 17 21:02:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.113 2020/03/14 18:24:10 ad Exp $	*/
+/*	$NetBSD: pmap.h,v 1.114 2020/03/17 21:02:56 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -248,8 +248,6 @@ extern struct pool_cache pmap_cache;
  * (the other object locks are only used when uvm_pagealloc is called)
  */
 
-struct pv_page;
-
 struct pmap {
 	struct uvm_object pm_obj[PTP_LEVELS-1];/* objects for lvl >= 1) */
 	LIST_ENTRY(pmap) pm_list;	/* list of all pmaps */
@@ -258,11 +256,11 @@ struct pmap {
 	struct vm_page *pm_ptphint[PTP_LEVELS-1];
 	/* pointer to a PTP in our pmap */
 	struct pmap_statistics pm_stats;  /* pmap stats */
-	struct pv_entry *pm_pve;	/* spare pv_entry */
 
 #if !defined(__x86_64__)
 	vaddr_t pm_hiexec;		/* highest executable mapping */
 #endif /* !defined(__x86_64__) */
+	struct lwp *pm_remove_all;	/* who's emptying the pmap */
 
 	union descriptor *pm_ldt;	/* user-set LDT */
 	size_t pm_ldt_len;		/* size of LDT in bytes */

Index: src/sys/arch/x86/include/pmap_pv.h
diff -u src/sys/arch/x86/include/pmap_pv.h:1.15 src/sys/arch/x86/include/pmap_pv.h:1.16
--- src/sys/arch/x86/include/pmap_pv.h:1.15	Sun Mar 15 15:58:24 2020
+++ src/sys/arch/x86/include/pmap_pv.h	Tue Mar 17 21:02:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_pv.h,v 1.15 2020/03/15 15:58:24 ad Exp $	*/
+/*	$NetBSD: pmap_pv.h,v 1.16 2020/03/17 21:02:56 ad Exp $	*/
 
 /*-
  * Copyright (c)2008 YAMAMOTO Takashi,
@@ -34,7 +34,6 @@
 #include 
 
 struct vm_page;
-struct pmap_page;
 
 /*
  * structures to track P->V mapping
@@ -52,14 +51,14 @@ struct pv_pte {
 };
 
 /*
- * pv_entry: plug pv_pte into lists.  32 bytes on i386, 64 on amd64.
+ * pv_entry: plug pv_pte into lists.
  */
 
 struct pv_entry {
 	struct pv_pte pve_pte;		/* should be the first member */
 	LIST_ENTRY(pv_entry) pve_list;	/* on pmap_page::pp_pvlist */
 	rb_node_t pve_rb;		/* red-black tree node */
-	struct pmap_page *pve_pp;	/* backpointer to mapped page */
+	uintptr_t pve_padding;		/* unused */
 };
 #define	pve_next	pve_list.le_next
 
@@ -72,13 +71,16 @@ struct pmap_page {
 		/* PTPs */
 		rb_tree_t rb;
 
-		/* PTPs, when being freed */
+		/* PTPs */
 		LIST_ENTRY(vm_page) link;
 
-		/* Non-PTPs (i.e. normal pages) */
+		/* Non-PTPs */
 		struct {
+			/* PP_EMBEDDED */
 			struct pv_pte pte;
+
 			LIST_HEAD(, pv_entry) pvlist;
+			uint8_t flags;
 			uint8_t attrs;
 		} s;
 	} pp_u;
@@ -87,6 +89,7 @@ struct pmap_page {
 #define	pp_link		pp_u.link
 #define	pp_pte		pp_u.s.pte
 #define pp_pvlist	pp_u.s.pvlist
+#define	pp_pflags	pp_u.s.flags
 #define	pp_attrs	pp_u.s.attrs
 };
 
@@ -94,6 +97,10 @@ struct pmap_page {
 #define PP_ATTRS_A	0x02	/* Accessed */
 #define PP_ATTRS_W	0x04	/* Writable */
 
+/* pp_flags */
+#define	PP_EMBEDDED	1
+#define	PP_FREEING	2
+
 #define	PMAP_PAGE_INIT(pp) \
 do { \
 	LIST_INIT(&(pp)->pp_pvlist); \

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.372 src/sys/arch/x86/x86/pmap.c:1.373
--- src/sys/arch/x86/x86/pmap.c:1.372	Tue Mar 17 18:40:35 2020
+++ src/sys/arch/x86/x86/pmap.c	Tue Mar 17 21:02:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.372 2020/03/17 18:40:35 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.373 2020/03/17 21:02:56 ad Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.372 2020/03/17 18:40:35 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.373 2020/03/17 21:02:56 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -139,8 +139,6 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.3
 #include "opt_svs.h"
 #include "opt_kaslr.h"
 
-#define	__MUTEX_PRIVATE	/* for assertions */
-
 #include 
 #include 
 #include 
@@ -226,39 +224,23 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.3
 /*
  * Locking
  *
- * We have the following locks that we must deal with, listed in the order
- * that they are acquired:
- *
- * pg->uobject->vmobjlock, pg->uanon->an_lock
+ * We have the following locks that we must contend with, listed in the
+ * order that they 

CVS commit: src/sys/arch/x86

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 21:02:56 UTC 2020

Modified Files:
src/sys/arch/x86/include: pmap.h pmap_pv.h
src/sys/arch/x86/x86: pmap.c

Log Message:
Back out the recent pmap changes until I can figure out what is going on
with pmap_page_remove()  (to pmap.c rev 1.365).


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/include/pmap_pv.h
cvs rdiff -u -r1.372 -r1.373 src/sys/arch/x86/x86/pmap.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/x86/x86

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 18:40:35 UTC 2020

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

Log Message:
- Add more assertions.

- Range clipping for pmap_remove(): only need to keep track of the lowest VA
  in PTP, as ptp->wire_count provides an upper bound.  D'oh.  Move set of
  range to where there is already a writeback to the PTP.

- pmap_pp_remove(): panic if pmap_sync_pv() returns an error, because it means
  something has gone very wrong.  The PTE should not change here since the
  pmap is locked.

- pmap_pp_clear_attrs(): wait for the competing V->P operation by acquiring
  and releasing the pmap's lock, rather than busy looping.

- pmap_test_attrs(): this needs to wait for any competing operations,
  otherwise it could return without all necessary updates reflected in
  pp_attrs.

- pmap_enter(): fix cut-n-paste screwup in an error path for Xen.


To generate a diff of this commit:
cvs rdiff -u -r1.371 -r1.372 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.371 src/sys/arch/x86/x86/pmap.c:1.372
--- src/sys/arch/x86/x86/pmap.c:1.371	Tue Mar 17 13:34:50 2020
+++ src/sys/arch/x86/x86/pmap.c	Tue Mar 17 18:40:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.371 2020/03/17 13:34:50 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.372 2020/03/17 18:40:35 ad Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.371 2020/03/17 13:34:50 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.372 2020/03/17 18:40:35 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -640,13 +640,8 @@ pmap_compare_key(void *context, const vo
 static inline void
 pmap_ptp_init(struct vm_page *ptp)
 {
-	uint16_t *minidx, *maxidx;
 
-	minidx = (uint16_t *)>uanon;
-	maxidx = (uint16_t *)>uanon + 1;
-
-	*minidx = UINT16_MAX;
-	*maxidx = 0;
+	ptp->uanon = (struct vm_anon *)(vaddr_t)~0L;
 	rb_tree_init(_PAGE_TO_PP(ptp)->pp_rb, _rbtree_ops);
 	PMAP_CHECK_PP(VM_PAGE_TO_PP(ptp));
 }
@@ -664,24 +659,15 @@ pmap_ptp_fini(struct vm_page *ptp)
 }
 
 /*
- * pmap_ptp_range_set: abuse ptp->uanon to record min/max idx of PTE
+ * pmap_ptp_range_set: abuse ptp->uanon to record minimum VA of PTE
  */
 static inline void
 pmap_ptp_range_set(struct vm_page *ptp, vaddr_t va)
 {
-	uint16_t *minidx, *maxidx;
-	u_int idx;
-
-	idx = pl1_pi(va);
-	KASSERT(idx < UINT16_MAX);
-	minidx = (uint16_t *)>uanon;
-	maxidx = (uint16_t *)>uanon + 1;
+	vaddr_t *min = (vaddr_t *)>uanon;
 
-	if (idx < *minidx) {
-		*minidx = idx;
-	}
-	if (idx > *maxidx) {
-		*maxidx = idx;
+	if (va < *min) {
+		*min = va;
 	}
 }
 
@@ -689,27 +675,18 @@ pmap_ptp_range_set(struct vm_page *ptp, 
  * pmap_ptp_range_clip: abuse ptp->uanon to clip range of PTEs to remove
  */
 static inline void
-pmap_ptp_range_clip(struct vm_page *ptp, vaddr_t *startva, vaddr_t *endva,
-pt_entry_t **pte)
+pmap_ptp_range_clip(struct vm_page *ptp, vaddr_t *startva, pt_entry_t **pte)
 {
-	vaddr_t sclip, eclip;
+	vaddr_t sclip;
 
 	if (ptp == NULL) {
 		return;
 	}
 
-	sclip = (*startva & L2_FRAME) +
-	x86_ptob(*(uint16_t *)>uanon);
-	eclip = (*startva & L2_FRAME) +
-	x86_ptob(*((uint16_t *)>uanon + 1) + 1);
-
-	KASSERT(sclip < eclip);
-
+	sclip = (vaddr_t)ptp->uanon;
 	sclip = (*startva < sclip ? sclip : *startva);
-	eclip = (*endva > eclip ? eclip : *endva);
 	*pte += (sclip - *startva) / PAGE_SIZE;
 	*startva = sclip;
-	*endva = eclip;
 }
 
 /*
@@ -2966,7 +2943,7 @@ pmap_remove_all(struct pmap *pmap)
 			blkendva, _tofree);
 
 			/* PTP should now be unused - free it. */
-			KASSERT(ptps[i]->wire_count <= 1);
+			KASSERT(ptps[i]->wire_count == 1);
 			pmap_free_ptp(pmap, ptps[i], va, ptes, pdes);
 		}
 		pmap_unmap_ptes(pmap, pmap2);
@@ -2982,6 +2959,9 @@ pmap_remove_all(struct pmap *pmap)
 
 	/* Verify that the pmap is now completely empty. */
 	pmap_check_ptps(pmap);
+	KASSERTMSG(pmap->pm_stats.resident_count == PDP_SIZE,
+	"pmap %p not empty", pmap);
+
 	return true;
 }
 
@@ -3817,7 +3797,7 @@ pmap_remove_ptes(struct pmap *pmap, stru
 	 * mappings are very often sparse, so clip the given range to the
 	 * range of PTEs that are known present in the PTP.
 	 */
-	pmap_ptp_range_clip(ptp, , , );
+	pmap_ptp_range_clip(ptp, , );
 
 	/*
 	 * note that ptpva points to the PTE that maps startva.   this may
@@ -4168,9 +4148,9 @@ pmap_pp_remove(struct pmap_page *pp, pad
 {
 	struct pv_pte *pvpte;
 	struct vm_page *ptp;
+	uintptr_t sum;
 	uint8_t oattrs;
 	bool locked;
-	int count;
 
 	/*
 	 * Do an unlocked check to see if the page has no mappings, eg when
@@ -4179,20 +4159,19 @@ pmap_pp_remove(struct pmap_page *pp, pad
 	 * out, so we don't have to worry about concurrent attempts to enter
 	 * it (otherwise the caller either doesn't care or has 

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

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 18:40:35 UTC 2020

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

Log Message:
- Add more assertions.

- Range clipping for pmap_remove(): only need to keep track of the lowest VA
  in PTP, as ptp->wire_count provides an upper bound.  D'oh.  Move set of
  range to where there is already a writeback to the PTP.

- pmap_pp_remove(): panic if pmap_sync_pv() returns an error, because it means
  something has gone very wrong.  The PTE should not change here since the
  pmap is locked.

- pmap_pp_clear_attrs(): wait for the competing V->P operation by acquiring
  and releasing the pmap's lock, rather than busy looping.

- pmap_test_attrs(): this needs to wait for any competing operations,
  otherwise it could return without all necessary updates reflected in
  pp_attrs.

- pmap_enter(): fix cut-n-paste screwup in an error path for Xen.


To generate a diff of this commit:
cvs rdiff -u -r1.371 -r1.372 src/sys/arch/x86/x86/pmap.c

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



CVS commit: src

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 18:31:39 UTC 2020

Modified Files:
src/sys/miscfs/genfs: genfs_io.c
src/sys/rump/librump/rumpkern: vm.c
src/sys/ufs/lfs: lfs_pages.c
src/sys/uvm: uvm_aobj.c uvm_bio.c uvm_fault.c uvm_loan.c uvm_page.c
uvm_page.h
src/tests/rump/kernspace: busypage.c

Log Message:
Tweak the March 14th change to make page waits interlocked by pg->interlock.
Remove unneeded changes and only deal with the PQ_WANTED flag, to exclude
possible bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/miscfs/genfs/genfs_io.c
cvs rdiff -u -r1.186 -r1.187 src/sys/rump/librump/rumpkern/vm.c
cvs rdiff -u -r1.24 -r1.25 src/sys/ufs/lfs/lfs_pages.c
cvs rdiff -u -r1.137 -r1.138 src/sys/uvm/uvm_aobj.c
cvs rdiff -u -r1.105 -r1.106 src/sys/uvm/uvm_bio.c
cvs rdiff -u -r1.218 -r1.219 src/sys/uvm/uvm_fault.c
cvs rdiff -u -r1.97 -r1.98 src/sys/uvm/uvm_loan.c
cvs rdiff -u -r1.233 -r1.234 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.101 -r1.102 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.7 -r1.8 src/tests/rump/kernspace/busypage.c

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



CVS commit: src

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 18:31:39 UTC 2020

Modified Files:
src/sys/miscfs/genfs: genfs_io.c
src/sys/rump/librump/rumpkern: vm.c
src/sys/ufs/lfs: lfs_pages.c
src/sys/uvm: uvm_aobj.c uvm_bio.c uvm_fault.c uvm_loan.c uvm_page.c
uvm_page.h
src/tests/rump/kernspace: busypage.c

Log Message:
Tweak the March 14th change to make page waits interlocked by pg->interlock.
Remove unneeded changes and only deal with the PQ_WANTED flag, to exclude
possible bugs.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/miscfs/genfs/genfs_io.c
cvs rdiff -u -r1.186 -r1.187 src/sys/rump/librump/rumpkern/vm.c
cvs rdiff -u -r1.24 -r1.25 src/sys/ufs/lfs/lfs_pages.c
cvs rdiff -u -r1.137 -r1.138 src/sys/uvm/uvm_aobj.c
cvs rdiff -u -r1.105 -r1.106 src/sys/uvm/uvm_bio.c
cvs rdiff -u -r1.218 -r1.219 src/sys/uvm/uvm_fault.c
cvs rdiff -u -r1.97 -r1.98 src/sys/uvm/uvm_loan.c
cvs rdiff -u -r1.233 -r1.234 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.101 -r1.102 src/sys/uvm/uvm_page.h
cvs rdiff -u -r1.7 -r1.8 src/tests/rump/kernspace/busypage.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/miscfs/genfs/genfs_io.c
diff -u src/sys/miscfs/genfs/genfs_io.c:1.93 src/sys/miscfs/genfs/genfs_io.c:1.94
--- src/sys/miscfs/genfs/genfs_io.c:1.93	Sat Mar 14 20:45:23 2020
+++ src/sys/miscfs/genfs/genfs_io.c	Tue Mar 17 18:31:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfs_io.c,v 1.93 2020/03/14 20:45:23 ad Exp $	*/
+/*	$NetBSD: genfs_io.c,v 1.94 2020/03/17 18:31:38 ad Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.93 2020/03/14 20:45:23 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfs_io.c,v 1.94 2020/03/17 18:31:38 ad Exp $");
 
 #include 
 #include 
@@ -516,9 +516,9 @@ out:
 			}
 			uvm_pagelock(pg);
 			uvm_pageenqueue(pg);
-			uvm_pageunbusy(pg);
+			uvm_pagewakeup(pg);
 			uvm_pageunlock(pg);
-			pg->flags &= ~PG_FAKE;
+			pg->flags &= ~(PG_BUSY|PG_FAKE);
 			UVM_PAGE_OWN(pg, NULL);
 		} else if (memwrite && !overwrite &&
 		uvm_pagegetdirty(pg) == UVM_PAGE_STATUS_CLEAN) {

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.186 src/sys/rump/librump/rumpkern/vm.c:1.187
--- src/sys/rump/librump/rumpkern/vm.c:1.186	Sat Mar 14 20:23:51 2020
+++ src/sys/rump/librump/rumpkern/vm.c	Tue Mar 17 18:31:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.186 2020/03/14 20:23:51 ad Exp $	*/
+/*	$NetBSD: vm.c,v 1.187 2020/03/17 18:31:38 ad Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.186 2020/03/14 20:23:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.187 2020/03/17 18:31:38 ad Exp $");
 
 #include 
 #include 
@@ -689,8 +689,9 @@ uvm_page_unbusy(struct vm_page **pgs, in
 		if (pg->flags & PG_RELEASED) {
 			uvm_pagefree(pg);
 		} else {
+			pg->flags &= ~PG_BUSY;
 			uvm_pagelock(pg);
-			uvm_pageunbusy(pg);
+			uvm_pagewakeup(pg);
 			uvm_pageunlock(pg);
 		}
 	}
@@ -710,17 +711,15 @@ uvm_pagewait(struct vm_page *pg, krwlock
 }
 
 void
-uvm_pageunbusy(struct vm_page *pg)
+uvm_pagewakeup(struct vm_page *pg)
 {
 
-	KASSERT((pg->flags & PG_BUSY) != 0);
 	KASSERT(mutex_owned(>interlock));
 
 	if ((pg->pqflags & PQ_WANTED) != 0) {
 		pg->pqflags &= ~PQ_WANTED;
 		wakeup(pg);
 	}
-	pg->flags &= ~PG_BUSY;
 }
 
 void

Index: src/sys/ufs/lfs/lfs_pages.c
diff -u src/sys/ufs/lfs/lfs_pages.c:1.24 src/sys/ufs/lfs/lfs_pages.c:1.25
--- src/sys/ufs/lfs/lfs_pages.c:1.24	Sat Mar 14 20:45:23 2020
+++ src/sys/ufs/lfs/lfs_pages.c	Tue Mar 17 18:31:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lfs_pages.c,v 1.24 2020/03/14 20:45:23 ad Exp $	*/
+/*	$NetBSD: lfs_pages.c,v 1.25 2020/03/17 18:31:38 ad Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2002, 2003, 2019 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.24 2020/03/14 20:45:23 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lfs_pages.c,v 1.25 2020/03/17 18:31:38 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -348,8 +348,9 @@ check_dirty(struct lfs *fs, struct vnode
 	pg->flags |= PG_DELWRI;
 }
 			}
+			pg->flags &= ~PG_BUSY;
 			uvm_pagelock(pg);
-			uvm_pageunbusy(pg);
+			uvm_pagewakeup(pg);
 			uvm_pageunlock(pg);
 			UVM_PAGE_OWN(pg, NULL);
 		}

Index: src/sys/uvm/uvm_aobj.c
diff -u src/sys/uvm/uvm_aobj.c:1.137 src/sys/uvm/uvm_aobj.c:1.138
--- src/sys/uvm/uvm_aobj.c:1.137	Sat Mar 14 20:23:51 2020
+++ src/sys/uvm/uvm_aobj.c	Tue Mar 17 18:31:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_aobj.c,v 1.137 2020/03/14 20:23:51 ad Exp $	*/
+/*	$NetBSD: uvm_aobj.c,v 1.138 2020/03/17 18:31:39 ad Exp $	*/
 
 /*
  * Copyright (c) 1998 Chuck Silvers, Charles D. Cranor and
@@ -38,7 +38,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: 

CVS commit: src/sys/arch

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 18:17:07 UTC 2020

Modified Files:
src/sys/arch/amd64/include: pmap.h
src/sys/arch/i386/include: pmap.h

Log Message:
Always set PTEs using atomics.  There are too many assumptions to go wrong.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/amd64/include/pmap.h
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/i386/include/pmap.h

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



CVS commit: src/sys/arch

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 18:17:07 UTC 2020

Modified Files:
src/sys/arch/amd64/include: pmap.h
src/sys/arch/i386/include: pmap.h

Log Message:
Always set PTEs using atomics.  There are too many assumptions to go wrong.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/amd64/include/pmap.h
cvs rdiff -u -r1.123 -r1.124 src/sys/arch/i386/include/pmap.h

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

Modified files:

Index: src/sys/arch/amd64/include/pmap.h
diff -u src/sys/arch/amd64/include/pmap.h:1.64 src/sys/arch/amd64/include/pmap.h:1.65
--- src/sys/arch/amd64/include/pmap.h:1.64	Thu Nov 14 16:23:52 2019
+++ src/sys/arch/amd64/include/pmap.h	Tue Mar 17 18:17:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.64 2019/11/14 16:23:52 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.65 2020/03/17 18:17:07 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -202,7 +202,8 @@ extern bool svs_pcid;
 #ifndef XENPV
 #define pmap_pa2pte(a)			(a)
 #define pmap_pte2pa(a)			((a) & PTE_FRAME)
-#define pmap_pte_set(p, n)		do { *(p) = (n); } while (0)
+#define pmap_pte_set(p, n)		\
+(void)atomic_swap_ulong((volatile unsigned long *)p, n)
 #define pmap_pte_cas(p, o, n)		atomic_cas_64((p), (o), (n))
 #define pmap_pte_testset(p, n)		\
 atomic_swap_ulong((volatile unsigned long *)p, n)

Index: src/sys/arch/i386/include/pmap.h
diff -u src/sys/arch/i386/include/pmap.h:1.123 src/sys/arch/i386/include/pmap.h:1.124
--- src/sys/arch/i386/include/pmap.h:1.123	Sat Mar  9 09:09:56 2019
+++ src/sys/arch/i386/include/pmap.h	Tue Mar 17 18:17:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.123 2019/03/09 09:09:56 maxv Exp $	*/
+/*	$NetBSD: pmap.h,v 1.124 2020/03/17 18:17:07 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -294,10 +294,11 @@
 #ifndef XENPV
 #define pmap_pa2pte(a)			(a)
 #define pmap_pte2pa(a)			((a) & PTE_FRAME)
-#define pmap_pte_set(p, n)		do { *(p) = (n); } while (0)
 #define pmap_pte_flush()		/* nothing */
 
 #ifdef PAE
+#define pmap_pte_set(p, n)		\
+(void)atomic_swap_64((volatile uint64_t *)p, n)
 #define pmap_pte_cas(p, o, n)		atomic_cas_64((p), (o), (n))
 #define pmap_pte_testset(p, n)		\
 atomic_swap_64((volatile uint64_t *)p, n)
@@ -306,6 +307,8 @@
 #define pmap_pte_clearbits(p, b)	\
 atomic_and_64((volatile uint64_t *)p, ~(b))
 #else /* PAE */
+#define pmap_pte_set(p, n)		\
+(void)atomic_swap_ulong((volatile unsigned long *)p, n)
 #define pmap_pte_cas(p, o, n)		atomic_cas_32((p), (o), (n))
 #define pmap_pte_testset(p, n)		\
 atomic_swap_ulong((volatile unsigned long *)p, n)



Re: CVS commit: src/sys/arch/evbarm/conf

2020-03-17 Thread Jonathan A. Kollasch
On Mon, Mar 16, 2020 at 08:17:58AM +, Tohru Nishimura wrote:
> Module Name:  src
> Committed By: nisimura
> Date: Mon Mar 16 08:17:58 UTC 2020
> 
> Modified Files:
>   src/sys/arch/evbarm/conf: GENERIC64 files.generic64
> 
> Log Message:
> include files.sociox for generic64
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.140 -r1.141 src/sys/arch/evbarm/conf/GENERIC64
> cvs rdiff -u -r1.15 -r1.16 src/sys/arch/evbarm/conf/files.generic64
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
> 


This (and the related changes) breaks the GENERIC64 build:

nbmake: nbmake: don't know how to make 
[...]/src/sys/arch/arm/sociox/sni_emmc.c. Stop



CVS commit: src/sys/arch

2020-03-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Mar 17 17:18:49 UTC 2020

Modified Files:
src/sys/arch/amd64/include: cpu.h param.h pcb.h types.h
src/sys/arch/x86/x86: vm_machdep.c

Log Message:
Add a redzone between the pcb and the stack. Sent to port-amd64@.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/amd64/include/cpu.h
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/amd64/include/param.h
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/amd64/include/pcb.h
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/amd64/include/types.h
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/x86/x86/vm_machdep.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

2020-03-17 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Mar 17 17:18:49 UTC 2020

Modified Files:
src/sys/arch/amd64/include: cpu.h param.h pcb.h types.h
src/sys/arch/x86/x86: vm_machdep.c

Log Message:
Add a redzone between the pcb and the stack. Sent to port-amd64@.


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/amd64/include/cpu.h
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/amd64/include/param.h
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/amd64/include/pcb.h
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/amd64/include/types.h
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/x86/x86/vm_machdep.c

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

Modified files:

Index: src/sys/arch/amd64/include/cpu.h
diff -u src/sys/arch/amd64/include/cpu.h:1.67 src/sys/arch/amd64/include/cpu.h:1.68
--- src/sys/arch/amd64/include/cpu.h:1.67	Sun Dec  8 11:53:54 2019
+++ src/sys/arch/amd64/include/cpu.h	Tue Mar 17 17:18:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.67 2019/12/08 11:53:54 maxv Exp $	*/
+/*	$NetBSD: cpu.h,v 1.68 2020/03/17 17:18:49 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -84,6 +84,9 @@ x86_curlwp(void)
 #define CLKF_INTR(frame)	(curcpu()->ci_idepth > 0)
 #define LWP_PC(l)		((l)->l_md.md_regs->tf_rip)
 
+void *cpu_uarea_alloc(bool);		
+bool cpu_uarea_free(void *);
+
 #endif	/* _KERNEL */
 
 #else	/*	__x86_64__	*/

Index: src/sys/arch/amd64/include/param.h
diff -u src/sys/arch/amd64/include/param.h:1.36 src/sys/arch/amd64/include/param.h:1.37
--- src/sys/arch/amd64/include/param.h:1.36	Sat Feb  8 07:07:07 2020
+++ src/sys/arch/amd64/include/param.h	Tue Mar 17 17:18:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.36 2020/02/08 07:07:07 maxv Exp $	*/
+/*	$NetBSD: param.h,v 1.37 2020/03/17 17:18:49 maxv Exp $	*/
 
 #ifdef __x86_64__
 
@@ -69,10 +69,8 @@
 
 #if defined(KASAN) || defined(KMSAN)
 #define	UPAGES		8
-#elif defined(DIAGNOSTIC)
-#define	UPAGES		5		/* pages of u-area (1 for redzone) */
 #else
-#define	UPAGES		4		/* pages of u-area */
+#define	UPAGES		5		/* pages of u-area (1 for redzone) */
 #endif
 #define	USPACE		(UPAGES * NBPG)	/* total size of u-area */
 

Index: src/sys/arch/amd64/include/pcb.h
diff -u src/sys/arch/amd64/include/pcb.h:1.31 src/sys/arch/amd64/include/pcb.h:1.32
--- src/sys/arch/amd64/include/pcb.h:1.31	Sat Oct 12 15:44:46 2019
+++ src/sys/arch/amd64/include/pcb.h	Tue Mar 17 17:18:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcb.h,v 1.31 2019/10/12 15:44:46 christos Exp $	*/
+/*	$NetBSD: pcb.h,v 1.32 2020/03/17 17:18:49 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -77,6 +77,10 @@
 
 #define	NIOPORTS	1024		/* # of ports we allow to be mapped */
 
+/*
+ * IMPORTANT NOTE: this structure, including the variable-sized FPU state at
+ * the end, must fit within one page.
+ */
 struct pcb {
 	int	  pcb_flags;
 #define	PCB_COMPAT32	0x01

Index: src/sys/arch/amd64/include/types.h
diff -u src/sys/arch/amd64/include/types.h:1.64 src/sys/arch/amd64/include/types.h:1.65
--- src/sys/arch/amd64/include/types.h:1.64	Thu Nov 14 16:23:52 2019
+++ src/sys/arch/amd64/include/types.h	Tue Mar 17 17:18:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.64 2019/11/14 16:23:52 maxv Exp $	*/
+/*	$NetBSD: types.h,v 1.65 2020/03/17 17:18:49 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -116,6 +116,7 @@ typedef	unsigned char		__cpu_simple_lock
 #define	__HAVE_PCPU_AREA 1
 #define	__HAVE_DIRECT_MAP 1
 #endif
+#define	__HAVE_CPU_UAREA_ROUTINES 1
 #if !defined(NO_PCI_MSI_MSIX)
 #define	__HAVE_PCI_MSI_MSIX
 #endif

Index: src/sys/arch/x86/x86/vm_machdep.c
diff -u src/sys/arch/x86/x86/vm_machdep.c:1.41 src/sys/arch/x86/x86/vm_machdep.c:1.42
--- src/sys/arch/x86/x86/vm_machdep.c:1.41	Sat Jan 25 15:38:24 2020
+++ src/sys/arch/x86/x86/vm_machdep.c	Tue Mar 17 17:18:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_machdep.c,v 1.41 2020/01/25 15:38:24 ad Exp $	*/
+/*	$NetBSD: vm_machdep.c,v 1.42 2020/03/17 17:18:49 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986 The Regents of the University of California.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.41 2020/01/25 15:38:24 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.42 2020/03/17 17:18:49 maxv Exp $");
 
 #include "opt_mtrr.h"
 
@@ -194,12 +194,6 @@ cpu_lwp_fork(struct lwp *l1, struct lwp 
 	/* Child LWP might get aston() before returning to userspace. */
 	tf->tf_trapno = T_ASTFLT;
 
-#if 0 /* DIAGNOSTIC */
-	/* Set a red zone in the kernel stack after the uarea. */
-	pmap_kremove(uv, PAGE_SIZE);
-	pmap_update(pmap_kernel());
-#endif
-
 	/* If specified, set a different user stack for a child. */
 	if (stack != NULL) {
 #ifdef __x86_64__
@@ -353,3 +347,31 @@ vunmapbuf(struct buf *bp, vsize_t len)
 	bp->b_data = bp->b_saveaddr;
 	bp->b_saveaddr = 0;
 }
+
+#ifdef __HAVE_CPU_UAREA_ROUTINES
+void *
+cpu_uarea_alloc(bool system)

CVS commit: src/sys/compat/netbsd32

2020-03-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Mar 17 17:16:26 UTC 2020

Modified Files:
src/sys/compat/netbsd32: netbsd32_sysctl.c

Log Message:
Remove a debug printf() that accidentally got committed.  :(


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/compat/netbsd32/netbsd32_sysctl.c

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



CVS commit: src/sys/compat/netbsd32

2020-03-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Mar 17 17:16:26 UTC 2020

Modified Files:
src/sys/compat/netbsd32: netbsd32_sysctl.c

Log Message:
Remove a debug printf() that accidentally got committed.  :(


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/compat/netbsd32/netbsd32_sysctl.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/compat/netbsd32/netbsd32_sysctl.c
diff -u src/sys/compat/netbsd32/netbsd32_sysctl.c:1.42 src/sys/compat/netbsd32/netbsd32_sysctl.c:1.43
--- src/sys/compat/netbsd32/netbsd32_sysctl.c:1.42	Sun Mar 15 14:15:12 2020
+++ src/sys/compat/netbsd32/netbsd32_sysctl.c	Tue Mar 17 17:16:26 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_sysctl.c,v 1.42 2020/03/15 14:15:12 pgoyette Exp $	*/
+/*	$NetBSD: netbsd32_sysctl.c,v 1.43 2020/03/17 17:16:26 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.42 2020/03/15 14:15:12 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.43 2020/03/17 17:16:26 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -122,7 +122,6 @@ SYSCTL_SETUP(netbsd32_sysctl_emul_setup,
 	const struct sysctlnode *_root = _sysctl_root;
 	extern const char machine32[];
 
-	printf("%s: called\n", __func__); /* XXX PRG */
 	sysctl_createv(clog, 0, &_root, NULL,
 		   CTLFLAG_PERMANENT,
 		   CTLTYPE_NODE, "kern", NULL,



Re: CVS commit: src/share/man/man4

2020-03-17 Thread Tetsuya Isaki
At Tue, 17 Mar 2020 10:50:59 +,
Nia Alarie wrote:
> Module Name:  src
> Committed By: nia
> Date: Tue Mar 17 10:50:59 UTC 2020
> 
> Modified Files:
>   src/share/man/man4: audio.4
> 
> Log Message:
> audio.4: 1-12 channels are only universally supported for playback.
> 
> When a mono recording device is set to use 1 channel, the kernel will
> correct the number of channels back down to 1. This information can be
> obtained with AUDIO_GETINFO...

Please revert and send a bug report if so.
---
Tetsuya Isaki 


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

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 13:34:51 UTC 2020

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

Log Message:
Add a bunch of assertions.


To generate a diff of this commit:
cvs rdiff -u -r1.370 -r1.371 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.370 src/sys/arch/x86/x86/pmap.c:1.371
--- src/sys/arch/x86/x86/pmap.c:1.370	Sun Mar 15 19:41:04 2020
+++ src/sys/arch/x86/x86/pmap.c	Tue Mar 17 13:34:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.370 2020/03/15 19:41:04 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.371 2020/03/17 13:34:50 ad Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.370 2020/03/15 19:41:04 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.371 2020/03/17 13:34:50 ad Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -139,6 +139,8 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.3
 #include "opt_svs.h"
 #include "opt_kaslr.h"
 
+#define	__MUTEX_PRIVATE	/* for assertions */
+
 #include 
 #include 
 #include 
@@ -333,6 +335,8 @@ paddr_t pmap_pa_end;   /* PA of last phy
 #endif
 
 #define	VM_PAGE_TO_PP(pg)	(&(pg)->mdpage.mp_pp)
+#define	PMAP_CHECK_PP(pp) \
+KASSERTMSG((pp)->pp_lock.mtx_ipl._ipl == IPL_VM, "bad pmap_page %p", pp)
 
 /*
  * Other data structures
@@ -644,6 +648,7 @@ pmap_ptp_init(struct vm_page *ptp)
 	*minidx = UINT16_MAX;
 	*maxidx = 0;
 	rb_tree_init(_PAGE_TO_PP(ptp)->pp_rb, _rbtree_ops);
+	PMAP_CHECK_PP(VM_PAGE_TO_PP(ptp));
 }
 
 /*
@@ -654,6 +659,7 @@ pmap_ptp_fini(struct vm_page *ptp)
 {
 
 	KASSERT(RB_TREE_MIN(_PAGE_TO_PP(ptp)->pp_rb) == NULL);
+	PMAP_CHECK_PP(VM_PAGE_TO_PP(ptp));
 	ptp->uanon = NULL;
 }
 
@@ -1982,6 +1988,34 @@ pmap_free_pvs(struct pmap *pmap, struct 
 }
 
 /*
+ * pmap_check_pv: verify {VA, PTP} pair is either tracked/untracked by page
+ */
+static void
+pmap_check_pv(struct pmap *pmap, struct vm_page *ptp, struct pmap_page *pp,
+vaddr_t va, bool tracked)
+{
+#ifdef DIAGNOSTIC /* XXX too slow make this DEBUG before April 2020 */
+	struct pv_pte *pvpte;
+
+	PMAP_CHECK_PP(pp);
+
+	mutex_spin_enter(>pp_lock);
+	for (pvpte = pv_pte_first(pp); pvpte; pvpte = pv_pte_next(pp, pvpte)) {
+		if (pvpte->pte_ptp == ptp && pvpte->pte_va == va) {
+			break;
+		}
+	}
+	mutex_spin_exit(>pp_lock);
+
+	if (pvpte && !tracked) {
+		panic("pmap_check_pv: %p/%lx found on pp %p", ptp, va, pp);
+	} else if (!pvpte && tracked) {
+		panic("pmap_check_pv: %p/%lx missing on pp %p", ptp, va, pp);
+	}
+#endif
+}
+
+/*
  * pmap_treelookup_pv: search the PV tree for a dynamic entry
  *
  * => pmap must be locked
@@ -2010,6 +2044,7 @@ pmap_treelookup_pv(const struct pmap *pm
 		node = node->rb_nodes[pve->pve_pte.pte_va < va];
 	}
 }
+
 /*
  * pmap_lookup_pv: look up a non-embedded pv entry for the given pmap
  *
@@ -2083,6 +2118,7 @@ pmap_enter_pv(struct pmap *pmap, struct 
 	KASSERT(ptp_to_pmap(ptp) == pmap);
 	KASSERT(ptp == NULL || ptp->uobject != NULL);
 	KASSERT(ptp == NULL || ptp_va2o(va, 1) == ptp->offset);
+	PMAP_CHECK_PP(pp);
 
 	/*
 	 * If entering the same page and it's already tracked with an
@@ -2093,6 +2129,7 @@ pmap_enter_pv(struct pmap *pmap, struct 
 	if (atomic_load_relaxed(>pp_pte.pte_ptp) == ptp &&
 	atomic_load_relaxed(>pp_pte.pte_va) == va) {
 		*samepage = true;
+		pmap_check_pv(pmap, ptp, pp, va, true);
 		return 0;
 	}
 
@@ -2104,6 +2141,7 @@ pmap_enter_pv(struct pmap *pmap, struct 
 	*old_pve = pmap_treelookup_pv(pmap, ptp, tree, va);
 	if (*old_pve != NULL && (*old_pve)->pve_pp == pp) {
 		*samepage = true;
+		pmap_check_pv(pmap, ptp, pp, va, true);
 		return 0;
 	}
 
@@ -2116,6 +2154,7 @@ pmap_enter_pv(struct pmap *pmap, struct 
 	}
 
 	error = 0;
+	pmap_check_pv(pmap, ptp, pp, va, false);
 	mutex_spin_enter(>pp_lock);
 	if (!pv_pte_embedded(pp)) {
 		/*
@@ -2142,6 +2181,7 @@ pmap_enter_pv(struct pmap *pmap, struct 
 		LIST_INSERT_HEAD(>pp_pvlist, pve, pve_list);
 	}
 	mutex_spin_exit(>pp_lock);
+	pmap_check_pv(pmap, ptp, pp, va, true);
 
 	return error;
 }
@@ -2157,7 +2197,8 @@ static void
 pmap_remove_pv(struct pmap *pmap, struct pmap_page *pp, struct vm_page *ptp,
 vaddr_t va, struct pv_entry *pve, uint8_t oattrs)
 {
-	rb_tree_t *tree;
+	rb_tree_t *tree = (ptp != NULL ?
+	_PAGE_TO_PP(ptp)->pp_rb : _kernel_rb);
 
 	KASSERT(mutex_owned(>pm_lock));
 	KASSERT(ptp_to_pmap(ptp) == pmap);
@@ -2165,6 +2206,8 @@ pmap_remove_pv(struct pmap *pmap, struct
 	KASSERT(ptp == NULL || ptp_va2o(va, 1) == ptp->offset);
 	KASSERT(ptp != NULL || pmap == pmap_kernel());
 
+	pmap_check_pv(pmap, ptp, pp, va, true);
+
 	mutex_spin_enter(>pp_lock);
 	pp->pp_attrs |= oattrs;
 	if (pve == NULL) {
@@ -2174,16 +2217,23 @@ pmap_remove_pv(struct pmap *pmap, struct
 		pp->pp_pte.pte_va = 0;
 		

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

2020-03-17 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Mar 17 13:34:51 UTC 2020

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

Log Message:
Add a bunch of assertions.


To generate a diff of this commit:
cvs rdiff -u -r1.370 -r1.371 src/sys/arch/x86/x86/pmap.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/man4

2020-03-17 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Mar 17 10:50:59 UTC 2020

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

Log Message:
audio.4: 1-12 channels are only universally supported for playback.

When a mono recording device is set to use 1 channel, the kernel will
correct the number of channels back down to 1. This information can be
obtained with AUDIO_GETINFO...


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

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



CVS commit: src/share/man/man4

2020-03-17 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue Mar 17 10:50:59 UTC 2020

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

Log Message:
audio.4: 1-12 channels are only universally supported for playback.

When a mono recording device is set to use 1 channel, the kernel will
correct the number of channels back down to 1. This information can be
obtained with AUDIO_GETINFO...


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

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

Modified files:

Index: src/share/man/man4/audio.4
diff -u src/share/man/man4/audio.4:1.99 src/share/man/man4/audio.4:1.100
--- src/share/man/man4/audio.4:1.99	Mon Mar 16 19:20:36 2020
+++ src/share/man/man4/audio.4	Tue Mar 17 10:50:59 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: audio.4,v 1.99 2020/03/16 19:20:36 nia Exp $
+.\"	$NetBSD: audio.4,v 1.100 2020/03/17 10:50:59 nia Exp $
 .\"
 .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -401,7 +401,7 @@ and
 are one of the values obtained by
 .Dv AUDIO_GETENC .
 .Va channels
-ranges from 1 to 12.
+ranges from 1 to 12 for playback.
 .Va frequency
 ranges from 1000Hz to 192000Hz.
 .Pp