CVS commit: src

2020-04-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr  8 04:32:14 UTC 2020

Modified Files:
src/doc: CHANGES.prev
src/sys/dev/ic: lancereg.h
src/sys/dev/mca: if_ep_mca.c

Log Message:
 Correctly spell "count".


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/doc/CHANGES.prev
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/lancereg.h
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/mca/if_ep_mca.c

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



CVS commit: src

2020-04-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr  8 04:32:14 UTC 2020

Modified Files:
src/doc: CHANGES.prev
src/sys/dev/ic: lancereg.h
src/sys/dev/mca: if_ep_mca.c

Log Message:
 Correctly spell "count".


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/doc/CHANGES.prev
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/ic/lancereg.h
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/mca/if_ep_mca.c

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.prev
diff -u src/doc/CHANGES.prev:1.154 src/doc/CHANGES.prev:1.155
--- src/doc/CHANGES.prev:1.154	Thu Apr  2 15:30:25 2020
+++ src/doc/CHANGES.prev	Wed Apr  8 04:32:14 2020
@@ -1,4 +1,4 @@
-LIST OF CHANGES FROM PREVIOUS RELEASES:			<$Revision: 1.154 $>
+LIST OF CHANGES FROM PREVIOUS RELEASES:			<$Revision: 1.155 $>
 
 
 Changes from 386bsd 0.1 + patchkit 0.2.2 to NetBSD 0.8:
@@ -9229,8 +9229,8 @@ Changes from NetBSD 4.0 to NetBSD 5.0:
 		(introduce run-length detection to msdosfs_bmap(),
 		from FreeBSD).  [christos 20080105]
 	gem(4): Add support for Sun PCI SX fibre cards.  [jdc 20080105]
-	amiga: Add timecounter(9) support and coutner-based delay(9) from i386.
-		[mhitch 20080106]
+	amiga: Add timecounter(9) support and counter-based delay(9) from
+		i386. [mhitch 20080106]
 	mvme68k: Add timecounter(9) support. [tsutsui 20080107]
 	vax: Add timecounter(9) support. [joerg 20080107]
 	evbppc: Add timecounter(9) support. [joerg 20080108]

Index: src/sys/dev/ic/lancereg.h
diff -u src/sys/dev/ic/lancereg.h:1.13 src/sys/dev/ic/lancereg.h:1.14
--- src/sys/dev/ic/lancereg.h:1.13	Mon Apr 28 20:23:50 2008
+++ src/sys/dev/ic/lancereg.h	Wed Apr  8 04:32:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: lancereg.h,v 1.13 2008/04/28 20:23:50 martin Exp $	*/
+/*	$NetBSD: lancereg.h,v 1.14 2020/04/08 04:32:14 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -301,7 +301,7 @@
 #define	LE_C4_APAD_XMT	0x0800		/* auto pad transmit */
 #define	LE_C4_ASTRP_RCV	0x0400		/* auto strip receive */
 #define	LE_C4_MFCO	0x0200		/* missed frame counter overflow */
-#define	LE_C4_MFCOM	0x0100		/* missed frame coutner overflow mask */
+#define	LE_C4_MFCOM	0x0100		/* missed frame counter overflow mask */
 #define	LE_C4_UINTCMD	0x0080		/* user interrupt command */
 #define	LE_C4_UINT	0x0040		/* user interrupt */
 #define	LE_C4_RCVCCO	0x0020		/* receive collision counter overflow */

Index: src/sys/dev/mca/if_ep_mca.c
diff -u src/sys/dev/mca/if_ep_mca.c:1.23 src/sys/dev/mca/if_ep_mca.c:1.24
--- src/sys/dev/mca/if_ep_mca.c:1.23	Mon Jul 11 11:31:51 2016
+++ src/sys/dev/mca/if_ep_mca.c	Wed Apr  8 04:32:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ep_mca.c,v 1.23 2016/07/11 11:31:51 msaitoh Exp $	*/
+/*	$NetBSD: if_ep_mca.c,v 1.24 2020/04/08 04:32:14 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -63,13 +63,13 @@
 /*
  * Driver for 3Com 3c529 cards.
  *
- * If you encouter sucky performance, try kernel without DEBUG/DIAGNOSTIC.
+ * If you encounter sucky performance, try kernel without DEBUG/DIAGNOSTIC.
  * This helped on my test machine to change the performance of the card
  * from like 5KB/s to like 800 KB/s.
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ep_mca.c,v 1.23 2016/07/11 11:31:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ep_mca.c,v 1.24 2020/04/08 04:32:14 msaitoh Exp $");
 
 #include 
 #include 



CVS commit: src/sys/net

2020-04-07 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Apr  8 03:37:14 UTC 2020

Modified Files:
src/sys/net: route.c

Log Message:
Fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.228 -r1.229 src/sys/net/route.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/route.c
diff -u src/sys/net/route.c:1.228 src/sys/net/route.c:1.229
--- src/sys/net/route.c:1.228	Wed Apr  1 02:38:17 2020
+++ src/sys/net/route.c	Wed Apr  8 03:37:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: route.c,v 1.228 2020/04/01 02:38:17 knakahara Exp $	*/
+/*	$NetBSD: route.c,v 1.229 2020/04/08 03:37:14 knakahara Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -97,7 +97,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.228 2020/04/01 02:38:17 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: route.c,v 1.229 2020/04/08 03:37:14 knakahara Exp $");
 
 #include 
 #ifdef RTFLUSH_DEBUG
@@ -179,7 +179,7 @@ static void	rt_timer_timer(void *);
  * - Make rtcache per-CPU and allow only accesses from softint
  *   (e.g., ipforward_rt_percpu)
  * - References to a rtentry is managed by reference counting and psref
- *   - Reference couting is used for temporal reference when a rtentry
+ *   - Reference counting is used for temporal reference when a rtentry
  * is fetched from the routing table
  *   - psref is used for temporal reference when a rtentry is fetched
  * from a rtcache



CVS commit: src/sys/net

2020-04-07 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Wed Apr  8 03:37:14 UTC 2020

Modified Files:
src/sys/net: route.c

Log Message:
Fix typo in comment


To generate a diff of this commit:
cvs rdiff -u -r1.228 -r1.229 src/sys/net/route.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/mii

2020-04-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr  8 03:01:58 UTC 2020

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

Log Message:
 Add two new RDC PHYs from Andrius V.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/mii/rdcphy.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/mii

2020-04-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr  8 03:01:58 UTC 2020

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

Log Message:
 Add two new RDC PHYs from Andrius V.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/mii/rdcphy.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/rdcphy.c
diff -u src/sys/dev/mii/rdcphy.c:1.7 src/sys/dev/mii/rdcphy.c:1.8
--- src/sys/dev/mii/rdcphy.c:1.7	Sun Mar 15 23:04:50 2020
+++ src/sys/dev/mii/rdcphy.c	Wed Apr  8 03:01:58 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: rdcphy.c,v 1.7 2020/03/15 23:04:50 thorpej Exp $*/
+/*  $NetBSD: rdcphy.c,v 1.8 2020/04/08 03:01:58 msaitoh Exp $*/
 
 /*-
  * Copyright (c) 2010, Pyun YongHyeon 
@@ -33,7 +33,7 @@
  * Driver for the RDC Semiconductor R6040 10/100 PHY.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rdcphy.c,v 1.7 2020/03/15 23:04:50 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rdcphy.c,v 1.8 2020/04/08 03:01:58 msaitoh Exp $");
 
 #include 
 #include 
@@ -75,6 +75,8 @@ static const struct mii_phy_funcs rdcphy
 
 static const struct mii_phydesc rdcphys[] = {
 	MII_PHY_DESC(xxRDC, R6040),
+	MII_PHY_DESC(xxRDC, R6040_2),
+	MII_PHY_DESC(xxRDC, R6040_3),
 	MII_PHY_END,
 };
 



CVS commit: src/sys/dev/mii

2020-04-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr  8 03:01:28 UTC 2020

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

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.151 -r1.152 src/sys/dev/mii/miidevs_data.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/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.163 src/sys/dev/mii/miidevs.h:1.164
--- src/sys/dev/mii/miidevs.h:1.163	Fri Mar 13 04:44:58 2020
+++ src/sys/dev/mii/miidevs.h	Wed Apr  8 03:01:28 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.163 2020/03/13 04:44:58 msaitoh Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.164 2020/04/08 03:01:28 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.166 2020/03/13 04:44:34 msaitoh Exp
+ *	NetBSD: miidevs,v 1.167 2020/04/08 03:01:05 msaitoh Exp
  */
 
 /*-
@@ -554,6 +554,10 @@
 /* RDC Semiconductor PHYs */
 #define	MII_MODEL_xxRDC_R6040	0x0003
 #define	MII_STR_xxRDC_R6040	"R6040 10/100 media interface"
+#define	MII_MODEL_xxRDC_R6040_2	0x0005
+#define	MII_STR_xxRDC_R6040_2	"R6040 10/100 media interface"
+#define	MII_MODEL_xxRDC_R6040_3	0x0006
+#define	MII_STR_xxRDC_R6040_3	"R6040 10/100 media interface"
 
 /* RealTek PHYs */
 #define	MII_MODEL_xxREALTEK_RTL8169S	0x0011

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.151 src/sys/dev/mii/miidevs_data.h:1.152
--- src/sys/dev/mii/miidevs_data.h:1.151	Fri Mar 13 04:44:58 2020
+++ src/sys/dev/mii/miidevs_data.h	Wed Apr  8 03:01:28 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.151 2020/03/13 04:44:58 msaitoh Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.152 2020/04/08 03:01:28 msaitoh Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.166 2020/03/13 04:44:34 msaitoh Exp
+ *	NetBSD: miidevs,v 1.167 2020/04/08 03:01:05 msaitoh Exp
  */
 
 /*-
@@ -229,6 +229,8 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_PMCSIERRA, MII_MODEL_PMCSIERRA_PM8354, MII_STR_PMCSIERRA_PM8354 },
  { MII_OUI_xxQUALSEMI, MII_MODEL_xxQUALSEMI_QS6612, MII_STR_xxQUALSEMI_QS6612 },
  { MII_OUI_xxRDC, MII_MODEL_xxRDC_R6040, MII_STR_xxRDC_R6040 },
+ { MII_OUI_xxRDC, MII_MODEL_xxRDC_R6040_2, MII_STR_xxRDC_R6040_2 },
+ { MII_OUI_xxRDC, MII_MODEL_xxRDC_R6040_3, MII_STR_xxRDC_R6040_3 },
  { MII_OUI_xxREALTEK, MII_MODEL_xxREALTEK_RTL8169S, MII_STR_xxREALTEK_RTL8169S },
  { MII_OUI_yyREALTEK, MII_MODEL_yyREALTEK_RTL8201L, MII_STR_yyREALTEK_RTL8201L },
  { MII_OUI_REALTEK, MII_MODEL_REALTEK_RTL8251, MII_STR_REALTEK_RTL8251 },



CVS commit: src/sys/dev/mii

2020-04-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr  8 03:01:05 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
 Add two new RDC PHYs from Andrius V.


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/dev/mii/miidevs

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/miidevs
diff -u src/sys/dev/mii/miidevs:1.166 src/sys/dev/mii/miidevs:1.167
--- src/sys/dev/mii/miidevs:1.166	Fri Mar 13 04:44:34 2020
+++ src/sys/dev/mii/miidevs	Wed Apr  8 03:01:05 2020
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.166 2020/03/13 04:44:34 msaitoh Exp $
+$NetBSD: miidevs,v 1.167 2020/04/08 03:01:05 msaitoh Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -360,6 +360,8 @@ model xxQUALSEMI QS6612		0x QS6612 1
 
 /* RDC Semiconductor PHYs */
 model xxRDC R6040		0x0003 R6040 10/100 media interface
+model xxRDC R6040_2		0x0005 R6040 10/100 media interface
+model xxRDC R6040_3		0x0006 R6040 10/100 media interface
 
 /* RealTek PHYs */
 model xxREALTEK RTL8169S	0x0011 RTL8169S/8110S/8211 1000BASE-T media interface



CVS commit: src/sys/dev/mii

2020-04-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr  8 03:01:28 UTC 2020

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

Log Message:
 Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.151 -r1.152 src/sys/dev/mii/miidevs_data.h

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



CVS commit: src/sys/dev/mii

2020-04-07 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Wed Apr  8 03:01:05 UTC 2020

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
 Add two new RDC PHYs from Andrius V.


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/dev/mii/miidevs

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



CVS commit: src/sys/arch/aarch64

2020-04-07 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Wed Apr  8 00:13:40 UTC 2020

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

Log Message:
use PMAP_PAGE_INIT() to initialize mutex in pmap_page.

VM_MDPAGE_INIT() in pmap_free_pdp() had initialized pp_flags,
so it unintentionally cleared PMAP_PAGE_FLAGS_PV_TRACKED.
use PMAP_PAGE_INIT to avoid using PMAP_PAGE_FLAGS_PV_TRACKED.

pointed out by tnn@, thanks


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/aarch64/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/aarch64/aarch64/pmap.c
diff -u src/sys/arch/aarch64/aarch64/pmap.c:1.68 src/sys/arch/aarch64/aarch64/pmap.c:1.69
--- src/sys/arch/aarch64/aarch64/pmap.c:1.68	Sat Mar 14 14:05:42 2020
+++ src/sys/arch/aarch64/aarch64/pmap.c	Wed Apr  8 00:13:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.68 2020/03/14 14:05:42 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.69 2020/04/08 00:13:40 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.68 2020/03/14 14:05:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.69 2020/04/08 00:13:40 ryo Exp $");
 
 #include "opt_arm_debug.h"
 #include "opt_ddb.h"
@@ -249,12 +249,6 @@ pm_unlock(struct pmap *pm)
 	mutex_exit(>pm_lock);
 }
 
-static inline void
-_pmap_page_init(struct pmap_page *pp)
-{
-	mutex_init(>pp_pvlock, MUTEX_SPIN, IPL_VM);
-}
-
 static inline struct pmap_page *
 phys_to_pp(paddr_t pa)
 {
@@ -265,13 +259,7 @@ phys_to_pp(paddr_t pa)
 		return VM_PAGE_TO_PP(pg);
 
 #ifdef __HAVE_PMAP_PV_TRACK
-	struct pmap_page *pp = pmap_pv_tracked(pa);
-	if (pp != NULL && (pp->pp_flags & PMAP_PAGE_FLAGS_PV_TRACKED) == 0) {
-		/* XXX: initialize pv_tracked pmap_page. should not init here */
-		_pmap_page_init(pp);
-		pp->pp_flags |= PMAP_PAGE_FLAGS_PV_TRACKED;
-	}
-	return pp;
+	return pmap_pv_tracked(pa);
 #else
 	return NULL;
 #endif /* __HAVE_PMAP_PV_TRACK */
@@ -537,7 +525,7 @@ pmap_init(void)
 		 pfn++) {
 			pg = PHYS_TO_VM_PAGE(ptoa(pfn));
 			md = VM_PAGE_TO_MD(pg);
-			_pmap_page_init(>mdpg_pp);
+			PMAP_PAGE_INIT(>mdpg_pp);
 		}
 	}
 }

Index: src/sys/arch/aarch64/include/pmap.h
diff -u src/sys/arch/aarch64/include/pmap.h:1.36 src/sys/arch/aarch64/include/pmap.h:1.37
--- src/sys/arch/aarch64/include/pmap.h:1.36	Sat Feb 29 21:32:22 2020
+++ src/sys/arch/aarch64/include/pmap.h	Wed Apr  8 00:13:40 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: pmap.h,v 1.36 2020/02/29 21:32:22 ryo Exp $ */
+/* $NetBSD: pmap.h,v 1.37 2020/04/08 00:13:40 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -92,7 +92,6 @@ struct pmap_page {
 
 	/* VM_PROT_READ means referenced, VM_PROT_WRITE means modified */
 	uint32_t pp_flags;
-#define PMAP_PAGE_FLAGS_PV_TRACKED	0x8000
 };
 
 struct vm_page_md {
@@ -109,6 +108,10 @@ struct vm_page_md {
 		(pg)->mdpage.mdpg_pp.pp_flags = 0;		\
 	} while (/*CONSTCOND*/ 0)
 
+#define PMAP_PAGE_INIT(pp)		\
+	do {\
+		mutex_init(&(pp)->pp_pvlock, MUTEX_SPIN, IPL_VM);	\
+	} while (/*CONSTCOND*/ 0)
 
 /* saved permission bit for referenced/modified emulation */
 #define LX_BLKPAG_OS_READ		LX_BLKPAG_OS_0



CVS commit: src/sys/arch/aarch64

2020-04-07 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Wed Apr  8 00:13:40 UTC 2020

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

Log Message:
use PMAP_PAGE_INIT() to initialize mutex in pmap_page.

VM_MDPAGE_INIT() in pmap_free_pdp() had initialized pp_flags,
so it unintentionally cleared PMAP_PAGE_FLAGS_PV_TRACKED.
use PMAP_PAGE_INIT to avoid using PMAP_PAGE_FLAGS_PV_TRACKED.

pointed out by tnn@, thanks


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/arch/aarch64/aarch64/pmap.c
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/aarch64/include/pmap.h

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



CVS commit: [is-mlppp] src/sys/net

2020-04-07 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Tue Apr  7 19:26:45 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: if_spppsubr.c

Log Message:
The specification calls this a class, not type.


To generate a diff of this commit:
cvs rdiff -u -r1.187.2.2 -r1.187.2.3 src/sys/net/if_spppsubr.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/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.187.2.2 src/sys/net/if_spppsubr.c:1.187.2.3
--- src/sys/net/if_spppsubr.c:1.187.2.2	Tue Apr  7 18:32:20 2020
+++ src/sys/net/if_spppsubr.c	Tue Apr  7 19:26:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.187.2.2 2020/04/07 18:32:20 is Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.187.2.3 2020/04/07 19:26:44 is Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.2 2020/04/07 18:32:20 is Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.3 2020/04/07 19:26:44 is Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2575,7 +2575,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp
 			 * but ignored by now.
 			 */
 			if (debug) {
-addlog(" type %d", p[2]);
+addlog(" class %d", p[2]);
 sppp_print_bytes(p+3, p[1]-3);
 			}
 			continue;



CVS commit: [is-mlppp] src/sys/net

2020-04-07 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Tue Apr  7 19:26:45 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: if_spppsubr.c

Log Message:
The specification calls this a class, not type.


To generate a diff of this commit:
cvs rdiff -u -r1.187.2.2 -r1.187.2.3 src/sys/net/if_spppsubr.c

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



CVS commit: src/sys/kern

2020-04-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Apr  7 19:17:50 UTC 2020

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

Log Message:
lookup_fastforward(): failure to vget foundobj vnode also translates into
EOPNOTSUPP; VOP_LOOKUP() should retry it.


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

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



CVS commit: src/sys/kern

2020-04-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Apr  7 19:17:50 UTC 2020

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

Log Message:
lookup_fastforward(): failure to vget foundobj vnode also translates into
EOPNOTSUPP; VOP_LOOKUP() should retry it.


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

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

Modified files:

Index: src/sys/kern/vfs_lookup.c
diff -u src/sys/kern/vfs_lookup.c:1.216 src/sys/kern/vfs_lookup.c:1.217
--- src/sys/kern/vfs_lookup.c:1.216	Tue Apr  7 18:28:31 2020
+++ src/sys/kern/vfs_lookup.c	Tue Apr  7 19:17:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.216 2020/04/07 18:28:31 ad Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.217 2020/04/07 19:17:50 ad Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.216 2020/04/07 18:28:31 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.217 2020/04/07 19:17:50 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_magiclinks.h"
@@ -1351,6 +1351,7 @@ lookup_fastforward(struct namei_state *s
 			/* v_interlock now unheld */
 			if (error != 0) {
 foundobj = NULL;
+error = EOPNOTSUPP;
 			}
 			break;
 		}



CVS commit: src/sys/uvm

2020-04-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Apr  7 19:15:24 UTC 2020

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

Log Message:
For single page I/O, use direct mapping if available.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/uvm/uvm_pager.c

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

Modified files:

Index: src/sys/uvm/uvm_pager.c
diff -u src/sys/uvm/uvm_pager.c:1.123 src/sys/uvm/uvm_pager.c:1.124
--- src/sys/uvm/uvm_pager.c:1.123	Mon Feb 24 12:38:57 2020
+++ src/sys/uvm/uvm_pager.c	Tue Apr  7 19:15:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pager.c,v 1.123 2020/02/24 12:38:57 rin Exp $	*/
+/*	$NetBSD: uvm_pager.c,v 1.124 2020/04/07 19:15:23 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.123 2020/02/24 12:38:57 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.124 2020/04/07 19:15:23 ad Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_readahead.h"
@@ -154,6 +154,24 @@ uvm_pager_init(void)
 	}
 }
 
+#ifdef PMAP_DIRECT
+/*
+ * uvm_pagermapdirect: map a single page via the pmap's direct segment
+ *
+ * this is an abuse of pmap_direct_process(), since the kva is being grabbed
+ * and no processing is taking place, but for now..
+ */
+
+static int
+uvm_pagermapdirect(void *kva, size_t sz, void *cookie)
+{
+
+	KASSERT(sz == PAGE_SIZE);
+	*(vaddr_t *)cookie = (vaddr_t)kva;
+	return 0;
+}
+#endif
+
 /*
  * uvm_pagermapin: map pages into KVA (pager_map) for I/O that needs mappings
  *
@@ -176,6 +194,22 @@ uvm_pagermapin(struct vm_page **pps, int
 	UVMHIST_LOG(maphist,"(pps=%#jx, npages=%jd, first_color=%ju)",
 		(uintptr_t)pps, npages, first_color, 0);
 
+#ifdef PMAP_DIRECT
+	/* 
+	 * for a single page the direct mapped segment can be used.
+	 */
+
+	if (npages == 1) {
+		int error __diagused;
+		KASSERT((pps[0]->flags & PG_BUSY) != 0);
+		error = pmap_direct_process(VM_PAGE_TO_PHYS(pps[0]), 0,
+		PAGE_SIZE, uvm_pagermapdirect, );
+		KASSERT(error == 0);
+		UVMHIST_LOG(maphist, "<- done, direct (KVA=%#jx)", kva,0,0,0);
+		return kva;
+	}
+#endif
+
 	/*
 	 * compute protection.  outgoing I/O only needs read
 	 * access to the page, whereas incoming needs read/write.
@@ -250,6 +284,17 @@ uvm_pagermapout(vaddr_t kva, int npages)
 
 	UVMHIST_LOG(maphist, " (kva=%#jx, npages=%jd)", kva, npages,0,0);
 
+#ifdef PMAP_DIRECT
+	/* 
+	 * solitary pages are mapped directly.
+	 */
+
+	if (npages == 1) {
+		UVMHIST_LOG(maphist,"<- done, direct", 0,0,0,0);
+		return;
+	}
+#endif
+
 	/*
 	 * duplicate uvm_unmap, but add in pager_map_wanted handling.
 	 */



CVS commit: src/sys/uvm

2020-04-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Apr  7 19:15:24 UTC 2020

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

Log Message:
For single page I/O, use direct mapping if available.


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/sys/uvm/uvm_pager.c

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



CVS commit: src/sys/uvm

2020-04-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Apr  7 19:12:25 UTC 2020

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

Log Message:
ubc_direct_release(): remove spurious call to uvm_pagemarkdirty().


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/uvm/uvm_bio.c

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



CVS commit: src/sys/uvm

2020-04-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Apr  7 19:12:25 UTC 2020

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

Log Message:
ubc_direct_release(): remove spurious call to uvm_pagemarkdirty().


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/uvm/uvm_bio.c

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

Modified files:

Index: src/sys/uvm/uvm_bio.c
diff -u src/sys/uvm/uvm_bio.c:1.107 src/sys/uvm/uvm_bio.c:1.108
--- src/sys/uvm/uvm_bio.c:1.107	Tue Apr  7 19:11:13 2020
+++ src/sys/uvm/uvm_bio.c	Tue Apr  7 19:12:25 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_bio.c,v 1.107 2020/04/07 19:11:13 ad Exp $	*/
+/*	$NetBSD: uvm_bio.c,v 1.108 2020/04/07 19:12:25 ad Exp $	*/
 
 /*
  * Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.107 2020/04/07 19:11:13 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.108 2020/04/07 19:12:25 ad Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_ubc.h"
@@ -914,17 +914,12 @@ ubc_direct_release(struct uvm_object *uo
 		uvm_pageactivate(pg);
 		uvm_pageunlock(pg);
 
-		/*
-		 * Page was changed, no longer fake and neither clean. 
-		 * There's no managed mapping in the direct case, so 
-		 * mark the page dirty manually.
-		 */
+		/* Page was changed, no longer fake and neither clean. */
 		if (flags & UBC_WRITE) {
 			pg->flags &= ~PG_FAKE;
 			KASSERTMSG(uvm_pagegetdirty(pg) ==
 			UVM_PAGE_STATUS_DIRTY,
 			"page %p not dirty", pg);
-			uvm_pagemarkdirty(pg, UVM_PAGE_STATUS_DIRTY);
 		}
 	}
 	uvm_page_unbusy(pgs, npages);



CVS commit: src/sys/uvm

2020-04-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Apr  7 19:11:13 UTC 2020

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

Log Message:
PR kern/54759: vm.ubc_direct deadlock when read()/write() into mapping of itself

Prevent ubc_uiomove_direct() on mapped vnodes.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/uvm/uvm_bio.c

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

Modified files:

Index: src/sys/uvm/uvm_bio.c
diff -u src/sys/uvm/uvm_bio.c:1.106 src/sys/uvm/uvm_bio.c:1.107
--- src/sys/uvm/uvm_bio.c:1.106	Tue Mar 17 18:31:39 2020
+++ src/sys/uvm/uvm_bio.c	Tue Apr  7 19:11:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_bio.c,v 1.106 2020/03/17 18:31:39 ad Exp $	*/
+/*	$NetBSD: uvm_bio.c,v 1.107 2020/04/07 19:11:13 ad Exp $	*/
 
 /*
  * Copyright (c) 1998 Chuck Silvers.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.106 2020/03/17 18:31:39 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_bio.c,v 1.107 2020/04/07 19:11:13 ad Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_ubc.h"
@@ -734,8 +734,25 @@ ubc_uiomove(struct uvm_object *uobj, str
 	((flags & UBC_READ) != 0 && uio->uio_rw == UIO_READ));
 
 #ifdef UBC_USE_PMAP_DIRECT
-	if (ubc_direct) {
-		return ubc_uiomove_direct(uobj, uio, todo, advice, flags);
+	if (ubc_direct && UVM_OBJ_IS_VNODE(uobj)) {
+		/*
+		 * during direct access pages need to be held busy to
+		 * prevent them disappearing.  if the LWP reads or writes
+		 * a vnode into a mapped view of same it could deadlock.
+		 * prevent this by disallowing direct access if the vnode
+		 * is visible somewhere via mmap().
+		 *
+		 * the vnode flags are tested here, but at all points UBC is
+		 * called for vnodes, the vnode is locked (thus preventing a
+		 * new mapping via mmap() while busy here).
+		 */
+
+		struct vnode *vp = (struct vnode *)uobj;
+		KASSERT(VOP_ISLOCKED(vp) != LK_NONE);
+		if ((vp->v_vflag & VV_MAPPED) == 0) {
+			return ubc_uiomove_direct(uobj, uio, todo, advice,
+			flags);
+		}
 	}
 #endif
 



CVS commit: src/sys/uvm

2020-04-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Apr  7 19:11:13 UTC 2020

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

Log Message:
PR kern/54759: vm.ubc_direct deadlock when read()/write() into mapping of itself

Prevent ubc_uiomove_direct() on mapped vnodes.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/uvm/uvm_bio.c

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



CVS commit: [is-mlppp] src/sys/net

2020-04-07 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Tue Apr  7 18:47:43 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: if_spppvar.h

Log Message:
fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.22.12.1 -r1.22.12.2 src/sys/net/if_spppvar.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/net/if_spppvar.h
diff -u src/sys/net/if_spppvar.h:1.22.12.1 src/sys/net/if_spppvar.h:1.22.12.2
--- src/sys/net/if_spppvar.h:1.22.12.1	Tue Apr  7 18:32:20 2020
+++ src/sys/net/if_spppvar.h	Tue Apr  7 18:47:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppvar.h,v 1.22.12.1 2020/04/07 18:32:20 is Exp $	*/
+/*	$NetBSD: if_spppvar.h,v 1.22.12.2 2020/04/07 18:47:43 is Exp $	*/
 
 #ifndef _NET_IF_SPPPVAR_H_
 #define _NET_IF_SPPPVAR_H_
@@ -47,7 +47,7 @@ struct slcp {
 	int	max_failure;
 	/* multilink variables */
 	u_long	mrru;		/* our   max received reconstructed unit */
-	u_long	their_mrru;	/* their max receive dreconstructed unit */
+	u_long	their_mrru;	/* their max received reconstructed unit */
 };
 
 #define IDX_IPCP 1		/* idx into state table */



CVS commit: [is-mlppp] src/sys/net

2020-04-07 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Tue Apr  7 18:47:43 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: if_spppvar.h

Log Message:
fix typo in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.22.12.1 -r1.22.12.2 src/sys/net/if_spppvar.h

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



CVS commit: [is-mlppp] src/sys/net

2020-04-07 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Tue Apr  7 18:35:01 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: ppp_defs.h

Log Message:
Multilink fragment protocol type.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.106.1 src/sys/net/ppp_defs.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/net/ppp_defs.h
diff -u src/sys/net/ppp_defs.h:1.13 src/sys/net/ppp_defs.h:1.13.106.1
--- src/sys/net/ppp_defs.h:1.13	Wed Feb 20 17:05:53 2008
+++ src/sys/net/ppp_defs.h	Tue Apr  7 18:35:01 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppp_defs.h,v 1.13 2008/02/20 17:05:53 matt Exp $	*/
+/*	$NetBSD: ppp_defs.h,v 1.13.106.1 2020/04/07 18:35:01 is Exp $	*/
 /*	Id: ppp_defs.h,v 1.11 1997/04/30 05:46:24 paulus Exp 	*/
 
 /*
@@ -84,6 +84,7 @@
 #define PPP_IPX		0x002b		/* IPX protocol */
 #define	PPP_VJC_COMP	0x002d		/* VJ compressed TCP */
 #define	PPP_VJC_UNCOMP	0x002f		/* VJ uncompressed TCP */
+#define PPP_MP		0x003d		/* Multilink PPP Fragment */
 #define PPP_IPV6	0x0057		/* Internet Protocol Version 6 */
 #define PPP_COMP	0x00fd		/* compressed packet */
 #define PPP_IPCP	0x8021		/* IP Control Protocol */



CVS commit: [is-mlppp] src/sys/net

2020-04-07 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Tue Apr  7 18:35:01 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: ppp_defs.h

Log Message:
Multilink fragment protocol type.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.13.106.1 src/sys/net/ppp_defs.h

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



CVS commit: [is-mlppp] src/sys/net

2020-04-07 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Tue Apr  7 18:32:20 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: if_spppsubr.c if_spppvar.h

Log Message:
Multilink PPP: sanity check of option values, storage of remote MRRU.


To generate a diff of this commit:
cvs rdiff -u -r1.187.2.1 -r1.187.2.2 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.22 -r1.22.12.1 src/sys/net/if_spppvar.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/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.187.2.1 src/sys/net/if_spppsubr.c:1.187.2.2
--- src/sys/net/if_spppsubr.c:1.187.2.1	Tue Apr  7 18:28:40 2020
+++ src/sys/net/if_spppsubr.c	Tue Apr  7 18:32:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.187.2.1 2020/04/07 18:28:40 is Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.187.2.2 2020/04/07 18:32:20 is Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.1 2020/04/07 18:28:40 is Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.2 2020/04/07 18:32:20 is Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -2383,12 +2383,19 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp
 			break;
 		case LCP_OPT_MP_EID:
 			if (len >= l && l >= 3) {
-if (debug)
-	addlog(" [rej]");
-break;
+switch (p[2]) {
+case 0: if (l==3+ 0) continue;break;
+case 2: if (l==3+ 4) continue;break;
+case 3: if (l==3+ 6) continue;break;
+case 6: if (l==3+16) continue;break;
+case 1: /* FALLTHROUGH */
+case 4: if (l<=3+20) continue;break;
+case 5: if (l<=3+15) continue;break;
+/* XXX should it be default: continue;? */
+}
 			}
 			if (debug)
-addlog(" [invalid]");
+addlog(" [invalid class %d len %d]", p[2], l);
 			break;
 		case LCP_OPT_MP_SSNHF:
 			if (len >= 2 && l == 2) {
@@ -2402,15 +2409,7 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp
 		case LCP_OPT_MP_MRRU:
 			/* Multilink maximum received reconstructed unit */
 			/* should be fall through, both are same length */
-			/* for now, check, then reject anyway */
-			if (len >= 4 && l == 4) {
-if (debug)
-	addlog(" %d [rej]", (p[2] <<8) + p[3]);
-break;
-			}
-			if (debug)
-addlog(" [invalid]");
-			break;
+			/* FALLTHROUGH */
 		case LCP_OPT_MRU:
 			/* Maximum receive unit. */
 			if (len >= 4 && l == 4)
@@ -2569,6 +2568,27 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp
 break;
 			}
 			continue;
+		case LCP_OPT_MP_EID:
+			/*
+			 * Endpoint identification.
+			 * Always agreeable,
+			 * but ignored by now.
+			 */
+			if (debug) {
+addlog(" type %d", p[2]);
+sppp_print_bytes(p+3, p[1]-3);
+			}
+			continue;
+		case LCP_OPT_MP_MRRU:
+			/*
+			 * Maximum received reconstructed unit. 
+			 * Always agreeable,
+			 * but ignored by now.
+			 */
+			sp->lcp.their_mrru = p[2] * 256 + p[3];
+			if (debug)
+addlog(" %ld", sp->lcp.their_mrru);
+			continue;
 		}
 		if (rlen + l > blen) {
 			if (debug)

Index: src/sys/net/if_spppvar.h
diff -u src/sys/net/if_spppvar.h:1.22 src/sys/net/if_spppvar.h:1.22.12.1
--- src/sys/net/if_spppvar.h:1.22	Thu Oct 12 09:53:55 2017
+++ src/sys/net/if_spppvar.h	Tue Apr  7 18:32:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppvar.h,v 1.22 2017/10/12 09:53:55 knakahara Exp $	*/
+/*	$NetBSD: if_spppvar.h,v 1.22.12.1 2020/04/07 18:32:20 is Exp $	*/
 
 #ifndef _NET_IF_SPPPVAR_H_
 #define _NET_IF_SPPPVAR_H_
@@ -45,6 +45,9 @@ struct slcp {
 	int	max_terminate;
 	int	max_configure;
 	int	max_failure;
+	/* multilink variables */
+	u_long	mrru;		/* our   max received reconstructed unit */
+	u_long	their_mrru;	/* their max receive dreconstructed unit */
 };
 
 #define IDX_IPCP 1		/* idx into state table */



CVS commit: [is-mlppp] src/sys/net

2020-04-07 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Tue Apr  7 18:32:20 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: if_spppsubr.c if_spppvar.h

Log Message:
Multilink PPP: sanity check of option values, storage of remote MRRU.


To generate a diff of this commit:
cvs rdiff -u -r1.187.2.1 -r1.187.2.2 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.22 -r1.22.12.1 src/sys/net/if_spppvar.h

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



CVS commit: [is-mlppp] src/sys/net

2020-04-07 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Tue Apr  7 18:28:40 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: if_spppsubr.c

Log Message:
Define a few more LCP options. Recognize, sanity-check and report (but
still reject for the moment) multilink PPP configuration options received.


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.187.2.1 src/sys/net/if_spppsubr.c

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



CVS commit: src/sys/kern

2020-04-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Apr  7 18:28:32 UTC 2020

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

Log Message:
PR kern/55146 (100+ file system test cases failing)

- namei_oneroot(): key on negative return from lookup_fastforward()
  (EOPNOTSUPP), not positive.

- lookup_crossmount(): don't lose track of founddir.

>From hannken@, with a couple of tweaks.


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

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

Modified files:

Index: src/sys/kern/vfs_lookup.c
diff -u src/sys/kern/vfs_lookup.c:1.215 src/sys/kern/vfs_lookup.c:1.216
--- src/sys/kern/vfs_lookup.c:1.215	Sat Apr  4 20:49:30 2020
+++ src/sys/kern/vfs_lookup.c	Tue Apr  7 18:28:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.215 2020/04/04 20:49:30 ad Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.216 2020/04/07 18:28:31 ad Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.215 2020/04/04 20:49:30 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.216 2020/04/07 18:28:31 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_magiclinks.h"
@@ -961,7 +961,7 @@ lookup_crossmount(struct namei_state *st
 		error = vn_lock(foundobj, LK_SHARED);
 		if (error != 0) {
 			vrele(foundobj);
-			*foundobj_ret = NULL;
+			foundobj = NULL;
 			break;
 		}
 
@@ -975,7 +975,7 @@ lookup_crossmount(struct namei_state *st
 		error = vfs_busy(mp);
 		vput(foundobj);
 		if (error != 0) {
-			*foundobj_ret = NULL;
+			foundobj = NULL;
 			break;
 		}
 
@@ -983,7 +983,7 @@ lookup_crossmount(struct namei_state *st
 		error = VFS_ROOT(mp, LK_NONE, );
 		vfs_unbusy(mp);
 		if (error) {
-			*foundobj_ret = NULL;
+			foundobj = NULL;
 			break;
 		}
 
@@ -1005,7 +1005,6 @@ lookup_crossmount(struct namei_state *st
 		} else if (foundobj->v_type == VDIR) {
 			vrele(searchdir);
 			*searchdir_ret = searchdir = NULL;
-			*foundobj_ret = foundobj;
 			lktype = LK_NONE;
 		}
 	}
@@ -1015,6 +1014,7 @@ lookup_crossmount(struct namei_state *st
 		vn_lock(searchdir, lktype | LK_RETRY);
 		*searchdir_locked = true;
 	}
+	*foundobj_ret = foundobj;
 	return error;
 }
 
@@ -1472,7 +1472,7 @@ namei_oneroot(struct namei_state *state,
 		 * If we didn't get a good answer from the namecache, then
 		 * go directly to the file system.
 		 */
-		if (error != 0 && error != ENOENT) {
+		if (error == EOPNOTSUPP) {
 			error = lookup_once(state, searchdir, ,
 			, _locked);
 		}



CVS commit: src/sys/kern

2020-04-07 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Apr  7 18:28:32 UTC 2020

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

Log Message:
PR kern/55146 (100+ file system test cases failing)

- namei_oneroot(): key on negative return from lookup_fastforward()
  (EOPNOTSUPP), not positive.

- lookup_crossmount(): don't lose track of founddir.

>From hannken@, with a couple of tweaks.


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

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



CVS commit: [is-mlppp] src/sys/net

2020-04-07 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Tue Apr  7 18:28:40 UTC 2020

Modified Files:
src/sys/net [is-mlppp]: if_spppsubr.c

Log Message:
Define a few more LCP options. Recognize, sanity-check and report (but
still reject for the moment) multilink PPP configuration options received.


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.187.2.1 src/sys/net/if_spppsubr.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/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.187 src/sys/net/if_spppsubr.c:1.187.2.1
--- src/sys/net/if_spppsubr.c:1.187	Fri Mar  6 10:26:59 2020
+++ src/sys/net/if_spppsubr.c	Tue Apr  7 18:28:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.187 2020/03/06 10:26:59 knakahara Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.187.2.1 2020/04/07 18:28:40 is Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187 2020/03/06 10:26:59 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187.2.1 2020/04/07 18:28:40 is Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -146,6 +146,13 @@ __KERNEL_RCSID(0, "$NetBSD: if_spppsubr.
 #define LCP_OPT_RESERVED	6	/* reserved */
 #define LCP_OPT_PROTO_COMP	7	/* protocol field compression */
 #define LCP_OPT_ADDR_COMP	8	/* address/control field compression */
+#define LCP_OPT_FCS_ALTS	9	/* FCS alternatives */
+#define LCP_OPT_SELF_DESC_PAD	10	/* self-describing padding */
+#define LCP_OPT_CALL_BACK	13	/* callback */
+#define LCP_OPT_COMPOUND_FRMS	15	/* compound frames */
+#define LCP_OPT_MP_MRRU		17	/* multilink MRRU */
+#define LCP_OPT_MP_SSNHF	18	/* multilink short seq. numbers */
+#define LCP_OPT_MP_EID		19	/* multilink endpoint discriminator */
 
 #define IPCP_OPT_ADDRESSES	1	/* both IP addresses; deprecated */
 #define IPCP_OPT_COMPRESSION	2	/* IP compression protocol */
@@ -2374,6 +2381,36 @@ sppp_lcp_RCR(struct sppp *sp, struct lcp
 			if (debug)
 addlog(" [invalid]");
 			break;
+		case LCP_OPT_MP_EID:
+			if (len >= l && l >= 3) {
+if (debug)
+	addlog(" [rej]");
+break;
+			}
+			if (debug)
+addlog(" [invalid]");
+			break;
+		case LCP_OPT_MP_SSNHF:
+			if (len >= 2 && l == 2) {
+if (debug)
+	addlog(" [rej]");
+break;
+			}
+			if (debug)
+addlog(" [invalid]");
+			break;
+		case LCP_OPT_MP_MRRU:
+			/* Multilink maximum received reconstructed unit */
+			/* should be fall through, both are same length */
+			/* for now, check, then reject anyway */
+			if (len >= 4 && l == 4) {
+if (debug)
+	addlog(" %d [rej]", (p[2] <<8) + p[3]);
+break;
+			}
+			if (debug)
+addlog(" [invalid]");
+			break;
 		case LCP_OPT_MRU:
 			/* Maximum receive unit. */
 			if (len >= 4 && l == 4)
@@ -6016,6 +6053,12 @@ sppp_lcp_opt_name(u_char opt)
 	case LCP_OPT_MAGIC:		return "magic";
 	case LCP_OPT_PROTO_COMP:	return "proto-comp";
 	case LCP_OPT_ADDR_COMP:		return "addr-comp";
+	case LCP_OPT_SELF_DESC_PAD:	return "sdpad";
+	case LCP_OPT_CALL_BACK:		return "callback";
+	case LCP_OPT_COMPOUND_FRMS:	return "cmpd-frms";
+	case LCP_OPT_MP_MRRU:		return "mrru";
+	case LCP_OPT_MP_SSNHF:		return "mp-ssnhf";
+	case LCP_OPT_MP_EID:		return "mp-eid";
 	}
 	snprintf(buf, sizeof(buf), "0x%x", opt);
 	return buf;



CVS commit: src/usr.bin/banner

2020-04-07 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Tue Apr  7 17:57:33 UTC 2020

Modified Files:
src/usr.bin/banner: banner.1

Log Message:
Add history section


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/banner/banner.1

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

Modified files:

Index: src/usr.bin/banner/banner.1
diff -u src/usr.bin/banner/banner.1:1.9 src/usr.bin/banner/banner.1:1.10
--- src/usr.bin/banner/banner.1:1.9	Wed Feb 29 08:54:55 2012
+++ src/usr.bin/banner/banner.1	Tue Apr  7 17:57:33 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: banner.1,v 1.9 2012/02/29 08:54:55 wiz Exp $
+.\"	$NetBSD: banner.1,v 1.10 2020/04/07 17:57:33 sevan Exp $
 .\"
 .\"	@(#)Copyright (c) 1995, Simon J. Gerraty.
 .\"
@@ -15,7 +15,7 @@
 .\"	Please send copies of changes and bug-fixes to:
 .\"	s...@zen.void.oz.au
 .\"
-.Dd February 26, 2012
+.Dd April 7, 2020
 .Dt BANNER 1
 .Os
 .Sh NAME
@@ -61,3 +61,8 @@ font.
 .Ex -std
 .Sh SEE ALSO
 .Xr banner 6
+.Sh HISTORY
+The
+.Nm
+utility first appeared in
+.Nx 1.2 .



CVS commit: src/usr.bin/banner

2020-04-07 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Tue Apr  7 17:57:33 UTC 2020

Modified Files:
src/usr.bin/banner: banner.1

Log Message:
Add history section


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/usr.bin/banner/banner.1

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



CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 16:10:48 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xenbus: xenbus_dev.c xenbus_xs.c

Log Message:
add wrapper to free response from xenbus_dev_request_and_reply(), so
that call in xenbus_dev_write() wouldn't need to know how it's allocated


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/xenbus/xenbus_dev.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/xen/xenbus/xenbus_xs.c

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



CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 16:10:48 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xenbus: xenbus_dev.c xenbus_xs.c

Log Message:
add wrapper to free response from xenbus_dev_request_and_reply(), so
that call in xenbus_dev_write() wouldn't need to know how it's allocated


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/xenbus/xenbus_dev.c
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/xen/xenbus/xenbus_xs.c

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

Modified files:

Index: src/sys/arch/xen/include/xenbus.h
diff -u src/sys/arch/xen/include/xenbus.h:1.21 src/sys/arch/xen/include/xenbus.h:1.22
--- src/sys/arch/xen/include/xenbus.h:1.21	Tue Apr  7 15:59:57 2020
+++ src/sys/arch/xen/include/xenbus.h	Tue Apr  7 16:10:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus.h,v 1.21 2020/04/07 15:59:57 jdolecek Exp $ */
+/* $NetBSD: xenbus.h,v 1.22 2020/04/07 16:10:48 jdolecek Exp $ */
 /**
  * xenbus.h
  *
@@ -153,6 +153,7 @@ void xs_resume(void);
 
 /* Used by xenbus_dev to borrow kernel's store connection. */
 int xenbus_dev_request_and_reply(struct xsd_sockmsg *msg, void **);
+void xenbus_dev_reply_free(struct xsd_sockmsg *msg, void *);
 
 void xenbus_probe(void *);
 

Index: src/sys/arch/xen/xenbus/xenbus_dev.c
diff -u src/sys/arch/xen/xenbus/xenbus_dev.c:1.16 src/sys/arch/xen/xenbus/xenbus_dev.c:1.17
--- src/sys/arch/xen/xenbus/xenbus_dev.c:1.16	Tue Apr  7 15:43:42 2020
+++ src/sys/arch/xen/xenbus/xenbus_dev.c	Tue Apr  7 16:10:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_dev.c,v 1.16 2020/04/07 15:43:42 jdolecek Exp $ */
+/* $NetBSD: xenbus_dev.c,v 1.17 2020/04/07 16:10:48 jdolecek Exp $ */
 /*
  * xenbus_dev.c
  * 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenbus_dev.c,v 1.16 2020/04/07 15:43:42 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_dev.c,v 1.17 2020/04/07 16:10:48 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -40,7 +40,6 @@ __KERNEL_RCSID(0, "$NetBSD: xenbus_dev.c
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -312,7 +311,8 @@ xenbus_dev_write(void *v)
 			queue_reply(xlwp, (char *)>u.msg,
 		sizeof(xlwp->u.msg));
 			queue_reply(xlwp, (char *)reply, xlwp->u.msg.len);
-			free(reply, M_DEVBUF);
+
+			xenbus_dev_reply_free(>u.msg, reply);
 		}
 		break;
 

Index: src/sys/arch/xen/xenbus/xenbus_xs.c
diff -u src/sys/arch/xen/xenbus/xenbus_xs.c:1.25 src/sys/arch/xen/xenbus/xenbus_xs.c:1.26
--- src/sys/arch/xen/xenbus/xenbus_xs.c:1.25	Tue Apr  7 15:59:57 2020
+++ src/sys/arch/xen/xenbus/xenbus_xs.c	Tue Apr  7 16:10:48 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_xs.c,v 1.25 2020/04/07 15:59:57 jdolecek Exp $ */
+/* $NetBSD: xenbus_xs.c,v 1.26 2020/04/07 16:10:48 jdolecek Exp $ */
 /**
  * xenbus_xs.c
  *
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenbus_xs.c,v 1.25 2020/04/07 15:59:57 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_xs.c,v 1.26 2020/04/07 16:10:48 jdolecek Exp $");
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -175,6 +175,12 @@ xenbus_dev_request_and_reply(struct xsd_
 	return err;
 }
 
+void
+xenbus_dev_reply_free(struct xsd_sockmsg *msg, void *reply)
+{
+	free(reply, M_DEVBUF);
+}
+
 /* Send message to xs, get kmalloc'ed reply.  ERR_PTR() on error. */
 static int
 xs_talkv(struct xenbus_transaction *t,



CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 15:59:58 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xenbus: xenbus_probe.c xenbus_xs.c

Log Message:
add a small wrapper xenbus_directory_free() to free result of
xenbus_directory(), so that caller doesn't need to be aware how the memory
was allocated


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/xen/xenbus/xenbus_probe.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/xen/xenbus/xenbus_xs.c

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

Modified files:

Index: src/sys/arch/xen/include/xenbus.h
diff -u src/sys/arch/xen/include/xenbus.h:1.20 src/sys/arch/xen/include/xenbus.h:1.21
--- src/sys/arch/xen/include/xenbus.h:1.20	Tue Apr  7 15:40:14 2020
+++ src/sys/arch/xen/include/xenbus.h	Tue Apr  7 15:59:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus.h,v 1.20 2020/04/07 15:40:14 jdolecek Exp $ */
+/* $NetBSD: xenbus.h,v 1.21 2020/04/07 15:59:57 jdolecek Exp $ */
 /**
  * xenbus.h
  *
@@ -120,6 +120,7 @@ struct xenbus_transaction;
 int xenbus_directory(struct xenbus_transaction *t,
 			const char *dir, const char *node, unsigned int *num,
 			char ***);
+void xenbus_directory_free(unsigned int, char **);
 int xenbus_read(struct xenbus_transaction *,
 		  const char *, const char *, char *, size_t);
 int xenbus_read_ul(struct xenbus_transaction *,

Index: src/sys/arch/xen/xenbus/xenbus_probe.c
diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.45 src/sys/arch/xen/xenbus/xenbus_probe.c:1.46
--- src/sys/arch/xen/xenbus/xenbus_probe.c:1.45	Tue Apr  7 15:40:14 2020
+++ src/sys/arch/xen/xenbus/xenbus_probe.c	Tue Apr  7 15:59:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_probe.c,v 1.45 2020/04/07 15:40:14 jdolecek Exp $ */
+/* $NetBSD: xenbus_probe.c,v 1.46 2020/04/07 15:59:57 jdolecek Exp $ */
 /**
  * Talks to Xen Store to figure out what devices we have.
  *
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.45 2020/04/07 15:40:14 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.46 2020/04/07 15:59:57 jdolecek Exp $");
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -41,7 +41,6 @@ __KERNEL_RCSID(0, "$NetBSD: xenbus_probe
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -316,16 +315,17 @@ xenbus_probe_device_type(const char *pat
 	size_t lookup_sz = 0;
 	unsigned long state;
 	char **dir;
-	unsigned int dir_n = 0;
+	unsigned int orig_dir_n = 0, dir_n;
 	struct xenbus_device *xbusd;
 	struct xenbusdev_attach_args xa;
 	char *ep;
 
 	DPRINTK("probe %s type %s", path, type);
-	err = xenbus_directory(NULL, path, "", _n, );
+	err = xenbus_directory(NULL, path, "", _dir_n, );
 	DPRINTK("directory err %d dir_n %d", err, dir_n);
 	if (err)
 		return err;
+	dir_n = orig_dir_n;
 
 	/* Only sort frontend devices i.e. create == NULL*/
 	if (dir_n > 1 && create == NULL) {
@@ -456,7 +456,7 @@ xenbus_probe_device_type(const char *pat
 		xbusd, xbusd_entries);
 		watch_otherend(xbusd);
 	}
-	free(dir, M_DEVBUF);
+	xenbus_directory_free(orig_dir_n, dir);
 	if (lookup)
 		kmem_free(lookup, lookup_sz);
 	
@@ -511,7 +511,7 @@ xenbus_probe_frontends(void)
 		if (err)
 			break;
 	}
-	free(dir, M_DEVBUF);
+	xenbus_directory_free(dir_n, dir);
 	return err;
 }
 
@@ -542,10 +542,9 @@ xenbus_probe_backends(void)
 		_n, );
 		DPRINTK("directory backend/%s err %d dirid_n %d",
 		dirt[type], err, dirid_n);
-		if (err) {
-			free(dirt, M_DEVBUF); /* to be checked */
-			return err;
-		}
+		if (err)
+			goto out;
+
 		for (id = 0; id < dirid_n; id++) {
 			snprintf(path, sizeof(path), "backend/%s/%s",
 			dirt[type], dirid[id]);
@@ -554,9 +553,11 @@ xenbus_probe_backends(void)
 			if (err)
 break;
 		}
-		free(dirid, M_DEVBUF);
+		xenbus_directory_free(dirid_n, dirid);
 	}
-	free(dirt, M_DEVBUF);
+
+out:
+	xenbus_directory_free(dirt_n, dirt);
 	return err;
 }
 

Index: src/sys/arch/xen/xenbus/xenbus_xs.c
diff -u src/sys/arch/xen/xenbus/xenbus_xs.c:1.24 src/sys/arch/xen/xenbus/xenbus_xs.c:1.25
--- src/sys/arch/xen/xenbus/xenbus_xs.c:1.24	Tue Apr  7 11:47:06 2020
+++ src/sys/arch/xen/xenbus/xenbus_xs.c	Tue Apr  7 15:59:57 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_xs.c,v 1.24 2020/04/07 11:47:06 jdolecek Exp $ */
+/* $NetBSD: xenbus_xs.c,v 1.25 2020/04/07 15:59:57 jdolecek Exp $ */
 /**
  * xenbus_xs.c
  *
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenbus_xs.c,v 1.24 2020/04/07 11:47:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_xs.c,v 1.25 2020/04/07 15:59:57 jdolecek Exp $");
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -338,6 +338,12 

CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 15:59:58 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xenbus: xenbus_probe.c xenbus_xs.c

Log Message:
add a small wrapper xenbus_directory_free() to free result of
xenbus_directory(), so that caller doesn't need to be aware how the memory
was allocated


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/xen/xenbus/xenbus_probe.c
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/xen/xenbus/xenbus_xs.c

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



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

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 15:43:42 UTC 2020

Modified Files:
src/sys/arch/xen/xenbus: xenbus_dev.c

Log Message:
mostly convert to kmem_alloc()

doing this, remove check for failed allocation with KM_SLEEP, and make
sure to not hold mutex during the call


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

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

Modified files:

Index: src/sys/arch/xen/xenbus/xenbus_dev.c
diff -u src/sys/arch/xen/xenbus/xenbus_dev.c:1.15 src/sys/arch/xen/xenbus/xenbus_dev.c:1.16
--- src/sys/arch/xen/xenbus/xenbus_dev.c:1.15	Tue Apr  7 08:14:43 2020
+++ src/sys/arch/xen/xenbus/xenbus_dev.c	Tue Apr  7 15:43:42 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_dev.c,v 1.15 2020/04/07 08:14:43 jdolecek Exp $ */
+/* $NetBSD: xenbus_dev.c,v 1.16 2020/04/07 15:43:42 jdolecek Exp $ */
 /*
  * xenbus_dev.c
  * 
@@ -31,16 +31,16 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenbus_dev.c,v 1.15 2020/04/07 08:14:43 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_dev.c,v 1.16 2020/04/07 15:43:42 jdolecek Exp $");
 
 #include "opt_xen.h"
 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -289,8 +289,7 @@ xenbus_dev_write(void *v)
 		err = xenbus_dev_request_and_reply(>u.msg, );
 		if (err == 0) {
 			if (xlwp->u.msg.type == XS_TRANSACTION_START) {
-trans = malloc(sizeof(*trans), M_DEVBUF,
-M_WAITOK);
+trans = kmem_alloc(sizeof(*trans), KM_SLEEP);
 trans->handle = (struct xenbus_transaction *)
 	strtoul(reply, NULL, 0);
 SLIST_INSERT_HEAD(>transactions,
@@ -308,7 +307,7 @@ xenbus_dev_write(void *v)
 }
 SLIST_REMOVE(>transactions, trans, 
 xenbus_dev_transaction, trans_next);
-free(trans, M_DEVBUF);
+kmem_free(trans, sizeof(*trans));
 			}
 			queue_reply(xlwp, (char *)>u.msg,
 		sizeof(xlwp->u.msg));
@@ -348,37 +347,50 @@ xenbus_dev_open(void *v)
 	mutex_enter(_dev_open_mtx);
 	u = kfs->kfs_v;
 	if (u == NULL) {
-		u = malloc(sizeof(*u), M_DEVBUF, M_WAITOK);
-		if (u == NULL) {  
-			mutex_exit(_dev_open_mtx);
-			return ENOMEM;
-		}
-		memset(u, 0, sizeof(*u));
+		mutex_exit(_dev_open_mtx);
+
+		u = kmem_zalloc(sizeof(*u), KM_SLEEP);
 		SLIST_INIT(>lwps); 
 		mutex_init(>mtx, MUTEX_DEFAULT, IPL_NONE);
-		kfs->kfs_v = u;   
+
+		mutex_enter(_dev_open_mtx);
+		/*
+		 * Must re-check if filled while waiting in alloc
+		 * by some other lwp.
+		 */
+		if (kfs->kfs_v) {
+			kmem_free(u, sizeof(*u));
+			u = kfs->kfs_v;
+		} else {
+			kfs->kfs_v = u;   
+		}
 	};
-	mutex_enter(>mtx);
 	mutex_exit(_dev_open_mtx);
+
+	mutex_enter(>mtx);
 	SLIST_FOREACH(xlwp, >lwps, lwp_next) {
 		if (xlwp->lwp == curlwp) {
 			break;
 		}
 	}
 	if (xlwp == NULL) {
-		xlwp = malloc(sizeof(*xlwp ), M_DEVBUF, M_WAITOK);  
-		if (xlwp  == NULL) {  
-			mutex_exit(>mtx);
-			return ENOMEM;
-		}
-		memset(xlwp, 0, sizeof(*xlwp));
+		mutex_exit(>mtx);
+
+		xlwp = kmem_zalloc(sizeof(*xlwp), KM_SLEEP);  
 		xlwp->lwp = curlwp;   
 		SLIST_INIT(>transactions);
 		mutex_init(>mtx, MUTEX_DEFAULT, IPL_NONE);
-		SLIST_INSERT_HEAD(>lwps,
-		xlwp, lwp_next);  
+
+		mutex_enter(>mtx);
+		/*
+		 * While alloc can block, this can't be re-entered with
+		 * curlwp, so no need to re-check. Also the node can't
+		 * be closed while we are blocked here.
+		 */
+		SLIST_INSERT_HEAD(>lwps, xlwp, lwp_next);  
 	}
 	mutex_exit(>mtx);
+
 	return 0;
 }
 
@@ -415,7 +427,7 @@ xenbus_dev_close(void *v)
 		trans = SLIST_FIRST(>transactions);
 		xenbus_transaction_end(trans->handle, 1);
 		SLIST_REMOVE_HEAD(>transactions, trans_next);
-		free(trans, M_DEVBUF);
+		kmem_free(trans, sizeof(*trans));
 	}
 	mutex_exit(>mtx);
 	SLIST_REMOVE(>lwps, xlwp, xenbus_dev_lwp, lwp_next);
@@ -430,8 +442,8 @@ xenbus_dev_close(void *v)
 	mutex_destroy(>mtx);
 	kfs->kfs_v = NULL;
 	mutex_exit(_dev_open_mtx);
-	free(xlwp, M_DEVBUF);
-	free(u, M_DEVBUF);
+	kmem_free(xlwp, sizeof(*xlwp));
+	kmem_free(u, sizeof(*u));
 	return 0;
 }
 



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

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 15:43:42 UTC 2020

Modified Files:
src/sys/arch/xen/xenbus: xenbus_dev.c

Log Message:
mostly convert to kmem_alloc()

doing this, remove check for failed allocation with KM_SLEEP, and make
sure to not hold mutex during the call


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

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



CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 15:40:14 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xenbus: xenbus_probe.c

Log Message:
partially convert to kmem_alloc()

plug memory leak in one xenbus_probe_device_type() error path
when read_backend_details() fails


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/xen/xenbus/xenbus_probe.c

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

Modified files:

Index: src/sys/arch/xen/include/xenbus.h
diff -u src/sys/arch/xen/include/xenbus.h:1.19 src/sys/arch/xen/include/xenbus.h:1.20
--- src/sys/arch/xen/include/xenbus.h:1.19	Tue Apr  7 14:07:01 2020
+++ src/sys/arch/xen/include/xenbus.h	Tue Apr  7 15:40:14 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus.h,v 1.19 2020/04/07 14:07:01 jdolecek Exp $ */
+/* $NetBSD: xenbus.h,v 1.20 2020/04/07 15:40:14 jdolecek Exp $ */
 /**
  * xenbus.h
  *
@@ -96,6 +96,7 @@ struct xenbus_device {
 	int xbusd_has_error;
 	/* for xenbus internal use */
 	struct xenbus_watch xbusd_otherend_watch;
+	size_t xbusd_sz;		/* size of allocated structure */
 	const char xbusd_path[1]; /* our path */
 };
 

Index: src/sys/arch/xen/xenbus/xenbus_probe.c
diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.44 src/sys/arch/xen/xenbus/xenbus_probe.c:1.45
--- src/sys/arch/xen/xenbus/xenbus_probe.c:1.44	Tue Apr  7 14:07:01 2020
+++ src/sys/arch/xen/xenbus/xenbus_probe.c	Tue Apr  7 15:40:14 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_probe.c,v 1.44 2020/04/07 14:07:01 jdolecek Exp $ */
+/* $NetBSD: xenbus_probe.c,v 1.45 2020/04/07 15:40:14 jdolecek Exp $ */
 /**
  * Talks to Xen Store to figure out what devices we have.
  *
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.44 2020/04/07 14:07:01 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.45 2020/04/07 15:40:14 jdolecek Exp $");
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -313,6 +313,7 @@ xenbus_probe_device_type(const char *pat
 {
 	int err, i, pos, msize;
 	int *lookup = NULL;
+	size_t lookup_sz = 0;
 	unsigned long state;
 	char **dir;
 	unsigned int dir_n = 0;
@@ -331,16 +332,13 @@ xenbus_probe_device_type(const char *pat
 		int minp;
 		unsigned long minv;
 		unsigned long *id;
+		size_t id_sz;
 
-		lookup = malloc(sizeof(int) * dir_n, M_DEVBUF,
-		M_WAITOK | M_ZERO);
-		if (lookup == NULL)
-			panic("can't malloc lookup");
-
-		id = malloc(sizeof(unsigned long) * dir_n, M_DEVBUF,
-		M_WAITOK | M_ZERO);
-		if (id == NULL)
-			panic("can't malloc id");
+		lookup_sz = sizeof(int) * dir_n;
+		lookup = kmem_zalloc(lookup_sz, KM_SLEEP);
+
+		id_sz = sizeof(unsigned long) * dir_n;
+		id = kmem_zalloc(id_sz, KM_SLEEP);
 
 		/* Convert string values to numeric; skip invalid */
 		for (i = 0; i < dir_n; i++) {
@@ -370,8 +368,9 @@ xenbus_probe_device_type(const char *pat
 			else
 break;
 		}
-		
-		free(id, M_DEVBUF);
+
+		kmem_free(id, id_sz);
+
 		/* Adjust in case we had to skip non-numeric entries */
 		dir_n = pos;
 	}
@@ -387,15 +386,14 @@ xenbus_probe_device_type(const char *pat
 		 * already has room for one char in xbusd_path.
 		 */
 		msize = sizeof(*xbusd) + strlen(path) + strlen(dir[i]) + 2;
-		xbusd = malloc(msize, M_DEVBUF, M_WAITOK | M_ZERO);
-		if (xbusd == NULL)
-			panic("can't malloc xbusd");
-			
+		xbusd = kmem_zalloc(msize, KM_SLEEP);
+		xbusd->xbusd_sz = msize;
+
 		snprintf(__UNCONST(xbusd->xbusd_path),
 		msize - sizeof(*xbusd) + 1, "%s/%s", path, dir[i]);
 		if (xenbus_lookup_device_path(xbusd->xbusd_path) != NULL) {
 			/* device already registered */
-			free(xbusd, M_DEVBUF);
+			kmem_free(xbusd, xbusd->xbusd_sz);
 			continue;
 		}
 		err = xenbus_read_ul(NULL, xbusd->xbusd_path, "state",
@@ -403,13 +401,13 @@ xenbus_probe_device_type(const char *pat
 		if (err) {
 			printf("xenbus: can't get state "
 			"for %s (%d)\n", xbusd->xbusd_path, err);
-			free(xbusd, M_DEVBUF);
+			kmem_free(xbusd, xbusd->xbusd_sz);
 			err = 0;
 			continue;
 		}
 		if (state != XenbusStateInitialising) {
 			/* device is not new */
-			free(xbusd, M_DEVBUF);
+			kmem_free(xbusd, xbusd->xbusd_sz);
 			continue;
 		}
 
@@ -425,7 +423,7 @@ xenbus_probe_device_type(const char *pat
 break;
 			}
 			if (create(xbusd)) {
-free(xbusd, M_DEVBUF);
+kmem_free(xbusd, xbusd->xbusd_sz);
 continue;
 			}
 		} else {
@@ -437,19 +435,20 @@ xenbus_probe_device_type(const char *pat
 printf("xenbus device type %s: id %s is not a"
 " number\n", type, dir[i]);
 err = EFTYPE;
-free(xbusd, M_DEVBUF);
+kmem_free(xbusd, xbusd->xbusd_sz);
 break;
 			}
 			err = read_backend_details(xbusd);
 			if (err != 0) {
 printf("xenbus: can't 

CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 15:40:14 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xenbus: xenbus_probe.c

Log Message:
partially convert to kmem_alloc()

plug memory leak in one xenbus_probe_device_type() error path
when read_backend_details() fails


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.44 -r1.45 src/sys/arch/xen/xenbus/xenbus_probe.c

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



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

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 15:16:52 UTC 2020

Modified Files:
src/sys/arch/xen/xenbus: xenbus_client.c

Log Message:
convert from malloc() to kmem_alloc()


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

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

Modified files:

Index: src/sys/arch/xen/xenbus/xenbus_client.c
diff -u src/sys/arch/xen/xenbus/xenbus_client.c:1.16 src/sys/arch/xen/xenbus/xenbus_client.c:1.17
--- src/sys/arch/xen/xenbus/xenbus_client.c:1.16	Tue Apr  7 14:07:01 2020
+++ src/sys/arch/xen/xenbus/xenbus_client.c	Tue Apr  7 15:16:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_client.c,v 1.16 2020/04/07 14:07:01 jdolecek Exp $ */
+/* $NetBSD: xenbus_client.c,v 1.17 2020/04/07 15:16:52 jdolecek Exp $ */
 /**
  * Client-facing interface for the Xenbus driver.  In other words, the
  * interface between the Xenbus and the device-specific code, be it the
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenbus_client.c,v 1.16 2020/04/07 14:07:01 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_client.c,v 1.17 2020/04/07 15:16:52 jdolecek Exp $");
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -41,7 +41,6 @@ __KERNEL_RCSID(0, "$NetBSD: xenbus_clien
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -129,13 +128,12 @@ xenbus_switch_state(struct xenbus_device
  * If the value returned is non-NULL, then it is the caller's to kfree.
  */
 static char *
-error_path(struct xenbus_device *dev)
+error_path(struct xenbus_device *dev, size_t *len)
 {
-	char *path_buffer = malloc(strlen("error/") + strlen(dev->xbusd_path) +
-1, M_DEVBUF, M_NOWAIT);
-	if (path_buffer == NULL) {
+	*len = strlen("error/") + strlen(dev->xbusd_path) + 1;
+	char *path_buffer = kmem_alloc(*len, KM_NOSLEEP);
+	if (path_buffer == NULL)
 		return NULL;
-	}
 
 	strcpy(path_buffer, "error/");
 	strcpy(path_buffer + strlen("error/"), dev->xbusd_path);
@@ -151,9 +149,10 @@ _dev_error(struct xenbus_device *dev, in
 	int ret __diagused;
 	unsigned int len;
 	char *printf_buffer = NULL, *path_buffer = NULL;
+	size_t path_buffer_sz = 0;
 
 #define PRINTF_BUFFER_SIZE 4096
-	printf_buffer = malloc(PRINTF_BUFFER_SIZE, M_DEVBUF, M_NOWAIT);
+	printf_buffer = kmem_alloc(PRINTF_BUFFER_SIZE, KM_NOSLEEP);
 	if (printf_buffer == NULL)
 		goto fail;
 
@@ -163,8 +162,7 @@ _dev_error(struct xenbus_device *dev, in
 	KASSERT(len + ret < PRINTF_BUFFER_SIZE);
 	dev->xbusd_has_error = 1;
 
-	path_buffer = error_path(dev);
-
+	path_buffer = error_path(dev, _buffer_sz);
 	if (path_buffer == NULL) {
 		printk("xenbus: failed to write error node for %s (%s)\n",
 		   dev->xbusd_path, printf_buffer);
@@ -179,9 +177,9 @@ _dev_error(struct xenbus_device *dev, in
 
 fail:
 	if (printf_buffer)
-		free(printf_buffer, M_DEVBUF);
+		kmem_free(printf_buffer, PRINTF_BUFFER_SIZE);
 	if (path_buffer)
-		free(path_buffer, M_DEVBUF);
+		kmem_free(path_buffer, path_buffer_sz);
 }
 
 



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

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 15:16:52 UTC 2020

Modified Files:
src/sys/arch/xen/xenbus: xenbus_client.c

Log Message:
convert from malloc() to kmem_alloc()


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

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



CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 14:07:01 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xen: xbdback_xenbus.c
src/sys/arch/xen/xenbus: xenbus_client.c xenbus_probe.c

Log Message:
convert the node watch code to use kmem_alloc() instead of malloc()


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/xen/xenbus/xenbus_client.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/xen/xenbus/xenbus_probe.c

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



CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 14:07:01 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xen: xbdback_xenbus.c
src/sys/arch/xen/xenbus: xenbus_client.c xenbus_probe.c

Log Message:
convert the node watch code to use kmem_alloc() instead of malloc()


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/xen/xenbus/xenbus_client.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/xen/xenbus/xenbus_probe.c

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

Modified files:

Index: src/sys/arch/xen/include/xenbus.h
diff -u src/sys/arch/xen/include/xenbus.h:1.18 src/sys/arch/xen/include/xenbus.h:1.19
--- src/sys/arch/xen/include/xenbus.h:1.18	Tue Apr  7 13:38:50 2020
+++ src/sys/arch/xen/include/xenbus.h	Tue Apr  7 14:07:01 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus.h,v 1.18 2020/04/07 13:38:50 jdolecek Exp $ */
+/* $NetBSD: xenbus.h,v 1.19 2020/04/07 14:07:01 jdolecek Exp $ */
 /**
  * xenbus.h
  *
@@ -58,6 +58,7 @@ struct xenbus_watch {
 
 	/* Path being watched. */
 	char *node;
+	size_t node_sz;
 
 	/* Callback (executed in a process context with no locks held). */
 	void (*xbw_callback)(struct xenbus_watch *,
@@ -180,6 +181,8 @@ int xenbus_watch_path2(struct xenbus_dev
 		   void (*callback)(struct xenbus_watch *,
 	const char **, unsigned int));
 
+/* Unregister the watch, and free associated internal structures. */
+void xenbus_unwatch_path(struct xenbus_watch *);
 
 /**
  * Advertise in the store a change of the given driver to the given new_state.

Index: src/sys/arch/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.76 src/sys/arch/xen/xen/xbdback_xenbus.c:1.77
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.76	Tue Apr  7 13:36:22 2020
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Tue Apr  7 14:07:01 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbdback_xenbus.c,v 1.76 2020/04/07 13:36:22 jdolecek Exp $  */
+/*  $NetBSD: xbdback_xenbus.c,v 1.77 2020/04/07 14:07:01 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.76 2020/04/07 13:36:22 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.77 2020/04/07 14:07:01 jdolecek Exp $");
 
 #include 
 #include 
@@ -487,11 +487,9 @@ xbdback_xenbus_destroy(void *arg)
 	xbdback_disconnect(xbdi);
 
 	/* unregister watch */
-	if (xbdi->xbdi_watch.node) {
-		unregister_xenbus_watch(>xbdi_watch);
-		free(xbdi->xbdi_watch.node, M_DEVBUF);
-		xbdi->xbdi_watch.node = NULL;
-	}
+	if (xbdi->xbdi_watch.node)
+		xenbus_unwatch_path(>xbdi_watch);
+
 	/* unmap ring */
 	if (xbdi->xbdi_ring_va != 0) {
 		ungrop.host_addr = xbdi->xbdi_ring_va;

Index: src/sys/arch/xen/xenbus/xenbus_client.c
diff -u src/sys/arch/xen/xenbus/xenbus_client.c:1.15 src/sys/arch/xen/xenbus/xenbus_client.c:1.16
--- src/sys/arch/xen/xenbus/xenbus_client.c:1.15	Tue Apr  7 13:38:50 2020
+++ src/sys/arch/xen/xenbus/xenbus_client.c	Tue Apr  7 14:07:01 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_client.c,v 1.15 2020/04/07 13:38:50 jdolecek Exp $ */
+/* $NetBSD: xenbus_client.c,v 1.16 2020/04/07 14:07:01 jdolecek Exp $ */
 /**
  * Client-facing interface for the Xenbus driver.  In other words, the
  * interface between the Xenbus and the device-specific code, be it the
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenbus_client.c,v 1.15 2020/04/07 13:38:50 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_client.c,v 1.16 2020/04/07 14:07:01 jdolecek Exp $");
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: xenbus_clien
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -50,30 +51,6 @@ __KERNEL_RCSID(0, "$NetBSD: xenbus_clien
 #include 
 #include 
 
-
-static int
-xenbus_watch_path(struct xenbus_device *dev, char *path,
-		  struct xenbus_watch *watch, 
-		  void (*callback)(struct xenbus_watch *,
-   const char **, unsigned int))
-{
-	int err;
-
-	watch->node = path;
-	watch->xbw_callback = callback;
-
-	err = register_xenbus_watch(watch);
-
-	if (err) {
-		watch->node = NULL;
-		watch->xbw_callback = NULL;
-		xenbus_dev_fatal(dev, err, "adding watch on %s", path);
-	}
-	err = 0;
-
-	return err;
-}
-
 int
 xenbus_watch_path2(struct xenbus_device *dev, const char *path,
 		   const char *path2, struct xenbus_watch *watch, 
@@ -84,21 +61,37 @@ xenbus_watch_path2(struct xenbus_device 
 	char *state;
 
 	DPRINTK("xenbus_watch_path2 path %s path2 %s\n", path, path2);
-	state =
-		malloc(strlen(path) + 1 + strlen(path2) + 1, M_DEVBUF,
-		

CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 13:38:50 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xenbus: xenbus_client.c

Log Message:
make xenbus_watch_path() static, it's not used outside xenbus_client.c


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/xen/xenbus/xenbus_client.c

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

Modified files:

Index: src/sys/arch/xen/include/xenbus.h
diff -u src/sys/arch/xen/include/xenbus.h:1.17 src/sys/arch/xen/include/xenbus.h:1.18
--- src/sys/arch/xen/include/xenbus.h:1.17	Tue Apr  7 13:36:22 2020
+++ src/sys/arch/xen/include/xenbus.h	Tue Apr  7 13:38:50 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus.h,v 1.17 2020/04/07 13:36:22 jdolecek Exp $ */
+/* $NetBSD: xenbus.h,v 1.18 2020/04/07 13:38:50 jdolecek Exp $ */
 /**
  * xenbus.h
  *
@@ -167,20 +167,6 @@ int xenbus_free_device(struct xenbus_dev
 
 
 /**
- * Register a watch on the given path, using the given xenbus_watch structure
- * for storage, and the given callback function as the callback.  Return 0 on
- * success, or -errno on error.  On success, the given path will be saved as
- * watch->node, and remains the caller's to free.  On error, watch->node will
- * be NULL, the device will switch to XenbusStateClosing, and the error will
- * be saved in the store.
- */
-int xenbus_watch_path(struct xenbus_device *dev, char *path,
-		  struct xenbus_watch *watch, 
-		  void (*callback)(struct xenbus_watch *,
-   const char **, unsigned int));
-
-
-/**
  * Register a watch on the given path/path2, using the given xenbus_watch
  * structure for storage, and the given callback function as the callback.
  * Return 0 on success, or -errno on error.  On success, the watched path

Index: src/sys/arch/xen/xenbus/xenbus_client.c
diff -u src/sys/arch/xen/xenbus/xenbus_client.c:1.14 src/sys/arch/xen/xenbus/xenbus_client.c:1.15
--- src/sys/arch/xen/xenbus/xenbus_client.c:1.14	Sun Nov 10 21:16:34 2019
+++ src/sys/arch/xen/xenbus/xenbus_client.c	Tue Apr  7 13:38:50 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_client.c,v 1.14 2019/11/10 21:16:34 chs Exp $ */
+/* $NetBSD: xenbus_client.c,v 1.15 2020/04/07 13:38:50 jdolecek Exp $ */
 /**
  * Client-facing interface for the Xenbus driver.  In other words, the
  * interface between the Xenbus and the device-specific code, be it the
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenbus_client.c,v 1.14 2019/11/10 21:16:34 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_client.c,v 1.15 2020/04/07 13:38:50 jdolecek Exp $");
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -51,7 +51,7 @@ __KERNEL_RCSID(0, "$NetBSD: xenbus_clien
 #include 
 
 
-int
+static int
 xenbus_watch_path(struct xenbus_device *dev, char *path,
 		  struct xenbus_watch *watch, 
 		  void (*callback)(struct xenbus_watch *,



CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 13:38:50 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xenbus: xenbus_client.c

Log Message:
make xenbus_watch_path() static, it's not used outside xenbus_client.c


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/xen/xenbus/xenbus_client.c

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



CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 13:36:23 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xen: xbdback_xenbus.c
src/sys/arch/xen/xenbus: xenbus_probe.c

Log Message:
revert the watch.node change, xenbus_watch_path() and xenbus_watch_path2()
need to use non-constant path


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/xen/xenbus/xenbus_probe.c

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

Modified files:

Index: src/sys/arch/xen/include/xenbus.h
diff -u src/sys/arch/xen/include/xenbus.h:1.16 src/sys/arch/xen/include/xenbus.h:1.17
--- src/sys/arch/xen/include/xenbus.h:1.16	Tue Apr  7 11:47:05 2020
+++ src/sys/arch/xen/include/xenbus.h	Tue Apr  7 13:36:22 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus.h,v 1.16 2020/04/07 11:47:05 jdolecek Exp $ */
+/* $NetBSD: xenbus.h,v 1.17 2020/04/07 13:36:22 jdolecek Exp $ */
 /**
  * xenbus.h
  *
@@ -57,7 +57,7 @@ struct xenbus_watch {
 	SLIST_ENTRY(xenbus_watch) watch_next;
 
 	/* Path being watched. */
-	const char *node;
+	char *node;
 
 	/* Callback (executed in a process context with no locks held). */
 	void (*xbw_callback)(struct xenbus_watch *,

Index: src/sys/arch/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.75 src/sys/arch/xen/xen/xbdback_xenbus.c:1.76
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.75	Tue Apr  7 11:47:06 2020
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Tue Apr  7 13:36:22 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbdback_xenbus.c,v 1.75 2020/04/07 11:47:06 jdolecek Exp $  */
+/*  $NetBSD: xbdback_xenbus.c,v 1.76 2020/04/07 13:36:22 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.75 2020/04/07 11:47:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.76 2020/04/07 13:36:22 jdolecek Exp $");
 
 #include 
 #include 
@@ -489,6 +489,7 @@ xbdback_xenbus_destroy(void *arg)
 	/* unregister watch */
 	if (xbdi->xbdi_watch.node) {
 		unregister_xenbus_watch(>xbdi_watch);
+		free(xbdi->xbdi_watch.node, M_DEVBUF);
 		xbdi->xbdi_watch.node = NULL;
 	}
 	/* unmap ring */

Index: src/sys/arch/xen/xenbus/xenbus_probe.c
diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.42 src/sys/arch/xen/xenbus/xenbus_probe.c:1.43
--- src/sys/arch/xen/xenbus/xenbus_probe.c:1.42	Tue Apr  7 11:47:06 2020
+++ src/sys/arch/xen/xenbus/xenbus_probe.c	Tue Apr  7 13:36:22 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_probe.c,v 1.42 2020/04/07 11:47:06 jdolecek Exp $ */
+/* $NetBSD: xenbus_probe.c,v 1.43 2020/04/07 13:36:22 jdolecek Exp $ */
 /**
  * Talks to Xen Store to figure out what devices we have.
  *
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.42 2020/04/07 11:47:06 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.43 2020/04/07 13:36:22 jdolecek Exp $");
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -234,6 +234,7 @@ free_otherend_watch(struct xenbus_device
 {
 	if (dev->xbusd_otherend_watch.node) {
 		unregister_xenbus_watch(>xbusd_otherend_watch);
+		free(dev->xbusd_otherend_watch.node, M_DEVBUF);
 		dev->xbusd_otherend_watch.node = NULL;
 	}
 }
@@ -614,10 +615,12 @@ xenbus_probe(void *unused)
 	xenbus_probe_backends();
 
 	/* Watch for changes. */
-	fe_watch.node = "device";
+	fe_watch.node = malloc(strlen("device") + 1, M_DEVBUF, M_NOWAIT);
+	strcpy(fe_watch.node, "device");
 	fe_watch.xbw_callback = frontend_changed;
 	register_xenbus_watch(_watch);
-	be_watch.node = "backend";
+	be_watch.node = malloc(strlen("backend") + 1, M_DEVBUF, M_NOWAIT);
+	strcpy(be_watch.node, "backend");
 	be_watch.xbw_callback = backend_changed;
 	register_xenbus_watch(_watch);
 



CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 13:36:23 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xen: xbdback_xenbus.c
src/sys/arch/xen/xenbus: xenbus_probe.c

Log Message:
revert the watch.node change, xenbus_watch_path() and xenbus_watch_path2()
need to use non-constant path


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.75 -r1.76 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/xen/xenbus/xenbus_probe.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/ata

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 13:22:05 UTC 2020

Modified Files:
src/sys/dev/ata: wd.c

Log Message:
drop wd lock in wdstart1() before calling the ata_bio hook; when called
from ata thread context, that can still need to sleep for wdc attachments
in wdcwait()


To generate a diff of this commit:
cvs rdiff -u -r1.459 -r1.460 src/sys/dev/ata/wd.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/ata/wd.c
diff -u src/sys/dev/ata/wd.c:1.459 src/sys/dev/ata/wd.c:1.460
--- src/sys/dev/ata/wd.c:1.459	Mon Mar  2 16:01:56 2020
+++ src/sys/dev/ata/wd.c	Tue Apr  7 13:22:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: wd.c,v 1.459 2020/03/02 16:01:56 riastradh Exp $ */
+/*	$NetBSD: wd.c,v 1.460 2020/04/07 13:22:05 jdolecek Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.459 2020/03/02 16:01:56 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.460 2020/04/07 13:22:05 jdolecek Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -666,6 +666,7 @@ wdstart1(struct wd_softc *wd, struct buf
 
 	KASSERT(bp == xfer->c_bio.bp || xfer->c_bio.bp == NULL);
 	KASSERT((xfer->c_flags & (C_WAITACT|C_FREE)) == 0);
+	KASSERT(mutex_owned(>sc_lock));
 
 	/* Reset state, so that retries don't use stale info */
 	if (__predict_false(xfer->c_retries > 0)) {
@@ -757,6 +758,8 @@ wdstart1(struct wd_softc *wd, struct buf
 
 	if (xfer->c_retries == 0)
 		wd->inflight++;
+	mutex_exit(>sc_lock);
+
 	switch (wd->atabus->ata_bio(wd->drvp, xfer)) {
 	case ATACMD_TRY_AGAIN:
 		panic("wdstart1: try again");
@@ -767,6 +770,8 @@ wdstart1(struct wd_softc *wd, struct buf
 	default:
 		panic("wdstart1: bad return code from ata_bio()");
 	}
+
+	mutex_enter(>sc_lock);
 }
 
 static int



CVS commit: src/sys/dev/ata

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 13:22:05 UTC 2020

Modified Files:
src/sys/dev/ata: wd.c

Log Message:
drop wd lock in wdstart1() before calling the ata_bio hook; when called
from ata thread context, that can still need to sleep for wdc attachments
in wdcwait()


To generate a diff of this commit:
cvs rdiff -u -r1.459 -r1.460 src/sys/dev/ata/wd.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/pci

2020-04-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  7 12:42:11 UTC 2020

Modified Files:
src/sys/arch/x86/pci: rdcpcib.c

Log Message:
Recognize more rdc devices (Andrius V.)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/pci/rdcpcib.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/pci/rdcpcib.c
diff -u src/sys/arch/x86/pci/rdcpcib.c:1.2 src/sys/arch/x86/pci/rdcpcib.c:1.3
--- src/sys/arch/x86/pci/rdcpcib.c:1.2	Fri Jul  1 14:22:08 2011
+++ src/sys/arch/x86/pci/rdcpcib.c	Tue Apr  7 08:42:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rdcpcib.c,v 1.2 2011/07/01 18:22:08 dyoung Exp $	*/
+/*	$NetBSD: rdcpcib.c,v 1.3 2020/04/07 12:42:11 christos Exp $	*/
 
 /*
  * Copyright (c) 2011 Manuel Bouyer.
@@ -31,7 +31,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rdcpcib.c,v 1.2 2011/07/01 18:22:08 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rdcpcib.c,v 1.3 2020/04/07 12:42:11 christos Exp $");
 
 #include 
 #include 
@@ -88,6 +88,17 @@ CFATTACH_DECL2_NEW(rdcpcib, sizeof(struc
 rdcpcibmatch, rdcpcibattach, rdcpcibdetach, NULL,
 pcibrescan, pcibchilddet);
 
+
+static const struct rdcpcib_device {
+	pcireg_t vendor, product;
+} rdcpcib_devices[] = {
+	{ PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6011_PCIB},
+	{ PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6013_PCIB},
+	{ PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6031_PCIB},
+	{ PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6035_PCIB},
+	{ PCI_VENDOR_RDC, PCI_PRODUCT_RDC_R6036_PCIB},
+};
+
 static int
 rdcpcibmatch(device_t parent, cfdata_t match, void *aux)
 {
@@ -97,9 +108,11 @@ rdcpcibmatch(device_t parent, cfdata_t m
 	PCI_SUBCLASS(pa->pa_class) != PCI_SUBCLASS_BRIDGE_ISA)
 		return 0;
 
-	if (PCI_VENDOR(pa->pa_id) == PCI_VENDOR_RDC &&
-	PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_RDC_PCIB)
+	for (size_t i = 0; i < __arraycount(rdcpcib_devices); i++) {
+		if (PCI_VENDOR(pa->pa_id) == rdcpcib_devices[i].vendor &&
+		PCI_PRODUCT(pa->pa_id) == rdcpcib_devices[i].product)
 			return 10;
+	}
 
 	return 0;
 }



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

2020-04-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  7 12:42:11 UTC 2020

Modified Files:
src/sys/arch/x86/pci: rdcpcib.c

Log Message:
Recognize more rdc devices (Andrius V.)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/pci/rdcpcib.c

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



CVS commit: src/sys/dev/pci

2020-04-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  7 12:32:03 UTC 2020

Modified Files:
src/sys/dev/pci: pcidevs.h pcidevs_data.h

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1391 -r1.1392 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1390 -r1.1391 src/sys/dev/pci/pcidevs_data.h

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



CVS commit: src/sys/dev/pci

2020-04-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  7 12:31:13 UTC 2020

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add more RDC products (Andrius V)


To generate a diff of this commit:
cvs rdiff -u -r1.1403 -r1.1404 src/sys/dev/pci/pcidevs

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



CVS commit: src/sys/dev/pci

2020-04-07 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Apr  7 12:31:13 UTC 2020

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
Add more RDC products (Andrius V)


To generate a diff of this commit:
cvs rdiff -u -r1.1403 -r1.1404 src/sys/dev/pci/pcidevs

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1403 src/sys/dev/pci/pcidevs:1.1404
--- src/sys/dev/pci/pcidevs:1.1403	Wed Apr  1 11:53:35 2020
+++ src/sys/dev/pci/pcidevs	Tue Apr  7 08:31:13 2020
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1403 2020/04/01 15:53:35 msaitoh Exp $
+$NetBSD: pcidevs,v 1.1404 2020/04/07 12:31:13 christos Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -7067,13 +7067,28 @@ product RALINK	RT5390_5	0x539f	RT5390
 product RATOC	REXPCI31	0x0853	REX PCI-31/33 SCSI
 
 /* RDC Semiconductor products */
-product RDC	R1010_IDE	0x1010	R1010 IDE controller
-product RDC	R1011_IDE	0x1011	R1011 IDE controller
-product RDC	R1012_IDE	0x1012	R1012 IDE controller
+product RDC	R1010_IDE	0x1010	R1010 IDE Controller
+product RDC	R1011_IDE	0x1011	R1011 IDE Controller
+product RDC	R1012_IDE	0x1012	R1012 IDE Controller
+product RDC	R1031_PPB	0x1031	R1031 PCI-PCIE Bridge
+product RDC	R1060_USBD	0x1060	R1060 USB Device
+product RDC	R1061_USBD	0x1061	R1061 USB Device
+product RDC	R1070_CAN	0x1070	R1070 CANbus
+product RDC	R1331_MC	0x1331	R1331 Motion Control
+product RDC	R1710_SPI	0x1710	R1710 SPI
+product RDC	R1930_HBRD	0x1930	R1930 Hybrid Function Control Register
+product RDC	R2010_VGA	0x2010	R2010 VGA Controller
+product RDC	R2012_VGA	0x2012	R2012 VGA Controller
+product RDC	R2015_VGA	0x2015	R2015 VGA Controller
+product RDC	R6011_PCIB	0x6011	R6011 PCI-ISA bridge
+product RDC	R6013_PCIB	0x6013	R6013 PCI-ISA bridge
 product RDC	R6021_HB	0x6021	R6021 Host
+product RDC	R6023_HB	0x6023	R6023 Host
 product RDC	R6025_HB	0x6025	R6025 Host
-product RDC	R6031_ISA	0x6031	R6031 PCI-ISA bridge
-product RDC	PCIB		0x6036	R6036 PCI-ISA bridge
+product RDC	R6026_HB	0x6026i	R6026 Host
+product RDC	R6031_PCIB	0x6031	R6031 PCI-ISA bridge
+product RDC	R6035_PCIB	0x6035	R6035 PCI-ISA bridge
+product RDC	R6036_PCIB	0x6036	R6036 PCI-ISA bridge
 product RDC	R6040		0x6040	R6040 10/100 Ethernet
 product RDC	R6060_OHCI	0x6060	R6060 USB OHCI
 product RDC	R6061_EHCI	0x6061	R6061 USB EHCI



CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 11:47:06 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xen: if_xennet_xenbus.c pciback.c shutdown_xenbus.c
xbd_xenbus.c xbdback_xenbus.c xennetback_xenbus.c xpci_xenbus.c
src/sys/arch/xen/xenbus: xenbus_probe.c xenbus_xs.c

Log Message:
change xenbus_read() interface so that caller supplies the buffer and it's
size, caller doesn't free(9) the returned value any more


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/xen/xen/if_xennet_xenbus.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/xen/pciback.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/xen/xen/shutdown_xenbus.c
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/xen/xen/xbd_xenbus.c
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/xen/xen/xennetback_xenbus.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/xen/xen/xpci_xenbus.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/xen/xenbus/xenbus_probe.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/xen/xenbus/xenbus_xs.c

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

Modified files:

Index: src/sys/arch/xen/include/xenbus.h
diff -u src/sys/arch/xen/include/xenbus.h:1.15 src/sys/arch/xen/include/xenbus.h:1.16
--- src/sys/arch/xen/include/xenbus.h:1.15	Tue Apr  7 09:18:00 2020
+++ src/sys/arch/xen/include/xenbus.h	Tue Apr  7 11:47:05 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus.h,v 1.15 2020/04/07 09:18:00 jdolecek Exp $ */
+/* $NetBSD: xenbus.h,v 1.16 2020/04/07 11:47:05 jdolecek Exp $ */
 /**
  * xenbus.h
  *
@@ -78,7 +78,7 @@ typedef enum {
 
 struct xenbus_device {
 	SLIST_ENTRY(xenbus_device) xbusd_entries;
-	char *xbusd_otherend; /* the otherend path */
+	char xbusd_otherend[64]; /* the otherend path (size arbitrary) */
 	int xbusd_otherend_id; /* the otherend's id */
 	/* callback for otherend change */
 	void (*xbusd_otherend_changed)(void *, XenbusState);
@@ -118,9 +118,8 @@ struct xenbus_transaction;
 int xenbus_directory(struct xenbus_transaction *t,
 			const char *dir, const char *node, unsigned int *num,
 			char ***);
-int xenbus_read(struct xenbus_transaction *t,
-		  const char *dir, const char *node, unsigned int *len,
-		  char **);
+int xenbus_read(struct xenbus_transaction *,
+		  const char *, const char *, char *, size_t);
 int xenbus_read_ul(struct xenbus_transaction *,
 		  const char *, const char *, unsigned long *, int);
 int xenbus_read_ull(struct xenbus_transaction *,
@@ -135,20 +134,11 @@ int xenbus_rm(struct xenbus_transaction 
 struct xenbus_transaction *xenbus_transaction_start(void);
 int xenbus_transaction_end(struct xenbus_transaction *t, int abort);
 
-/* Single read and scanf: returns -errno or num scanned if > 0. */
-int xenbus_scanf(struct xenbus_transaction *t,
-		 const char *dir, const char *node, const char *fmt, ...)
-	__attribute__((format(scanf, 4, 5)));
-
 /* Single printf and write: returns -errno or 0. */
 int xenbus_printf(struct xenbus_transaction *t,
 		  const char *dir, const char *node, const char *fmt, ...)
 	__attribute__((format(printf, 4, 5)));
 
-/* Generic read function: NULL-terminated triples of name,
- * sprintf-style type string, and pointer. Returns 0 or errno.*/
-int xenbus_gather(struct xenbus_transaction *t, const char *dir, ...);
-
 /* notifer routines for when the xenstore comes up */
 // XXX int register_xenstore_notifier(struct notifier_block *nb);
 // XXX void unregister_xenstore_notifier(struct notifier_block *nb);

Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.108 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.109
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.108	Mon Apr  6 19:58:09 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Tue Apr  7 11:47:06 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.108 2020/04/06 19:58:09 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.109 2020/04/07 11:47:06 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.108 2020/04/06 19:58:09 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.109 2020/04/07 11:47:06 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -268,9 +268,10 @@ xennet_xenbus_attach(device_t parent, de
 	netif_tx_sring_t *tx_ring;
 	netif_rx_sring_t *rx_ring;
 	RING_IDX i;
-	char *val, *e, *p;
+	char *e, *p;
 	unsigned long uval;
 	extern int ifqmaxlen; /* XXX */
+	char mac[32];
 #ifdef XENNET_DEBUG
 	char **dir;
 	int dir_n = 0;
@@ -280,28 +281,6 @@ xennet_xenbus_attach(device_t parent, de
 	aprint_normal(": Xen Virtual Network Interface\n");
 	sc->sc_dev = self;
 
-#ifdef XENNET_DEBUG
-	

CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 11:47:06 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xen: if_xennet_xenbus.c pciback.c shutdown_xenbus.c
xbd_xenbus.c xbdback_xenbus.c xennetback_xenbus.c xpci_xenbus.c
src/sys/arch/xen/xenbus: xenbus_probe.c xenbus_xs.c

Log Message:
change xenbus_read() interface so that caller supplies the buffer and it's
size, caller doesn't free(9) the returned value any more


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/xen/xen/if_xennet_xenbus.c
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/xen/pciback.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/xen/xen/shutdown_xenbus.c
cvs rdiff -u -r1.96 -r1.97 src/sys/arch/xen/xen/xbd_xenbus.c
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/xen/xen/xennetback_xenbus.c
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/xen/xen/xpci_xenbus.c
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/xen/xenbus/xenbus_probe.c
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/xen/xenbus/xenbus_xs.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/ews4800mips/conf

2020-04-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr  7 11:12:25 UTC 2020

Modified Files:
src/sys/arch/ews4800mips/conf: RAMDISK

Log Message:
Disable userconf in the RAMDISK kernel to shrink it a bit


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/ews4800mips/conf/RAMDISK

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



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

2020-04-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr  7 11:12:25 UTC 2020

Modified Files:
src/sys/arch/ews4800mips/conf: RAMDISK

Log Message:
Disable userconf in the RAMDISK kernel to shrink it a bit


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/ews4800mips/conf/RAMDISK

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/ews4800mips/conf/RAMDISK
diff -u src/sys/arch/ews4800mips/conf/RAMDISK:1.25 src/sys/arch/ews4800mips/conf/RAMDISK:1.26
--- src/sys/arch/ews4800mips/conf/RAMDISK:1.25	Sun Jan 19 01:25:05 2020
+++ src/sys/arch/ews4800mips/conf/RAMDISK	Tue Apr  7 11:12:25 2020
@@ -1,4 +1,4 @@
-# 	$NetBSD: RAMDISK,v 1.25 2020/01/19 01:25:05 thorpej Exp $
+# 	$NetBSD: RAMDISK,v 1.26 2020/04/07 11:12:25 martin Exp $
 #
 # kernel config file with memory disk for installation
 #
@@ -27,6 +27,7 @@ no options	DDB
 no options 	INCLUDE_CONFIG_FILE
 no options 	NTP
 no options 	KTRACE
+no options 	USERCONF
 no options 	SYSVMSG
 no options 	SYSVSEM
 no options 	SYSVSHM



CVS commit: src/distrib/ews4800mips/floppies/ramdisk

2020-04-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr  7 10:22:00 UTC 2020

Modified Files:
src/distrib/ews4800mips/floppies/ramdisk: list

Log Message:
Ooops, editor mishap in previous


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/distrib/ews4800mips/floppies/ramdisk/list

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



CVS commit: src/distrib/ews4800mips/floppies/ramdisk

2020-04-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Apr  7 10:22:00 UTC 2020

Modified Files:
src/distrib/ews4800mips/floppies/ramdisk: list

Log Message:
Ooops, editor mishap in previous


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/distrib/ews4800mips/floppies/ramdisk/list

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

Modified files:

Index: src/distrib/ews4800mips/floppies/ramdisk/list
diff -u src/distrib/ews4800mips/floppies/ramdisk/list:1.12 src/distrib/ews4800mips/floppies/ramdisk/list:1.13
--- src/distrib/ews4800mips/floppies/ramdisk/list:1.12	Sun Apr  5 11:19:01 2020
+++ src/distrib/ews4800mips/floppies/ramdisk/list	Tue Apr  7 10:22:00 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: list,v 1.12 2020/04/05 11:19:01 martin Exp $
+#	$NetBSD: list,v 1.13 2020/04/07 10:22:00 martin Exp $
 
 SRCDIRS	bin sbin usr.bin usr.sbin
 
@@ -67,7 +67,7 @@ SPECIAL	ping		srcdir	distrib/utils/x_pin
 SPECIAL	route		srcdir	distrib/utils/x_route
 SPECIAL	umount		srcdir	distrib/utils/x_umount
 
-LIBS	libhack.o -ledit -lutil-lrmt -ll -lm -lz -lprop
+LIBS	libhack.o -ledit -lutil -lrmt -ll -lm -lz -lprop
 
 COPY	${DESTDIR}/usr/mdec/bootxx_ustarfs	usr/mdec/bootxx_ustarfs
 COPY	${DESTDIR}/usr/mdec/bootxx_bfs		usr/mdec/bootxx_bfs



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

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 10:19:53 UTC 2020

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

Log Message:
switch from malloc() to kmem_zalloc()


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/xen/xen/xenevt.c

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



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

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 10:19:53 UTC 2020

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

Log Message:
switch from malloc() to kmem_zalloc()


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/xen/xen/xenevt.c

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

Modified files:

Index: src/sys/arch/xen/xen/xenevt.c
diff -u src/sys/arch/xen/xen/xenevt.c:1.55 src/sys/arch/xen/xen/xenevt.c:1.56
--- src/sys/arch/xen/xen/xenevt.c:1.55	Mon Apr  6 17:55:51 2020
+++ src/sys/arch/xen/xen/xenevt.c	Tue Apr  7 10:19:53 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xenevt.c,v 1.55 2020/04/06 17:55:51 jdolecek Exp $  */
+/*  $NetBSD: xenevt.c,v 1.56 2020/04/07 10:19:53 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -26,12 +26,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.55 2020/04/06 17:55:51 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.56 2020/04/07 10:19:53 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -307,7 +306,7 @@ xenevtopen(dev_t dev, int flags, int mod
 		if ((error = fd_allocfile(, )) != 0)
 			return error;
 
-		d = malloc(sizeof(*d), M_DEVBUF, M_WAITOK | M_ZERO);
+		d = kmem_zalloc(sizeof(*d), KM_SLEEP);
 		d->ci = _info_primary;
 		mutex_init(>lock, MUTEX_DEFAULT, IPL_HIGH);
 		cv_init(>cv, "xenevt");
@@ -392,7 +391,7 @@ xenevt_free(struct xenevt_d *d)
 	seldestroy(>sel);
 	cv_destroy(>cv);
 	mutex_destroy(>lock);
-	free(d, M_DEVBUF);
+	kmem_free(d, sizeof(*d));
 }
 
 static int



CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 09:18:00 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xen: xbdback_xenbus.c
src/sys/arch/xen/xenbus: xenbus_probe.c

Log Message:
no need to malloc()+copy watch.node, it's constant string - either "device"
or "backend"; just use the strings direct


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/xen/xenbus/xenbus_probe.c

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

Modified files:

Index: src/sys/arch/xen/include/xenbus.h
diff -u src/sys/arch/xen/include/xenbus.h:1.14 src/sys/arch/xen/include/xenbus.h:1.15
--- src/sys/arch/xen/include/xenbus.h:1.14	Sat Feb  2 12:32:55 2019
+++ src/sys/arch/xen/include/xenbus.h	Tue Apr  7 09:18:00 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus.h,v 1.14 2019/02/02 12:32:55 cherry Exp $ */
+/* $NetBSD: xenbus.h,v 1.15 2020/04/07 09:18:00 jdolecek Exp $ */
 /**
  * xenbus.h
  *
@@ -57,7 +57,7 @@ struct xenbus_watch {
 	SLIST_ENTRY(xenbus_watch) watch_next;
 
 	/* Path being watched. */
-	char *node;
+	const char *node;
 
 	/* Callback (executed in a process context with no locks held). */
 	void (*xbw_callback)(struct xenbus_watch *,

Index: src/sys/arch/xen/xen/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.73 src/sys/arch/xen/xen/xbdback_xenbus.c:1.74
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.73	Fri Jan 17 19:30:51 2020
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Tue Apr  7 09:18:00 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbdback_xenbus.c,v 1.73 2020/01/17 19:30:51 ad Exp $  */
+/*  $NetBSD: xbdback_xenbus.c,v 1.74 2020/04/07 09:18:00 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.73 2020/01/17 19:30:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.74 2020/04/07 09:18:00 jdolecek Exp $");
 
 #include 
 #include 
@@ -490,7 +490,6 @@ xbdback_xenbus_destroy(void *arg)
 	/* unregister watch */
 	if (xbdi->xbdi_watch.node) {
 		unregister_xenbus_watch(>xbdi_watch);
-		free(xbdi->xbdi_watch.node, M_DEVBUF);
 		xbdi->xbdi_watch.node = NULL;
 	}
 	/* unmap ring */

Index: src/sys/arch/xen/xenbus/xenbus_probe.c
diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.40 src/sys/arch/xen/xenbus/xenbus_probe.c:1.41
--- src/sys/arch/xen/xenbus/xenbus_probe.c:1.40	Tue Feb 26 15:55:33 2019
+++ src/sys/arch/xen/xenbus/xenbus_probe.c	Tue Apr  7 09:18:00 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_probe.c,v 1.40 2019/02/26 15:55:33 joerg Exp $ */
+/* $NetBSD: xenbus_probe.c,v 1.41 2020/04/07 09:18:00 jdolecek Exp $ */
 /**
  * Talks to Xen Store to figure out what devices we have.
  *
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.40 2019/02/26 15:55:33 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.41 2020/04/07 09:18:00 jdolecek Exp $");
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -242,7 +242,6 @@ free_otherend_watch(struct xenbus_device
 {
 	if (dev->xbusd_otherend_watch.node) {
 		unregister_xenbus_watch(>xbusd_otherend_watch);
-		free(dev->xbusd_otherend_watch.node, M_DEVBUF);
 		dev->xbusd_otherend_watch.node = NULL;
 	}
 }
@@ -623,12 +622,10 @@ xenbus_probe(void *unused)
 	xenbus_probe_backends();
 
 	/* Watch for changes. */
-	fe_watch.node = malloc(strlen("device") + 1, M_DEVBUF, M_NOWAIT);
-	strcpy(fe_watch.node, "device");
+	fe_watch.node = "device";
 	fe_watch.xbw_callback = frontend_changed;
 	register_xenbus_watch(_watch);
-	be_watch.node = malloc(strlen("backend") + 1, M_DEVBUF, M_NOWAIT);
-	strcpy(be_watch.node, "backend");
+	be_watch.node = "backend";
 	be_watch.xbw_callback = backend_changed;
 	register_xenbus_watch(_watch);
 



CVS commit: src/sys/arch/xen

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 09:18:00 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenbus.h
src/sys/arch/xen/xen: xbdback_xenbus.c
src/sys/arch/xen/xenbus: xenbus_probe.c

Log Message:
no need to malloc()+copy watch.node, it's constant string - either "device"
or "backend"; just use the strings direct


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/xen/include/xenbus.h
cvs rdiff -u -r1.73 -r1.74 src/sys/arch/xen/xen/xbdback_xenbus.c
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/xen/xenbus/xenbus_probe.c

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



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

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 09:05:14 UTC 2020

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

Log Message:
convert from malloc() to kmem_alloc()


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/xen/xen/xengnt.c

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



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

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 09:05:14 UTC 2020

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

Log Message:
convert from malloc() to kmem_alloc()


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/xen/xen/xengnt.c

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

Modified files:

Index: src/sys/arch/xen/xen/xengnt.c
diff -u src/sys/arch/xen/xen/xengnt.c:1.28 src/sys/arch/xen/xen/xengnt.c:1.29
--- src/sys/arch/xen/xen/xengnt.c:1.28	Sun Apr  5 17:48:30 2020
+++ src/sys/arch/xen/xen/xengnt.c	Tue Apr  7 09:05:14 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xengnt.c,v 1.28 2020/04/05 17:48:30 jdolecek Exp $  */
+/*  $NetBSD: xengnt.c,v 1.29 2020/04/07 09:05:14 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,12 +26,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.28 2020/04/05 17:48:30 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xengnt.c,v 1.29 2020/04/07 09:05:14 jdolecek Exp $");
 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -97,8 +97,8 @@ xengnt_init(void)
 	gnt_max_grant_frames * PAGE_SIZE, 0, UVM_KMF_VAONLY);
 	if (grant_table == NULL)
 		panic("xengnt_init() no VM space");
-	gnt_entries = malloc((nr_grant_entries + 1) * sizeof(grant_ref_t),
-	M_DEVBUF, M_WAITOK);
+	gnt_entries = kmem_alloc((nr_grant_entries + 1) * sizeof(grant_ref_t),
+	KM_SLEEP);
 	for (i = 0; i <= nr_grant_entries; i++)
 		gnt_entries[i] = XENGNT_NO_ENTRY;
 
@@ -163,12 +163,14 @@ xengnt_more_entries(void)
 	u_long *pages;
 	int nframes_new = gnt_nr_grant_frames + 1;
 	int i, start_gnt;
+	size_t sz;
 	KASSERT(mutex_owned(_lock));
 
 	if (gnt_nr_grant_frames == gnt_max_grant_frames)
 		return ENOMEM;
 
-	pages = malloc(nframes_new * sizeof(u_long), M_DEVBUF, M_NOWAIT);
+	sz = nframes_new * sizeof(u_long);
+	pages = kmem_alloc(sz, KM_NOSLEEP);
 	if (pages == NULL)
 		return ENOMEM;
 
@@ -207,7 +209,7 @@ xengnt_more_entries(void)
 		if (setup.status != GNTST_okay) {
 			aprint_error("%s: setup table returned %d\n",
 			__func__, setup.status);
-			free(pages, M_DEVBUF);
+			kmem_free(pages, sz);
 			return ENOMEM;
 		}
 	}
@@ -242,7 +244,7 @@ xengnt_more_entries(void)
 		last_gnt_entry++;
 	}
 	gnt_nr_grant_frames = nframes_new;
-	free(pages, M_DEVBUF);
+	kmem_free(pages, sz);
 	return 0;
 }
 



CVS commit: src/sys/miscfs/kernfs

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 08:35:49 UTC 2020

Modified Files:
src/sys/miscfs/kernfs: kernfs_vfsops.c

Log Message:
switch to kmem_zalloc() instead of malloc() for struct kernfs_mount


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/miscfs/kernfs/kernfs_vfsops.c

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



CVS commit: src/sys/miscfs/kernfs

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 08:35:49 UTC 2020

Modified Files:
src/sys/miscfs/kernfs: kernfs_vfsops.c

Log Message:
switch to kmem_zalloc() instead of malloc() for struct kernfs_mount


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/miscfs/kernfs/kernfs_vfsops.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/kernfs/kernfs_vfsops.c
diff -u src/sys/miscfs/kernfs/kernfs_vfsops.c:1.99 src/sys/miscfs/kernfs/kernfs_vfsops.c:1.100
--- src/sys/miscfs/kernfs/kernfs_vfsops.c:1.99	Mon Mar 16 21:20:11 2020
+++ src/sys/miscfs/kernfs/kernfs_vfsops.c	Tue Apr  7 08:35:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kernfs_vfsops.c,v 1.99 2020/03/16 21:20:11 pgoyette Exp $	*/
+/*	$NetBSD: kernfs_vfsops.c,v 1.100 2020/04/07 08:35:49 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993, 1995
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kernfs_vfsops.c,v 1.99 2020/03/16 21:20:11 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_vfsops.c,v 1.100 2020/04/07 08:35:49 jdolecek Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -54,7 +54,6 @@ __KERNEL_RCSID(0, "$NetBSD: kernfs_vfsop
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -65,8 +64,6 @@ __KERNEL_RCSID(0, "$NetBSD: kernfs_vfsop
 
 MODULE(MODULE_CLASS_VFS, kernfs, NULL);
 
-MALLOC_JUSTDEFINE(M_KERNFSMNT, "kernfs mount", "kernfs mount structures");
-
 dev_t rrootdev = NODEV;
 kmutex_t kfs_lock;
 
@@ -78,7 +75,6 @@ void
 kernfs_init(void)
 {
 
-	malloc_type_attach(M_KERNFSMNT);
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
 }
 
@@ -93,7 +89,6 @@ kernfs_done(void)
 {
 
 	mutex_destroy(_lock);
-	malloc_type_detach(M_KERNFSMNT);
 }
 
 void
@@ -141,7 +136,7 @@ kernfs_mount(struct mount *mp, const cha
 	if (mp->mnt_flag & MNT_UPDATE)
 		return (EOPNOTSUPP);
 
-	fmp = malloc(sizeof(struct kernfs_mount), M_KERNFSMNT, M_WAITOK|M_ZERO);
+	fmp = kmem_zalloc(sizeof(struct kernfs_mount), KM_SLEEP);
 	TAILQ_INIT(>nodelist);
 
 	mp->mnt_stat.f_namemax = KERNFS_MAXNAMLEN;
@@ -151,7 +146,7 @@ kernfs_mount(struct mount *mp, const cha
 
 	if ((error = set_statvfs_info(path, UIO_USERSPACE, "kernfs",
 	UIO_SYSSPACE, mp->mnt_op->vfs_name, mp, l)) != 0) {
-		free(fmp, M_KERNFSMNT);
+		kmem_free(fmp, sizeof(struct kernfs_mount));
 		return error;
 	}
 
@@ -181,7 +176,7 @@ kernfs_unmount(struct mount *mp, int mnt
 	/*
 	 * Finally, throw away the kernfs_mount structure
 	 */
-	free(mp->mnt_data, M_KERNFSMNT);
+	kmem_free(mp->mnt_data, sizeof(struct kernfs_mount));
 	mp->mnt_data = NULL;
 	return (0);
 }



CVS commit: src/sys

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 08:14:43 UTC 2020

Modified Files:
src/sys/arch/xen/xen: hypervisor.c pciback.c privcmd.c
src/sys/arch/xen/xenbus: xenbus_dev.c
src/sys/miscfs/kernfs: kernfs.h

Log Message:
switch KERNFS_ALLOCENTRY() to use kmem_zalloc() instead of malloc()


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/xen/xen/pciback.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/xen/xen/privcmd.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/xen/xenbus/xenbus_dev.c
cvs rdiff -u -r1.43 -r1.44 src/sys/miscfs/kernfs/kernfs.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/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.72 src/sys/arch/xen/xen/hypervisor.c:1.73
--- src/sys/arch/xen/xen/hypervisor.c:1.72	Thu Feb 14 08:18:26 2019
+++ src/sys/arch/xen/xen/hypervisor.c	Tue Apr  7 08:14:42 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.72 2019/02/14 08:18:26 cherry Exp $ */
+/* $NetBSD: hypervisor.c,v 1.73 2020/04/07 08:14:42 jdolecek Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -53,12 +53,11 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.72 2019/02/14 08:18:26 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.73 2020/04/07 08:14:42 jdolecek Exp $");
 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #include "xenbus.h"
@@ -416,7 +415,7 @@ hypervisor_match(device_t parent, cfdata
 	bi.common.len = sizeof(struct btinfo_rootdevice);
 
 	/* From i386/multiboot.c */
-	/*	$NetBSD: hypervisor.c,v 1.72 2019/02/14 08:18:26 cherry Exp $	*/
+	/*	$NetBSD: hypervisor.c,v 1.73 2020/04/07 08:14:42 jdolecek Exp $	*/
 	int i, len;
 	vaddr_t data;
 	extern struct bootinfo	bootinfo;
@@ -671,7 +670,7 @@ xenkernfs_init(void)
 {
 	kernfs_entry_t *dkt;
 
-	KERNFS_ALLOCENTRY(dkt, M_TEMP, M_WAITOK);
+	KERNFS_ALLOCENTRY(dkt, KM_SLEEP);
 	KERNFS_INITENTRY(dkt, DT_DIR, "xen", NULL, KFSsubdir, VDIR, DIR_MODE);
 	kernfs_addentry(NULL, dkt);
 	kernxen_pkt = KERNFS_ENTOPARENTDIR(dkt);

Index: src/sys/arch/xen/xen/pciback.c
diff -u src/sys/arch/xen/xen/pciback.c:1.19 src/sys/arch/xen/xen/pciback.c:1.20
--- src/sys/arch/xen/xen/pciback.c:1.19	Sat Feb  2 12:32:55 2019
+++ src/sys/arch/xen/xen/pciback.c	Tue Apr  7 08:14:42 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: pciback.c,v 1.19 2019/02/02 12:32:55 cherry Exp $  */
+/*  $NetBSD: pciback.c,v 1.20 2020/04/07 08:14:42 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2009 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.19 2019/02/02 12:32:55 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.20 2020/04/07 08:14:42 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -290,7 +290,7 @@ pciback_pci_attach(device_t parent, devi
 	snprintf(sc->sc_kernfsname, sizeof(sc->sc_kernfsname),
 	":%02x:%02x.%x", pa->pa_bus, pa->pa_device, pa->pa_function);
 	kfst = KERNFS_ALLOCTYPE(pciback_dev_fileops);
-	KERNFS_ALLOCENTRY(dkt, M_TEMP, M_WAITOK);
+	KERNFS_ALLOCENTRY(dkt, KM_SLEEP);
 	KERNFS_INITENTRY(dkt, DT_REG, sc->sc_kernfsname, sc,
 	kfst, VREG, FILE_MODE);
 	kernfs_addentry(pciback_kern_pkt, dkt);
@@ -405,7 +405,7 @@ pciback_pci_init(void)
 
 	xenbus_backend_register(_backend_driver);
 
-	KERNFS_ALLOCENTRY(dkt, M_TEMP, M_WAITOK);
+	KERNFS_ALLOCENTRY(dkt, KM_SLEEP);
 	KERNFS_INITENTRY(dkt, DT_DIR, "pci", NULL, KFSsubdir, VDIR, DIR_MODE);
 	kernfs_addentry(kernxen_pkt, dkt);
 	pciback_kern_pkt = KERNFS_ENTOPARENTDIR(dkt);

Index: src/sys/arch/xen/xen/privcmd.c
diff -u src/sys/arch/xen/xen/privcmd.c:1.53 src/sys/arch/xen/xen/privcmd.c:1.54
--- src/sys/arch/xen/xen/privcmd.c:1.53	Sun Feb 23 15:46:39 2020
+++ src/sys/arch/xen/xen/privcmd.c	Tue Apr  7 08:14:42 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: privcmd.c,v 1.53 2020/02/23 15:46:39 ad Exp $ */
+/* $NetBSD: privcmd.c,v 1.54 2020/04/07 08:14:42 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2004 Christian Limpach.
@@ -27,12 +27,11 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.53 2020/02/23 15:46:39 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.54 2020/04/07 08:14:42 jdolecek Exp $");
 
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -572,7 +571,7 @@ xenprivcmd_init(void)
 
 	kfst = KERNFS_ALLOCTYPE(privcmd_fileops);
 
-	KERNFS_ALLOCENTRY(dkt, M_TEMP, M_WAITOK);
+	KERNFS_ALLOCENTRY(dkt, KM_SLEEP);
 	KERNFS_INITENTRY(dkt, DT_REG, "privcmd", NULL, kfst, VREG,
 	PRIVCMD_MODE);
 	kernfs_addentry(kernxen_pkt, dkt);

Index: src/sys/arch/xen/xenbus/xenbus_dev.c
diff -u src/sys/arch/xen/xenbus/xenbus_dev.c:1.14 src/sys/arch/xen/xenbus/xenbus_dev.c:1.15
--- src/sys/arch/xen/xenbus/xenbus_dev.c:1.14	Mon Mar 27 18:39:55 2017
+++ src/sys/arch/xen/xenbus/xenbus_dev.c	Tue Apr  7 08:14:43 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_dev.c,v 1.14 2017/03/27 

CVS commit: src/sys

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 08:14:43 UTC 2020

Modified Files:
src/sys/arch/xen/xen: hypervisor.c pciback.c privcmd.c
src/sys/arch/xen/xenbus: xenbus_dev.c
src/sys/miscfs/kernfs: kernfs.h

Log Message:
switch KERNFS_ALLOCENTRY() to use kmem_zalloc() instead of malloc()


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/xen/xen/pciback.c
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/xen/xen/privcmd.c
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/xen/xenbus/xenbus_dev.c
cvs rdiff -u -r1.43 -r1.44 src/sys/miscfs/kernfs/kernfs.h

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



CVS commit: src

2020-04-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr  7 08:07:58 UTC 2020

Modified Files:
src/common/lib/libc/string: strcat.c strchr.c strrchr.c
src/sys/lib/libkern: libkern.h

Log Message:
Fix KASAN build on aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/string/strcat.c
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/string/strchr.c \
src/common/lib/libc/string/strrchr.c
cvs rdiff -u -r1.138 -r1.139 src/sys/lib/libkern/libkern.h

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



CVS commit: src

2020-04-07 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Apr  7 08:07:58 UTC 2020

Modified Files:
src/common/lib/libc/string: strcat.c strchr.c strrchr.c
src/sys/lib/libkern: libkern.h

Log Message:
Fix KASAN build on aarch64


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/string/strcat.c
cvs rdiff -u -r1.6 -r1.7 src/common/lib/libc/string/strchr.c \
src/common/lib/libc/string/strrchr.c
cvs rdiff -u -r1.138 -r1.139 src/sys/lib/libkern/libkern.h

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

Modified files:

Index: src/common/lib/libc/string/strcat.c
diff -u src/common/lib/libc/string/strcat.c:1.3 src/common/lib/libc/string/strcat.c:1.4
--- src/common/lib/libc/string/strcat.c:1.3	Sun Feb  4 20:22:17 2018
+++ src/common/lib/libc/string/strcat.c	Tue Apr  7 08:07:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: strcat.c,v 1.3 2018/02/04 20:22:17 mrg Exp $	*/
+/*	$NetBSD: strcat.c,v 1.4 2020/04/07 08:07:58 skrll Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)strcat.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: strcat.c,v 1.3 2018/02/04 20:22:17 mrg Exp $");
+__RCSID("$NetBSD: strcat.c,v 1.4 2020/04/07 08:07:58 skrll Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -45,7 +45,7 @@ __RCSID("$NetBSD: strcat.c,v 1.3 2018/02
 #include 
 #endif
 
-#ifdef _FORTIFY_SOURCE
+#if defined(_FORTIFY_SOURCE) || defined(KASAN)
 #undef strcat
 #endif
 

Index: src/common/lib/libc/string/strchr.c
diff -u src/common/lib/libc/string/strchr.c:1.6 src/common/lib/libc/string/strchr.c:1.7
--- src/common/lib/libc/string/strchr.c:1.6	Sun Feb  4 20:22:17 2018
+++ src/common/lib/libc/string/strchr.c	Tue Apr  7 08:07:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: strchr.c,v 1.6 2018/02/04 20:22:17 mrg Exp $	*/
+/*	$NetBSD: strchr.c,v 1.7 2020/04/07 08:07:58 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)index.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: strchr.c,v 1.6 2018/02/04 20:22:17 mrg Exp $");
+__RCSID("$NetBSD: strchr.c,v 1.7 2020/04/07 08:07:58 skrll Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -46,6 +46,10 @@ __RCSID("$NetBSD: strchr.c,v 1.6 2018/02
 #include 
 #endif
 
+#if defined(KASAN)
+#undef strchr
+#endif
+
 __strong_alias(index, strchr)
 char *
 strchr(const char *p, int ch)
Index: src/common/lib/libc/string/strrchr.c
diff -u src/common/lib/libc/string/strrchr.c:1.6 src/common/lib/libc/string/strrchr.c:1.7
--- src/common/lib/libc/string/strrchr.c:1.6	Sun Feb  4 20:22:17 2018
+++ src/common/lib/libc/string/strrchr.c	Tue Apr  7 08:07:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: strrchr.c,v 1.6 2018/02/04 20:22:17 mrg Exp $	*/
+/*	$NetBSD: strrchr.c,v 1.7 2020/04/07 08:07:58 skrll Exp $	*/
 
 /*
  * Copyright (c) 1988, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)rindex.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: strrchr.c,v 1.6 2018/02/04 20:22:17 mrg Exp $");
+__RCSID("$NetBSD: strrchr.c,v 1.7 2020/04/07 08:07:58 skrll Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -45,6 +45,10 @@ __RCSID("$NetBSD: strrchr.c,v 1.6 2018/0
 #include 
 #endif
 
+#if defined(KASAN)
+#undef strrchr
+#endif
+
 __strong_alias(rindex, strrchr)
 char *
 strrchr(const char *p, int ch)

Index: src/sys/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.138 src/sys/lib/libkern/libkern.h:1.139
--- src/sys/lib/libkern/libkern.h:1.138	Fri Apr  3 18:44:50 2020
+++ src/sys/lib/libkern/libkern.h	Tue Apr  7 08:07:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.138 2020/04/03 18:44:50 maxv Exp $	*/
+/*	$NetBSD: libkern.h,v 1.139 2020/04/07 08:07:58 skrll Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -429,6 +429,9 @@ size_t	 kmsan_strlen(const char *);
 #define	alloca(s)		__builtin_alloca(s)
 #endif
 
+char	*strcat(char *, const char *);
+char	*strchr(const char *, int);
+char	*strrchr(const char *, int);
 /* These exist in GCC 3.x, but we don't bother. */
 #if defined(_KERNEL) && defined(KASAN)
 char	*kasan_strcat(char *, const char *);



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

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 07:43:33 UTC 2020

Modified Files:
src/sys/arch/xen/x86: pintr.c

Log Message:
remove  include, not used here


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/xen/x86/pintr.c

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

Modified files:

Index: src/sys/arch/xen/x86/pintr.c
diff -u src/sys/arch/xen/x86/pintr.c:1.10 src/sys/arch/xen/x86/pintr.c:1.11
--- src/sys/arch/xen/x86/pintr.c:1.10	Wed Feb 13 06:15:51 2019
+++ src/sys/arch/xen/x86/pintr.c	Tue Apr  7 07:43:33 2020
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.10 2019/02/13 06:15:51 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.11 2020/04/07 07:43:33 jdolecek Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -115,7 +115,6 @@ __KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 



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

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 07:43:33 UTC 2020

Modified Files:
src/sys/arch/xen/x86: pintr.c

Log Message:
remove  include, not used here


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/xen/x86/pintr.c

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



CVS commit: src/sys/dev/ic

2020-04-07 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue Apr  7 07:25:42 UTC 2020

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

Log Message:
avoid "panic: LOCKDEBUG: Mutex error: rw_vector_enter,309: spin lock held"

ok nonaka@. thanks


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/ic/nvme.c

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

Modified files:

Index: src/sys/dev/ic/nvme.c
diff -u src/sys/dev/ic/nvme.c:1.47 src/sys/dev/ic/nvme.c:1.48
--- src/sys/dev/ic/nvme.c:1.47	Mon Nov 11 07:27:48 2019
+++ src/sys/dev/ic/nvme.c	Tue Apr  7 07:25:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvme.c,v 1.47 2019/11/11 07:27:48 nonaka Exp $	*/
+/*	$NetBSD: nvme.c,v 1.48 2020/04/07 07:25:41 ryo Exp $	*/
 /*	$OpenBSD: nvme.c,v 1.49 2016/04/18 05:59:50 dlg Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.47 2019/11/11 07:27:48 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvme.c,v 1.48 2020/04/07 07:25:41 ryo Exp $");
 
 #include 
 #include 
@@ -1721,7 +1721,13 @@ nvme_ccbs_free(struct nvme_queue *q)
 	mutex_enter(>q_ccb_mtx);
 	while ((ccb = SIMPLEQ_FIRST(>q_ccb_list)) != NULL) {
 		SIMPLEQ_REMOVE_HEAD(>q_ccb_list, ccb_entry);
+		/* 
+		 * bus_dmamap_destroy() may call vm_map_lock() and rw_enter()
+		 * internally. don't hold spin mutex
+		 */
+		mutex_exit(>q_ccb_mtx);
 		bus_dmamap_destroy(sc->sc_dmat, ccb->ccb_dmamap);
+		mutex_enter(>q_ccb_mtx);
 	}
 	mutex_exit(>q_ccb_mtx);
 



CVS commit: src/sys/dev/ic

2020-04-07 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue Apr  7 07:25:42 UTC 2020

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

Log Message:
avoid "panic: LOCKDEBUG: Mutex error: rw_vector_enter,309: spin lock held"

ok nonaka@. thanks


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/ic/nvme.c

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



CVS commit: src/share/man/man9

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 07:25:09 UTC 2020

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

Log Message:
bring the section on automatic acquisition of kernel_lock up-to-date


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/share/man/man9/spl.9

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

Modified files:

Index: src/share/man/man9/spl.9
diff -u src/share/man/man9/spl.9:1.41 src/share/man/man9/spl.9:1.42
--- src/share/man/man9/spl.9:1.41	Thu Apr  6 03:00:13 2017
+++ src/share/man/man9/spl.9	Tue Apr  7 07:25:09 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: spl.9,v 1.41 2017/04/06 03:00:13 pgoyette Exp $
+.\"	$NetBSD: spl.9,v 1.42 2020/04/07 07:25:09 jdolecek Exp $
 .\"
 .\" Copyright (c) 2000, 2001 Jason R. Thorpe.  All rights reserved.
 .\" Copyright (c) 1997 Michael Long.
@@ -27,7 +27,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 6, 2017
+.Dd April 7, 2020
 .Dt SPL 9
 .Os
 .Sh NAME
@@ -169,14 +169,17 @@ or endorsed
 .Xr pool_cache 9
 interfaces to allocate memory.
 .Pp
-At the time of writing, the global
+The global
 .Dv kernel_lock
-is automatically acquired for interrupts at this level, in order to
+is automatically acquired for interrupts at this level by default,
+in order to
 support device drivers that do not provide their own multiprocessor
 synchronization.
-A future release of the system may allow the automatic acquisition of
+The automatic acquisition of
 .Dv kernel_lock
-to be disabled for individual interrupt handlers.
+can be disabled for individual interrupt handlers by device drivers
+if supported by subsystem, see e.g.
+.Xr pci_intr_establish 9 .
 .Pp
 .Fn splbio ,
 .Fn splnet ,



CVS commit: src/share/man/man9

2020-04-07 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue Apr  7 07:25:09 UTC 2020

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

Log Message:
bring the section on automatic acquisition of kernel_lock up-to-date


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/share/man/man9/spl.9

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



Re: CVS commit: src/sys

2020-04-07 Thread Martin Husemann
On Tue, Apr 07, 2020 at 02:50:25PM +0900, Tetsuya Isaki wrote:
> In this case, yds(4) is attached at 5msec automatically.
> When attaching, audio layer calculates the blocksize from
> AUDI_BLK_MS etc and query it to MD driver (this is round_blocksize
> in audio(9)).  If the requested size is too small (or too large)
> for the MD driver, it will return alternative blocksize.  If audio
> layer can accept it, then use it.
> Is this right?

Yes, that sounds good.

Martin