CVS commit: src/sys/dev/pci

2020-03-06 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Mar  7 07:33:39 UTC 2020

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

Log Message:
If bus_dmatag_subregion(), actually fall back on the base 64-bit
DMA tag.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/pci/if_stge.c

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

Modified files:

Index: src/sys/dev/pci/if_stge.c
diff -u src/sys/dev/pci/if_stge.c:1.83 src/sys/dev/pci/if_stge.c:1.84
--- src/sys/dev/pci/if_stge.c:1.83	Mon Mar  2 15:13:23 2020
+++ src/sys/dev/pci/if_stge.c	Sat Mar  7 07:33:39 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_stge.c,v 1.83 2020/03/02 15:13:23 thorpej Exp $	*/
+/*	$NetBSD: if_stge.c,v 1.84 2020/03/07 07:33:39 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.83 2020/03/02 15:13:23 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_stge.c,v 1.84 2020/03/07 07:33:39 thorpej Exp $");
 
 
 #include 
@@ -456,6 +456,7 @@ stge_attach(device_t parent, device_t se
 			aprint_error_dev(self,
 			"WARNING: failed to restrict dma range,"
 			" falling back to parent bus dma range\n");
+			sc->sc_dmat = pa->pa_dmat64;
 		}
 	} else {
 		sc->sc_dmat = pa->pa_dmat;



CVS commit: src/sys/dev/audio

2020-03-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Mar  7 06:27:19 UTC 2020

Modified Files:
src/sys/dev/audio: audio.c

Log Message:
Fix/Update comments about allocm/freem.


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/audio/audio.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.63 src/sys/dev/audio/audio.c:1.64
--- src/sys/dev/audio/audio.c:1.63	Sat Mar  7 06:25:57 2020
+++ src/sys/dev/audio/audio.c	Sat Mar  7 06:27:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.63 2020/03/07 06:25:57 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.64 2020/03/07 06:27:19 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -118,8 +118,8 @@
  *	set_port 		-	x +
  *	get_port 		-	x +
  *	query_devinfo 		-	x
- *	allocm 			-	- +	(*1)
- *	freem 			-	- +	(*1)
+ *	allocm 			-	- +
+ *	freem 			-	- +
  *	round_buffersize 	-	x
  *	get_props 		-	-	Called at attach time
  *	trigger_output 		x	x +
@@ -127,10 +127,6 @@
  *	dev_ioctl 		-	x
  *	get_locks 		-	-	Called at attach time
  *
- * *1 Note: Before 8.0, since these have been called only at attach time,
- *   neither lock were necessary.  Currently, on the other hand, since
- *   these may be also called after attach, the thread lock is required.
- *
  * In addition, there is an additional lock.
  *
  * - track->lock.  This is an atomic variable and is similar to the
@@ -142,7 +138,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.63 2020/03/07 06:25:57 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.64 2020/03/07 06:27:19 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -4887,10 +4883,8 @@ audio_mixer_init(struct audio_softc *sc,
 	bufsize);
 	mixer->hwbuf.capacity = capacity;
 
-	/*
-	 * XXX need to release sc_lock for compatibility?
-	 */
 	if (sc->hw_if->allocm) {
+		/* sc_lock is not necessary for allocm */
 		mixer->hwbuf.mem = sc->hw_if->allocm(sc->hw_hdl, mode, bufsize);
 		if (mixer->hwbuf.mem == NULL) {
 			device_printf(sc->sc_dev, "%s: allocm(%zu) failed\n",
@@ -5009,6 +5003,7 @@ audio_mixer_destroy(struct audio_softc *
 
 	if (mixer->hwbuf.mem != NULL) {
 		if (sc->hw_if->freem) {
+			/* sc_lock is not necessary for freem */
 			sc->hw_if->freem(sc->hw_hdl, mixer->hwbuf.mem, bufsize);
 		} else {
 			kmem_free(mixer->hwbuf.mem, bufsize);



CVS commit: src/sys/dev/audio

2020-03-06 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Mar  7 06:25:57 UTC 2020

Modified Files:
src/sys/dev/audio: audio.c audiovar.h

Log Message:
Split sc_lock and sc_exlock.
Most (probably all) malloc/free (or routines which may sleep) now can be
called without holding mutex.
Pointed out by riastradh@.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/dev/audio/audio.c
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/audio/audiovar.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/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.62 src/sys/dev/audio/audio.c:1.63
--- src/sys/dev/audio/audio.c:1.62	Wed Mar  4 14:19:41 2020
+++ src/sys/dev/audio/audio.c	Sat Mar  7 06:25:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.62 2020/03/04 14:19:41 isaki Exp $	*/
+/*	$NetBSD: audio.c,v 1.63 2020/03/07 06:25:57 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -142,7 +142,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.62 2020/03/04 14:19:41 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.63 2020/03/07 06:25:57 isaki Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -497,8 +497,10 @@ static void audio_mixer_restore(struct a
 static void audio_softintr_rd(void *);
 static void audio_softintr_wr(void *);
 
-static int  audio_enter_exclusive(struct audio_softc *);
-static void audio_exit_exclusive(struct audio_softc *);
+static int audio_exlock_mutex_enter(struct audio_softc *);
+static void audio_exlock_mutex_exit(struct audio_softc *);
+static int audio_exlock_enter(struct audio_softc *);
+static void audio_exlock_exit(struct audio_softc *);
 static struct audio_softc *audio_file_enter(audio_file_t *, struct psref *);
 static void audio_file_exit(struct audio_softc *, struct psref *);
 static int audio_track_waitio(struct audio_softc *, audio_track_t *);
@@ -898,6 +900,7 @@ audioattach(device_t parent, device_t se
 	sc->hw_hdl = hdlp;
 	sc->hw_dev = parent;
 
+	sc->sc_exlock = 1;
 	sc->sc_blk_ms = AUDIO_BLK_MS;
 	SLIST_INIT(&sc->sc_files);
 	cv_init(&sc->sc_exlockcv, "audiolk");
@@ -981,10 +984,8 @@ audioattach(device_t parent, device_t se
 
 	/* Init hardware. */
 	/* hw_probe() also validates [pr]hwfmt.  */
-	mutex_enter(sc->sc_lock);
 	error = audio_hw_set_format(sc, mode, &phwfmt, &rhwfmt, &pfil, &rfil);
 	if (error) {
-		mutex_exit(sc->sc_lock);
 		aprint_error_dev(self, "audio_hw_set_format failed, "
 		"error = %d\n", error);
 		goto bad;
@@ -995,7 +996,6 @@ audioattach(device_t parent, device_t se
 	 * attach time, we assume a success.
 	 */
 	error = audio_mixers_init(sc, mode, &phwfmt, &rhwfmt, &pfil, &rfil);
-	mutex_exit(sc->sc_lock);
 	if (sc->sc_pmixer == NULL && sc->sc_rmixer == NULL) {
 		aprint_error_dev(self, "audio_mixers_init failed, "
 		"error = %d\n", error);
@@ -1087,11 +1087,13 @@ audioattach(device_t parent, device_t se
 #endif
 
 	audiorescan(self, "audio", NULL);
+	sc->sc_exlock = 0;
 	return;
 
 bad:
 	/* Clearing hw_if means that device is attached but disabled. */
 	sc->hw_if = NULL;
+	sc->sc_exlock = 0;
 	aprint_error_dev(sc->sc_dev, "disabled\n");
 	return;
 }
@@ -1309,6 +1311,7 @@ audiodetach(device_t self, int flags)
 	 * that hold sc, and any new calls with files that were for sc will
 	 * fail.  Thus, we now have exclusive access to the softc.
 	 */
+	sc->sc_exlock = 1;
 
 	/*
 	 * Nuke all open instances.
@@ -1334,7 +1337,6 @@ audiodetach(device_t self, int flags)
 	pmf_device_deregister(self);
 
 	/* Free resources */
-	mutex_enter(sc->sc_lock);
 	if (sc->sc_pmixer) {
 		audio_mixer_destroy(sc, sc->sc_pmixer);
 		kmem_free(sc->sc_pmixer, sizeof(*sc->sc_pmixer));
@@ -1343,7 +1345,6 @@ audiodetach(device_t self, int flags)
 		audio_mixer_destroy(sc, sc->sc_rmixer);
 		kmem_free(sc->sc_rmixer, sizeof(*sc->sc_rmixer));
 	}
-	mutex_exit(sc->sc_lock);
 	if (sc->sc_am)
 		kern_free(sc->sc_am);
 
@@ -1415,12 +1416,12 @@ audio_attach_mi(const struct audio_hw_if
 }
 
 /*
- * Acquire sc_lock and enter exlock critical section.
- * If successful, it returns 0.  Otherwise returns errno.
+ * Enter critical section and also keep sc_lock.
+ * If successful, returns 0 with sc_lock held.  Otherwise returns errno.
  * Must be called without sc_lock held.
  */
 static int
-audio_enter_exclusive(struct audio_softc *sc)
+audio_exlock_mutex_enter(struct audio_softc *sc)
 {
 	int error;
 
@@ -1446,23 +1447,51 @@ audio_enter_exclusive(struct audio_softc
 }
 
 /*
- * Leave exlock critical section and release sc_lock.
+ * Exit critical section and exit sc_lock.
  * Must be called with sc_lock held.
  */
 static void
-audio_exit_exclusive(struct audio_softc *sc)
+audio_exlock_mutex_exit(struct audio_softc *sc)
 {
 
 	KASSERT(mutex_owned(sc->sc_lock));
-	KASSERT(sc->sc_exlock);
 
-	/* Leave critical section */
 	sc->sc_exlock = 0;
 	cv_broadcast(&sc->sc_exlockcv);
 	mutex_exit(sc->sc_lock);
 }
 
 /*
+ * Enter critical s

CVS commit: src/sys/compat/netbsd32

2020-03-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar  7 00:57:31 UTC 2020

Modified Files:
src/sys/compat/netbsd32: netbsd32_syscall.h netbsd32_syscallargs.h
netbsd32_syscalls.c netbsd32_syscalls_autoload.c netbsd32_sysent.c
netbsd32_systrace_args.c

Log Message:
Regen


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/compat/netbsd32/netbsd32_syscall.h
cvs rdiff -u -r1.147 -r1.148 src/sys/compat/netbsd32/netbsd32_syscallargs.h \
src/sys/compat/netbsd32/netbsd32_syscalls.c
cvs rdiff -u -r1.27 -r1.28 \
src/sys/compat/netbsd32/netbsd32_syscalls_autoload.c
cvs rdiff -u -r1.146 -r1.147 src/sys/compat/netbsd32/netbsd32_sysent.c
cvs rdiff -u -r1.38 -r1.39 src/sys/compat/netbsd32/netbsd32_systrace_args.c

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_syscall.h
diff -u src/sys/compat/netbsd32/netbsd32_syscall.h:1.148 src/sys/compat/netbsd32/netbsd32_syscall.h:1.149
--- src/sys/compat/netbsd32/netbsd32_syscall.h:1.148	Sat Jan 18 14:07:31 2020
+++ src/sys/compat/netbsd32/netbsd32_syscall.h	Sat Mar  7 00:57:31 2020
@@ -1,10 +1,10 @@
-/* $NetBSD: netbsd32_syscall.h,v 1.148 2020/01/18 14:07:31 pgoyette Exp $ */
+/* $NetBSD: netbsd32_syscall.h,v 1.149 2020/03/07 00:57:31 pgoyette Exp $ */
 
 /*
  * System call numbers.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.131 2020/01/18 07:33:24 kamil Exp
+ * created from	NetBSD: syscalls.master,v 1.132 2020/03/07 00:56:41 pgoyette Exp
  */
 
 #ifndef _NETBSD32_SYS_SYSCALL_H_
@@ -432,13 +432,10 @@
 /* syscall: "compat_50_netbsd32_quotactl" ret: "int" args: "netbsd32_charp" "int" "int" "netbsd32_voidp" */
 #define	NETBSD32_SYS_compat_50_netbsd32_quotactl	148
 
-/* syscall: "compat_43_oquota" ret: "int" args: */
-#define	NETBSD32_SYS_compat_43_oquota	149
-
 #else
 /* 148 is excluded compat_netbsd32_quotactl */
-/* 149 is excluded compat_netbsd32_quota */
 #endif
+/* 149 is excluded compat_netbsd32_quota */
 /* syscall: "compat_43_netbsd32_ogetsockname" ret: "int" args: "int" "netbsd32_voidp" "netbsd32_intp" */
 #define	NETBSD32_SYS_compat_43_netbsd32_ogetsockname	150
 

Index: src/sys/compat/netbsd32/netbsd32_syscallargs.h
diff -u src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.147 src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.148
--- src/sys/compat/netbsd32/netbsd32_syscallargs.h:1.147	Sat Jan 18 14:07:31 2020
+++ src/sys/compat/netbsd32/netbsd32_syscallargs.h	Sat Mar  7 00:57:31 2020
@@ -1,10 +1,10 @@
-/* $NetBSD: netbsd32_syscallargs.h,v 1.147 2020/01/18 14:07:31 pgoyette Exp $ */
+/* $NetBSD: netbsd32_syscallargs.h,v 1.148 2020/03/07 00:57:31 pgoyette Exp $ */
 
 /*
  * System call argument lists.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.131 2020/01/18 07:33:24 kamil Exp
+ * created from	NetBSD: syscalls.master,v 1.132 2020/03/07 00:56:41 pgoyette Exp
  */
 
 #ifndef _NETBSD32_SYS_SYSCALLARGS_H_
@@ -2928,8 +2928,6 @@ int	sys_setsid(struct lwp *, const void 
 #if defined(QUOTA) || !defined(_KERNEL_OPT)
 int	compat_50_netbsd32_quotactl(struct lwp *, const struct compat_50_netbsd32_quotactl_args *, register_t *);
 
-int	compat_43_sys_quota(struct lwp *, const void *, register_t *);
-
 #else
 #endif
 int	compat_43_netbsd32_ogetsockname(struct lwp *, const struct compat_43_netbsd32_ogetsockname_args *, register_t *);
Index: src/sys/compat/netbsd32/netbsd32_syscalls.c
diff -u src/sys/compat/netbsd32/netbsd32_syscalls.c:1.147 src/sys/compat/netbsd32/netbsd32_syscalls.c:1.148
--- src/sys/compat/netbsd32/netbsd32_syscalls.c:1.147	Sat Jan 18 14:07:31 2020
+++ src/sys/compat/netbsd32/netbsd32_syscalls.c	Sat Mar  7 00:57:31 2020
@@ -1,14 +1,14 @@
-/* $NetBSD: netbsd32_syscalls.c,v 1.147 2020/01/18 14:07:31 pgoyette Exp $ */
+/* $NetBSD: netbsd32_syscalls.c,v 1.148 2020/03/07 00:57:31 pgoyette Exp $ */
 
 /*
  * System call names.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.131 2020/01/18 07:33:24 kamil Exp
+ * created from	NetBSD: syscalls.master,v 1.132 2020/03/07 00:56:41 pgoyette Exp
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.147 2020/01/18 14:07:31 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_syscalls.c,v 1.148 2020/03/07 00:57:31 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #if defined(_KERNEL_OPT)
@@ -180,11 +180,10 @@ const char *const netbsd32_syscallnames[
 	/* 147 */	"setsid",
 #if defined(QUOTA) || !defined(_KERNEL_OPT)
 	/* 148 */	"compat_50_netbsd32_quotactl",
-	/* 149 */	"compat_43_oquota",
 #else
 	/* 148 */	"#148 (excluded compat_netbsd32_quotactl)",
-	/* 149 */	"#149 (excluded compat_netbsd32_quota)",
 #endif
+	/* 149 */	"#149 (excluded compat_netbsd32_quota)",
 	/* 150 */	"compat_43_netbsd32_ogetsockname",
 	/* 151 */	"#151 (unimplemen

CVS commit: src/sys/compat/netbsd32

2020-03-06 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sat Mar  7 00:56:41 UTC 2020

Modified Files:
src/sys/compat/netbsd32: netbsd32_compat_43.c syscalls.master

Log Message:
Properly mark netbsd32_compat_43 syscalls that are directly implemented
by calling their compat_43 equivalents.  With these changes, and with
built-in versions of COMPAT_NETBSD32, COMPAT_NOMID, and COMPAT_09, I can
now run a netbsd-0.9 statically linked i386 (32-bit) version of /bin/ls
on a 9.99.x amd64 host!

Addresses PR kern/55047 but more changes coming to handle non-built-in
modules.

XXX pullup-9


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/compat/netbsd32/netbsd32_compat_43.c
cvs rdiff -u -r1.131 -r1.132 src/sys/compat/netbsd32/syscalls.master

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

Modified files:

Index: src/sys/compat/netbsd32/netbsd32_compat_43.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_43.c:1.59 src/sys/compat/netbsd32/netbsd32_compat_43.c:1.60
--- src/sys/compat/netbsd32/netbsd32_compat_43.c:1.59	Wed Jan  1 09:17:45 2020
+++ src/sys/compat/netbsd32/netbsd32_compat_43.c	Sat Mar  7 00:56:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_43.c,v 1.59 2020/01/01 09:17:45 maxv Exp $	*/
+/*	$NetBSD: netbsd32_compat_43.c,v 1.60 2020/03/07 00:56:41 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.59 2020/01/01 09:17:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_43.c,v 1.60 2020/03/07 00:56:41 pgoyette Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_43.h"
@@ -769,6 +769,26 @@ static struct syscall_package compat_net
 	(sy_call_t *)compat_43_netbsd32_sigsetmask },
 	{ NETBSD32_SYS_compat_43_netbsd32_osigstack, 0,
 	(sy_call_t *)compat_43_netbsd32_osigstack },
+/*
+ * These syscalls are provided by emul_netbsd compat_43 code, but their
+ * entry points must still be loaded in the emul_netbsd32 disatch table
+ */
+	{ NETBSD32_SYS_compat_43_ogetpagesize, 0,
+	(sy_call_t *)compat_43_sys_getpagesize },
+	{ NETBSD32_SYS_compat_43_ogetdtablesize, 0,
+	(sy_call_t *)compat_43_sys_getdtablesize},
+	{ NETBSD32_SYS_compat_43_ogethostid, 0,
+	(sy_call_t *)compat_43_sys_gethostid },
+	{ NETBSD32_SYS_compat_43_owait, 0,
+	(sy_call_t *)compat_43_sys_wait },
+/*
+ * Skip oquota since it isn't part of compat_43
+ *	{ NETBSD32_SYS_compat_43_oquota, 0,
+ *	(sy_call_t *)compat_43_sys_quota },
+ */
+
+/* End of compat_43 syscalls */
+
 	{ 0, 0, NULL }
 }; 
 

Index: src/sys/compat/netbsd32/syscalls.master
diff -u src/sys/compat/netbsd32/syscalls.master:1.131 src/sys/compat/netbsd32/syscalls.master:1.132
--- src/sys/compat/netbsd32/syscalls.master:1.131	Sat Jan 18 07:33:24 2020
+++ src/sys/compat/netbsd32/syscalls.master	Sat Mar  7 00:56:41 2020
@@ -1,4 +1,4 @@
-	$NetBSD: syscalls.master,v 1.131 2020/01/18 07:33:24 kamil Exp $
+	$NetBSD: syscalls.master,v 1.132 2020/03/07 00:56:41 pgoyette Exp $
 
 ;	from: NetBSD: syscalls.master,v 1.81 1998/07/05 08:49:50 jonathan Exp
 ;	@(#)syscalls.master	8.2 (Berkeley) 1/13/94
@@ -183,7 +183,7 @@
 			{ int|netbsd32||ogetkerninfo(int op, \
 			netbsd32_charp where, netbsd32_intp size, \
 			int arg); }
-64	COMPAT_43 MODULAR compat_netbsd32_43	\
+64	COMPAT_43 MODULAR compat_43	\
 			{ int|sys||getpagesize(void); } ogetpagesize
 65	COMPAT_12 MODULAR compat_netbsd32_12	\
 			{ int|netbsd32||msync(netbsd32_voidp addr, \
@@ -219,7 +219,7 @@
 			{ int|netbsd32||setitimer(int which, \
 			netbsd32_itimerval50p_t itv, \
 			netbsd32_itimerval50p_t oitv); }
-84	COMPAT_43 MODULAR compat_netbsd32_43	\
+84	COMPAT_43 MODULAR compat_43	\
 			{ int|sys||wait(void); } owait
 85	COMPAT_12 MODULAR compat_netbsd32_12	\
 			{ int|netbsd32||oswapon(netbsd32_charp name); }
@@ -232,7 +232,7 @@
 88	COMPAT_43 MODULAR compat_netbsd32_43	\
 			{ int|netbsd32||osethostname(netbsd32_charp hostname, \
 			u_int len); }
-89	COMPAT_43 MODULAR compat_netbsd32_43	\
+89	COMPAT_43 MODULAR compat_43	\
 			{ int|sys||getdtablesize(void); } ogetdtablesize
 90	STD		{ int|netbsd32||dup2(int from, int to); }
 91	UNIMPL		getdopt
@@ -343,7 +343,7 @@
 141	COMPAT_43 MODULAR compat_netbsd32_43	\
 			{ int|netbsd32||ogetpeername(int fdes, \
 			netbsd32_voidp asa, netbsd32_intp alen); }
-142	COMPAT_43 MODULAR compat_netbsd32_43	\
+142	COMPAT_43 MODULAR compat_43	\
 			{ int32_t|sys||gethostid(void); } ogethostid
 143	COMPAT_43 MODULAR compat_netbsd32_43	\
 			{ int|netbsd32||sethostid(int32_t hostid); }
@@ -360,12 +360,10 @@
 148	COMPAT_50 MODULAR compat_netbsd32_50	\
 			{ int|netbsd32||quotactl(netbsd32_charp path, int cmd, \
 			int uid, netbsd32_voidp arg); }
-149	COMPAT_43 MODULAR compat_netbsd32_43	\
-			{ int|sys||quota(void); } oquota
 #else
 148	EXCL 		compat_netbsd32_quotactl
-149	EXCL 		compat_netbsd32_quota
 #endif
+149	EXCL 		compat_netbsd

CVS commit: src/sys/conf

2020-03-06 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sat Mar  7 00:53:25 UTC 2020

Modified Files:
src/sys/conf: copts.mk

Log Message:
XXX:

turn off -Wunused-but-set-variable for mips' linux_machdep.c and GCC 8.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/conf/copts.mk

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

Modified files:

Index: src/sys/conf/copts.mk
diff -u src/sys/conf/copts.mk:1.4 src/sys/conf/copts.mk:1.5
--- src/sys/conf/copts.mk:1.4	Mon Sep 30 00:06:02 2019
+++ src/sys/conf/copts.mk	Sat Mar  7 00:53:24 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: copts.mk,v 1.4 2019/09/30 00:06:02 mrg Exp $
+#	$NetBSD: copts.mk,v 1.5 2020/03/07 00:53:24 mrg Exp $
 
 # MI per-file compiler options required.
 
@@ -12,4 +12,9 @@ COPTS.radeon_cs.c+=	-Wno-error=implicit-
 COPTS.via_dmablit.c+=	-Wno-error=implicit-fallthrough
 .endif
 
+.if defined(HAVE_GCC) && ${HAVE_GCC} >= 8 && ${ACTIVE_CC} == "gcc" && \
+(${MACHINE_ARCH} == "mipseb" || ${MACHINE_ARCH} == "mipsel")
+COPTS.linux_machdep.c+=	-Wno-error=unused-but-set-variable
+.endif
+
 .endif



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

2020-03-06 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Mar  7 00:51:10 UTC 2020

Modified Files:
src/sys/arch/arm/sunxi: sunxi_mmc.c

Log Message:
enable DDR and HS200 modes only on boards which claim to support them
with this eMMC works on libretech,all-h3-cc-h5
also tested on pinebook
ok jmcneill@


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/arm/sunxi/sunxi_mmc.c

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

Modified files:

Index: src/sys/arch/arm/sunxi/sunxi_mmc.c
diff -u src/sys/arch/arm/sunxi/sunxi_mmc.c:1.40 src/sys/arch/arm/sunxi/sunxi_mmc.c:1.41
--- src/sys/arch/arm/sunxi/sunxi_mmc.c:1.40	Sat Oct  5 12:09:01 2019
+++ src/sys/arch/arm/sunxi/sunxi_mmc.c	Sat Mar  7 00:51:10 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mmc.c,v 1.40 2019/10/05 12:09:01 jmcneill Exp $ */
+/* $NetBSD: sunxi_mmc.c,v 1.41 2020/03/07 00:51:10 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_sunximmc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.40 2019/10/05 12:09:01 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.41 2020/03/07 00:51:10 macallan Exp $");
 
 #include 
 #include 
@@ -547,6 +547,14 @@ sunxi_mmc_attach_i(device_t self)
 	const u_int flags = sc->sc_config->flags;
 	struct sdmmcbus_attach_args saa;
 	uint32_t width;
+	const bool supports_hs200 =
+		of_hasprop(sc->sc_phandle, "mmc-hs200-1_2v") |
+		of_hasprop(sc->sc_phandle, "mmc-hs200-1_8v");
+
+	const bool supports_ddr =
+		of_hasprop(sc->sc_phandle, "mmc-ddr-1_2v") |
+		of_hasprop(sc->sc_phandle, "mmc-ddr-1_8v") |
+		of_hasprop(sc->sc_phandle, "mmc-ddr-3_3v");
 
 	if (sc->sc_pwrseq)
 		fdtbus_mmc_pwrseq_pre_power_on(sc->sc_pwrseq);
@@ -577,10 +585,11 @@ sunxi_mmc_attach_i(device_t self)
 		   SMC_CAPS_SD_HIGHSPEED |
 		   SMC_CAPS_MMC_HIGHSPEED;
 
-	if (sc->sc_config->delays || (flags & SUNXI_MMC_FLAG_NEW_TIMINGS))
+	if ((sc->sc_config->delays || (flags & SUNXI_MMC_FLAG_NEW_TIMINGS)) &&
+	 supports_ddr)
 		saa.saa_caps |= SMC_CAPS_MMC_DDR52;
 
-	if (flags & SUNXI_MMC_FLAG_HS200)
+	if ((flags & SUNXI_MMC_FLAG_HS200) != 0 && supports_hs200)
 		saa.saa_caps |= SMC_CAPS_MMC_HS200;
 
 	if (width == 4)



CVS commit: src/sys/uvm

2020-03-06 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri Mar  6 20:46:12 UTC 2020

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

Log Message:
Fix a comment.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/uvm/uvm_init.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_init.c
diff -u src/sys/uvm/uvm_init.c:1.52 src/sys/uvm/uvm_init.c:1.53
--- src/sys/uvm/uvm_init.c:1.52	Fri Dec 27 12:51:57 2019
+++ src/sys/uvm/uvm_init.c	Fri Mar  6 20:46:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_init.c,v 1.52 2019/12/27 12:51:57 ad Exp $	*/
+/*	$NetBSD: uvm_init.c,v 1.53 2020/03/06 20:46:12 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_init.c,v 1.52 2019/12/27 12:51:57 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_init.c,v 1.53 2020/03/06 20:46:12 ad Exp $");
 
 #include 
 #include 
@@ -164,9 +164,7 @@ uvm_init(void)
 	uvm_loan_init();
 
 	/*
-	 * The VM system is now up!  Now that kmem is up we can resize the
-	 *  =>  hash table for general use and enable paging
-	 * of kernel objects.
+	 * Enable paging of kernel objects.
 	 */
 
 	uao_create(VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS,



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

2020-03-06 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Mar  6 20:28:26 UTC 2020

Modified Files:
src/sys/arch/aarch64/include: armreg.h

Log Message:
fix missing paren


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/aarch64/include/armreg.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/include/armreg.h
diff -u src/sys/arch/aarch64/include/armreg.h:1.37 src/sys/arch/aarch64/include/armreg.h:1.38
--- src/sys/arch/aarch64/include/armreg.h:1.37	Fri Mar  6 20:13:24 2020
+++ src/sys/arch/aarch64/include/armreg.h	Fri Mar  6 20:28:26 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: armreg.h,v 1.37 2020/03/06 20:13:24 ryo Exp $ */
+/* $NetBSD: armreg.h,v 1.38 2020/03/06 20:28:26 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -208,7 +208,7 @@ AARCH64REG_READ_INLINE(id_aa64dfr0_el1)
 #define	ID_AA64DFR0_EL1_TRACEFILT	__BITS(43,40)
 #define	 ID_AA64DFR0_EL1_TRACEFILT_NONE	 0
 #define	 ID_AA64DFR0_EL1_TRACEFILT_IMPL	 1
-#define	ID_AA64DFR0_EL1_DBLLOCK		__BITS(39,36
+#define	ID_AA64DFR0_EL1_DBLLOCK		__BITS(39,36)
 #define	 ID_AA64DFR0_EL1_DBLLOCK_IMPL	 0
 #define	 ID_AA64DFR0_EL1_DBLLOCK_NONE	 15
 #define	ID_AA64DFR0_EL1_PMSVER		__BITS(35,32)



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

2020-03-06 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Fri Mar  6 20:13:24 UTC 2020

Modified Files:
src/sys/arch/aarch64/include: armreg.h

Log Message:
add more definitions for ARMv8.1-ARMv8.4


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/aarch64/include/armreg.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/include/armreg.h
diff -u src/sys/arch/aarch64/include/armreg.h:1.36 src/sys/arch/aarch64/include/armreg.h:1.37
--- src/sys/arch/aarch64/include/armreg.h:1.36	Sat Feb 29 21:29:23 2020
+++ src/sys/arch/aarch64/include/armreg.h	Fri Mar  6 20:13:24 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: armreg.h,v 1.36 2020/02/29 21:29:23 ryo Exp $ */
+/* $NetBSD: armreg.h,v 1.37 2020/03/06 20:13:24 ryo Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -96,6 +96,7 @@ AARCH64REG_READ_INLINE(ctr_el0)		// Cach
 #define	CTR_EL0_ERG_LINE	__BITS(23,20)	// Exclusives Reservation Granule
 #define	CTR_EL0_DMIN_LINE	__BITS(19,16)	// Dcache MIN LINE size (log2 - 2)
 #define	CTR_EL0_L1IP_MASK	__BITS(15,14)
+#define	 CTR_EL0_L1IP_VPIPT	0		//  VMID-aware Physical Index, Physical Tag
 #define	 CTR_EL0_L1IP_AIVIVT	1		//  ASID-tagged Virtual Index, Virtual Tag
 #define	 CTR_EL0_L1IP_VIPT	2		//  Virtual Index, Physical Tag
 #define	 CTR_EL0_L1IP_PIPT	3		//  Physical Index, Physical Tag
@@ -172,16 +173,17 @@ AARCH64REG_READ_INLINE2(cbar_el1, s3_1_c
 
 AARCH64REG_READ_INLINE(ccsidr_el1)
 
-#define	CCSIDR_WT		__BIT(31)	// Write-through supported
-#define	CCSIDR_WB		__BIT(30)	// Write-back supported
-#define	CCSIDR_RA		__BIT(29)	// Read-allocation supported
-#define	CCSIDR_WA		__BIT(28)	// Write-allocation supported
+#define	CCSIDR_WT		__BIT(31)	// OBSOLETE: Write-through supported
+#define	CCSIDR_WB		__BIT(30)	// OBSOLETE: Write-back supported
+#define	CCSIDR_RA		__BIT(29)	// OBSOLETE: Read-allocation supported
+#define	CCSIDR_WA		__BIT(28)	// OBSOLETE: Write-allocation supported
 #define	CCSIDR_NUMSET		__BITS(27,13)	// (Number of sets in cache) - 1
 #define	CCSIDR_ASSOC		__BITS(12,3)	// (Associativity of cache) - 1
 #define	CCSIDR_LINESIZE 	__BITS(2,0)	// Number of bytes in cache line
 
 AARCH64REG_READ_INLINE(clidr_el1)
 
+#define	CLIDR_ICB		__BITS(32,30)	// Inner cache boundary
 #define	CLIDR_LOUU		__BITS(29,27)	// Level of Unification Uniprocessor
 #define	CLIDR_LOC		__BITS(26,24)	// Level of Coherency
 #define	CLIDR_LOUIS		__BITS(23,21)	// Level of Unification InnerShareable*/
@@ -203,6 +205,13 @@ AARCH64REG_READ_INLINE(id_aa64afr0_el1)
 AARCH64REG_READ_INLINE(id_aa64afr1_el1)
 AARCH64REG_READ_INLINE(id_aa64dfr0_el1)
 
+#define	ID_AA64DFR0_EL1_TRACEFILT	__BITS(43,40)
+#define	 ID_AA64DFR0_EL1_TRACEFILT_NONE	 0
+#define	 ID_AA64DFR0_EL1_TRACEFILT_IMPL	 1
+#define	ID_AA64DFR0_EL1_DBLLOCK		__BITS(39,36
+#define	 ID_AA64DFR0_EL1_DBLLOCK_IMPL	 0
+#define	 ID_AA64DFR0_EL1_DBLLOCK_NONE	 15
+#define	ID_AA64DFR0_EL1_PMSVER		__BITS(35,32)
 #define	ID_AA64DFR0_EL1_CTX_CMPS	__BITS(31,28)
 #define	ID_AA64DFR0_EL1_WRPS		__BITS(20,23)
 #define	ID_AA64DFR0_EL1_BRPS		__BITS(12,15)
@@ -220,12 +229,45 @@ AARCH64REG_READ_INLINE(id_aa64dfr1_el1)
 
 AARCH64REG_READ_INLINE(id_aa64isar0_el1)
 
+#define	ID_AA64ISAR0_EL1_RNDR		__BITS(63,30)
+#define	 ID_AA64ISAR0_EL1_RNDR_NONE	 0
+#define	 ID_AA64ISAR0_EL1_RNDR_RNDRRS	 1
+#define	ID_AA64ISAR0_EL1_TLB		__BITS(59,56)
+#define	 ID_AA64ISAR0_EL1_TLB_NONE	 0
+#define	 ID_AA64ISAR0_EL1_TLB_OS	 1
+#define	 ID_AA64ISAR0_EL1_TLB_OS_TLB	 2
+#define	ID_AA64ISAR0_EL1_TS		__BITS(55,52)
+#define	 ID_AA64ISAR0_EL1_TS_NONE	 0
+#define	 ID_AA64ISAR0_EL1_TS_CFINV	 1
+#define	 ID_AA64ISAR0_EL1_TS_AXFLAG	 2
+#define	ID_AA64ISAR0_EL1_FHM		__BITS(51,48)
+#define	 ID_AA64ISAR0_EL1_FHM_NONE	 0
+#define	 ID_AA64ISAR0_EL1_FHM_FMLAL	 1
+#define	ID_AA64ISAR0_EL1_DP		__BITS(47,44)
+#define	 ID_AA64ISAR0_EL1_DP_NONE	 0
+#define	 ID_AA64ISAR0_EL1_DP_UDOT	 1
+#define	ID_AA64ISAR0_EL1_SM4		__BITS(43,40)
+#define	 ID_AA64ISAR0_EL1_SM4_NONE	 0
+#define	 ID_AA64ISAR0_EL1_SM4_SM4	 1
+#define	ID_AA64ISAR0_EL1_SM3		__BITS(39,36)
+#define	 ID_AA64ISAR0_EL1_SM3_NONE	 0
+#define	 ID_AA64ISAR0_EL1_SM3_SM3	 1
+#define	ID_AA64ISAR0_EL1_SHA3		__BITS(35,32)
+#define	 ID_AA64ISAR0_EL1_SHA3_NONE	 0
+#define	 ID_AA64ISAR0_EL1_SHA3_EOR3	 1
+#define	ID_AA64ISAR0_EL1_RDM		__BITS(31,28)
+#define	 ID_AA64ISAR0_EL1_RDM_NONE	 0
+#define	 ID_AA64ISAR0_EL1_RDM_SQRDML	 1
+#define	ID_AA64ISAR0_EL1_ATOMIC		__BITS(23,20)
+#define	 ID_AA64ISAR0_EL1_ATOMIC_NONE	 0
+#define	 ID_AA64ISAR0_EL1_ATOMIC_SWP	 1
 #define	ID_AA64ISAR0_EL1_CRC32		__BITS(19,16)
 #define	 ID_AA64ISAR0_EL1_CRC32_NONE	 0
 #define	 ID_AA64ISAR0_EL1_CRC32_CRC32X	 1
 #define	ID_AA64ISAR0_EL1_SHA2		__BITS(15,12)
 #define	 ID_AA64ISAR0_EL1_SHA2_NONE	 0
 #define	 ID_AA64ISAR0_EL1_SHA2_SHA256HSU 1
+#define	 ID_AA64ISAR0_EL1_SHA2_SHA512HSU 2
 #define	ID_AA64ISAR0_EL1_SHA1		__BITS(11,8)
 #define	 ID_AA64ISAR0_EL1_SHA1_NONE	 0
 #define	 ID_AA64ISAR0_EL

CVS commit: src/usr.sbin/sysinst

2020-03-06 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Fri Mar  6 20:07:26 UTC 2020

Modified Files:
src/usr.sbin/sysinst: sysinst.8

Log Message:
Remove note that has been incorrect for a while.

Thanks ottavio for the heads up.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/sysinst/sysinst.8

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

Modified files:

Index: src/usr.sbin/sysinst/sysinst.8
diff -u src/usr.sbin/sysinst/sysinst.8:1.2 src/usr.sbin/sysinst/sysinst.8:1.3
--- src/usr.sbin/sysinst/sysinst.8:1.2	Wed Feb 19 21:51:21 2020
+++ src/usr.sbin/sysinst/sysinst.8	Fri Mar  6 20:07:26 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysinst.8,v 1.2 2020/02/19 21:51:21 martin Exp $
+.\"	$NetBSD: sysinst.8,v 1.3 2020/03/06 20:07:26 maya Exp $
 .\"
 .\" Copyright (c) 2007 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd June 30, 2012
+.Dd March 6, 2020
 .Dt SYSINST 8
 .Os
 .Sh NAME
@@ -43,11 +43,6 @@ It
 is usually invoked automatically when the system is booted
 from appropriate installation media.
 .Pp
-.Nm
-is usually not present on a
-.Nx
-system that has been fully installed.
-.Pp
 The following options are available:
 .Bl -tag -width XfXdefinition_fileXX
 .It Fl D



CVS commit: src/tests/lib/libc/sys

2020-03-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Mar  6 19:10:27 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_sigchld.c

Log Message:
Remove duplicated lines


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libc/sys/t_ptrace_sigchld.c

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_sigchld.c
diff -u src/tests/lib/libc/sys/t_ptrace_sigchld.c:1.1 src/tests/lib/libc/sys/t_ptrace_sigchld.c:1.2
--- src/tests/lib/libc/sys/t_ptrace_sigchld.c:1.1	Fri Mar  6 18:32:35 2020
+++ src/tests/lib/libc/sys/t_ptrace_sigchld.c	Fri Mar  6 19:10:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_sigchld.c,v 1.1 2020/03/06 18:32:35 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_sigchld.c,v 1.2 2020/03/06 19:10:27 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2020 The NetBSD Foundation, Inc.
@@ -27,258 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_sigchld.c,v 1.1 2020/03/06 18:32:35 kamil Exp $");
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#include "h_macros.h"
-#include "msg.h"
-
-#include "t_ptrace_wait.h"
-
-#define SYSCALL_REQUIRE(expr) ATF_REQUIRE_MSG(expr, "%s: %s", # expr, \
-strerror(errno))
-#define SYSCALL_REQUIRE_ERRNO(res, exp) ATF_REQUIRE_MSG(res == exp, \
-"%d(%s) != %d", res, strerror(res), exp)
-
-static int debug = 0;
-
-#define DPRINTF(a, ...)	do  \
-	if (debug) \
-	printf("%s() %d.%d %s:%d " a, \
-	__func__, getpid(), _lwp_self(), __FILE__, __LINE__,  ##__VA_ARGS__); \
-while (/*CONSTCOND*/0)
-
-/// 
-
-static int expected_signo;
-static int expected_code;
-static int expected_status;
-static pid_t expected_pid;
-
-static void
-sigchld_action(int sig, siginfo_t *info, void *ctx)
-{
-
-	FORKEE_ASSERT_EQ(info->si_signo, expected_signo);
-	FORKEE_ASSERT_EQ(info->si_code, expected_code);
-	FORKEE_ASSERT_EQ(info->si_uid, getuid());
-	FORKEE_ASSERT_EQ(info->si_pid, expected_pid);
-
-	if (WIFEXITED(info->si_status))
-		ATF_REQUIRE_EQ(WEXITSTATUS(info->si_status), expected_status);
-	else if (WIFSTOPPED(info->si_status))
-		ATF_REQUIRE_EQ(WSTOPSIG(info->si_status), expected_status);
-	else if (WIFSIGNALED(info->si_status))
-		ATF_REQUIRE_EQ(WTERMSIG(info->si_status), expected_status);
-/*
-	else if (WIFCONTINUED(info->si_status))
-		;
-*/
-}
-
-static void
-traceme_raise(int sigval)
-{
-	const int exitval = 5;
-	struct sigaction sa;
-	pid_t child;
-	struct msg_fds parent_child;
-	uint8_t msg = 0xde; /* dummy message for IPC based on pipe(2) */
-
-	struct ptrace_siginfo info;
-	memset(&info, 0, sizeof(info));
-
-	memset(&sa, 0, sizeof(sa));
-	sa.sa_sigaction = sigchld_action;
-	sa.sa_flags = SA_SIGINFO | SA_NOCLDWAIT;
-	sigemptyset(&sa.sa_mask);
-
-	atf_tc_fail("XXX: zombie is not collected before tracer's death");
-
-	SYSCALL_REQUIRE(sigaction(SIGCHLD, &sa, NULL) == 0);
-
-	SYSCALL_REQUIRE(msg_open(&parent_child) == 0);
-
-	DPRINTF("Before forking process PID=%d\n", getpid());
-	SYSCALL_REQUIRE((child = fork()) != -1);
-	if (child == 0) {
-		DPRINTF("Before calling PT_TRACE_ME from child %d\n", getpid());
-		FORKEE_ASSERT(ptrace(PT_TRACE_ME, 0, NULL, 0) != -1);
-
-		CHILD_FROM_PARENT("raise1 child", parent_child, msg);
-
-		raise(sigval);
-
-		CHILD_TO_PARENT("raise2 child", parent_child, msg);
-
-		switch (sigval) {
-		case SIGKILL:
-			/* NOTREACHED */
-			FORKEE_ASSERTX(0 && "This shall not be reached");
-			__unreachable();
-		default:
-			DPRINTF("Before exiting of the child process\n");
-			_exit(exitval);
-		}
-	}
-	DPRINTF("Parent process PID=%d, child's PID=%d\n", getpid(), child);
-
-	expected_signo = SIGCHLD;
-	expected_pid = child;
-	switch (sigval) {
-	case SIGKILL:
-		expected_code = CLD_KILLED;
-		expected_status = SIGKILL;
-		break;
-	case SIGSTOP:
-		expected_code = CLD_STOPPED;
-		expected_status = SIGSTOP;
-		break;
-	default:
-		break;
-	}	
-
-	PARENT_TO_CHILD("raise1 child", parent_child, msg);
-
-	switch (sigval) {
-	case SIGKILL:
-		break;
-	default:
-		PARENT_FROM_CHILD("raise2 child", parent_child, msg);
-
-		DPRINTF("Before calling ptrace(2) with PT_GET_SIGINFO for "
-			"child\n");
-		SYSCALL_REQUIRE(ptrace(PT_GET_SIGINFO, child, &info,
-			sizeof(info)) != -1);
-
-		DPRINTF("Signal traced to lwpid=%d\n", info.psi_lwpid);
-		DPRINTF("Signal properties: si_signo=%#x si_code=%#x "
-			"si_errno=%#x\n",
-			info.psi_siginfo.si_signo, info.psi_siginfo.si_code,
-			info.psi_siginfo.si_errno);
-
-		ATF_REQUIRE_EQ(info.psi_siginfo.si_signo, sigval);
-		ATF_REQUIRE_EQ(info.psi_siginfo.si_code, SI_LWP);
-
-		expected_code = CLD_EXITED;
-		expected_status = exitval;
-
-

CVS commit: src

2020-03-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Mar  6 18:32:36 UTC 2020

Modified Files:
src/distrib/sets/lists/debug: mi
src/distrib/sets/lists/tests: mi
src/tests/lib/libc/sys: Makefile
Added Files:
src/tests/lib/libc/sys: t_ptrace_sigchld.c

Log Message:
Add new ptrace(2) test file

t_ptrace_sigchld - for SIGCHLD handler + ptrace(2).

Right now a single test is enabled (raise(SIGKILL)) and marked as failed
as it never finishes as the child is never collected before exiting the
parent uninterested about its child (SA_NOCLDWAIT).


To generate a diff of this commit:
cvs rdiff -u -r1.296 -r1.297 src/distrib/sets/lists/debug/mi
cvs rdiff -u -r1.830 -r1.831 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.60 -r1.61 src/tests/lib/libc/sys/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libc/sys/t_ptrace_sigchld.c

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

Modified files:

Index: src/distrib/sets/lists/debug/mi
diff -u src/distrib/sets/lists/debug/mi:1.296 src/distrib/sets/lists/debug/mi:1.297
--- src/distrib/sets/lists/debug/mi:1.296	Wed Mar  4 22:09:00 2020
+++ src/distrib/sets/lists/debug/mi	Fri Mar  6 18:32:35 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.296 2020/03/04 22:09:00 christos Exp $
+# $NetBSD: mi,v 1.297 2020/03/06 18:32:35 kamil Exp $
 ./etc/mtree/set.debug   comp-sys-root
 ./usr/lib	comp-sys-usr		compatdir
 ./usr/lib/i18n/libBIG5_g.a			comp-c-debuglib		debuglib,compatfile
@@ -2154,6 +2154,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_posix_fadvise.debug	tests-lib-debug		debug,atf,rump
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_posix_fallocate.debug	tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_ptrace.debug		tests-lib-debug		debug,atf,compattestfile
+./usr/libdata/debug/usr/tests/lib/libc/sys/t_ptrace_sigchld.debug	tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_ptrace_wait.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_ptrace_wait3.debug		tests-lib-debug		debug,atf,compattestfile
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_ptrace_wait4.debug		tests-lib-debug		debug,atf,compattestfile

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.830 src/distrib/sets/lists/tests/mi:1.831
--- src/distrib/sets/lists/tests/mi:1.830	Tue Feb 11 07:03:16 2020
+++ src/distrib/sets/lists/tests/mi	Fri Mar  6 18:32:35 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.830 2020/02/11 07:03:16 isaki Exp $
+# $NetBSD: mi,v 1.831 2020/03/06 18:32:35 kamil Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -3149,6 +3149,7 @@
 ./usr/tests/lib/libc/sys/t_posix_fadvise	tests-lib-tests		atf,rump
 ./usr/tests/lib/libc/sys/t_posix_fallocate	tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/sys/t_ptrace		tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libc/sys/t_ptrace_sigchld	tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/sys/t_ptrace_wait		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/sys/t_ptrace_wait3		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libc/sys/t_ptrace_wait4		tests-lib-tests		compattestfile,atf

Index: src/tests/lib/libc/sys/Makefile
diff -u src/tests/lib/libc/sys/Makefile:1.60 src/tests/lib/libc/sys/Makefile:1.61
--- src/tests/lib/libc/sys/Makefile:1.60	Sun Mar  1 20:24:07 2020
+++ src/tests/lib/libc/sys/Makefile	Fri Mar  6 18:32:35 2020
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.60 2020/03/01 20:24:07 christos Exp $
+# $NetBSD: Makefile,v 1.61 2020/03/06 18:32:35 kamil Exp $
 
 MKMAN=	no
 
@@ -53,6 +53,7 @@ TESTS_C+=		t_pipe2
 TESTS_C+=		t_poll
 TESTS_C+=		t_posix_fallocate
 TESTS_C+=		t_ptrace
+TESTS_C+=		t_ptrace_sigchld
 TESTS_C+=		t_ptrace_wait
 TESTS_C+=		t_ptrace_wait3
 TESTS_C+=		t_ptrace_wait4
@@ -88,6 +89,8 @@ SRCS.t_mprotect=	t_mprotect.c ${SRCS_EXE
 
 LDADD.t_getpid+=-lpthread
 
+LDADD.t_ptrace_sigchld+=	-pthread -lm
+
 LDADD.t_ptrace_wait+=		-pthread -lm -lelf
 LDADD.t_ptrace_wait3+=		-pthread -lm -lelf
 LDADD.t_ptrace_wait4+=		-pthread -lm -lelf

Added files:

Index: src/tests/lib/libc/sys/t_ptrace_sigchld.c
diff -u /dev/null src/tests/lib/libc/sys/t_ptrace_sigchld.c:1.1
--- /dev/null	Fri Mar  6 18:32:36 2020
+++ src/tests/lib/libc/sys/t_ptrace_sigchld.c	Fri Mar  6 18:32:35 2020
@@ -0,0 +1,502 @@
+/*	$NetBSD: t_ptrace_sigchld.c,v 1.1 2020/03/06 18:32:35 kamil Exp $	*/
+
+/*-
+ * Copyright (c) 2020 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * 

CVS commit: src/tests/lib/libc/sys

2020-03-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Mar  6 17:03:35 UTC 2020

Modified Files:
src/tests/lib/libc/sys: t_ptrace_wait.h

Log Message:
Add await_collected()

This functions waits for collecting a process.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/tests/lib/libc/sys/t_ptrace_wait.h

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

Modified files:

Index: src/tests/lib/libc/sys/t_ptrace_wait.h
diff -u src/tests/lib/libc/sys/t_ptrace_wait.h:1.23 src/tests/lib/libc/sys/t_ptrace_wait.h:1.24
--- src/tests/lib/libc/sys/t_ptrace_wait.h:1.23	Tue Mar  3 17:09:22 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.h	Fri Mar  6 17:03:35 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.h,v 1.23 2020/03/03 17:09:22 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.h,v 1.24 2020/03/06 17:03:35 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -463,6 +463,33 @@ await_stopped_child(pid_t process)
 	return child;
 }
 
+static void __used
+await_collected(pid_t process)
+{
+	struct kinfo_proc2 p;
+	size_t len = sizeof(p);
+
+	const int name[] = {
+		[0] = CTL_KERN,
+		[1] = KERN_PROC2,
+		[2] = KERN_PROC_PID,
+		[3] = process,
+		[4] = sizeof(p),
+		[5] = 1
+	};
+
+	const size_t namelen = __arraycount(name);
+
+	/* Await the process to disappear */
+	while(1) {
+		FORKEE_ASSERT_EQ(sysctl(name, namelen, &p, &len, NULL, 0), 0);
+		if (len == 0)
+			break;
+
+		ATF_REQUIRE(usleep(1000) == 0);
+	}
+}
+
 /* Happy number sequence -- this function is used to just consume cpu cycles */
 #define	HAPPY_NUMBER	1
 



CVS commit: src/tests/lib/libc/sys

2020-03-06 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Mar  6 14:06:56 UTC 2020

Modified Files:
src/tests/lib/libc/sys: msg.h t_ptrace_wait.c

Log Message:
Move macros wrapping functions from msg.h into msg.h

This makes code reusing easier.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/tests/lib/libc/sys/msg.h
cvs rdiff -u -r1.167 -r1.168 src/tests/lib/libc/sys/t_ptrace_wait.c

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

Modified files:

Index: src/tests/lib/libc/sys/msg.h
diff -u src/tests/lib/libc/sys/msg.h:1.2 src/tests/lib/libc/sys/msg.h:1.3
--- src/tests/lib/libc/sys/msg.h:1.2	Tue Mar 13 14:45:36 2018
+++ src/tests/lib/libc/sys/msg.h	Fri Mar  6 14:06:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.h,v 1.2 2018/03/13 14:45:36 kamil Exp $	*/
+/*	$NetBSD: msg.h,v 1.3 2020/03/06 14:06:56 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@ struct msg_fds {
 	} \
 } while (/*CONSTCOND*/ 0)
 
-static int
+static int __used
 msg_open(struct msg_fds *fds)
 {
 	if (pipe(fds->pfd) == -1)
@@ -54,7 +54,7 @@ msg_open(struct msg_fds *fds)
 	return 0;
 }
 
-static void
+static void __used
 msg_close(struct msg_fds *fds)
 {
 	CLOSEFD(fds->pfd[0]);
@@ -63,7 +63,7 @@ msg_close(struct msg_fds *fds)
 	CLOSEFD(fds->cfd[1]);
 }
 
-static int
+static int __used
 msg_write_child(const char *info, struct msg_fds *fds, void *msg, size_t len)
 {
 	ssize_t rv;
@@ -81,7 +81,7 @@ msg_write_child(const char *info, struct
 	return 0;
 }
 
-static int
+static int __used
 msg_write_parent(const char *info, struct msg_fds *fds, void *msg, size_t len)
 {
 	ssize_t rv;
@@ -99,7 +99,7 @@ msg_write_parent(const char *info, struc
 	return 0;
 }
 
-static int
+static int __used
 msg_read_parent(const char *info, struct msg_fds *fds, void *msg, size_t len)
 {
 	ssize_t rv;
@@ -117,7 +117,7 @@ msg_read_parent(const char *info, struct
 	return 0;
 }
 
-static int
+static int __used
 msg_read_child(const char *info, struct msg_fds *fds, void *msg, size_t len)
 {
 	ssize_t rv;
@@ -134,3 +134,19 @@ msg_read_child(const char *info, struct 
 		return 1;
 	return 0;
 }
+
+#define PARENT_TO_CHILD(info, fds, msg) \
+SYSCALL_REQUIRE(msg_write_child(info " to child " # fds, &fds, &msg, \
+	sizeof(msg)) == 0)
+
+#define CHILD_FROM_PARENT(info, fds, msg) \
+FORKEE_ASSERT(msg_read_parent(info " from parent " # fds, &fds, &msg, \
+	sizeof(msg)) == 0)
+
+#define CHILD_TO_PARENT(info, fds, msg) \
+FORKEE_ASSERT(msg_write_parent(info " to parent " # fds, &fds, &msg, \
+	sizeof(msg)) == 0)
+
+#define PARENT_FROM_CHILD(info, fds, msg) \
+SYSCALL_REQUIRE(msg_read_child(info " from parent " # fds, &fds, &msg, \
+	sizeof(msg)) == 0)

Index: src/tests/lib/libc/sys/t_ptrace_wait.c
diff -u src/tests/lib/libc/sys/t_ptrace_wait.c:1.167 src/tests/lib/libc/sys/t_ptrace_wait.c:1.168
--- src/tests/lib/libc/sys/t_ptrace_wait.c:1.167	Sun Mar  1 18:22:00 2020
+++ src/tests/lib/libc/sys/t_ptrace_wait.c	Fri Mar  6 14:06:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_ptrace_wait.c,v 1.167 2020/03/01 18:22:00 kamil Exp $	*/
+/*	$NetBSD: t_ptrace_wait.c,v 1.168 2020/03/06 14:06:56 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2016, 2017, 2018, 2019 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_ptrace_wait.c,v 1.167 2020/03/01 18:22:00 kamil Exp $");
+__RCSID("$NetBSD: t_ptrace_wait.c,v 1.168 2020/03/06 14:06:56 kamil Exp $");
 
 #define __LEGACY_PT_LWPINFO
 
@@ -97,22 +97,6 @@ static_assert(sizeof(((struct ptrace_sta
 #include "t_ptrace_wait.h"
 #include "msg.h"
 
-#define PARENT_TO_CHILD(info, fds, msg) \
-SYSCALL_REQUIRE(msg_write_child(info " to child " # fds, &fds, &msg, \
-	sizeof(msg)) == 0)
-
-#define CHILD_FROM_PARENT(info, fds, msg) \
-FORKEE_ASSERT(msg_read_parent(info " from parent " # fds, &fds, &msg, \
-	sizeof(msg)) == 0)
-
-#define CHILD_TO_PARENT(info, fds, msg) \
-FORKEE_ASSERT(msg_write_parent(info " to parent " # fds, &fds, &msg, \
-	sizeof(msg)) == 0)
-
-#define PARENT_FROM_CHILD(info, fds, msg) \
-SYSCALL_REQUIRE(msg_read_child(info " from parent " # fds, &fds, &msg, \
-	sizeof(msg)) == 0)
-
 #define SYSCALL_REQUIRE(expr) ATF_REQUIRE_MSG(expr, "%s: %s", # expr, \
 strerror(errno))
 #define SYSCALL_REQUIRE_ERRNO(res, exp) ATF_REQUIRE_MSG(res == exp, \



CVS commit: src/sys/net

2020-03-06 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Fri Mar  6 10:26:59 UTC 2020

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

Log Message:
remove unnecessary lock in sppp_mediastatus() as it doesn't touch struct sppp.

ok'ed by yamaguchi@n.o.


To generate a diff of this commit:
cvs rdiff -u -r1.186 -r1.187 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.186 src/sys/net/if_spppsubr.c:1.187
--- src/sys/net/if_spppsubr.c:1.186	Tue Feb  4 05:46:32 2020
+++ src/sys/net/if_spppsubr.c	Fri Mar  6 10:26:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.186 2020/02/04 05:46:32 thorpej Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.187 2020/03/06 10:26:59 knakahara Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.186 2020/02/04 05:46:32 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_spppsubr.c,v 1.187 2020/03/06 10:26:59 knakahara Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -972,11 +972,10 @@ sppp_mediachange(struct ifnet *ifp)
 static void
 sppp_mediastatus(struct ifnet *ifp, struct ifmediareq *imr)
 {
-	struct sppp *sp = (struct sppp *)ifp;
-
-	SPPP_LOCK(sp, RW_WRITER);
+	int link_state;
 
-	switch (ifp->if_link_state) {
+	link_state = atomic_load_relaxed(&ifp->if_link_state);
+	switch (link_state) {
 	case LINK_STATE_UP:
 		imr->ifm_status = IFM_AVALID | IFM_ACTIVE;
 		break;
@@ -988,8 +987,6 @@ sppp_mediastatus(struct ifnet *ifp, stru
 		imr->ifm_status = 0;
 		break;
 	}
-
-	SPPP_UNLOCK(sp);
 }
 
 void