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

2020-04-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Apr  6 20:26:17 UTC 2020

Modified Files:
src/sys/arch/riscv/riscv: trap.c

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/riscv/trap.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/riscv/riscv/trap.c
diff -u src/sys/arch/riscv/riscv/trap.c:1.5 src/sys/arch/riscv/riscv/trap.c:1.6
--- src/sys/arch/riscv/riscv/trap.c:1.5	Sat Mar 14 16:12:16 2020
+++ src/sys/arch/riscv/riscv/trap.c	Mon Apr  6 20:26:16 2020
@@ -32,7 +32,7 @@
 #define __PMAP_PRIVATE
 #define __UFETCHSTORE_PRIVATE
 
-__RCSID("$NetBSD: trap.c,v 1.5 2020/03/14 16:12:16 skrll Exp $");
+__RCSID("$NetBSD: trap.c,v 1.6 2020/04/06 20:26:16 skrll Exp $");
 
 #include 
 #include 
@@ -293,7 +293,7 @@ trap_pagefault_fixup(struct trapframe *t
 	pmap_tlb_update_addr(pmap, addr, npte, 0);
 
 	if (attr & VM_PAGEMD_EXECPAGE)
-		 pmap_md_page_syncicache(pg, curcpu()->ci_data.cpu_kcpuset);
+		pmap_md_page_syncicache(pg, curcpu()->ci_data.cpu_kcpuset);
 
 	return true;
 }



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

2020-04-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr  6 19:58:09 UTC 2020

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

Log Message:
adjust previous - set the Tx flag only when the feature supported, instead
of first setting it and then masking it when unsupported


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/arch/xen/xen/if_xennet_xenbus.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/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.107 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.108
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.107	Mon Apr  6 19:52:38 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Mon Apr  6 19:58:09 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.107 2020/04/06 19:52:38 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.108 2020/04/06 19:58:09 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.107 2020/04/06 19:52:38 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.108 2020/04/06 19:58:09 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -379,20 +379,20 @@ xennet_xenbus_attach(device_t parent, de
 		IFCAP_CSUM_IPv4_Rx | IFCAP_CSUM_IPv4_Tx
 		| IFCAP_CSUM_UDPv4_Rx | IFCAP_CSUM_UDPv4_Tx
 		| IFCAP_CSUM_TCPv4_Rx | IFCAP_CSUM_TCPv4_Tx
-		| IFCAP_CSUM_UDPv6_Rx | IFCAP_CSUM_UDPv6_Tx
-		| IFCAP_CSUM_TCPv6_Rx | IFCAP_CSUM_TCPv6_Tx;
+		| IFCAP_CSUM_UDPv6_Rx
+		| IFCAP_CSUM_TCPv6_Rx;
 #define XN_M_CSUM_SUPPORTED (	\
 		M_CSUM_TCPv4 | M_CSUM_UDPv4 | M_CSUM_IPv4	\
 		| M_CSUM_TCPv6 | M_CSUM_UDPv6			\
 	)
-	if (!sc->sc_ipv6_csum) {
+	if (sc->sc_ipv6_csum) {
 		/*
-		 * If backend doesn't support IPv6 csum offloading, we must
-		 * provide valid IPv6 csum for Tx packets, but can still
-		 * skip validation for Rx packets.
+		 * If backend supports IPv6 csum offloading, we can skip
+		 * IPv6 csum for Tx packets. Rx packet validation can
+		 * be skipped regardless.
 		 */
-		ifp->if_capabilities &=
-		~(IFCAP_CSUM_UDPv6_Tx | IFCAP_CSUM_TCPv6_Tx);
+		ifp->if_capabilities |=
+		IFCAP_CSUM_UDPv6_Tx | IFCAP_CSUM_TCPv6_Tx;
 	}
 
 	IFQ_SET_READY(>if_snd);



CVS commit: src/usr.bin/man

2020-04-06 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Apr  6 19:53:22 UTC 2020

Modified Files:
src/usr.bin/man: man.c

Log Message:
Exit successfully after printing the search path, stop further processing.

Continuing to process had the unintended effect that `man` failed to find
a matching manual page for {EMPTY LIST OF REQUESTED MANUAL PAGES}, and
exited with 1.

Prompted by a fish shell snippet that tried and failed to distinguish between
FreeBSD man (-p takes argument) and NetBSD man (-p no argument) by comparing
`man -p` exit code.

ok riastradh, logix (which also pointed out the manual page SYNOPSIS is
saying man -p should be used this way).


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

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

Modified files:

Index: src/usr.bin/man/man.c
diff -u src/usr.bin/man/man.c:1.67 src/usr.bin/man/man.c:1.68
--- src/usr.bin/man/man.c:1.67	Fri Jun 15 20:16:35 2018
+++ src/usr.bin/man/man.c	Mon Apr  6 19:53:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: man.c,v 1.67 2018/06/15 20:16:35 mrg Exp $	*/
+/*	$NetBSD: man.c,v 1.68 2020/04/06 19:53:22 maya Exp $	*/
 
 /*
  * Copyright (c) 1987, 1993, 1994, 1995
@@ -40,7 +40,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 19
 #if 0
 static char sccsid[] = "@(#)man.c	8.17 (Berkeley) 1/31/95";
 #else
-__RCSID("$NetBSD: man.c,v 1.67 2018/06/15 20:16:35 mrg Exp $");
+__RCSID("$NetBSD: man.c,v 1.68 2020/04/06 19:53:22 maya Exp $");
 #endif
 #endif /* not lint */
 
@@ -363,8 +363,10 @@ main(int argc, char **argv)
 
 	}
 
-	if (m.getpath) 
+	if (m.getpath) {
 		printmanpath();
+		exit(cleanup());
+	}
 		
 	/*
 	 * now m.mymanpath is complete!



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

2020-04-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr  6 19:52:38 UTC 2020

Modified Files:
src/sys/arch/xen/xen: if_xennet_xenbus.c xennetback_xenbus.c

Log Message:
pass and use feature-ipv6-csum-offload for ipv6 csum support, matches
Linux Dom0/DomU


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/xen/xen/if_xennet_xenbus.c
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/xen/xen/xennetback_xenbus.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/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.106 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.107
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.106	Mon Apr  6 18:23:21 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Mon Apr  6 19:52:38 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.106 2020/04/06 18:23:21 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.107 2020/04/06 19:52:38 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.106 2020/04/06 18:23:21 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.107 2020/04/06 19:52:38 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -207,6 +207,7 @@ struct xennet_xenbus_softc {
 #define BEST_DISCONNECTED	1
 #define BEST_CONNECTED		2
 #define BEST_SUSPENDED		3
+	bool sc_ipv6_csum;	/* whether backend support IPv6 csum offload */
 	krndsource_t sc_rnd_source;
 };
 #define SC_NLIVEREQ(sc) ((sc)->sc_rx_ring.req_prod_pvt - \
@@ -268,6 +269,7 @@ xennet_xenbus_attach(device_t parent, de
 	netif_rx_sring_t *rx_ring;
 	RING_IDX i;
 	char *val, *e, *p;
+	unsigned long uval;
 	extern int ifqmaxlen; /* XXX */
 #ifdef XENNET_DEBUG
 	char **dir;
@@ -338,7 +340,7 @@ xennet_xenbus_attach(device_t parent, de
 	}
 
 	/* read mac address */
-	err = xenbus_read(NULL, xa->xa_xbusd->xbusd_path, "mac", NULL, );
+	err = xenbus_read(NULL, sc->sc_xbusd->xbusd_path, "mac", NULL, );
 	if (err) {
 		aprint_error_dev(self, "can't read mac address, err %d\n", err);
 		return;
@@ -356,6 +358,12 @@ xennet_xenbus_attach(device_t parent, de
 	free(val, M_DEVBUF);
 	aprint_normal_dev(self, "MAC address %s\n",
 	ether_sprintf(sc->sc_enaddr));
+
+	/* read ipv6 csum support flag */
+	err = xenbus_read_ul(NULL, sc->sc_xbusd->xbusd_otherend,
+	"feature-ipv6-csum-offload", , 10);
+	sc->sc_ipv6_csum = (!err && uval == 1);
+
 	/* Initialize ifnet structure and attach interface */
 	strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
 	sc->sc_ethercom.ec_capabilities |= ETHERCAP_VLAN_MTU;
@@ -377,6 +385,15 @@ xennet_xenbus_attach(device_t parent, de
 		M_CSUM_TCPv4 | M_CSUM_UDPv4 | M_CSUM_IPv4	\
 		| M_CSUM_TCPv6 | M_CSUM_UDPv6			\
 	)
+	if (!sc->sc_ipv6_csum) {
+		/*
+		 * If backend doesn't support IPv6 csum offloading, we must
+		 * provide valid IPv6 csum for Tx packets, but can still
+		 * skip validation for Rx packets.
+		 */
+		ifp->if_capabilities &=
+		~(IFCAP_CSUM_UDPv6_Tx | IFCAP_CSUM_TCPv6_Tx);
+	}
 
 	IFQ_SET_READY(>if_snd);
 	if_attach(ifp);

Index: src/sys/arch/xen/xen/xennetback_xenbus.c
diff -u src/sys/arch/xen/xen/xennetback_xenbus.c:1.92 src/sys/arch/xen/xen/xennetback_xenbus.c:1.93
--- src/sys/arch/xen/xen/xennetback_xenbus.c:1.92	Sun Apr  5 17:26:46 2020
+++ src/sys/arch/xen/xen/xennetback_xenbus.c	Mon Apr  6 19:52:38 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xennetback_xenbus.c,v 1.92 2020/04/05 17:26:46 jdolecek Exp $  */
+/*  $NetBSD: xennetback_xenbus.c,v 1.93 2020/04/06 19:52:38 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.92 2020/04/05 17:26:46 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xennetback_xenbus.c,v 1.93 2020/04/06 19:52:38 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -289,6 +289,14 @@ xennetback_xenbus_create(struct xenbus_d
 			xbusd->xbusd_path, err);
 			goto abort_xbt;
 		}
+		err = xenbus_printf(xbt, xbusd->xbusd_path,
+		"feature-ipv6-csum-offload", "%d", 1);
+		if (err) {
+			aprint_error_ifnet(ifp,
+			"failed to write %s/feature-ipv6-csum-offload: %d\n",
+			xbusd->xbusd_path, err);
+			goto abort_xbt;
+		}
 	} while ((err = xenbus_transaction_end(xbt, 0)) == EAGAIN);
 	if (err) {
 		aprint_error_ifnet(ifp,



CVS commit: src/sys/arch

2020-04-06 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Mon Apr  6 19:28:21 UTC 2020

Modified Files:
src/sys/arch/amd64/conf: XEN3_PVHVM
src/sys/arch/i386/conf: XEN3PAE_PVHVM

Log Message:
use conf/filesystems.config, fix missing PTYFS


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amd64/conf/XEN3_PVHVM
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/i386/conf/XEN3PAE_PVHVM

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

Modified files:

Index: src/sys/arch/amd64/conf/XEN3_PVHVM
diff -u src/sys/arch/amd64/conf/XEN3_PVHVM:1.2 src/sys/arch/amd64/conf/XEN3_PVHVM:1.3
--- src/sys/arch/amd64/conf/XEN3_PVHVM:1.2	Wed Aug 21 12:16:07 2019
+++ src/sys/arch/amd64/conf/XEN3_PVHVM	Mon Apr  6 19:28:21 2020
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_PVHVM,v 1.2 2019/08/21 12:16:07 maxv Exp $
+# $NetBSD: XEN3_PVHVM,v 1.3 2020/04/06 19:28:21 bouyer Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -12,7 +12,7 @@ options 	INCLUDE_CONFIG_FILE	# embed con
 #options 	UVMHIST_PRINT
 #options 	SYSCALL_DEBUG
 
-#ident		"XEN3_PVHVM-$Revision: 1.2 $"
+#ident		"XEN3_PVHVM-$Revision: 1.3 $"
 
 maxusers	32		# estimated number of users
 options 	MAXPHYS=32768	#xbd doesn't handle 64k transfers
@@ -72,21 +72,7 @@ options 	DKWEDGE_METHOD_APPLE	# Support 
 #options 	DKWEDGE_METHOD_RDB	# Support RDB partitions as wedges
 
 # File systems
-file-system	FFS		# UFS
-file-system	EXT2FS		# second extended file system (linux)
-file-system	LFS		# log-structured file system
-file-system	MFS		# memory file system
-file-system	NFS		# Network File System client
-file-system	NTFS		# Windows/NT file system (experimental)
-file-system	CD9660		# ISO 9660 + Rock Ridge file system
-file-system	MSDOSFS		# MS-DOS file system
-file-system	FDESC		# /dev/fd
-file-system	KERNFS		# /kern
-file-system	NULLFS		# loopback file system
-file-system	OVERLAY		# overlay file system
-file-system	PROCFS		# /proc
-file-system	UMAPFS		# NULLFS + uid and gid remapping
-file-system	UNION		# union file system
+include "conf/filesystems.config"
 
 # File system options
 options 	QUOTA		# legacy UFS quotas

Index: src/sys/arch/i386/conf/XEN3PAE_PVHVM
diff -u src/sys/arch/i386/conf/XEN3PAE_PVHVM:1.2 src/sys/arch/i386/conf/XEN3PAE_PVHVM:1.3
--- src/sys/arch/i386/conf/XEN3PAE_PVHVM:1.2	Wed Aug 21 12:16:07 2019
+++ src/sys/arch/i386/conf/XEN3PAE_PVHVM	Mon Apr  6 19:28:21 2020
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3PAE_PVHVM,v 1.2 2019/08/21 12:16:07 maxv Exp $
+# $NetBSD: XEN3PAE_PVHVM,v 1.3 2020/04/06 19:28:21 bouyer Exp $
 
 include 	"arch/xen/conf/std.xen"
 
@@ -70,21 +70,7 @@ options 	DKWEDGE_METHOD_APPLE	# Support 
 #options 	DKWEDGE_METHOD_RDB	# Support RDB partitions as wedges
 
 # File systems
-file-system	FFS		# UFS
-file-system	EXT2FS		# second extended file system (linux)
-file-system	LFS		# log-structured file system
-file-system	MFS		# memory file system
-file-system	NFS		# Network File System client
-file-system	NTFS		# Windows/NT file system (experimental)
-file-system	CD9660		# ISO 9660 + Rock Ridge file system
-file-system	MSDOSFS		# MS-DOS file system
-file-system	FDESC		# /dev/fd
-file-system	KERNFS		# /kern
-file-system	NULLFS		# loopback file system
-file-system	OVERLAY		# overlay file system
-file-system	PROCFS		# /proc
-file-system	UMAPFS		# NULLFS + uid and gid remapping
-file-system	UNION		# union file system
+include "conf/filesystems.config"
 
 # File system options
 options 	QUOTA		# legacy UFS quotas



CVS commit: src/sys/arch/xen

2020-04-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr  6 19:26:00 UTC 2020

Modified Files:
src/sys/arch/xen/include: evtchn.h
src/sys/arch/xen/x86: xen_intr.c
src/sys/arch/xen/xen: evtchn.c

Log Message:
add known_mpsafe parameter also to pirq_establish(), and pass the parameter
to underlying event_set_handler()


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/xen/include/evtchn.h
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/xen/xen/evtchn.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/evtchn.h
diff -u src/sys/arch/xen/include/evtchn.h:1.27 src/sys/arch/xen/include/evtchn.h:1.28
--- src/sys/arch/xen/include/evtchn.h:1.27	Mon Apr  6 18:02:33 2020
+++ src/sys/arch/xen/include/evtchn.h	Mon Apr  6 19:26:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: evtchn.h,v 1.27 2020/04/06 18:02:33 jdolecek Exp $	*/
+/*	$NetBSD: evtchn.h,v 1.28 2020/04/06 19:26:00 jdolecek Exp $	*/
 
 /*
  *
@@ -70,7 +70,7 @@ struct pintrhand {
 };
 
 struct pintrhand *pirq_establish(int, int, int (*)(void *), void *, int,
- const char *, const char *);
+ const char *, const char *, bool);
 void pirq_disestablish(struct pintrhand *);
 
 #endif /*  _XEN_EVENTS_H_ */

Index: src/sys/arch/xen/x86/xen_intr.c
diff -u src/sys/arch/xen/x86/xen_intr.c:1.20 src/sys/arch/xen/x86/xen_intr.c:1.21
--- src/sys/arch/xen/x86/xen_intr.c:1.20	Mon Apr  6 18:02:33 2020
+++ src/sys/arch/xen/x86/xen_intr.c	Mon Apr  6 19:26:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_intr.c,v 1.20 2020/04/06 18:02:33 jdolecek Exp $	*/
+/*	$NetBSD: xen_intr.c,v 1.21 2020/04/06 19:26:00 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.20 2020/04/06 18:02:33 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.21 2020/04/06 19:26:00 jdolecek Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -231,7 +231,7 @@ xen_intr_establish_xname(int legacy_irq,
 	}
 
 	pih = pirq_establish(gsi, evtchn, handler, arg, level,
-			 intrstr, xname);
+			 intrstr, xname, known_mpsafe);
 	pih->pic_type = pic->pic_type;
 	return pih;
 #endif /* NPCI > 0 || NISA > 0 */

Index: src/sys/arch/xen/xen/evtchn.c
diff -u src/sys/arch/xen/xen/evtchn.c:1.87 src/sys/arch/xen/xen/evtchn.c:1.88
--- src/sys/arch/xen/xen/evtchn.c:1.87	Mon Apr  6 18:02:33 2020
+++ src/sys/arch/xen/xen/evtchn.c	Mon Apr  6 19:26:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: evtchn.c,v 1.87 2020/04/06 18:02:33 jdolecek Exp $	*/
+/*	$NetBSD: evtchn.c,v 1.88 2020/04/06 19:26:00 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -54,7 +54,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.87 2020/04/06 18:02:33 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88 2020/04/06 19:26:00 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "isa.h"
@@ -745,7 +745,7 @@ unbind_pirq_from_evtch(int pirq)
 
 struct pintrhand *
 pirq_establish(int pirq, int evtch, int (*func)(void *), void *arg, int level,
-const char *intrname, const char *xname)
+const char *intrname, const char *xname, bool known_mpsafe)
 {
 	struct pintrhand *ih;
 
@@ -764,7 +764,7 @@ pirq_establish(int pirq, int evtch, int 
 	ih->arg = arg;
 
 	if (event_set_handler(evtch, pirq_interrupt, ih, level, intrname,
-	xname) != 0) {
+	xname, known_mpsafe) != 0) {
 		kmem_free(ih, sizeof(struct pintrhand));
 		return NULL;
 	}



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

2020-04-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr  6 18:23:21 UTC 2020

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

Log Message:
convert to IFEF_MPSAFE, also enable interrupt handler without biglock

no performance difference observed compared to version before change,
for neither UP nor MP DomU


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/xen/xen/if_xennet_xenbus.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/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.105 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.106
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.105	Mon Apr  6 16:43:34 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Mon Apr  6 18:23:21 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.105 2020/04/06 16:43:34 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.106 2020/04/06 18:23:21 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.105 2020/04/06 16:43:34 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.106 2020/04/06 18:23:21 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -194,8 +194,8 @@ struct xennet_xenbus_softc {
 	grant_ref_t sc_tx_ring_gntref;
 	grant_ref_t sc_rx_ring_gntref;
 
-	kmutex_t sc_tx_lock; /* protects free TX list, TX ring, and ifp */
-	kmutex_t sc_rx_lock; /* protects free RX list, RX ring, and rxreql */
+	kmutex_t sc_tx_lock; /* protects free TX list, TX ring */
+	kmutex_t sc_rx_lock; /* protects free RX list, RX ring, rxreql */
 	struct xennet_txreq sc_txreqs[NET_TX_RING_SIZE];
 	struct xennet_rxreq sc_rxreqs[NET_RX_RING_SIZE];
 	SLIST_HEAD(,xennet_txreq) sc_txreq_head; /* list of free TX requests */
@@ -234,7 +234,6 @@ static int  xennet_init(struct ifnet *);
 static void xennet_stop(struct ifnet *, int);
 static void xennet_start(struct ifnet *);
 static int  xennet_ioctl(struct ifnet *, u_long, void *);
-static void xennet_watchdog(struct ifnet *);
 
 static bool xennet_xenbus_suspend(device_t dev, const pmf_qual_t *);
 static bool xennet_xenbus_resume (device_t dev, const pmf_qual_t *);
@@ -363,11 +362,10 @@ xennet_xenbus_attach(device_t parent, de
 	ifp->if_softc = sc;
 	ifp->if_start = xennet_start;
 	ifp->if_ioctl = xennet_ioctl;
-	ifp->if_watchdog = xennet_watchdog;
 	ifp->if_init = xennet_init;
 	ifp->if_stop = xennet_stop;
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
-	ifp->if_timer = 0;
+	ifp->if_extflags = IFEF_MPSAFE;
 	ifp->if_snd.ifq_maxlen = uimax(ifqmaxlen, NET_TX_RING_SIZE * 2);
 	ifp->if_capabilities =
 		IFCAP_CSUM_IPv4_Rx | IFCAP_CSUM_IPv4_Tx
@@ -535,8 +533,8 @@ xennet_xenbus_resume(device_t dev, const
 		goto abort_resume;
 	aprint_verbose_dev(dev, "using event channel %d\n",
 	sc->sc_evtchn);
-	sc->sc_ih = xen_intr_establish_xname(-1, _pic, sc->sc_evtchn, IST_LEVEL,
-	IPL_NET, _handler, sc, false, device_xname(dev));
+	sc->sc_ih = xen_intr_establish_xname(-1, _pic, sc->sc_evtchn,
+	IST_LEVEL, IPL_NET, _handler, sc, true, device_xname(dev));
 	KASSERT(sc->sc_ih != NULL);
 	return true;
 
@@ -849,7 +847,6 @@ again:
 	/* set new event and check for race with rsp_cons update */
 	sc->sc_tx_ring.sring->rsp_event =
 	resp_prod + ((sc->sc_tx_ring.sring->req_prod - resp_prod) >> 1) + 1;
-	ifp->if_timer = 0;
 	xen_wmb();
 	if (resp_prod != sc->sc_tx_ring.sring->rsp_prod)
 		goto again;
@@ -906,18 +903,6 @@ again:
 #ifdef XENNET_DEBUG_DUMP
 		xennet_hex_dump(pktp, rx->status, "r", rx->id);
 #endif
-		if ((ifp->if_flags & IFF_PROMISC) == 0) {
-			struct ether_header *eh = pktp;
-			if (ETHER_IS_MULTICAST(eh->ether_dhost) == 0 &&
-			memcmp(CLLADDR(ifp->if_sadl), eh->ether_dhost,
-			ETHER_ADDR_LEN) != 0) {
-DPRINTFN(XEDB_EVENT,
-("xennet_handler bad dest\n"));
-/* packet not for us */
-xennet_rx_free_req(sc, req);
-continue;
-			}
-		}
 		MGETHDR(m, M_DONTWAIT, MT_DATA);
 		if (__predict_false(m == NULL)) {
 			printf("%s: rx no mbuf\n", ifp->if_xname);
@@ -984,7 +969,7 @@ void
 xennet_start(struct ifnet *ifp)
 {
 	struct xennet_xenbus_softc *sc = ifp->if_softc;
-	struct mbuf *m, *new_m;
+	struct mbuf *m;
 	netif_tx_request_t *txreq;
 	RING_IDX req_prod;
 	paddr_t pa;
@@ -994,11 +979,6 @@ xennet_start(struct ifnet *ifp)
 
 	mutex_enter(>sc_tx_lock);
 
-	if ((ifp->if_flags & IFF_RUNNING) == 0) {
-		mutex_exit(>sc_tx_lock);
-		return;
-	}
-
 	rnd_add_uint32(>sc_rnd_source, sc->sc_tx_ring.req_prod_pvt);
 
 	xennet_tx_complete(sc);
@@ -1011,7 +991,7 @@ xennet_start(struct ifnet *ifp)
 		if (__predict_false(req == NULL)) {
 			break;
 		}
-		IFQ_POLL(>if_snd, m);
+		IFQ_DEQUEUE(>if_snd, m);
 		if (m == NULL)
 			break;
 
@@ -1043,11 +1023,13 @@ xennet_start(struct ifnet *ifp)
 
 		if (m->m_pkthdr.len != m->m_len ||
 		(pa ^ 

CVS commit: src/doc

2020-04-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr  6 18:15:57 UTC 2020

Modified Files:
src/doc: BRANCHES

Log Message:
Document the phil-wifi branch


To generate a diff of this commit:
cvs rdiff -u -r1.352 -r1.353 src/doc/BRANCHES

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

Modified files:

Index: src/doc/BRANCHES
diff -u src/doc/BRANCHES:1.352 src/doc/BRANCHES:1.353
--- src/doc/BRANCHES:1.352	Wed Jan  8 11:05:39 2020
+++ src/doc/BRANCHES	Mon Apr  6 18:15:57 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: BRANCHES,v 1.352 2020/01/08 11:05:39 ad Exp $
+#	$NetBSD: BRANCHES,v 1.353 2020/04/06 18:15:57 martin Exp $
 #
 # This file contains a list of branches that exist in the NetBSD CVS
 # tree and their current state.
@@ -666,6 +666,17 @@ Notes:		A more flexible infrastructure f
 		allowing multiple conflicting packages and versions to co-exist
 		within the same tree
 
+Branch:		phil-wifi
+Description:	Refresh WiFi code from FreeBSD
+Status:		Active
+Start Date:	2018-06-28
+End Date:	-
+Base Tag:	phil-wifi-base
+Maintainer:	phil, martin
+Scope:		src
+Notes:		Please check with martin before commiting,
+		but no formal commit restrictions.
+
 Branch:		rmind-smpnet
 Description:	MP safe network stack (milestone 1): IPv4, UDP and ICMP
 Status:		Active



CVS commit: src/sys/arch/xen

2020-04-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr  6 18:02:33 UTC 2020

Modified Files:
src/sys/arch/xen/include: evtchn.h
src/sys/arch/xen/x86: xen_intr.c
src/sys/arch/xen/xen: evtchn.c

Log Message:
remove restriction on interrupt level for MP-safe interrupt handlers


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/xen/include/evtchn.h
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.86 -r1.87 src/sys/arch/xen/xen/evtchn.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/evtchn.h
diff -u src/sys/arch/xen/include/evtchn.h:1.26 src/sys/arch/xen/include/evtchn.h:1.27
--- src/sys/arch/xen/include/evtchn.h:1.26	Sun Jun 24 13:35:32 2018
+++ src/sys/arch/xen/include/evtchn.h	Mon Apr  6 18:02:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: evtchn.h,v 1.26 2018/06/24 13:35:32 jdolecek Exp $	*/
+/*	$NetBSD: evtchn.h,v 1.27 2020/04/06 18:02:33 jdolecek Exp $	*/
 
 /*
  *
@@ -42,7 +42,7 @@ unsigned int evtchn_do_event(int, struct
 void call_evtchn_do_event(int, struct intrframe *);
 void call_xenevt_event(int);
 int event_set_handler(int, int (*func)(void *), void *, int, const char *,
-const char *);
+const char *, bool);
 int event_remove_handler(int, int (*func)(void *), void *);
 
 struct cpu_info;

Index: src/sys/arch/xen/x86/xen_intr.c
diff -u src/sys/arch/xen/x86/xen_intr.c:1.19 src/sys/arch/xen/x86/xen_intr.c:1.20
--- src/sys/arch/xen/x86/xen_intr.c:1.19	Fri Apr  3 22:20:36 2020
+++ src/sys/arch/xen/x86/xen_intr.c	Mon Apr  6 18:02:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen_intr.c,v 1.19 2020/04/03 22:20:36 ad Exp $	*/
+/*	$NetBSD: xen_intr.c,v 1.20 2020/04/06 18:02:33 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.19 2020/04/03 22:20:36 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_intr.c,v 1.20 2020/04/06 18:02:33 jdolecek Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -166,17 +166,11 @@ xen_intr_establish_xname(int legacy_irq,
 	if (pic->pic_type == PIC_XEN) {
 		struct intrhand *rih;
 
-		/*
-		 * event_set_handler interprets `level != IPL_VM' to
-		 * mean MP-safe, so we require the caller to match that
-		 * for the moment.
-		 */
-		KASSERT(known_mpsafe == (level != IPL_VM));
-
 		intrstr = intr_create_intrid(legacy_irq, pic, pin, intrstr_buf,
 		sizeof(intrstr_buf));
 
-		event_set_handler(pin, handler, arg, level, intrstr, xname);
+		event_set_handler(pin, handler, arg, level, intrstr, xname,
+		known_mpsafe);
 
 		rih = kmem_zalloc(sizeof(*rih), cold ? KM_NOSLEEP : KM_SLEEP);
 		if (rih == NULL) {

Index: src/sys/arch/xen/xen/evtchn.c
diff -u src/sys/arch/xen/xen/evtchn.c:1.86 src/sys/arch/xen/xen/evtchn.c:1.87
--- src/sys/arch/xen/xen/evtchn.c:1.86	Thu May  9 17:09:51 2019
+++ src/sys/arch/xen/xen/evtchn.c	Mon Apr  6 18:02:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: evtchn.c,v 1.86 2019/05/09 17:09:51 bouyer Exp $	*/
+/*	$NetBSD: evtchn.c,v 1.87 2020/04/06 18:02:33 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -54,7 +54,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.86 2019/05/09 17:09:51 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.87 2020/04/06 18:02:33 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "isa.h"
@@ -834,15 +834,12 @@ intr_calculatemasks(struct evtsource *ev
 
 int
 event_set_handler(int evtch, int (*func)(void *), void *arg, int level,
-const char *intrname, const char *xname)
+const char *intrname, const char *xname, bool mpsafe)
 {
 	struct cpu_info *ci = curcpu(); /* XXX: pass in ci ? */
 	struct evtsource *evts;
 	struct intrhand *ih, **ihp;
 	int s;
-#ifdef MULTIPROCESSOR
-	bool mpsafe = (level != IPL_VM);
-#endif /* MULTIPROCESSOR */
 
 #ifdef IRQ_DEBUG
 	printf("event_set_handler IRQ %d handler %p\n", evtch, func);



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

2020-04-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr  6 17:55:51 UTC 2020

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

Log Message:
just pass true as known_mpsafe for interrupt establish, drop the
(level != IPL_VM); NFCI, this uses IPL_HIGH so was mpsafe already


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 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.54 src/sys/arch/xen/xen/xenevt.c:1.55
--- src/sys/arch/xen/xen/xenevt.c:1.54	Fri Nov 22 14:30:58 2019
+++ src/sys/arch/xen/xen/xenevt.c	Mon Apr  6 17:55:51 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xenevt.c,v 1.54 2019/11/22 14:30:58 martin Exp $  */
+/*  $NetBSD: xenevt.c,v 1.55 2020/04/06 17:55:51 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.54 2019/11/22 14:30:58 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.55 2020/04/06 17:55:51 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include 
@@ -163,7 +163,6 @@ xenevtattach(int n)
 {
 	struct intrhand *ih __diagused;
 	int level = IPL_HIGH;
-	bool mpsafe = (level != IPL_VM);
 
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_HIGH);
 	STAILQ_INIT(_pending);
@@ -184,7 +183,7 @@ xenevtattach(int n)
 
 	/* The real objective here is to wiggle into the ih callchain for IPL level */
 	ih = xen_intr_establish_xname(-1, _pic, evtchn,  IST_LEVEL, level,
-	xenevt_processevt, NULL, mpsafe, "xenevt");
+	xenevt_processevt, NULL, true, "xenevt");
 
 	KASSERT(ih != NULL);
 }



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

2020-04-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr  6 16:43:34 UTC 2020

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

Log Message:
make a pass on locking, replacing spl*() calls with mutexes:
- sc_tx_lock covers any access to tx list, tx ring, and writes to
  if_flags and if_itimer
- sc_rx_lock covers any access to rx list, tx ring, and free tx counter

fix suspend and detach to work again - recent softintr changes made
xennet_tx_complete() not actually being called, because the call
in xennet_handler() was after IFF_RUNNING check; now it's called
directly rather than triggering softint, with updates locking it's safe

enable DVF_DETACH_SHUTDOWN for xennet(4), though the call only
triggers notification to backend to close, leaves actual detach to
xenwatch_thread


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/xen/xen/if_xennet_xenbus.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/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.104 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.105
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.104	Mon Apr  6 15:30:52 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Mon Apr  6 16:43:34 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.104 2020/04/06 15:30:52 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.105 2020/04/06 16:43:34 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.104 2020/04/06 15:30:52 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.105 2020/04/06 16:43:34 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -194,8 +194,8 @@ struct xennet_xenbus_softc {
 	grant_ref_t sc_tx_ring_gntref;
 	grant_ref_t sc_rx_ring_gntref;
 
-	kmutex_t sc_tx_lock; /* protects free TX list, below */
-	kmutex_t sc_rx_lock; /* protects free RX list, below */
+	kmutex_t sc_tx_lock; /* protects free TX list, TX ring, and ifp */
+	kmutex_t sc_rx_lock; /* protects free RX list, RX ring, and rxreql */
 	struct xennet_txreq sc_txreqs[NET_TX_RING_SIZE];
 	struct xennet_rxreq sc_rxreqs[NET_RX_RING_SIZE];
 	SLIST_HEAD(,xennet_txreq) sc_txreq_head; /* list of free TX requests */
@@ -232,7 +232,6 @@ static void xennet_hex_dump(const unsign
 
 static int  xennet_init(struct ifnet *);
 static void xennet_stop(struct ifnet *, int);
-static void xennet_reset(struct xennet_xenbus_softc *);
 static void xennet_start(struct ifnet *);
 static int  xennet_ioctl(struct ifnet *, u_long, void *);
 static void xennet_watchdog(struct ifnet *);
@@ -242,7 +241,7 @@ static bool xennet_xenbus_resume (device
 
 CFATTACH_DECL3_NEW(xennet, sizeof(struct xennet_xenbus_softc),
xennet_xenbus_match, xennet_xenbus_attach, xennet_xenbus_detach, NULL,
-   NULL, NULL, /*DVF_DETACH_SHUTDOWN*/0);
+   NULL, NULL, DVF_DETACH_SHUTDOWN);
 
 static int
 xennet_xenbus_match(device_t parent, cfdata_t match, void *aux)
@@ -308,7 +307,7 @@ xennet_xenbus_attach(device_t parent, de
 	/* xenbus ensure 2 devices can't be probed at the same time */
 	if (if_xennetrxbuf_cache_inited == 0) {
 		if_xennetrxbuf_cache = pool_cache_init(PAGE_SIZE, 0, 0, 0,
-		"xnfrx", NULL, IPL_VM, NULL, NULL, NULL);
+		"xnfrx", NULL, IPL_NET, NULL, NULL, NULL);
 		if_xennetrxbuf_cache_inited = 1;
 	}
 
@@ -421,22 +420,34 @@ xennet_xenbus_detach(device_t self, int 
 {
 	struct xennet_xenbus_softc *sc = device_private(self);
 	struct ifnet *ifp = >sc_ethercom.ec_if;
-	int s0;
 	RING_IDX i;
 
+	if ((flags & (DETACH_SHUTDOWN | DETACH_FORCE)) == DETACH_SHUTDOWN) {
+		/* Trigger state transition with backend */
+		xenbus_switch_state(sc->sc_xbusd, NULL, XenbusStateClosing);
+		return EBUSY;
+	}
+
 	DPRINTF(("%s: xennet_xenbus_detach\n", device_xname(self)));
-	s0 = splnet();
+
+	/* stop interface */
 	xennet_stop(ifp, 1);
-	xen_intr_disestablish(sc->sc_ih);
-	/* wait for pending TX to complete, and collect pending RX packets */
-	xennet_handler(sc);
+	if (sc->sc_ih != NULL) {
+		xen_intr_disestablish(sc->sc_ih);
+		sc->sc_ih = NULL;
+	}
+
+	/* collect any outstanding TX responses */
+	mutex_enter(>sc_tx_lock);
+	xennet_tx_complete(sc);
 	while (sc->sc_tx_ring.sring->rsp_prod != sc->sc_tx_ring.rsp_cons) {
-		/* XXXSMP */
-		tsleep(xennet_xenbus_detach, PRIBIO, "xnet_detach", hz/2);
-		xennet_handler(sc);
+		kpause("xndetach", true, hz/2, >sc_tx_lock);
+		xennet_tx_complete(sc);
 	}
-	xennet_free_rx_buffer(sc);
+	mutex_exit(>sc_tx_lock);
 
+	mutex_enter(>sc_rx_lock);
+	xennet_free_rx_buffer(sc);
 	for (i = 0; i < NET_RX_RING_SIZE; i++) {
 		struct xennet_rxreq *rxreq = >sc_rxreqs[i];
 		if (rxreq->rxreq_va != 0) {
@@ -445,6 +456,7 @@ xennet_xenbus_detach(device_t self, int 
 			rxreq->rxreq_va = 0;
 		}
 	}
+	mutex_exit(>sc_rx_lock);
 
 	ether_ifdetach(ifp);
 	if_detach(ifp);
@@ -452,24 

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

2020-04-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr  6 15:30:52 UTC 2020

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

Log Message:
#undef XENNET_DEBUG, accidentaly left enabled in previous commit


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/xen/xen/if_xennet_xenbus.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/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.103 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.104
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.103	Mon Apr  6 10:44:44 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Mon Apr  6 15:30:52 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.103 2020/04/06 10:44:44 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.104 2020/04/06 15:30:52 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.103 2020/04/06 10:44:44 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.104 2020/04/06 15:30:52 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -127,7 +127,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_xennet_xe
 #include "locators.h"
 
 #undef XENNET_DEBUG_DUMP
-#define XENNET_DEBUG
+#undef XENNET_DEBUG
 
 #ifdef XENNET_DEBUG
 #define XEDB_FOLLOW 0x01



CVS commit: [netbsd-9] src/doc

2020-04-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr  6 14:59:48 UTC 2020

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

Log Message:
Tickets #820, #822, #823


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.30 -r1.1.2.31 src/doc/CHANGES-9.1

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

Modified files:

Index: src/doc/CHANGES-9.1
diff -u src/doc/CHANGES-9.1:1.1.2.30 src/doc/CHANGES-9.1:1.1.2.31
--- src/doc/CHANGES-9.1:1.1.2.30	Fri Apr  3 12:28:24 2020
+++ src/doc/CHANGES-9.1	Mon Apr  6 14:59:48 2020
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-9.1,v 1.1.2.30 2020/04/03 12:28:24 martin Exp $
+# $NetBSD: CHANGES-9.1,v 1.1.2.31 2020/04/06 14:59:48 martin Exp $
 
 A complete list of changes from the NetBSD 9.0 release to the NetBSD 9.1
 release:
@@ -794,3 +794,21 @@ sys/dev/usb/usbdi.c1.199
 	Avoid crashes if we fail to allocate a transfer buffer.
 	[skrll, ticket #819]
 
+sys/dev/wscons/wsevent.c			1.43,1.44
+
+	PR 55103: make default protocol version used by wscons selectable
+	and default to the current version.
+	[pgoyette, ticket #820]
+
+sys/dev/dkwedge/dk.c1.99
+
+	Allow dumping to cgd(4) on a dk(4).
+	[riastradh, ticket #822]
+
+sys/dev/cgd.c	1.122-1.124
+sys/dev/cgdvar.h1.19
+
+	Defer crypto operations to a workqueue and make it utilize all CPUs.
+	Make device mpsafe.
+	[riastradh, ticket #823]
+



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

2020-04-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr  6 14:57:42 UTC 2020

Modified Files:
src/sys/dev [netbsd-9]: cgd.c cgdvar.h

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

sys/dev/cgdvar.h: revision 1.19
sys/dev/cgd.c: revision 1.122
sys/dev/cgd.c: revision 1.123
sys/dev/cgd.c: revision 1.124

Defer crypto operations to a workqueue and make it utilize all CPUs.

Make device mpsafe.

Some code cleanup.

Don't wait for data buffer.

cgd: switch from malloc(9) to kmem(9)
XXX might be worthwhile to use pool_cache(9) in the write path


To generate a diff of this commit:
cvs rdiff -u -r1.116.10.2 -r1.116.10.3 src/sys/dev/cgd.c
cvs rdiff -u -r1.18 -r1.18.24.1 src/sys/dev/cgdvar.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/cgd.c
diff -u src/sys/dev/cgd.c:1.116.10.2 src/sys/dev/cgd.c:1.116.10.3
--- src/sys/dev/cgd.c:1.116.10.2	Sat Mar 21 15:52:09 2020
+++ src/sys/dev/cgd.c	Mon Apr  6 14:57:42 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.116.10.2 2020/03/21 15:52:09 martin Exp $ */
+/* $NetBSD: cgd.c,v 1.116.10.3 2020/04/06 14:57:42 martin Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.116.10.2 2020/03/21 15:52:09 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.116.10.3 2020/04/06 14:57:42 martin Exp $");
 
 #include 
 #include 
@@ -39,7 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.11
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -51,6 +51,8 @@ __KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.11
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -90,7 +92,7 @@ const struct bdevsw cgd_bdevsw = {
 	.d_dump = cgddump,
 	.d_psize = cgdsize,
 	.d_discard = nodiscard,
-	.d_flag = D_DISK
+	.d_flag = D_DISK | D_MPSAFE
 };
 
 const struct cdevsw cgd_cdevsw = {
@@ -105,7 +107,7 @@ const struct cdevsw cgd_cdevsw = {
 	.d_mmap = nommap,
 	.d_kqfilter = nokqfilter,
 	.d_discard = nodiscard,
-	.d_flag = D_DISK
+	.d_flag = D_DISK | D_MPSAFE
 };
 
 /*
@@ -207,12 +209,20 @@ static int cgd_match(device_t, cfdata_t,
 static void cgd_attach(device_t, device_t, void *);
 static int cgd_detach(device_t, int);
 static struct cgd_softc	*cgd_spawn(int);
+static struct cgd_worker *cgd_create_one_worker(void);
+static void cgd_destroy_one_worker(struct cgd_worker *);
+static struct cgd_worker *cgd_create_worker(void);
+static void cgd_destroy_worker(struct cgd_worker *);
 static int cgd_destroy(device_t);
 
 /* Internal Functions */
 
 static int	cgd_diskstart(device_t, struct buf *);
+static void	cgd_diskstart2(struct cgd_softc *, struct cgd_xfer *);
 static void	cgdiodone(struct buf *);
+static void	cgd_iodone2(struct cgd_softc *, struct cgd_xfer *);
+static void	cgd_enqueue(struct cgd_softc *, struct cgd_xfer *);
+static void	cgd_process(struct work *, void *);
 static int	cgd_dumpblocks(device_t, void *, daddr_t, int);
 
 static int	cgd_ioctl_set(struct cgd_softc *, void *, struct lwp *);
@@ -272,25 +282,49 @@ static void	hexprint(const char *, void 
 
 /* Global variables */
 
+static kmutex_t cgd_spawning_mtx;
+static kcondvar_t cgd_spawning_cv;
+static bool cgd_spawning;
+static struct cgd_worker *cgd_worker;
+static u_int cgd_refcnt;	/* number of users of cgd_worker */
+
 /* Utility Functions */
 
 #define CGDUNIT(x)		DISKUNIT(x)
-#define GETCGD_SOFTC(_cs, x)	if (!((_cs) = getcgd_softc(x))) return ENXIO
 
 /* The code */
 
-static struct cgd_softc *
-getcgd_softc(dev_t dev)
+static int
+cgd_lock(bool intr)
 {
-	int	unit = CGDUNIT(dev);
-	struct cgd_softc *sc;
+	int error = 0;
 
-	DPRINTF_FOLLOW(("getcgd_softc(0x%"PRIx64"): unit = %d\n", dev, unit));
+	mutex_enter(_spawning_mtx);
+	while (cgd_spawning) {
+		if (intr)
+			error = cv_wait_sig(_spawning_cv, _spawning_mtx);
+		else
+			cv_wait(_spawning_cv, _spawning_mtx);
+	}
+	if (error == 0)
+		cgd_spawning = true;
+	mutex_exit(_spawning_mtx);
+	return error;
+}
 
-	sc = device_lookup_private(_cd, unit);
-	if (sc == NULL)
-		sc = cgd_spawn(unit);
-	return sc;
+static void
+cgd_unlock(void)
+{
+	mutex_enter(_spawning_mtx);
+	cgd_spawning = false;
+	cv_broadcast(_spawning_cv);
+	mutex_exit(_spawning_mtx);
+}
+
+static struct cgd_softc *
+getcgd_softc(dev_t dev)
+{
+	return device_lookup_private(_cd, CGDUNIT(dev));
 }
 
 static int
@@ -306,6 +340,7 @@ cgd_attach(device_t parent, device_t sel
 	struct cgd_softc *sc = device_private(self);
 
 	mutex_init(>sc_lock, MUTEX_DEFAULT, IPL_BIO);
+	cv_init(>sc_cv, "cgdcv");
 	dk_init(>sc_dksc, self, DKTYPE_CGD);
 	disk_init(>sc_dksc.sc_dkdev, sc->sc_dksc.sc_xname, );
 
@@ -331,6 +366,7 @@ cgd_detach(device_t self, int flags)
 		return ret;
 
 	disk_destroy(>sc_dkdev);
+	cv_destroy(>sc_cv);
 	mutex_destroy(>sc_lock);
 
 	return 0;
@@ -339,89 +375,224 @@ cgd_detach(device_t self, int 

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

2020-04-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr  6 14:53:33 UTC 2020

Modified Files:
src/sys/dev/dkwedge [netbsd-9]: dk.c

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

sys/dev/dkwedge/dk.c: revision 1.99

Allow dumping to cgd(4) on a dk(4).

(Technically this also allows dumping to a dk(4) on which there
happens to be a cgd(4) configured, but I'm not sure how to
distinguish that case here.  So don't do that!)


To generate a diff of this commit:
cvs rdiff -u -r1.97.8.1 -r1.97.8.2 src/sys/dev/dkwedge/dk.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/dkwedge/dk.c
diff -u src/sys/dev/dkwedge/dk.c:1.97.8.1 src/sys/dev/dkwedge/dk.c:1.97.8.2
--- src/sys/dev/dkwedge/dk.c:1.97.8.1	Sat Mar 21 15:18:57 2020
+++ src/sys/dev/dkwedge/dk.c	Mon Apr  6 14:53:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dk.c,v 1.97.8.1 2020/03/21 15:18:57 martin Exp $	*/
+/*	$NetBSD: dk.c,v 1.97.8.2 2020/04/06 14:53:33 martin Exp $	*/
 
 /*-
  * Copyright (c) 2004, 2005, 2006, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.97.8.1 2020/03/21 15:18:57 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dk.c,v 1.97.8.2 2020/04/06 14:53:33 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_dkwedge.h"
@@ -1622,7 +1622,8 @@ dkdump(dev_t dev, daddr_t blkno, void *v
 	/* Our content type is static, no need to open the device. */
 
 	if (strcmp(sc->sc_ptype, DKW_PTYPE_SWAP) != 0 &&
-	strcmp(sc->sc_ptype, DKW_PTYPE_RAID) != 0) {
+	strcmp(sc->sc_ptype, DKW_PTYPE_RAID) != 0 &&
+	strcmp(sc->sc_ptype, DKW_PTYPE_CGD) != 0) {
 		rv = ENXIO;
 		goto out;
 	}



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

2020-04-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr  6 14:44:15 UTC 2020

Modified Files:
src/sys/dev/wscons [netbsd-9]: wsevent.c

Log Message:
Pull up following revision(s) (requested by pgoyette in ticket #820):

sys/dev/wscons/wsevent.c: revision 1.43
sys/dev/wscons/wsevent.c: revision 1.44

Make default protocol version used by wscons selectable and default
to the current version.

Fixes PR 55103.

KNF (Format block comment)
NFCI


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.42.4.1 src/sys/dev/wscons/wsevent.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/wscons/wsevent.c
diff -u src/sys/dev/wscons/wsevent.c:1.42 src/sys/dev/wscons/wsevent.c:1.42.4.1
--- src/sys/dev/wscons/wsevent.c:1.42	Fri Mar  1 11:06:57 2019
+++ src/sys/dev/wscons/wsevent.c	Mon Apr  6 14:44:15 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: wsevent.c,v 1.42 2019/03/01 11:06:57 pgoyette Exp $ */
+/* $NetBSD: wsevent.c,v 1.42.4.1 2020/04/06 14:44:15 martin Exp $ */
 
 /*-
  * Copyright (c) 2006, 2008 The NetBSD Foundation, Inc.
@@ -104,7 +104,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.42 2019/03/01 11:06:57 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 1.42.4.1 2020/04/06 14:44:15 martin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -121,6 +121,7 @@ __KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -138,6 +139,8 @@ __KERNEL_RCSID(0, "$NetBSD: wsevent.c,v 
 sizeof(struct owscons_event))
 #define EVARRAY(ev, idx) (&(ev)->q[(idx)])
 
+static int wsevent_default_version = WSEVENT_VERSION;
+
 /*
  * Priority of code managing wsevent queues.  PWSEVENT is set just above
  * PSOCK, which is just above TTIPRI, on the theory that mouse and keyboard
@@ -161,8 +164,17 @@ wsevent_init(struct wseventvar *ev, stru
 #endif
 		return;
 	}
-	/* For binary compat. New code must call WSxxxIO_SETVERSION */
-	ev->version = 0;
+	/*
+	 * For binary compat set default version and either build with
+	 * COMPAT_50 or load COMPAT_50 module to include the compatibility
+	 * code.
+	 */
+	if (wsevent_default_version >= 0 &&
+	wsevent_default_version < WSEVENT_VERSION)
+		ev->version = wsevent_default_version;
+	else
+		ev->version = WSEVENT_VERSION;
+
 	ev->get = ev->put = 0;
 	ev->q = kmem_alloc(WSEVENT_QSIZE * sizeof(*ev->q), KM_SLEEP);
 	selinit(>sel);
@@ -445,3 +457,22 @@ wsevent_setversion(struct wseventvar *ev
 	ev->version = vers;
 	return 0;
 }
+
+SYSCTL_SETUP(sysctl_wsevent_setup, "sysctl hw.wsevent subtree setup")
+{
+const struct sysctlnode *node = NULL;
+ 
+if (sysctl_createv(clog, 0, NULL, ,
+CTLFLAG_PERMANENT,
+CTLTYPE_NODE, "wsevent", NULL, 
+NULL, 0, NULL, 0,
+CTL_HW, CTL_CREATE, CTL_EOL) != 0)
+return;
+ 
+sysctl_createv(clog, 0, , NULL,
+CTLFLAG_READWRITE,
+CTLTYPE_INT, "default_version",
+SYSCTL_DESCR("Set default event version for compatibility"),
+NULL, 0, _default_version, 0,
+CTL_CREATE, CTL_EOL);
+}



CVS commit: src/sys/fs/udf

2020-04-06 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Apr  6 14:31:06 UTC 2020

Modified Files:
src/sys/fs/udf: udf_subr.c

Log Message:
udf_get_node(): fix typo and honor "lktype" argument.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/fs/udf/udf_subr.c

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

Modified files:

Index: src/sys/fs/udf/udf_subr.c
diff -u src/sys/fs/udf/udf_subr.c:1.149 src/sys/fs/udf/udf_subr.c:1.150
--- src/sys/fs/udf/udf_subr.c:1.149	Thu Feb 27 22:12:54 2020
+++ src/sys/fs/udf/udf_subr.c	Mon Apr  6 14:31:06 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_subr.c,v 1.149 2020/02/27 22:12:54 ad Exp $ */
+/* $NetBSD: udf_subr.c,v 1.150 2020/04/06 14:31:06 hannken Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -29,7 +29,7 @@
 
 #include 
 #ifndef lint
-__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.149 2020/02/27 22:12:54 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udf_subr.c,v 1.150 2020/04/06 14:31:06 hannken Exp $");
 #endif /* not lint */
 
 
@@ -5641,7 +5641,7 @@ udf_get_node(struct udf_mount *ump, stru
 	sizeof(node_icb_loc->loc), );
 	if (error)
 		return error;
-	error = vn_lock(vp, LK_EXCLUSIVE);
+	error = vn_lock(vp, lktype);
 	if (error) {
 		vrele(vp);
 		return error;



CVS commit: src/distrib/cobalt/ramdisk

2020-04-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr  6 13:28:15 UTC 2020

Modified Files:
src/distrib/cobalt/ramdisk: Makefile

Log Message:
Sync image size with available space reserved in the RAMDISK kernel


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/distrib/cobalt/ramdisk/Makefile

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

Modified files:

Index: src/distrib/cobalt/ramdisk/Makefile
diff -u src/distrib/cobalt/ramdisk/Makefile:1.13 src/distrib/cobalt/ramdisk/Makefile:1.14
--- src/distrib/cobalt/ramdisk/Makefile:1.13	Sun Dec 29 18:26:16 2019
+++ src/distrib/cobalt/ramdisk/Makefile	Mon Apr  6 13:28:15 2020
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.13 2019/12/29 18:26:16 christos Exp $
+#	$NetBSD: Makefile,v 1.14 2020/04/06 13:28:15 martin Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
 
 IMAGE=		ramdisk.fs
-IMAGESIZE=	3600k
+IMAGESIZE=	3700k
 MAKEFS_FLAGS+=	-f 15
 
 WARNS=		1



CVS commit: src/usr.sbin/postinstall

2020-04-06 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Mon Apr  6 13:10:48 UTC 2020

Modified Files:
src/usr.sbin/postinstall: postinstall.in

Log Message:
postinstall: fix contents_owner to return an error on error

find returning nothing via stdout but does return an error is an error.
Fixes the case where dhcpcd chroot db directory isn't owned by _dhcpcd.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/usr.sbin/postinstall/postinstall.in

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

Modified files:

Index: src/usr.sbin/postinstall/postinstall.in
diff -u src/usr.sbin/postinstall/postinstall.in:1.17 src/usr.sbin/postinstall/postinstall.in:1.18
--- src/usr.sbin/postinstall/postinstall.in:1.17	Thu Apr  2 13:44:46 2020
+++ src/usr.sbin/postinstall/postinstall.in	Mon Apr  6 13:10:48 2020
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.17 2020/04/02 13:44:46 roy Exp $
+# $NetBSD: postinstall.in,v 1.18 2020/04/06 13:10:48 roy Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -738,10 +738,12 @@ contents_owner()
 	_grp="$4"
 
 	if [ "${_op}" = "check" ]; then
-		if [ ! -z "`find "${_dir}" \( ! -user "${_user}" \) -o \
-		\( ! -group "${_grp}" \)`" ]; then
-			msg \
-"${_dir} and contents not all owned by ${_user}:${_grp}"
+		_files=$(find "${_dir}" \( \( ! -user "${_user}" \) -o \
+		\( ! -group "${_grp}" \) \) )
+		_error=$?
+		if [ ! -z "$_files" ] || [ $_error != 0 ]; then
+			msg "${_dir} and contents not all owned by" \
+			"${_user}:${_grp}"
 			return 1
 		else
 			return 0



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

2020-04-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr  6 11:57:52 UTC 2020

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

Log Message:
Slightly bump ramdisk space


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/alpha/conf/INSTALL

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

Modified files:

Index: src/sys/arch/alpha/conf/INSTALL
diff -u src/sys/arch/alpha/conf/INSTALL:1.113 src/sys/arch/alpha/conf/INSTALL:1.114
--- src/sys/arch/alpha/conf/INSTALL:1.113	Sat Jan 25 18:38:34 2020
+++ src/sys/arch/alpha/conf/INSTALL	Mon Apr  6 11:57:51 2020
@@ -1,4 +1,4 @@
-# $NetBSD: INSTALL,v 1.113 2020/01/25 18:38:34 thorpej Exp $
+# $NetBSD: INSTALL,v 1.114 2020/04/06 11:57:51 martin Exp $
 #
 # Alpha INSTALL kernel.
 
@@ -13,7 +13,7 @@ maxusers 8
 # Enable the hooks used for initializing the ram-disk.
 options 	MEMORY_DISK_HOOKS
 options 	MEMORY_DISK_IS_ROOT	# Force root on ram-disk
-options 	MEMORY_DISK_ROOT_SIZE=9300	# 4 Megabytes
+options 	MEMORY_DISK_ROOT_SIZE=9320	# 4660k
 options 	MEMORY_DISK_RBFLAGS=RB_SINGLE	# boot in single-user mode
 
 # CPU Support



CVS commit: src/distrib/alpha/instkernel/ramdisk

2020-04-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr  6 11:58:10 UTC 2020

Modified Files:
src/distrib/alpha/instkernel/ramdisk: Makefile

Log Message:
Use full available ram disk space


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/distrib/alpha/instkernel/ramdisk/Makefile

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

Modified files:

Index: src/distrib/alpha/instkernel/ramdisk/Makefile
diff -u src/distrib/alpha/instkernel/ramdisk/Makefile:1.32 src/distrib/alpha/instkernel/ramdisk/Makefile:1.33
--- src/distrib/alpha/instkernel/ramdisk/Makefile:1.32	Tue Jan 24 18:04:01 2017
+++ src/distrib/alpha/instkernel/ramdisk/Makefile	Mon Apr  6 11:58:10 2020
@@ -1,10 +1,10 @@
-#	$NetBSD: Makefile,v 1.32 2017/01/24 18:04:01 christos Exp $
+#	$NetBSD: Makefile,v 1.33 2020/04/06 11:58:10 martin Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
 
 IMAGE=		ramdisk.fs
-IMAGESIZE=	4480k
+IMAGESIZE=	4660k
 MAKEFS_FLAGS+=	-o density=5k
 
 WARNS=		1



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

2020-04-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr  6 10:44:44 UTC 2020

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

Log Message:
remove some XENNET_DEBUG code which causes kernel faults


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/xen/xen/if_xennet_xenbus.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/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.102 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.103
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.102	Mon Apr  6 10:33:10 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Mon Apr  6 10:44:44 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.102 2020/04/06 10:33:10 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.103 2020/04/06 10:44:44 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.102 2020/04/06 10:33:10 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.103 2020/04/06 10:44:44 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -127,7 +127,7 @@ __KERNEL_RCSID(0, "$NetBSD: if_xennet_xe
 #include "locators.h"
 
 #undef XENNET_DEBUG_DUMP
-#undef XENNET_DEBUG
+#define XENNET_DEBUG
 
 #ifdef XENNET_DEBUG
 #define XEDB_FOLLOW 0x01
@@ -240,8 +240,9 @@ static void xennet_watchdog(struct ifnet
 static bool xennet_xenbus_suspend(device_t dev, const pmf_qual_t *);
 static bool xennet_xenbus_resume (device_t dev, const pmf_qual_t *);
 
-CFATTACH_DECL_NEW(xennet, sizeof(struct xennet_xenbus_softc),
-   xennet_xenbus_match, xennet_xenbus_attach, xennet_xenbus_detach, NULL);
+CFATTACH_DECL3_NEW(xennet, sizeof(struct xennet_xenbus_softc),
+   xennet_xenbus_match, xennet_xenbus_attach, xennet_xenbus_detach, NULL,
+   NULL, NULL, /*DVF_DETACH_SHUTDOWN*/0);
 
 static int
 xennet_xenbus_match(device_t parent, cfdata_t match, void *aux)
@@ -1089,12 +1090,6 @@ xennet_start(struct ifnet *ifp)
 		"mbuf %p, buf %p/%p/%p, size %d\n",
 		req->txreq_id, m, mtod(m, void *), (void *)pa,
 		(void *)xpmap_ptom_masked(pa), m->m_pkthdr.len));
-#ifdef XENNET_DEBUG
-		paddr_t pa2;
-		pmap_extract_ma(pmap_kernel(), mtod(m, vaddr_t), );
-		DPRINTFN(XEDB_MBUF, ("xennet_start pa %p ma %p/%p\n",
-		(void *)pa, (void *)xpmap_ptom_masked(pa), (void *)pa2));
-#endif
 
 #ifdef XENNET_DEBUG_DUMP
 		xennet_hex_dump(mtod(m, u_char *), m->m_pkthdr.len, "s",
@@ -1114,18 +1109,6 @@ xennet_start(struct ifnet *ifp)
 		if (notify)
 			do_notify = 1;
 
-#ifdef XENNET_DEBUG
-		DPRINTFN(XEDB_MEM, ("packet addr %p/%p, physical %p/%p, "
-		"m_paddr %p, len %d/%d\n", M_BUFADDR(m), mtod(m, void *),
-		(void *)*kvtopte(mtod(m, vaddr_t)),
-		(void *)xpmap_mtop(*kvtopte(mtod(m, vaddr_t))),
-		(void *)m->m_paddr, m->m_pkthdr.len, m->m_len));
-		DPRINTFN(XEDB_MEM, ("id %d gref %d offset %d size %d flags %d"
-		" prod %d\n",
-		txreq->id, txreq->gref, txreq->offset, txreq->size,
-		txreq->flags, req_prod));
-#endif
-
 		/*
 		 * Pass packet to bpf if there is a listener.
 		 */



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

2020-04-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr  6 10:33:10 UTC 2020

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

Log Message:
remove some unnecessary spl*() calls, and fix the rxreq va/pa deallocation
in xennet_xenbus_detach()


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/xen/xen/if_xennet_xenbus.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/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.101 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.102
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.101	Mon Apr  6 10:05:38 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Mon Apr  6 10:33:10 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.101 2020/04/06 10:05:38 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.102 2020/04/06 10:33:10 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.101 2020/04/06 10:05:38 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.102 2020/04/06 10:33:10 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -269,7 +269,6 @@ xennet_xenbus_attach(device_t parent, de
 	netif_rx_sring_t *rx_ring;
 	RING_IDX i;
 	char *val, *e, *p;
-	int s;
 	extern int ifqmaxlen; /* XXX */
 #ifdef XENNET_DEBUG
 	char **dir;
@@ -320,9 +319,9 @@ xennet_xenbus_attach(device_t parent, de
 		SLIST_INSERT_HEAD(>sc_txreq_head, >sc_txreqs[i],
 		txreq_next);
 	}
+
 	mutex_init(>sc_rx_lock, MUTEX_DEFAULT, IPL_NET);
 	SLIST_INIT(>sc_rxreq_head);
-	s = splvm(); /* XXXSMP */
 	for (i = 0; i < NET_RX_RING_SIZE; i++) {
 		struct xennet_rxreq *rxreq = >sc_rxreqs[i];
 		rxreq->rxreq_id = i;
@@ -333,7 +332,6 @@ xennet_xenbus_attach(device_t parent, de
 		rxreq->rxreq_gntref = GRANT_INVALID_REF;
 		SLIST_INSERT_HEAD(>sc_rxreq_head, rxreq, rxreq_next);
 	}
-	splx(s);
 	sc->sc_free_rxreql = i;
 	if (sc->sc_free_rxreql == 0) {
 		aprint_error_dev(self, "failed to allocate rx memory\n");
@@ -422,7 +420,7 @@ xennet_xenbus_detach(device_t self, int 
 {
 	struct xennet_xenbus_softc *sc = device_private(self);
 	struct ifnet *ifp = >sc_ethercom.ec_if;
-	int s0, s1;
+	int s0;
 	RING_IDX i;
 
 	DPRINTF(("%s: xennet_xenbus_detach\n", device_xname(self)));
@@ -438,13 +436,14 @@ xennet_xenbus_detach(device_t self, int 
 	}
 	xennet_free_rx_buffer(sc);
 
-	s1 = splvm(); /* XXXSMP */
 	for (i = 0; i < NET_RX_RING_SIZE; i++) {
 		struct xennet_rxreq *rxreq = >sc_rxreqs[i];
-		uvm_km_free(kernel_map, rxreq->rxreq_va, PAGE_SIZE,
-		UVM_KMF_WIRED);
+		if (rxreq->rxreq_va != 0) {
+			pool_cache_put_paddr(if_xennetrxbuf_cache,
+			(void *)rxreq->rxreq_va, rxreq->rxreq_pa);
+			rxreq->rxreq_va = 0;
+		}
 	}
-	splx(s1);
 
 	ether_ifdetach(ifp);
 	if_detach(ifp);



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

2020-04-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr  6 10:05:38 UTC 2020

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

Log Message:
save some memory - no need to embed sc inside struct xennet_rxreq


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/xen/xen/if_xennet_xenbus.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/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.100 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.101
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.100	Mon Apr  6 08:26:32 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Mon Apr  6 10:05:38 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.100 2020/04/06 08:26:32 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.101 2020/04/06 10:05:38 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.100 2020/04/06 08:26:32 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.101 2020/04/06 10:05:38 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -177,7 +177,6 @@ struct xennet_rxreq {
 /* va/pa for this receive buf. ma will be provided by backend */
 	paddr_t rxreq_pa;
 	vaddr_t rxreq_va;
-	struct xennet_xenbus_softc *rxreq_sc; /* pointer to our interface */
 };
 
 struct xennet_xenbus_softc {
@@ -225,7 +224,6 @@ static void xennet_alloc_rx_buffer(struc
 static void xennet_free_rx_buffer(struct xennet_xenbus_softc *);
 static void xennet_tx_complete(struct xennet_xenbus_softc *);
 static void xennet_rx_mbuf_free(struct mbuf *, void *, size_t, void *);
-static void xennet_rx_free_req(struct xennet_rxreq *);
 static int  xennet_handler(void *);
 static bool xennet_talk_to_backend(struct xennet_xenbus_softc *);
 #ifdef XENNET_DEBUG_DUMP
@@ -328,7 +326,6 @@ xennet_xenbus_attach(device_t parent, de
 	for (i = 0; i < NET_RX_RING_SIZE; i++) {
 		struct xennet_rxreq *rxreq = >sc_rxreqs[i];
 		rxreq->rxreq_id = i;
-		rxreq->rxreq_sc = sc;
 		rxreq->rxreq_va = (vaddr_t)pool_cache_get_paddr(
 		if_xennetrxbuf_cache, PR_WAITOK, >rxreq_pa);
 		if (rxreq->rxreq_va == 0)
@@ -782,10 +779,8 @@ xennet_rx_mbuf_free(struct mbuf *m, void
 };
 
 static void
-xennet_rx_free_req(struct xennet_rxreq *req)
+xennet_rx_free_req(struct xennet_xenbus_softc *sc, struct xennet_rxreq *req)
 {
-	struct xennet_xenbus_softc *sc = req->rxreq_sc;
-
 	KASSERT(mutex_owned(>sc_rx_lock));
 
 	/* puts back the RX request in the list of free RX requests */
@@ -907,7 +902,7 @@ again:
 DPRINTFN(XEDB_EVENT,
 ("xennet_handler bad dest\n"));
 /* packet not for us */
-xennet_rx_free_req(req);
+xennet_rx_free_req(sc, req);
 continue;
 			}
 		}
@@ -915,7 +910,7 @@ again:
 		if (__predict_false(m == NULL)) {
 			printf("%s: rx no mbuf\n", ifp->if_xname);
 			if_statinc(ifp, if_ierrors);
-			xennet_rx_free_req(req);
+			xennet_rx_free_req(sc, req);
 			continue;
 		}
 		MCLAIM(m, >sc_ethercom.ec_rx_mowner);
@@ -935,7 +930,7 @@ again:
 if_statinc(ifp, if_ierrors);
 req->rxreq_va = va;
 req->rxreq_pa = pa;
-xennet_rx_free_req(req);
+xennet_rx_free_req(sc, req);
 m_freem(m);
 continue;
 			}
@@ -950,7 +945,7 @@ again:
 		else if (rx->flags & NETRXF_data_validated)
 			m->m_pkthdr.csum_flags = XN_M_CSUM_SUPPORTED;
 		/* free req may overwrite *rx, better doing it late */
-		xennet_rx_free_req(req);
+		xennet_rx_free_req(sc, req);
 
 		/* Pass the packet up. */
 		if_percpuq_enqueue(ifp->if_percpuq, m);



CVS commit: src/sbin/fsck_ffs

2020-04-06 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Apr  6 09:54:24 UTC 2020

Modified Files:
src/sbin/fsck_ffs: main.c

Log Message:
Sync "common" declarations with ifdefs in header.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sbin/fsck_ffs/main.c

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

Modified files:

Index: src/sbin/fsck_ffs/main.c
diff -u src/sbin/fsck_ffs/main.c:1.88 src/sbin/fsck_ffs/main.c:1.89
--- src/sbin/fsck_ffs/main.c:1.88	Mon Apr  6 06:41:34 2020
+++ src/sbin/fsck_ffs/main.c	Mon Apr  6 09:54:24 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.88 2020/04/06 06:41:34 mrg Exp $	*/
+/*	$NetBSD: main.c,v 1.89 2020/04/06 09:54:24 martin Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.6 (Berkeley) 5/14/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.88 2020/04/06 06:41:34 mrg Exp $");
+__RCSID("$NetBSD: main.c,v 1.89 2020/04/06 09:54:24 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -117,12 +117,14 @@ int	rerun;
 char	resolved;
 #ifndef NO_FFS_EI
 int	endian;
-#endif
 int	doswap;
 int	needswap;
 int	do_blkswap;
 int	do_dirswap;
+#endif
+#ifndef NO_APPLE_UFS
 int	isappleufs;
+#endif
 daddr_t maxfsblock;
 char	*blockmap;
 ino_t	maxino;



CVS commit: src/usr.sbin/cpuctl/arch

2020-04-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr  6 09:48:44 UTC 2020

Modified Files:
src/usr.sbin/cpuctl/arch: i386.c

Log Message:
 Print CPUID 0x8007 %edx on both Intel and AMD.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/usr.sbin/cpuctl/arch/i386.c

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

Modified files:

Index: src/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.109 src/usr.sbin/cpuctl/arch/i386.c:1.110
--- src/usr.sbin/cpuctl/arch/i386.c:1.109	Mon Apr  6 09:46:21 2020
+++ src/usr.sbin/cpuctl/arch/i386.c	Mon Apr  6 09:48:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.109 2020/04/06 09:46:21 msaitoh Exp $	*/
+/*	$NetBSD: i386.c,v 1.110 2020/04/06 09:48:44 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.109 2020/04/06 09:46:21 msaitoh Exp $");
+__RCSID("$NetBSD: i386.c,v 1.110 2020/04/06 09:48:44 msaitoh Exp $");
 #endif /* not lint */
 
 #include 
@@ -2286,10 +2286,11 @@ identifycpu(int fd, const char *cpuname)
 		cpuname, descs[0]);
 	}
 
-	if (cpu_vendor == CPUVENDOR_AMD) {
+	if ((cpu_vendor == CPUVENDOR_INTEL) || (cpu_vendor == CPUVENDOR_AMD))
 		if (ci->ci_cpuid_extlevel >= 0x8007)
 			powernow_probe(ci);
 
+	if (cpu_vendor == CPUVENDOR_AMD) {
 		if (ci->ci_cpuid_extlevel >= 0x8008) {
 			x86_cpuid(0x8008, descs);
 			print_bits(cpuname, "AMD Extended features",
@@ -2566,8 +2567,7 @@ powernow_probe(struct cpu_info *ci)
 	x86_cpuid(0x8007, regs);
 
 	snprintb(buf, sizeof(buf), CPUID_APM_FLAGS, regs[3]);
-	aprint_normal_dev(ci->ci_dev, "AMD Power Management features: %s\n",
-	buf);
+	aprint_normal_dev(ci->ci_dev, "Power Management features: %s\n", buf);
 }
 
 bool



CVS commit: src/usr.sbin/cpuctl/arch

2020-04-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr  6 09:46:21 UTC 2020

Modified Files:
src/usr.sbin/cpuctl/arch: i386.c

Log Message:
 Remove ci_max_ext_cpuid because it's the same as ci_cpuid_extlevel.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/usr.sbin/cpuctl/arch/i386.c

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

Modified files:

Index: src/usr.sbin/cpuctl/arch/i386.c
diff -u src/usr.sbin/cpuctl/arch/i386.c:1.108 src/usr.sbin/cpuctl/arch/i386.c:1.109
--- src/usr.sbin/cpuctl/arch/i386.c:1.108	Sun Nov 17 15:32:00 2019
+++ src/usr.sbin/cpuctl/arch/i386.c	Mon Apr  6 09:46:21 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386.c,v 1.108 2019/11/17 15:32:00 msaitoh Exp $	*/
+/*	$NetBSD: i386.c,v 1.109 2020/04/06 09:46:21 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: i386.c,v 1.108 2019/11/17 15:32:00 msaitoh Exp $");
+__RCSID("$NetBSD: i386.c,v 1.109 2020/04/06 09:46:21 msaitoh Exp $");
 #endif /* not lint */
 
 #include 
@@ -119,7 +119,6 @@ struct cpu_info {
 	uint8_t		ci_coreid;
 	uint8_t		ci_smtid;
 	uint32_t	ci_initapicid;
-	uint32_t	ci_max_ext_cpuid;
 
 	uint32_t	ci_cur_xsave;
 	uint32_t	ci_max_xsave;
@@ -1944,7 +1943,7 @@ identifycpu_cpuids_amd(struct cpu_info *
 		x86_cpuid(1, descs);
 		lp_max = __SHIFTOUT(descs[1], CPUID_HTT_CORES);
 
-		if (cpu_family >= 0x10 && ci->ci_max_ext_cpuid >= 0x808) {
+		if (cpu_family >= 0x10 && ci->ci_cpuid_extlevel >= 0x808) {
 			x86_cpuid(0x808, descs);
 			core_max = (descs[2] & 0xff) + 1;
 			n = (descs[2] >> 12) & 0x0f;
@@ -2288,21 +2287,16 @@ identifycpu(int fd, const char *cpuname)
 	}
 
 	if (cpu_vendor == CPUVENDOR_AMD) {
-		x86_cpuid(0x8000, descs);
-		if (descs[0] >= 0x8000)
-			ci->ci_max_ext_cpuid = descs[0];
-		else
-			ci->ci_max_ext_cpuid = 0;
-		if (ci->ci_max_ext_cpuid >= 0x8007)
+		if (ci->ci_cpuid_extlevel >= 0x8007)
 			powernow_probe(ci);
 
-		if (ci->ci_max_ext_cpuid >= 0x8008) {
+		if (ci->ci_cpuid_extlevel >= 0x8008) {
 			x86_cpuid(0x8008, descs);
 			print_bits(cpuname, "AMD Extended features",
 			CPUID_CAPEX_FLAGS, descs[1]);
 		}
 
-		if ((ci->ci_max_ext_cpuid >= 0x800a)
+		if ((ci->ci_cpuid_extlevel >= 0x800a)
 		&& (ci->ci_feat_val[3] & CPUID_SVM) != 0) {
 			x86_cpuid(0x800a, descs);
 			aprint_verbose("%s: SVM Rev. %d\n", cpuname,
@@ -2312,7 +2306,7 @@ identifycpu(int fd, const char *cpuname)
 			print_bits(cpuname, "SVM features",
 			CPUID_AMD_SVM_FLAGS, descs[3]);
 		}
-		if (ci->ci_max_ext_cpuid >= 0x801f) {
+		if (ci->ci_cpuid_extlevel >= 0x801f) {
 			x86_cpuid(0x801f, descs);
 			print_bits(cpuname, "Encrypted Memory features",
 			CPUID_AMD_ENCMEM_FLAGS, descs[0]);



CVS commit: src/sys/sys

2020-04-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr  6 09:32:54 UTC 2020

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

Log Message:
define M_CSUM_BLANK, eventually to be used by xennet(4)/xvif(4) to offload
checksums to NIC hw


To generate a diff of this commit:
cvs rdiff -u -r1.226 -r1.227 src/sys/sys/mbuf.h

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

Modified files:

Index: src/sys/sys/mbuf.h
diff -u src/sys/sys/mbuf.h:1.226 src/sys/sys/mbuf.h:1.227
--- src/sys/sys/mbuf.h:1.226	Sun Mar 15 23:14:41 2020
+++ src/sys/sys/mbuf.h	Mon Apr  6 09:32:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbuf.h,v 1.226 2020/03/15 23:14:41 thorpej Exp $	*/
+/*	$NetBSD: mbuf.h,v 1.227 2020/04/06 09:32:54 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1999, 2001, 2007 The NetBSD Foundation, Inc.
@@ -218,6 +218,7 @@ struct pkthdr {
 #define M_CSUM_TSOv6		0x0200	/* TCPv6 segmentation offload */
 
 /* Checksum-assist quirks: keep separate from jump-table bits. */
+#define M_CSUM_BLANK		0x4000	/* csum is missing */
 #define M_CSUM_NO_PSEUDOHDR	0x8000	/* Rx csum_data does not include
 		 * the UDP/TCP pseudo-hdr, and
 		 * is not yet 1s-complemented.
@@ -225,7 +226,7 @@ struct pkthdr {
 
 #define M_CSUM_BITS \
 "\20\1TCPv4\2UDPv4\3TCP_UDP_BAD\4DATA\5TCPv6\6UDPv6\7IPv4\10IPv4_BAD" \
-"\11TSOv4\12TSOv6\40NO_PSEUDOHDR"
+"\11TSOv4\12TSOv6\39BLANK\40NO_PSEUDOHDR"
 
 /*
  * Macros for manipulating csum_data on outgoing packets. These are



CVS commit: src/sys/arch/x86

2020-04-06 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr  6 09:24:50 UTC 2020

Modified Files:
src/sys/arch/x86/include: specialreg.h
src/sys/arch/x86/x86: tsc.c

Log Message:
 Rename CPUID_APM_TSC to CPUID_APM_ITSC. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.160 -r1.161 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/x86/x86/tsc.c

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

Modified files:

Index: src/sys/arch/x86/include/specialreg.h
diff -u src/sys/arch/x86/include/specialreg.h:1.160 src/sys/arch/x86/include/specialreg.h:1.161
--- src/sys/arch/x86/include/specialreg.h:1.160	Mon Apr  6 02:36:49 2020
+++ src/sys/arch/x86/include/specialreg.h	Mon Apr  6 09:24:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: specialreg.h,v 1.160 2020/04/06 02:36:49 msaitoh Exp $	*/
+/*	$NetBSD: specialreg.h,v 1.161 2020/04/06 09:24:49 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2014-2019 The NetBSD Foundation, Inc.
@@ -697,8 +697,10 @@
 	"\35" "L2IPERFC" "\36" "MWAITX"	"\37" "B30"	"\40" "B31"
 
 /*
- * AMD Advanced Power Management
+ * Advanced Power Management
  * CPUID Fn8000_0007 %edx
+ *
+ * Only ITSC is for both Intel and AMD. Others are only for AMD.
  */
 #define CPUID_APM_TS	0x0001	/* Temperature Sensor */
 #define CPUID_APM_FID	0x0002	/* Frequency ID control */
@@ -708,7 +710,7 @@
 #define CPUID_APM_STC	0x0020	/* Software thermal control (STC) */
 #define CPUID_APM_100	0x0040	/* 100MHz multiplier control */
 #define CPUID_APM_HWP	0x0080	/* HW P-State control */
-#define CPUID_APM_TSC	0x0100	/* TSC invariant (Intel, too) */
+#define CPUID_APM_ITSC	0x0100	/* invariant TSC */
 #define CPUID_APM_CPB	0x0200	/* Core performance boost */
 #define CPUID_APM_EFF	0x0400	/* Effective Frequency (read-only) */
 #define CPUID_APM_PROCFI 0x0800	/* Proc Feedback Interface */

Index: src/sys/arch/x86/x86/tsc.c
diff -u src/sys/arch/x86/x86/tsc.c:1.39 src/sys/arch/x86/x86/tsc.c:1.40
--- src/sys/arch/x86/x86/tsc.c:1.39	Fri Apr  3 03:05:39 2020
+++ src/sys/arch/x86/x86/tsc.c	Mon Apr  6 09:24:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: tsc.c,v 1.39 2020/04/03 03:05:39 knakahara Exp $	*/
+/*	$NetBSD: tsc.c,v 1.40 2020/04/06 09:24:50 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.39 2020/04/03 03:05:39 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tsc.c,v 1.40 2020/04/06 09:24:50 msaitoh Exp $");
 
 #include 
 #include 
@@ -135,7 +135,7 @@ tsc_is_invariant(void)
 		x86_cpuid(0x8000, descs);
 		if (descs[0] >= 0x8007) {
 			x86_cpuid(0x8007, descs);
-			invariant = (descs[3] & CPUID_APM_TSC) != 0;
+			invariant = (descs[3] & CPUID_APM_ITSC) != 0;
 		}
 	}
 



CVS commit: src/sys/sys

2020-04-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Apr  6 08:28:53 UTC 2020

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

Log Message:
Welcome to 9.99.55!

struct proc regained p_oppid.


To generate a diff of this commit:
cvs rdiff -u -r1.657 -r1.658 src/sys/sys/param.h

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

Modified files:

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.657 src/sys/sys/param.h:1.658
--- src/sys/sys/param.h:1.657	Sat Apr  4 23:58:54 2020
+++ src/sys/sys/param.h	Mon Apr  6 08:28:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.657 2020/04/04 23:58:54 ad Exp $	*/
+/*	$NetBSD: param.h,v 1.658 2020/04/06 08:28:53 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	999005400	/* NetBSD 9.99.54 */
+#define	__NetBSD_Version__	999005500	/* NetBSD 9.99.55 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/share/man/man9

2020-04-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Apr  6 08:26:34 UTC 2020

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

Log Message:
Remove copy-paste garbage.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/share/man/man9/pool_cache.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/pool_cache.9
diff -u src/share/man/man9/pool_cache.9:1.19 src/share/man/man9/pool_cache.9:1.20
--- src/share/man/man9/pool_cache.9:1.19	Tue Nov 15 00:32:34 2011
+++ src/share/man/man9/pool_cache.9	Mon Apr  6 08:26:33 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: pool_cache.9,v 1.19 2011/11/15 00:32:34 jym Exp $
+.\"	$NetBSD: pool_cache.9,v 1.20 2020/04/06 08:26:33 rin Exp $
 .\"
 .\" Copyright (c)2003 YAMAMOTO Takashi,
 .\" All rights reserved.
@@ -274,7 +274,6 @@ should be physical address of the object
 .Fa object
 or
 .Dv POOL_PADDR_INVALID .
-.Fa pp .
 If the number of available items in the backing pool exceeds the maximum
 pool size set by
 .Fn pool_cache_sethiwat



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

2020-04-06 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Apr  6 08:26:32 UTC 2020

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

Log Message:
set rxreq_gntref to GRANT_INVALID_REF immediately after revoking
access, so it's clear where it comes from


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/xen/xen/if_xennet_xenbus.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/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.99 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.100
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.99	Sun Apr  5 17:26:46 2020
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Mon Apr  6 08:26:32 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.99 2020/04/05 17:26:46 jdolecek Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.100 2020/04/06 08:26:32 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.99 2020/04/05 17:26:46 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.100 2020/04/06 08:26:32 jdolecek Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -796,8 +796,6 @@ xennet_rx_free_req(struct xennet_rxreq *
 	 * ring needs more requests to be pushed in, allocate some
 	 * RX buffers to catch-up with backend's consumption
 	 */
-	req->rxreq_gntref = GRANT_INVALID_REF;
-
 	if (sc->sc_free_rxreql >= (NET_RX_RING_SIZE * 4 / 5) &&
 	__predict_true(sc->sc_backend_status == BEST_CONNECTED)) {
 		xennet_alloc_rx_buffer(sc);
@@ -892,6 +890,7 @@ again:
 		KASSERT(req->rxreq_id == rx->id);
 
 		xengnt_revoke_access(req->rxreq_gntref);
+		req->rxreq_gntref = GRANT_INVALID_REF;
 
 		pa = req->rxreq_pa;
 		va = req->rxreq_va;



CVS commit: src/sys

2020-04-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Mon Apr  6 08:20:05 UTC 2020

Modified Files:
src/sys/kern: kern_exec.c kern_fork.c kern_proc.c kern_sig.c
src/sys/sys: proc.h

Log Message:
Reintroduce struct proc::p_oppid

Relying on p_opptr is not safe as there is a race between:
 - spawner giving a birth to a child process and being killed
 - spawnee accessng p_opptr and reporting TRAP_CHLD

PR kern/54786 by Andreas Gustafsson


To generate a diff of this commit:
cvs rdiff -u -r1.494 -r1.495 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.220 -r1.221 src/sys/kern/kern_fork.c
cvs rdiff -u -r1.242 -r1.243 src/sys/kern/kern_proc.c
cvs rdiff -u -r1.386 -r1.387 src/sys/kern/kern_sig.c
cvs rdiff -u -r1.361 -r1.362 src/sys/sys/proc.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/kern/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.494 src/sys/kern/kern_exec.c:1.495
--- src/sys/kern/kern_exec.c:1.494	Sun Apr  5 20:53:17 2020
+++ src/sys/kern/kern_exec.c	Mon Apr  6 08:20:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.494 2020/04/05 20:53:17 christos Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.495 2020/04/06 08:20:05 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.494 2020/04/05 20:53:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.495 2020/04/06 08:20:05 kamil Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -2660,6 +2660,7 @@ do_posix_spawn(struct lwp *l1, pid_t *pi
 	if ((p1->p_slflag & (PSL_TRACEPOSIX_SPAWN|PSL_TRACED)) ==
 	(PSL_TRACEPOSIX_SPAWN|PSL_TRACED)) {
 		proc_changeparent(p2, p1->p_pptr);
+		p2->p_oppid = p1->p_pid;
 	}
 
 	LIST_INSERT_AFTER(p1, p2, p_pglist);

Index: src/sys/kern/kern_fork.c
diff -u src/sys/kern/kern_fork.c:1.220 src/sys/kern/kern_fork.c:1.221
--- src/sys/kern/kern_fork.c:1.220	Sun Apr  5 20:53:17 2020
+++ src/sys/kern/kern_fork.c	Mon Apr  6 08:20:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_fork.c,v 1.220 2020/04/05 20:53:17 christos Exp $	*/
+/*	$NetBSD: kern_fork.c,v 1.221 2020/04/06 08:20:05 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2001, 2004, 2006, 2007, 2008, 2019
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.220 2020/04/05 20:53:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_fork.c,v 1.221 2020/04/06 08:20:05 kamil Exp $");
 
 #include "opt_ktrace.h"
 #include "opt_dtrace.h"
@@ -511,8 +511,10 @@ fork1(struct lwp *l1, int flags, int exi
 	/*
 	 * Trace fork(2) and vfork(2)-like events on demand in a debugger.
 	 */
-	if (tracefork(p1, flags) || tracevfork(p1, flags))
+	if (tracefork(p1, flags) || tracevfork(p1, flags)) {
 		proc_changeparent(p2, p1->p_pptr);
+		p2->p_oppid = p1->p_pid;
+	}
 
 	LIST_INSERT_AFTER(p1, p2, p_pglist);
 	LIST_INSERT_HEAD(, p2, p_list);

Index: src/sys/kern/kern_proc.c
diff -u src/sys/kern/kern_proc.c:1.242 src/sys/kern/kern_proc.c:1.243
--- src/sys/kern/kern_proc.c:1.242	Sun Feb 23 22:14:03 2020
+++ src/sys/kern/kern_proc.c	Mon Apr  6 08:20:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_proc.c,v 1.242 2020/02/23 22:14:03 ad Exp $	*/
+/*	$NetBSD: kern_proc.c,v 1.243 2020/04/06 08:20:05 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.242 2020/02/23 22:14:03 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_proc.c,v 1.243 2020/04/06 08:20:05 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_kstack.h"
@@ -2270,6 +2270,7 @@ fill_proc(const struct proc *psrc, struc
 	COND_SET_VALUE(p->p_sigpend, psrc->p_sigpend, allowaddr);
 	COND_SET_VALUE(p->p_lwpctl, psrc->p_lwpctl, allowaddr);
 	p->p_ppid = psrc->p_ppid;
+	p->p_oppid = psrc->p_oppid;
 	COND_SET_VALUE(p->p_path, psrc->p_path, allowaddr);
 	COND_SET_VALUE(p->p_sigctx, psrc->p_sigctx, allowaddr);
 	p->p_nice = psrc->p_nice;

Index: src/sys/kern/kern_sig.c
diff -u src/sys/kern/kern_sig.c:1.386 src/sys/kern/kern_sig.c:1.387
--- src/sys/kern/kern_sig.c:1.386	Sun Apr  5 20:53:17 2020
+++ src/sys/kern/kern_sig.c	Mon Apr  6 08:20:05 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sig.c,v 1.386 2020/04/05 20:53:17 christos Exp $	*/
+/*	$NetBSD: kern_sig.c,v 1.387 2020/04/06 08:20:05 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.386 2020/04/05 20:53:17 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sig.c,v 1.387 2020/04/06 08:20:05 kamil Exp $");
 
 #include "opt_ptrace.h"
 #include "opt_dtrace.h"
@@ -1693,12 +1693,12 @@ eventswitchchild(struct proc *p, int cod
 {
 	mutex_enter(proc_lock);
 	mutex_enter(p->p_lock);
-	if (!(p->p_slflag & PSL_TRACED) || p->p_opptr == NULL) {
+	if (!(p->p_slflag & PSL_TRACED)) {
 		mutex_exit(p->p_lock);
 		mutex_exit(proc_lock);
 

CVS commit: src/sbin/fsck_ffs

2020-04-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Mon Apr  6 06:41:34 UTC 2020

Modified Files:
src/sbin/fsck_ffs: main.c

Log Message:
dion't define endian as well as try to declare it as a variable.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sbin/fsck_ffs/main.c

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

Modified files:

Index: src/sbin/fsck_ffs/main.c
diff -u src/sbin/fsck_ffs/main.c:1.87 src/sbin/fsck_ffs/main.c:1.88
--- src/sbin/fsck_ffs/main.c:1.87	Sun Apr  5 15:25:40 2020
+++ src/sbin/fsck_ffs/main.c	Mon Apr  6 06:41:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.87 2020/04/05 15:25:40 joerg Exp $	*/
+/*	$NetBSD: main.c,v 1.88 2020/04/06 06:41:34 mrg Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.6 (Berkeley) 5/14/95";
 #else
-__RCSID("$NetBSD: main.c,v 1.87 2020/04/05 15:25:40 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.88 2020/04/06 06:41:34 mrg Exp $");
 #endif
 #endif /* not lint */
 
@@ -115,7 +115,9 @@ int	fsreadfd;
 int	fswritefd;
 int	rerun;
 char	resolved;
+#ifndef NO_FFS_EI
 int	endian;
+#endif
 int	doswap;
 int	needswap;
 int	do_blkswap;