CVS commit: src/sys/dev

2019-01-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jan 16 07:32:14 UTC 2019

Modified Files:
src/sys/dev/mii: brgphyreg.h
src/sys/dev/pci: if_bge.c

Log Message:
 Remove the definition of BRGPHY_MII_1000CTL and use MII_GTCR.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/mii/brgphyreg.h
cvs rdiff -u -r1.320 -r1.321 src/sys/dev/pci/if_bge.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/mii/brgphyreg.h
diff -u src/sys/dev/mii/brgphyreg.h:1.9 src/sys/dev/mii/brgphyreg.h:1.10
--- src/sys/dev/mii/brgphyreg.h:1.9	Tue Jun 17 21:37:20 2014
+++ src/sys/dev/mii/brgphyreg.h	Wed Jan 16 07:32:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: brgphyreg.h,v 1.9 2014/06/17 21:37:20 msaitoh Exp $	*/
+/*	$NetBSD: brgphyreg.h,v 1.10 2019/01/16 07:32:13 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2000
@@ -41,14 +41,6 @@
  * Broadcom BCM5400 registers
  */
 
-#define BRGPHY_MII_1000CTL	0x09	/* 1000baseT control */
-#define	BRGPHY_1000CTL_TST	0xE000	/* Test modes */
-#define	BRGPHY_1000CTL_MSE	0x1000	/* Master/Slave enable */
-#define	BRGPHY_1000CTL_MSC	0x0800	/* Master/Slave configuration */
-#define	BRGPHY_1000CTL_RD	0x0400	/* Repeater/DTE */
-#define	BRGPHY_1000CTL_AFD	0x0200	/* Advertise full duplex */
-#define	BRGPHY_1000CTL_AHD	0x0100	/* Advertise half duplex */
-
 #define BRGPHY_MII_PHY_EXTCTL	0x10	/* PHY extended control */
 #define BRGPHY_PHY_EXTCTL_MAC_PHY	0x8000	/* 10BIT/GMI-interface */
 #define BRGPHY_PHY_EXTCTL_DIS_CROSS	0x4000	/* Disable MDI crossover */

Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.320 src/sys/dev/pci/if_bge.c:1.321
--- src/sys/dev/pci/if_bge.c:1.320	Sun Dec  2 17:02:04 2018
+++ src/sys/dev/pci/if_bge.c	Wed Jan 16 07:32:13 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bge.c,v 1.320 2018/12/02 17:02:04 bouyer Exp $	*/
+/*	$NetBSD: if_bge.c,v 1.321 2019/01/16 07:32:13 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.320 2018/12/02 17:02:04 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.321 2019/01/16 07:32:13 msaitoh Exp $");
 
 #include 
 #include 
@@ -1393,7 +1393,7 @@ bge_miibus_writereg(device_t dev, int ph
 	int i;
 
 	if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5906 &&
-	(reg == BRGPHY_MII_1000CTL || reg == BRGPHY_MII_AUXCTL))
+	(reg == MII_GTCR || reg == BRGPHY_MII_AUXCTL))
 		return;
 
 	if (bge_ape_lock(sc, sc->bge_phy_ape_lock) != 0)



CVS commit: src/sys/dev/mii

2019-01-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jan 16 07:30:35 UTC 2019

Modified Files:
src/sys/dev/mii: mii.h

Log Message:
 Add MII_GTCR(== 0x09 == MII_100T2CR) and MII_GTSR(== 0x0a == MII_100T2SR).
100T2 is little hard to imagine the meaning for gigabit Ethernet.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/mii/mii.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/mii/mii.h
diff -u src/sys/dev/mii/mii.h:1.23 src/sys/dev/mii/mii.h:1.24
--- src/sys/dev/mii/mii.h:1.23	Mon Jun 18 09:11:03 2018
+++ src/sys/dev/mii/mii.h	Wed Jan 16 07:30:35 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: mii.h,v 1.23 2018/06/18 09:11:03 msaitoh Exp $	*/
+/*	$NetBSD: mii.h,v 1.24 2019/01/16 07:30:35 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Manuel Bouyer.  All rights reserved.
@@ -217,8 +217,11 @@
 #define ANLPRNP_TOGGLE	0x0800	/* Toggle */
 #define ANLPRNP_MSGUNF_MASK 0x07ff /* Message(Anx28C)/Unformatted Code Field */
 
-			/* This is also the 1000baseT control register */
-#define	MII_100T2CR	0x09	/* 100base-T2 control register */
+#define	MII_GTCR	0x09	/*
+ * Master-Slave control register for
+ * 100BASE-T2 and 1000BASE-T.
+ */
+#define	MII_100T2CR	MII_GTCR /* alias */
 #define	GTCR_TEST_MASK	0xe000	/* see 802.3ab ss. 40.6.1.1.2 */
 #define	GTCR_MAN_MS	0x1000	/* enable manual master/slave control */
 #define	GTCR_ADV_MS	0x0800	/* 1 = adv. master, 0 = adv. slave */
@@ -226,8 +229,11 @@
 #define	GTCR_ADV_1000TFDX 0x0200 /* adv. 1000baseT FDX */
 #define	GTCR_ADV_1000THDX 0x0100 /* adv. 1000baseT HDX */
 
-			/* This is also the 1000baseT status register */
-#define	MII_100T2SR	0x0a	/* 100base-T2 status register */
+#define	MII_GTSR	0x0a	/*
+ * Master-Slave status register for
+ * 100BASE-T2 and 1000BASE-T.
+ */
+#define	MII_100T2SR	MII_GTSR /* alias */
 #define	GTSR_MAN_MS_FLT	0x8000	/* master/slave config fault */
 #define	GTSR_MS_RES	0x4000	/* result: 1 = master, 0 = slave */
 #define	GTSR_LRS	0x2000	/* local rx status, 1 = ok */



CVS commit: src/bin/sh

2019-01-15 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Wed Jan 16 07:14:17 UTC 2019

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

Log Message:
Redo 1.65 in a simpler way.   This is the bit rot avoidance code
that is #if 0'd and (still) has never been compiled (most likely
never will be.)

While here, in the same uncompiled code, deal with line number
counting.   Whether this is correct depends upon how this code
is used, and as it never is (and never has been since line numbers
first started being counted), this is somewhat speculative, but
it seems likely to be the correct way to handle things.

NFC (this code is still all #if 0).


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

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

Modified files:

Index: src/bin/sh/input.c
diff -u src/bin/sh/input.c:1.68 src/bin/sh/input.c:1.69
--- src/bin/sh/input.c:1.68	Tue Jan 15 14:23:56 2019
+++ src/bin/sh/input.c	Wed Jan 16 07:14:17 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: input.c,v 1.68 2019/01/15 14:23:56 kre Exp $	*/
+/*	$NetBSD: input.c,v 1.69 2019/01/16 07:14:17 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)input.c	8.3 (Berkeley) 6/9/95";
 #else
-__RCSID("$NetBSD: input.c,v 1.68 2019/01/15 14:23:56 kre Exp $");
+__RCSID("$NetBSD: input.c,v 1.69 2019/01/16 07:14:17 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -145,18 +145,18 @@ pfgets(char *line, int len)
 
 	while (--nleft > 0) {
 		c = pgetc_macro();
+		if (c == PFAKE)		/* consecutive PFAKEs is impossible */
+			c = pgetc_macro();
 		if (c == PEOF) {
 			if (p == line)
 return NULL;
 			break;
 		}
-		if (c == PFAKE) {
-			++nleft;
-			continue;
-		}
 		*p++ = c;
-		if (c == '\n')
+		if (c == '\n') {
+			plinno++;
 			break;
+		}
 	}
 	*p = '\0';
 	return line;



CVS commit: src/sys/dev/mii

2019-01-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jan 16 05:19:30 UTC 2019

Modified Files:
src/sys/dev/mii: makphy.c

Log Message:
 Change the register size to uint16_t again in makphy_reset(). No functional
change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/mii/makphy.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/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.50 src/sys/dev/mii/makphy.c:1.51
--- src/sys/dev/mii/makphy.c:1.50	Wed Jan 16 05:11:06 2019
+++ src/sys/dev/mii/makphy.c	Wed Jan 16 05:19:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.50 2019/01/16 05:11:06 msaitoh Exp $	*/
+/*	$NetBSD: makphy.c,v 1.51 2019/01/16 05:19:30 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.50 2019/01/16 05:11:06 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.51 2019/01/16 05:19:30 msaitoh Exp $");
 
 #include 
 #include 
@@ -230,7 +230,7 @@ makphyattach(device_t parent, device_t s
 static void
 makphy_reset(struct mii_softc *sc)
 {
-	int reg;
+	uint16_t reg;
 
 	mii_phy_reset(sc);
 



CVS commit: src/sys/dev/mii

2019-01-15 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Jan 16 05:11:06 UTC 2019

Modified Files:
src/sys/dev/mii: makphy.c

Log Message:
 Restore a comment which was removed in rev. 1.46.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/mii/makphy.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/mii/makphy.c
diff -u src/sys/dev/mii/makphy.c:1.49 src/sys/dev/mii/makphy.c:1.50
--- src/sys/dev/mii/makphy.c:1.49	Tue Jan  8 03:14:51 2019
+++ src/sys/dev/mii/makphy.c	Wed Jan 16 05:11:06 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: makphy.c,v 1.49 2019/01/08 03:14:51 msaitoh Exp $	*/
+/*	$NetBSD: makphy.c,v 1.50 2019/01/16 05:11:06 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -54,8 +54,12 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/*
+ * Driver for the Marvell 88E1000 ``Alaska'' 10/100/1000 PHY.
+ */
+
 #include 
-__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.49 2019/01/08 03:14:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: makphy.c,v 1.50 2019/01/16 05:11:06 msaitoh Exp $");
 
 #include 
 #include 



CVS commit: src/sys/kern

2019-01-15 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Jan 16 01:50:25 UTC 2019

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

Log Message:
Initialize m_pkthdr members explicity.


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.231 src/sys/kern/uipc_mbuf.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/uipc_mbuf.c
diff -u src/sys/kern/uipc_mbuf.c:1.230 src/sys/kern/uipc_mbuf.c:1.231
--- src/sys/kern/uipc_mbuf.c:1.230	Thu Dec 27 14:03:55 2018
+++ src/sys/kern/uipc_mbuf.c	Wed Jan 16 01:50:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_mbuf.c,v 1.230 2018/12/27 14:03:55 maxv Exp $	*/
+/*	$NetBSD: uipc_mbuf.c,v 1.231 2019/01/16 01:50:25 knakahara Exp $	*/
 
 /*
  * Copyright (c) 1999, 2001, 2018 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.230 2018/12/27 14:03:55 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_mbuf.c,v 1.231 2019/01/16 01:50:25 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mbuftrace.h"
@@ -565,6 +565,8 @@ m_gethdr(int how, int type)
 	m->m_pkthdr.len = 0;
 	m->m_pkthdr.csum_flags = 0;
 	m->m_pkthdr.csum_data = 0;
+	m->m_pkthdr.segsz = 0;
+	m->m_pkthdr.ether_vtag = 0;
 	SLIST_INIT(>m_pkthdr.tags);
 
 	m->m_pkthdr.pattr_class = NULL;



CVS commit: [pgoyette-compat] src/sys/net

2019-01-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan 15 22:28:15 UTC 2019

Modified Files:
src/sys/net [pgoyette-compat]: rtsock_shared.c

Log Message:
More #include removal


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/net/rtsock_shared.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/rtsock_shared.c
diff -u src/sys/net/rtsock_shared.c:1.1.2.3 src/sys/net/rtsock_shared.c:1.1.2.4
--- src/sys/net/rtsock_shared.c:1.1.2.3	Tue Jan 15 04:10:34 2019
+++ src/sys/net/rtsock_shared.c	Tue Jan 15 22:28:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_shared.c,v 1.1.2.3 2019/01/15 04:10:34 pgoyette Exp $	*/
+/*	$NetBSD: rtsock_shared.c,v 1.1.2.4 2019/01/15 22:28:15 pgoyette Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,12 +61,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.1.2.3 2019/01/15 04:10:34 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock_shared.c,v 1.1.2.4 2019/01/15 22:28:15 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
-#include "opt_mpls.h"
-#include "opt_compat_netbsd.h"
 #include "opt_net_mpsafe.h"
 #endif
 



CVS commit: [pgoyette-compat] src/sys

2019-01-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan 15 22:27:07 UTC 2019

Modified Files:
src/sys/compat/common [pgoyette-compat]: rtsock_50.c
src/sys/net [pgoyette-compat]: rtsock.c

Log Message:
Remove a couple of unneeded #include-s

XXX There's probably a lot more clean-up that could happen here!


To generate a diff of this commit:
cvs rdiff -u -r1.6.2.5 -r1.6.2.6 src/sys/compat/common/rtsock_50.c
cvs rdiff -u -r1.238.2.21 -r1.238.2.22 src/sys/net/rtsock.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/common/rtsock_50.c
diff -u src/sys/compat/common/rtsock_50.c:1.6.2.5 src/sys/compat/common/rtsock_50.c:1.6.2.6
--- src/sys/compat/common/rtsock_50.c:1.6.2.5	Tue Jan 15 03:40:35 2019
+++ src/sys/compat/common/rtsock_50.c	Tue Jan 15 22:27:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock_50.c,v 1.6.2.5 2019/01/15 03:40:35 pgoyette Exp $	*/
+/*	$NetBSD: rtsock_50.c,v 1.6.2.6 2019/01/15 22:27:07 pgoyette Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,11 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.6.2.5 2019/01/15 03:40:35 pgoyette Exp $");
-
-#ifdef _KERNEL_OPT
-#include "opt_compat_netbsd.h"
-#endif
+__KERNEL_RCSID(0, "$NetBSD: rtsock_50.c,v 1.6.2.6 2019/01/15 22:27:07 pgoyette Exp $");
 
 #define	COMPAT_RTSOCK	/* Use the COMPATNAME/COMPATCALL macros and the
 			 * various other compat definitions - see

Index: src/sys/net/rtsock.c
diff -u src/sys/net/rtsock.c:1.238.2.21 src/sys/net/rtsock.c:1.238.2.22
--- src/sys/net/rtsock.c:1.238.2.21	Tue Jan 15 04:10:34 2019
+++ src/sys/net/rtsock.c	Tue Jan 15 22:27:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtsock.c,v 1.238.2.21 2019/01/15 04:10:34 pgoyette Exp $	*/
+/*	$NetBSD: rtsock.c,v 1.238.2.22 2019/01/15 22:27:07 pgoyette Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,13 +61,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.238.2.21 2019/01/15 04:10:34 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.238.2.22 2019/01/15 22:27:07 pgoyette Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
-#include "opt_mpls.h"
 #include "opt_compat_netbsd.h"
-#include "opt_net_mpsafe.h"
 #endif
 
 #include 



CVS commit: [pgoyette-compat] src/doc

2019-01-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan 15 22:06:35 UTC 2019

Modified Files:
src/doc [pgoyette-compat]: TODO.compat-module

Log Message:
Now that the rtsock_50 stuff has been disentangled, remove a reference
to that in another entry.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.22 -r1.1.2.23 src/doc/TODO.compat-module

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

Modified files:

Index: src/doc/TODO.compat-module
diff -u src/doc/TODO.compat-module:1.1.2.22 src/doc/TODO.compat-module:1.1.2.23
--- src/doc/TODO.compat-module:1.1.2.22	Tue Jan 15 03:44:06 2019
+++ src/doc/TODO.compat-module	Tue Jan 15 22:06:34 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: TODO.compat-module,v 1.1.2.22 2019/01/15 03:44:06 pgoyette Exp $ */
+/* $NetBSD: TODO.compat-module,v 1.1.2.23 2019/01/15 22:06:34 pgoyette Exp $ */
 
 DONE
 
@@ -92,10 +92,10 @@ TODO - Not required for branch merge
 into the monolithic COMPAT module on HEAD.  Thus, its absence from
 any of the version-specific modules is not a regression.
 
-20. For compat_50, in addition to rtsock there are some things in dev/gpio
-and dev/wscons/wsmux that I haven't been able to cleanly separate.
-These items are not currently included in the monolithic COMPAT module
-on HEAD, so lack of integration on the branch is not a regression.
+20. For compat_50, there are some things in dev/gpio and dev/wscons/wsmux
+that I haven't been able to cleanly separate.  These items are not
+currently included in the monolithic COMPAT module on HEAD, so lack of
+integration on the branch is not a regression.
 
 21. Find all the remaining dependencies on the compat_utils routines and
 deal with them appropriately.  For now, we simply ensure that they



CVS commit: [pgoyette-compat] src/sys/kern

2019-01-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan 15 22:01:26 UTC 2019

Modified Files:
src/sys/kern [pgoyette-compat]: compat_stub.c

Log Message:
Add a comment for the SCTP section, as was done for the NTP section


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.38 -r1.1.2.39 src/sys/kern/compat_stub.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/compat_stub.c
diff -u src/sys/kern/compat_stub.c:1.1.2.38 src/sys/kern/compat_stub.c:1.1.2.39
--- src/sys/kern/compat_stub.c:1.1.2.38	Tue Jan 15 21:37:44 2019
+++ src/sys/kern/compat_stub.c	Tue Jan 15 22:01:26 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.38 2019/01/15 21:37:44 pgoyette Exp $	*/
+/* $NetBSD: compat_stub.c,v 1.1.2.39 2019/01/15 22:01:26 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -64,6 +64,12 @@ int (*vec_ntp_timestatus)(void) = NULL;
 void (*vec_ntp_adjtime1)(struct timex *) = NULL;
 #endif
 
+/*
+ * Routine vectors for sctp (called from within rtsock)
+ *
+ * MP-hooks not needed since the SCTP code is not modular
+ */
+
 #ifdef SCTP
 void (*vec_sctp_add_ip_address)(struct ifaddr *) = sctp_add_ip_address;
 void (*vec_sctp_delete_ip_address)(struct ifaddr *) = sctp_delete_ip_address;



CVS commit: [pgoyette-compat] src/sys/kern

2019-01-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan 15 21:37:44 UTC 2019

Modified Files:
src/sys/kern [pgoyette-compat]: compat_stub.c

Log Message:
Add missing # to fix the non-SCTP case.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.37 -r1.1.2.38 src/sys/kern/compat_stub.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/compat_stub.c
diff -u src/sys/kern/compat_stub.c:1.1.2.37 src/sys/kern/compat_stub.c:1.1.2.38
--- src/sys/kern/compat_stub.c:1.1.2.37	Tue Jan 15 10:52:20 2019
+++ src/sys/kern/compat_stub.c	Tue Jan 15 21:37:44 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.37 2019/01/15 10:52:20 pgoyette Exp $	*/
+/* $NetBSD: compat_stub.c,v 1.1.2.38 2019/01/15 21:37:44 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@ void (*vec_ntp_adjtime1)(struct timex *)
 #ifdef SCTP
 void (*vec_sctp_add_ip_address)(struct ifaddr *) = sctp_add_ip_address;
 void (*vec_sctp_delete_ip_address)(struct ifaddr *) = sctp_delete_ip_address;
-else
+#else
 void (*vec_sctp_add_ip_address)(struct ifaddr *) = NULL;
 void (*vec_sctp_delete_ip_address)(struct ifaddr *) = NULL;
 #endif 



CVS commit: [netbsd-7-0] src/doc

2019-01-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 15 18:45:51 UTC 2019

Modified Files:
src/doc [netbsd-7-0]: CHANGES-7.0.3

Log Message:
Ticket #1672


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.128 -r1.1.2.129 src/doc/CHANGES-7.0.3

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

Modified files:

Index: src/doc/CHANGES-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.128 src/doc/CHANGES-7.0.3:1.1.2.129
--- src/doc/CHANGES-7.0.3:1.1.2.128	Mon Jan  7 14:05:34 2019
+++ src/doc/CHANGES-7.0.3	Tue Jan 15 18:45:51 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.128 2019/01/07 14:05:34 martin Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.129 2019/01/15 18:45:51 martin Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -5675,3 +5675,8 @@ doc/3RDPARTY	(patch)
 	Updated tzdata to 2018i.
 	[kre, ticket #1670]
 
+sys/arch/sparc/sparc/pmap.c			1.366
+
+	Fix deadlocks on machines with more than two cpus.
+	[mrg, ticket #1672]
+



CVS commit: [netbsd-7-0] src/sys/arch/sparc/sparc

2019-01-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 15 18:45:24 UTC 2019

Modified Files:
src/sys/arch/sparc/sparc [netbsd-7-0]: pmap.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1672):

sys/arch/sparc/sparc/pmap.c: revision 1.366

switch sparc pmap lock to the scheme sparc64 uses:
- - local IPL_NONE mutex for general pmap locking operations, not
  kernel lock.
- - for pmap_activate()/pmap_deactivate(), switch to using the
  existing ctx_lock, and push handling of it into ctx_alloc() the
  ctx_free() callers.

fixes easy to trigger deadlocks on systems with >2 cpus.  without
this patch i usually hang during boot.  with it, i was able to
push the machine hard for over 12 hours.

XXX: pullup-8, and maybe -7.


To generate a diff of this commit:
cvs rdiff -u -r1.358 -r1.358.6.1 src/sys/arch/sparc/sparc/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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.358 src/sys/arch/sparc/sparc/pmap.c:1.358.6.1
--- src/sys/arch/sparc/sparc/pmap.c:1.358	Sat May  3 11:17:06 2014
+++ src/sys/arch/sparc/sparc/pmap.c	Tue Jan 15 18:45:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.358 2014/05/03 11:17:06 nakayama Exp $ */
+/*	$NetBSD: pmap.c,v 1.358.6.1 2019/01/15 18:45:24 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.358 2014/05/03 11:17:06 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.358.6.1 2019/01/15 18:45:24 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -176,8 +176,8 @@ paddr_t	vm_first_phys = (paddr_t)-1;
 paddr_t	vm_last_phys = 0;
 psize_t vm_num_phys;
 
-#define	PMAP_LOCK()	KERNEL_LOCK(1, NULL)
-#define	PMAP_UNLOCK()	KERNEL_UNLOCK_ONE(NULL)
+#define	PMAP_LOCK()	mutex_enter(_lock)
+#define	PMAP_UNLOCK()	mutex_exit(_lock)
 
 /*
  * Flags in pvlist.pv_flags.  Note that PV_MOD must be 1 and PV_REF must be 2
@@ -347,6 +347,7 @@ mmuq_insert_tail(struct mmuentry *head, 
 int	seginval;		/* [4/4c] the invalid segment number */
 int	reginval;		/* [4/3mmu] the invalid region number */
 
+static kmutex_t pmap_lock;
 static kmutex_t demap_lock;
 static bool	lock_available = false;	/* demap_lock has been initialized */
 
@@ -372,15 +373,15 @@ union ctxinfo {
 	struct	pmap *c_pmap;		/* pmap (if busy) */
 };
 
-static kmutex_t	ctx_lock;		/* lock for below */
+static kmutex_t	ctx_lock;		/* lock for below, and {,de}activate */
 union	ctxinfo *ctxinfo;		/* allocated at in pmap_bootstrap */
 union	ctxinfo *ctx_freelist;		/* context free list */
 int	ctx_kick;			/* allocation rover when none free */
 int	ctx_kickdir;			/* ctx_kick roves both directions */
 int	ncontext;			/* sizeof ctx_freelist */
 
-void	ctx_alloc(struct pmap *);
-void	ctx_free(struct pmap *);
+static void	ctx_alloc(struct pmap *);
+static void	ctx_free(struct pmap *);
 
 /*void *	vdumppages;	-* 32KB worth of reserved dump pages */
 
@@ -2121,7 +2122,7 @@ mmu_pagein(struct pmap *pm, vaddr_t va, 
  * This routine is only ever called from locore.s just after it has
  * saved away the previous process, so there are no active user windows.
  */
-void
+static void
 ctx_alloc(struct pmap *pm)
 {
 	union ctxinfo *c;
@@ -2133,6 +2134,8 @@ ctx_alloc(struct pmap *pm)
 	struct cpu_info *cpi;
 #endif
 
+	KASSERT(mutex_owned(_lock));
+
 /*XXX-GCC!*/gap_start=gap_end=0;
 #ifdef DEBUG
 	if (pm->pm_ctx)
@@ -2145,7 +2148,6 @@ ctx_alloc(struct pmap *pm)
 		gap_end = pm->pm_gap_end;
 	}
 
-	mutex_spin_enter(_lock);
 	if ((c = ctx_freelist) != NULL) {
 		ctx_freelist = c->c_nextfree;
 		cnum = c - ctxinfo;
@@ -2288,13 +2290,12 @@ ctx_alloc(struct pmap *pm)
 		setcontext4m(cnum);
 #endif /* SUN4M || SUN4D */
 	}
-	mutex_spin_exit(_lock);
 }
 
 /*
  * Give away a context.
  */
-void
+static void
 ctx_free(struct pmap *pm)
 {
 	union ctxinfo *c;
@@ -2303,6 +2304,8 @@ ctx_free(struct pmap *pm)
 	struct cpu_info *cpi;
 #endif
 
+	KASSERT(mutex_owned(_lock));
+
 	c = pm->pm_ctx;
 	ctx = pm->pm_ctxnum;
 	pm->pm_ctx = NULL;
@@ -2316,8 +2319,6 @@ ctx_free(struct pmap *pm)
 	}
 #endif /* SUN4 || SUN4C */
 
-	mutex_spin_enter(_lock);
-
 #if defined(SUN4M) || defined(SUN4D)
 	if (CPU_HAS_SRMMU) {
 		CPU_INFO_ITERATOR i;
@@ -2334,7 +2335,6 @@ ctx_free(struct pmap *pm)
 
 	c->c_nextfree = ctx_freelist;
 	ctx_freelist = c;
-	mutex_spin_exit(_lock);
 }
 
 
@@ -3070,6 +3070,7 @@ pmap_bootstrap(int nctx, int nregion, in
 	}
 
 	pmap_page_upload();
+	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_VM);
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_SCHED);
 	lock_available = true;
@@ -4386,7 +4387,9 @@ pmap_pmap_pool_dtor(void *arg, void *obj
 #endif
 
 	if ((c = pm->pm_ctx) != NULL) {
+		mutex_spin_enter(_lock);
 		ctx_free(pm);
+		mutex_spin_exit(_lock);
 	}
 
 #if defined(SUN4M) || defined(SUN4D)
@@ -4656,7 +4659,7 @@ pmap_remove(struct pmap *pm, 

CVS commit: [netbsd-7-1] src/doc

2019-01-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 15 18:44:58 UTC 2019

Modified Files:
src/doc [netbsd-7-1]: CHANGES-7.1.3

Log Message:
Ticket #1672


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.35 -r1.1.2.36 src/doc/CHANGES-7.1.3

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

Modified files:

Index: src/doc/CHANGES-7.1.3
diff -u src/doc/CHANGES-7.1.3:1.1.2.35 src/doc/CHANGES-7.1.3:1.1.2.36
--- src/doc/CHANGES-7.1.3:1.1.2.35	Mon Jan  7 14:04:04 2019
+++ src/doc/CHANGES-7.1.3	Tue Jan 15 18:44:58 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.3,v 1.1.2.35 2019/01/07 14:04:04 martin Exp $
+# $NetBSD: CHANGES-7.1.3,v 1.1.2.36 2019/01/15 18:44:58 martin Exp $
 
 A complete list of changes from the NetBSD 7.1.2 release to the NetBSD 7.1.3
 release:
@@ -367,3 +367,8 @@ doc/3RDPARTY	(patch)
 	Updated tzdata to 2018i.
 	[kre, ticket #1670]
 
+sys/arch/sparc/sparc/pmap.c			1.366
+
+	Fix deadlocks on machines with more than two cpus.
+	[mrg, ticket #1672]
+



CVS commit: [netbsd-7-1] src/sys/arch/sparc/sparc

2019-01-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 15 18:44:28 UTC 2019

Modified Files:
src/sys/arch/sparc/sparc [netbsd-7-1]: pmap.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1672):

sys/arch/sparc/sparc/pmap.c: revision 1.366

switch sparc pmap lock to the scheme sparc64 uses:
- - local IPL_NONE mutex for general pmap locking operations, not
  kernel lock.
- - for pmap_activate()/pmap_deactivate(), switch to using the
  existing ctx_lock, and push handling of it into ctx_alloc() the
  ctx_free() callers.

fixes easy to trigger deadlocks on systems with >2 cpus.  without
this patch i usually hang during boot.  with it, i was able to
push the machine hard for over 12 hours.

XXX: pullup-8, and maybe -7.


To generate a diff of this commit:
cvs rdiff -u -r1.358 -r1.358.10.1 src/sys/arch/sparc/sparc/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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.358 src/sys/arch/sparc/sparc/pmap.c:1.358.10.1
--- src/sys/arch/sparc/sparc/pmap.c:1.358	Sat May  3 11:17:06 2014
+++ src/sys/arch/sparc/sparc/pmap.c	Tue Jan 15 18:44:28 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.358 2014/05/03 11:17:06 nakayama Exp $ */
+/*	$NetBSD: pmap.c,v 1.358.10.1 2019/01/15 18:44:28 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.358 2014/05/03 11:17:06 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.358.10.1 2019/01/15 18:44:28 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -176,8 +176,8 @@ paddr_t	vm_first_phys = (paddr_t)-1;
 paddr_t	vm_last_phys = 0;
 psize_t vm_num_phys;
 
-#define	PMAP_LOCK()	KERNEL_LOCK(1, NULL)
-#define	PMAP_UNLOCK()	KERNEL_UNLOCK_ONE(NULL)
+#define	PMAP_LOCK()	mutex_enter(_lock)
+#define	PMAP_UNLOCK()	mutex_exit(_lock)
 
 /*
  * Flags in pvlist.pv_flags.  Note that PV_MOD must be 1 and PV_REF must be 2
@@ -347,6 +347,7 @@ mmuq_insert_tail(struct mmuentry *head, 
 int	seginval;		/* [4/4c] the invalid segment number */
 int	reginval;		/* [4/3mmu] the invalid region number */
 
+static kmutex_t pmap_lock;
 static kmutex_t demap_lock;
 static bool	lock_available = false;	/* demap_lock has been initialized */
 
@@ -372,15 +373,15 @@ union ctxinfo {
 	struct	pmap *c_pmap;		/* pmap (if busy) */
 };
 
-static kmutex_t	ctx_lock;		/* lock for below */
+static kmutex_t	ctx_lock;		/* lock for below, and {,de}activate */
 union	ctxinfo *ctxinfo;		/* allocated at in pmap_bootstrap */
 union	ctxinfo *ctx_freelist;		/* context free list */
 int	ctx_kick;			/* allocation rover when none free */
 int	ctx_kickdir;			/* ctx_kick roves both directions */
 int	ncontext;			/* sizeof ctx_freelist */
 
-void	ctx_alloc(struct pmap *);
-void	ctx_free(struct pmap *);
+static void	ctx_alloc(struct pmap *);
+static void	ctx_free(struct pmap *);
 
 /*void *	vdumppages;	-* 32KB worth of reserved dump pages */
 
@@ -2121,7 +2122,7 @@ mmu_pagein(struct pmap *pm, vaddr_t va, 
  * This routine is only ever called from locore.s just after it has
  * saved away the previous process, so there are no active user windows.
  */
-void
+static void
 ctx_alloc(struct pmap *pm)
 {
 	union ctxinfo *c;
@@ -2133,6 +2134,8 @@ ctx_alloc(struct pmap *pm)
 	struct cpu_info *cpi;
 #endif
 
+	KASSERT(mutex_owned(_lock));
+
 /*XXX-GCC!*/gap_start=gap_end=0;
 #ifdef DEBUG
 	if (pm->pm_ctx)
@@ -2145,7 +2148,6 @@ ctx_alloc(struct pmap *pm)
 		gap_end = pm->pm_gap_end;
 	}
 
-	mutex_spin_enter(_lock);
 	if ((c = ctx_freelist) != NULL) {
 		ctx_freelist = c->c_nextfree;
 		cnum = c - ctxinfo;
@@ -2288,13 +2290,12 @@ ctx_alloc(struct pmap *pm)
 		setcontext4m(cnum);
 #endif /* SUN4M || SUN4D */
 	}
-	mutex_spin_exit(_lock);
 }
 
 /*
  * Give away a context.
  */
-void
+static void
 ctx_free(struct pmap *pm)
 {
 	union ctxinfo *c;
@@ -2303,6 +2304,8 @@ ctx_free(struct pmap *pm)
 	struct cpu_info *cpi;
 #endif
 
+	KASSERT(mutex_owned(_lock));
+
 	c = pm->pm_ctx;
 	ctx = pm->pm_ctxnum;
 	pm->pm_ctx = NULL;
@@ -2316,8 +2319,6 @@ ctx_free(struct pmap *pm)
 	}
 #endif /* SUN4 || SUN4C */
 
-	mutex_spin_enter(_lock);
-
 #if defined(SUN4M) || defined(SUN4D)
 	if (CPU_HAS_SRMMU) {
 		CPU_INFO_ITERATOR i;
@@ -2334,7 +2335,6 @@ ctx_free(struct pmap *pm)
 
 	c->c_nextfree = ctx_freelist;
 	ctx_freelist = c;
-	mutex_spin_exit(_lock);
 }
 
 
@@ -3070,6 +3070,7 @@ pmap_bootstrap(int nctx, int nregion, in
 	}
 
 	pmap_page_upload();
+	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_VM);
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_SCHED);
 	lock_available = true;
@@ -4386,7 +4387,9 @@ pmap_pmap_pool_dtor(void *arg, void *obj
 #endif
 
 	if ((c = pm->pm_ctx) != NULL) {
+		mutex_spin_enter(_lock);
 		ctx_free(pm);
+		mutex_spin_exit(_lock);
 	}
 
 #if defined(SUN4M) || defined(SUN4D)
@@ -4656,7 +4659,7 @@ pmap_remove(struct pmap *pm, 

CVS commit: [netbsd-7] src/doc

2019-01-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 15 18:44:00 UTC 2019

Modified Files:
src/doc [netbsd-7]: CHANGES-7.3

Log Message:
Ticket #1672


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.32 -r1.1.2.33 src/doc/CHANGES-7.3

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

Modified files:

Index: src/doc/CHANGES-7.3
diff -u src/doc/CHANGES-7.3:1.1.2.32 src/doc/CHANGES-7.3:1.1.2.33
--- src/doc/CHANGES-7.3:1.1.2.32	Fri Jan 11 15:58:54 2019
+++ src/doc/CHANGES-7.3	Tue Jan 15 18:43:59 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.3,v 1.1.2.32 2019/01/11 15:58:54 martin Exp $
+# $NetBSD: CHANGES-7.3,v 1.1.2.33 2019/01/15 18:43:59 martin Exp $
 
 A complete list of changes from the NetBSD 7.2 release to the NetBSD 7.3
 release:
@@ -386,3 +386,8 @@ sys/dev/usb/usbdi.c1.181
 	upm_close before destroying the interupt pipe xfer.
 	[skrll, ticket #1671]
 
+sys/arch/sparc/sparc/pmap.c			1.366
+
+	Fix deadlocks on machines with more than two cpus.
+	[mrg, ticket #1672]
+



CVS commit: [netbsd-7] src/sys/arch/sparc/sparc

2019-01-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 15 18:43:27 UTC 2019

Modified Files:
src/sys/arch/sparc/sparc [netbsd-7]: pmap.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1672):

sys/arch/sparc/sparc/pmap.c: revision 1.366

switch sparc pmap lock to the scheme sparc64 uses:
- - local IPL_NONE mutex for general pmap locking operations, not
  kernel lock.
- - for pmap_activate()/pmap_deactivate(), switch to using the
  existing ctx_lock, and push handling of it into ctx_alloc() the
  ctx_free() callers.

fixes easy to trigger deadlocks on systems with >2 cpus.  without
this patch i usually hang during boot.  with it, i was able to
push the machine hard for over 12 hours.

XXX: pullup-8, and maybe -7.


To generate a diff of this commit:
cvs rdiff -u -r1.358 -r1.358.2.1 src/sys/arch/sparc/sparc/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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.358 src/sys/arch/sparc/sparc/pmap.c:1.358.2.1
--- src/sys/arch/sparc/sparc/pmap.c:1.358	Sat May  3 11:17:06 2014
+++ src/sys/arch/sparc/sparc/pmap.c	Tue Jan 15 18:43:27 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.358 2014/05/03 11:17:06 nakayama Exp $ */
+/*	$NetBSD: pmap.c,v 1.358.2.1 2019/01/15 18:43:27 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.358 2014/05/03 11:17:06 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.358.2.1 2019/01/15 18:43:27 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -176,8 +176,8 @@ paddr_t	vm_first_phys = (paddr_t)-1;
 paddr_t	vm_last_phys = 0;
 psize_t vm_num_phys;
 
-#define	PMAP_LOCK()	KERNEL_LOCK(1, NULL)
-#define	PMAP_UNLOCK()	KERNEL_UNLOCK_ONE(NULL)
+#define	PMAP_LOCK()	mutex_enter(_lock)
+#define	PMAP_UNLOCK()	mutex_exit(_lock)
 
 /*
  * Flags in pvlist.pv_flags.  Note that PV_MOD must be 1 and PV_REF must be 2
@@ -347,6 +347,7 @@ mmuq_insert_tail(struct mmuentry *head, 
 int	seginval;		/* [4/4c] the invalid segment number */
 int	reginval;		/* [4/3mmu] the invalid region number */
 
+static kmutex_t pmap_lock;
 static kmutex_t demap_lock;
 static bool	lock_available = false;	/* demap_lock has been initialized */
 
@@ -372,15 +373,15 @@ union ctxinfo {
 	struct	pmap *c_pmap;		/* pmap (if busy) */
 };
 
-static kmutex_t	ctx_lock;		/* lock for below */
+static kmutex_t	ctx_lock;		/* lock for below, and {,de}activate */
 union	ctxinfo *ctxinfo;		/* allocated at in pmap_bootstrap */
 union	ctxinfo *ctx_freelist;		/* context free list */
 int	ctx_kick;			/* allocation rover when none free */
 int	ctx_kickdir;			/* ctx_kick roves both directions */
 int	ncontext;			/* sizeof ctx_freelist */
 
-void	ctx_alloc(struct pmap *);
-void	ctx_free(struct pmap *);
+static void	ctx_alloc(struct pmap *);
+static void	ctx_free(struct pmap *);
 
 /*void *	vdumppages;	-* 32KB worth of reserved dump pages */
 
@@ -2121,7 +2122,7 @@ mmu_pagein(struct pmap *pm, vaddr_t va, 
  * This routine is only ever called from locore.s just after it has
  * saved away the previous process, so there are no active user windows.
  */
-void
+static void
 ctx_alloc(struct pmap *pm)
 {
 	union ctxinfo *c;
@@ -2133,6 +2134,8 @@ ctx_alloc(struct pmap *pm)
 	struct cpu_info *cpi;
 #endif
 
+	KASSERT(mutex_owned(_lock));
+
 /*XXX-GCC!*/gap_start=gap_end=0;
 #ifdef DEBUG
 	if (pm->pm_ctx)
@@ -2145,7 +2148,6 @@ ctx_alloc(struct pmap *pm)
 		gap_end = pm->pm_gap_end;
 	}
 
-	mutex_spin_enter(_lock);
 	if ((c = ctx_freelist) != NULL) {
 		ctx_freelist = c->c_nextfree;
 		cnum = c - ctxinfo;
@@ -2288,13 +2290,12 @@ ctx_alloc(struct pmap *pm)
 		setcontext4m(cnum);
 #endif /* SUN4M || SUN4D */
 	}
-	mutex_spin_exit(_lock);
 }
 
 /*
  * Give away a context.
  */
-void
+static void
 ctx_free(struct pmap *pm)
 {
 	union ctxinfo *c;
@@ -2303,6 +2304,8 @@ ctx_free(struct pmap *pm)
 	struct cpu_info *cpi;
 #endif
 
+	KASSERT(mutex_owned(_lock));
+
 	c = pm->pm_ctx;
 	ctx = pm->pm_ctxnum;
 	pm->pm_ctx = NULL;
@@ -2316,8 +2319,6 @@ ctx_free(struct pmap *pm)
 	}
 #endif /* SUN4 || SUN4C */
 
-	mutex_spin_enter(_lock);
-
 #if defined(SUN4M) || defined(SUN4D)
 	if (CPU_HAS_SRMMU) {
 		CPU_INFO_ITERATOR i;
@@ -2334,7 +2335,6 @@ ctx_free(struct pmap *pm)
 
 	c->c_nextfree = ctx_freelist;
 	ctx_freelist = c;
-	mutex_spin_exit(_lock);
 }
 
 
@@ -3070,6 +3070,7 @@ pmap_bootstrap(int nctx, int nregion, in
 	}
 
 	pmap_page_upload();
+	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_VM);
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_SCHED);
 	lock_available = true;
@@ -4386,7 +4387,9 @@ pmap_pmap_pool_dtor(void *arg, void *obj
 #endif
 
 	if ((c = pm->pm_ctx) != NULL) {
+		mutex_spin_enter(_lock);
 		ctx_free(pm);
+		mutex_spin_exit(_lock);
 	}
 
 #if defined(SUN4M) || defined(SUN4D)
@@ -4656,7 +4659,7 @@ pmap_remove(struct pmap *pm, 

CVS commit: [netbsd-8] src/doc

2019-01-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 15 18:41:22 UTC 2019

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

Log Message:
Ticket #1163


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.88 -r1.1.2.89 src/doc/CHANGES-8.1

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

Modified files:

Index: src/doc/CHANGES-8.1
diff -u src/doc/CHANGES-8.1:1.1.2.88 src/doc/CHANGES-8.1:1.1.2.89
--- src/doc/CHANGES-8.1:1.1.2.88	Fri Jan 11 15:56:48 2019
+++ src/doc/CHANGES-8.1	Tue Jan 15 18:41:22 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.88 2019/01/11 15:56:48 martin Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.89 2019/01/15 18:41:22 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -2228,3 +2228,8 @@ sys/net/if_ppp.c1.162,1.163
 	Fix missing splx in ppp_inproc().
 	[knakahara, ticket #1162]
 
+sys/arch/sparc/sparc/pmap.c			1.366
+
+	Fix deadlocks on machines with more than two cpus.
+	[mrg, ticket #1163]
+



CVS commit: [netbsd-8] src/sys/arch/sparc/sparc

2019-01-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 15 18:40:15 UTC 2019

Modified Files:
src/sys/arch/sparc/sparc [netbsd-8]: pmap.c

Log Message:
Pull up following revision(s) (requested by mrg in ticket #1163):

sys/arch/sparc/sparc/pmap.c: revision 1.366

switch sparc pmap lock to the scheme sparc64 uses:
- - local IPL_NONE mutex for general pmap locking operations, not
  kernel lock.
- - for pmap_activate()/pmap_deactivate(), switch to using the
  existing ctx_lock, and push handling of it into ctx_alloc() the
  ctx_free() callers.

fixes easy to trigger deadlocks on systems with >2 cpus.  without
this patch i usually hang during boot.  with it, i was able to
push the machine hard for over 12 hours.

XXX: pullup-8, and maybe -7.


To generate a diff of this commit:
cvs rdiff -u -r1.361 -r1.361.8.1 src/sys/arch/sparc/sparc/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/sparc/sparc/pmap.c
diff -u src/sys/arch/sparc/sparc/pmap.c:1.361 src/sys/arch/sparc/sparc/pmap.c:1.361.8.1
--- src/sys/arch/sparc/sparc/pmap.c:1.361	Thu Dec 22 14:47:59 2016
+++ src/sys/arch/sparc/sparc/pmap.c	Tue Jan 15 18:40:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.361 2016/12/22 14:47:59 cherry Exp $ */
+/*	$NetBSD: pmap.c,v 1.361.8.1 2019/01/15 18:40:15 martin Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.361 2016/12/22 14:47:59 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.361.8.1 2019/01/15 18:40:15 martin Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -176,8 +176,8 @@ paddr_t	vm_first_phys = (paddr_t)-1;
 paddr_t	vm_last_phys = 0;
 psize_t vm_num_phys;
 
-#define	PMAP_LOCK()	KERNEL_LOCK(1, NULL)
-#define	PMAP_UNLOCK()	KERNEL_UNLOCK_ONE(NULL)
+#define	PMAP_LOCK()	mutex_enter(_lock)
+#define	PMAP_UNLOCK()	mutex_exit(_lock)
 
 /*
  * Flags in pvlist.pv_flags.  Note that PV_MOD must be 1 and PV_REF must be 2
@@ -347,6 +347,7 @@ mmuq_insert_tail(struct mmuentry *head, 
 int	seginval;		/* [4/4c] the invalid segment number */
 int	reginval;		/* [4/3mmu] the invalid region number */
 
+static kmutex_t pmap_lock;
 static kmutex_t demap_lock;
 static bool	lock_available = false;	/* demap_lock has been initialized */
 
@@ -372,15 +373,15 @@ union ctxinfo {
 	struct	pmap *c_pmap;		/* pmap (if busy) */
 };
 
-static kmutex_t	ctx_lock;		/* lock for below */
+static kmutex_t	ctx_lock;		/* lock for below, and {,de}activate */
 union	ctxinfo *ctxinfo;		/* allocated at in pmap_bootstrap */
 union	ctxinfo *ctx_freelist;		/* context free list */
 int	ctx_kick;			/* allocation rover when none free */
 int	ctx_kickdir;			/* ctx_kick roves both directions */
 int	ncontext;			/* sizeof ctx_freelist */
 
-void	ctx_alloc(struct pmap *);
-void	ctx_free(struct pmap *);
+static void	ctx_alloc(struct pmap *);
+static void	ctx_free(struct pmap *);
 
 /*void *	vdumppages;	-* 32KB worth of reserved dump pages */
 
@@ -2121,7 +2122,7 @@ mmu_pagein(struct pmap *pm, vaddr_t va, 
  * This routine is only ever called from locore.s just after it has
  * saved away the previous process, so there are no active user windows.
  */
-void
+static void
 ctx_alloc(struct pmap *pm)
 {
 	union ctxinfo *c;
@@ -2133,6 +2134,8 @@ ctx_alloc(struct pmap *pm)
 	struct cpu_info *cpi;
 #endif
 
+	KASSERT(mutex_owned(_lock));
+
 /*XXX-GCC!*/gap_start=gap_end=0;
 #ifdef DEBUG
 	if (pm->pm_ctx)
@@ -2145,7 +2148,6 @@ ctx_alloc(struct pmap *pm)
 		gap_end = pm->pm_gap_end;
 	}
 
-	mutex_spin_enter(_lock);
 	if ((c = ctx_freelist) != NULL) {
 		ctx_freelist = c->c_nextfree;
 		cnum = c - ctxinfo;
@@ -2288,13 +2290,12 @@ ctx_alloc(struct pmap *pm)
 		setcontext4m(cnum);
 #endif /* SUN4M || SUN4D */
 	}
-	mutex_spin_exit(_lock);
 }
 
 /*
  * Give away a context.
  */
-void
+static void
 ctx_free(struct pmap *pm)
 {
 	union ctxinfo *c;
@@ -2303,6 +2304,8 @@ ctx_free(struct pmap *pm)
 	struct cpu_info *cpi;
 #endif
 
+	KASSERT(mutex_owned(_lock));
+
 	c = pm->pm_ctx;
 	ctx = pm->pm_ctxnum;
 	pm->pm_ctx = NULL;
@@ -2316,8 +2319,6 @@ ctx_free(struct pmap *pm)
 	}
 #endif /* SUN4 || SUN4C */
 
-	mutex_spin_enter(_lock);
-
 #if defined(SUN4M) || defined(SUN4D)
 	if (CPU_HAS_SRMMU) {
 		CPU_INFO_ITERATOR i;
@@ -2334,7 +2335,6 @@ ctx_free(struct pmap *pm)
 
 	c->c_nextfree = ctx_freelist;
 	ctx_freelist = c;
-	mutex_spin_exit(_lock);
 }
 
 
@@ -3070,6 +3070,7 @@ pmap_bootstrap(int nctx, int nregion, in
 	}
 
 	pmap_page_upload();
+	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_VM);
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_SCHED);
 	lock_available = true;
@@ -4386,7 +4387,9 @@ pmap_pmap_pool_dtor(void *arg, void *obj
 #endif
 
 	if ((c = pm->pm_ctx) != NULL) {
+		mutex_spin_enter(_lock);
 		ctx_free(pm);
+		mutex_spin_exit(_lock);
 	}
 
 #if defined(SUN4M) || defined(SUN4D)
@@ -4656,7 +4659,7 @@ pmap_remove(struct pmap *pm, vaddr_t 

CVS commit: src/bin/sh

2019-01-15 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jan 15 14:23:56 UTC 2019

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

Log Message:
Don't use quoteflag when deciding if the word after an alias
should be looked up as a potential following alias - if the first
expands to a string that ends with a space (any space, quoted or
not) then the next word is to be treated as an alias candidate.
(POSIX was to specify only unquoted spaces, but is now going to
leave that unspecified, and the "any space" version turns out to
be more useful.

And besides, the quoteflag test didn't work properly, and would
have been very messy to fix ... if in a word (as if we have a
quoted space) it means that the word has been quoted, which meant
that quoted spaces were correctly detected, but it outside a word,
it just means that the previous word was quoted, so it would sometimes
reject alias lookup on the next word in cases where it is unquestioned
it should be done.


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

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

Modified files:

Index: src/bin/sh/input.c
diff -u src/bin/sh/input.c:1.67 src/bin/sh/input.c:1.68
--- src/bin/sh/input.c:1.67	Wed Jan  9 11:09:16 2019
+++ src/bin/sh/input.c	Tue Jan 15 14:23:56 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: input.c,v 1.67 2019/01/09 11:09:16 kre Exp $	*/
+/*	$NetBSD: input.c,v 1.68 2019/01/15 14:23:56 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)input.c	8.3 (Berkeley) 6/9/95";
 #else
-__RCSID("$NetBSD: input.c,v 1.67 2019/01/09 11:09:16 kre Exp $");
+__RCSID("$NetBSD: input.c,v 1.68 2019/01/15 14:23:56 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -435,8 +435,7 @@ popstring(void)
 	if (sp->ap) {
 		int alen;
 
-		if (!quoteflag &&
-		(alen = strlen(sp->ap->val)) > 0 &&
+		if ((alen = strlen(sp->ap->val)) > 0 &&
 		(sp->ap->val[alen - 1] == ' ' ||
 		 sp->ap->val[alen - 1] == '\t'))
 			checkkwd |= CHKALIAS;



CVS commit: src/bin/sh

2019-01-15 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Jan 15 14:17:50 UTC 2019

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

Log Message:
pgetc_linecont() needs to use pgetc() rather than pgetc_macro()
so the fake char returned by the latter when an alias ends (which
is there so we can correctly avoid alias recursion) is correctly
ignored where it is not wanted.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/bin/sh/parser.c

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

Modified files:

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.160 src/bin/sh/parser.c:1.161
--- src/bin/sh/parser.c:1.160	Wed Jan  9 10:59:20 2019
+++ src/bin/sh/parser.c	Tue Jan 15 14:17:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.160 2019/01/09 10:59:20 kre Exp $	*/
+/*	$NetBSD: parser.c,v 1.161 2019/01/15 14:17:49 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)parser.c	8.7 (Berkeley) 5/16/95";
 #else
-__RCSID("$NetBSD: parser.c,v 1.160 2019/01/09 10:59:20 kre Exp $");
+__RCSID("$NetBSD: parser.c,v 1.161 2019/01/15 14:17:49 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -2365,7 +2365,7 @@ pgetc_linecont(void)
 {
 	int c;
 
-	while ((c = pgetc_macro()) == '\\') {
+	while ((c = pgetc()) == '\\') {
 		c = pgetc();
 		if (c == '\n') {
 			plinno++;



CVS commit: src/usr.sbin/sysinst

2019-01-15 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Jan 15 12:55:03 UTC 2019

Modified Files:
src/usr.sbin/sysinst: msg.mi.pl

Log Message:
PR 53869: improve polish "noroot" message


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.sbin/sysinst/msg.mi.pl

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/sysinst/msg.mi.pl
diff -u src/usr.sbin/sysinst/msg.mi.pl:1.16 src/usr.sbin/sysinst/msg.mi.pl:1.17
--- src/usr.sbin/sysinst/msg.mi.pl:1.16	Fri Jan 11 08:14:50 2019
+++ src/usr.sbin/sysinst/msg.mi.pl	Tue Jan 15 12:55:03 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.pl,v 1.16 2019/01/11 08:14:50 martin Exp $	*/
+/*	$NetBSD: msg.mi.pl,v 1.17 2019/01/15 12:55:03 martin Exp $	*/
 /*	Based on english version: */
 /*	NetBSD: msg.mi.pl,v 1.36 2004/04/17 18:55:35 atatat Exp   */
 
@@ -1078,7 +1078,7 @@ message auto {auto}
 message removepartswarn {To usun±æ wszystkie partycje na dysku. Czy chcesz kontynuowaæ?}
 message saveprompt {Zapisz zmiany przed zakoñczeniem?}
 message cantsave {Zmiany nie mog± byæ zbawieni.}
-message noroot {No partycja zdefiniowana, nie mo¿e kontynuowaæ \n}
+message noroot {Brak zdefiniowania partycji root. Nie mo¿na kontynuowac.\n}
 message wannaunblock {Urz±dzenie jest zablokowane. Czy chcesz, aby zmusiæ go odblokowaæ i kontynuowaæ?}
 message wannatry {Czy chcesz spróbowaæ?}
 message create_cgd {Utwórz wolumen kryptograficznych (CGD)}



CVS commit: [pgoyette-compat] src/sys/sys

2019-01-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan 15 12:42:12 UTC 2019

Modified Files:
src/sys/sys [pgoyette-compat]: compat_stub.h

Log Message:
Fix a copy/pasto in a comment


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.49 -r1.1.2.50 src/sys/sys/compat_stub.h

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

Modified files:

Index: src/sys/sys/compat_stub.h
diff -u src/sys/sys/compat_stub.h:1.1.2.49 src/sys/sys/compat_stub.h:1.1.2.50
--- src/sys/sys/compat_stub.h:1.1.2.49	Tue Jan 15 04:10:35 2019
+++ src/sys/sys/compat_stub.h	Tue Jan 15 12:42:12 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.h,v 1.1.2.49 2019/01/15 04:10:35 pgoyette Exp $	*/
+/* $NetBSD: compat_stub.h,v 1.1.2.50 2019/01/15 12:42:12 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@ MODULE_HOOK(ntp_adjtime1_hook, int, (str
 /*
  * Routine hooks for SCTP code - used by rtsock
  *
- * MP-hooks not needed since the NTP code is not modular
+ * MP-hooks not needed since the SCTP code is not modular
  */
 struct ifaddr;
 extern void (*vec_sctp_add_ip_address)(struct ifaddr *);



CVS commit: [pgoyette-compat] src/sys/kern

2019-01-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Jan 15 10:52:20 UTC 2019

Modified Files:
src/sys/kern [pgoyette-compat]: compat_stub.c

Log Message:
Include appropriate headers to define the sctp routines


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.36 -r1.1.2.37 src/sys/kern/compat_stub.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/compat_stub.c
diff -u src/sys/kern/compat_stub.c:1.1.2.36 src/sys/kern/compat_stub.c:1.1.2.37
--- src/sys/kern/compat_stub.c:1.1.2.36	Tue Jan 15 04:10:34 2019
+++ src/sys/kern/compat_stub.c	Tue Jan 15 10:52:20 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: compat_stub.c,v 1.1.2.36 2019/01/15 04:10:34 pgoyette Exp $	*/
+/* $NetBSD: compat_stub.c,v 1.1.2.37 2019/01/15 10:52:20 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -33,6 +33,7 @@
 
 #ifdef _KERNEL_OPT
 #include "opt_ntp.h"
+#include "opt_sctp.h"
 #endif
 
 #include 
@@ -43,6 +44,10 @@
 #include 
 #endif
 
+#ifdef SCTP
+#include 
+#endif
+
 /*
  * Routine vectors for compat_50___sys_ntp_gettime
  *