CVS commit: src/sys/miscfs/procfs

2020-04-19 Thread Hisashi T Fujinaka
Module Name:src
Committed By:   htodd
Date:   Mon Apr 20 05:22:28 UTC 2020

Modified Files:
src/sys/miscfs/procfs: procfs_vfsops.c

Log Message:
Sort include files.


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

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

Modified files:

Index: src/sys/miscfs/procfs/procfs_vfsops.c
diff -u src/sys/miscfs/procfs/procfs_vfsops.c:1.106 src/sys/miscfs/procfs/procfs_vfsops.c:1.107
--- src/sys/miscfs/procfs/procfs_vfsops.c:1.106	Mon Apr 20 05:11:00 2020
+++ src/sys/miscfs/procfs/procfs_vfsops.c	Mon Apr 20 05:22:28 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_vfsops.c,v 1.106 2020/04/20 05:11:00 htodd Exp $	*/
+/*	$NetBSD: procfs_vfsops.c,v 1.107 2020/04/20 05:22:28 htodd Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -76,29 +76,29 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.106 2020/04/20 05:11:00 htodd Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.107 2020/04/20 05:22:28 htodd Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
 #endif
 
 #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 
 



CVS commit: src/sys/miscfs/procfs

2020-04-19 Thread Hisashi T Fujinaka
Module Name:src
Committed By:   htodd
Date:   Mon Apr 20 05:11:01 UTC 2020

Modified Files:
src/sys/miscfs/procfs: procfs_vfsops.c

Log Message:
Add missing include to fix build.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/miscfs/procfs/procfs_vfsops.c

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

Modified files:

Index: src/sys/miscfs/procfs/procfs_vfsops.c
diff -u src/sys/miscfs/procfs/procfs_vfsops.c:1.105 src/sys/miscfs/procfs/procfs_vfsops.c:1.106
--- src/sys/miscfs/procfs/procfs_vfsops.c:1.105	Sun Apr 19 20:31:59 2020
+++ src/sys/miscfs/procfs/procfs_vfsops.c	Mon Apr 20 05:11:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: procfs_vfsops.c,v 1.105 2020/04/19 20:31:59 thorpej Exp $	*/
+/*	$NetBSD: procfs_vfsops.c,v 1.106 2020/04/20 05:11:00 htodd Exp $	*/
 
 /*
  * Copyright (c) 1993
@@ -76,7 +76,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.105 2020/04/19 20:31:59 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: procfs_vfsops.c,v 1.106 2020/04/20 05:11:00 htodd Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -98,6 +98,7 @@ __KERNEL_RCSID(0, "$NetBSD: procfs_vfsop
 #include 
 #include 
 #include 
+#include 
 
 #include 
 



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

2020-04-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 20 04:23:24 UTC 2020

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

Log Message:
 Whitespace fix. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.183 -r1.184 src/sys/arch/x86/x86/cpu.c

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

Modified files:

Index: src/sys/arch/x86/x86/cpu.c
diff -u src/sys/arch/x86/x86/cpu.c:1.183 src/sys/arch/x86/x86/cpu.c:1.184
--- src/sys/arch/x86/x86/cpu.c:1.183	Fri Apr 10 14:35:26 2020
+++ src/sys/arch/x86/x86/cpu.c	Mon Apr 20 04:23:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.183 2020/04/10 14:35:26 bouyer Exp $	*/
+/*	$NetBSD: cpu.c,v 1.184 2020/04/20 04:23:23 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.183 2020/04/10 14:35:26 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.184 2020/04/20 04:23:23 msaitoh Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -198,9 +198,9 @@ static vaddr_t cmos_data_mapping;
 struct cpu_info *cpu_starting;
 
 #ifdef MULTIPROCESSOR
-void	cpu_hatch(void *);
-static void	cpu_boot_secondary(struct cpu_info *ci);
-static void	cpu_start_secondary(struct cpu_info *ci);
+void		cpu_hatch(void *);
+static void	cpu_boot_secondary(struct cpu_info *ci);
+static void	cpu_start_secondary(struct cpu_info *ci);
 #if NLAPIC > 0
 static void	cpu_copy_trampoline(paddr_t);
 #endif
@@ -276,7 +276,7 @@ cpu_vm_init(struct cpu_info *ci)
 		cai = >ci_cinfo[i];
 
 		tcolors = atop(cai->cai_totalsize);
-		switch(cai->cai_associativity) {
+		switch (cai->cai_associativity) {
 		case 0xff:
 			tcolors = 1; /* fully associative */
 			break;
@@ -300,7 +300,7 @@ cpu_vm_init(struct cpu_info *ci)
 			}
 			if (picked == 1) {
 panic("desired number of cache colors %d is "
-			  	" > 1, but not even!", ncolors);
+" > 1, but not even!", ncolors);
 			}
 			ncolors = picked;
 		}
@@ -1018,7 +1018,7 @@ cpu_debug_dump(void)
 {
 	struct cpu_info *ci;
 	CPU_INFO_ITERATOR cii;
-	const char sixtyfour64space[] = 
+	const char sixtyfour64space[] =
 #ifdef _LP64
 			   ""
 #endif



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

2020-04-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 20 04:17:52 UTC 2020

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

Log Message:
Whitespace fix. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/arch/x86/x86/identcpu.c

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

Modified files:

Index: src/sys/arch/x86/x86/identcpu.c
diff -u src/sys/arch/x86/x86/identcpu.c:1.105 src/sys/arch/x86/x86/identcpu.c:1.106
--- src/sys/arch/x86/x86/identcpu.c:1.105	Thu Apr  9 02:07:01 2020
+++ src/sys/arch/x86/x86/identcpu.c	Mon Apr 20 04:17:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: identcpu.c,v 1.105 2020/04/09 02:07:01 christos Exp $	*/
+/*	$NetBSD: identcpu.c,v 1.106 2020/04/20 04:17:51 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.105 2020/04/09 02:07:01 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: identcpu.c,v 1.106 2020/04/20 04:17:51 msaitoh Exp $");
 
 #include "opt_xen.h"
 
@@ -62,7 +62,7 @@ __KERNEL_RCSID(0, "$NetBSD: identcpu.c,v
 
 static const struct x86_cache_info intel_cpuid_cache_info[] = INTEL_CACHE_INFO;
 
-static const struct x86_cache_info amd_cpuid_l2l3cache_assoc_info[] = 
+static const struct x86_cache_info amd_cpuid_l2l3cache_assoc_info[] =
 	AMD_L2L3CACHE_INFO;
 
 int cpu_vendor;
@@ -82,7 +82,7 @@ const int i386_nocpuid_cpus[] = {
 	CPUVENDOR_INTEL, CPUCLASS_386,	/* CPU_386SX */
 	CPUVENDOR_INTEL, CPUCLASS_386,	/* CPU_386   */
 	CPUVENDOR_INTEL, CPUCLASS_486,	/* CPU_486SX */
-	CPUVENDOR_INTEL, CPUCLASS_486, 	/* CPU_486   */
+	CPUVENDOR_INTEL, CPUCLASS_486,	/* CPU_486   */
 	CPUVENDOR_CYRIX, CPUCLASS_486,	/* CPU_486DLC */
 	CPUVENDOR_CYRIX, CPUCLASS_486,	/* CPU_6x86 */
 	CPUVENDOR_NEXGEN, CPUCLASS_386,	/* CPU_NX586 */
@@ -174,7 +174,7 @@ cpu_probe_intel_cache(struct cpu_info *c
 	int iterations, i, j;
 	uint8_t desc;
 
-	if (cpuid_level >= 2) { 
+	if (cpuid_level >= 2) {
 		/* Parse the cache info from `cpuid leaf 2', if we have it. */
 		x86_cpuid(2, descs);
 		iterations = descs[0] & 0xff;
@@ -488,7 +488,7 @@ cpu_probe_cyrix_cmn(struct cpu_info *ci)
 	 */
 	cyrix_write_reg(0xc2, cyrix_read_reg(0xc2) | 0x08);
 
-	/* 
+	/*
 	 * Do not disable the TSC on the Geode GX, it's reported to
 	 * work fine.
 	 */
@@ -525,7 +525,7 @@ cpu_probe_winchip(struct cpu_info *ci)
 
 	if (cpu_vendor != CPUVENDOR_IDT ||
 	CPUID_TO_FAMILY(ci->ci_signature) != 5)
-		return;
+		return;
 
 	/* WinChip C6 */
 	if (CPUID_TO_MODEL(ci->ci_signature) == 4)
@@ -556,7 +556,7 @@ cpu_probe_c3(struct cpu_info *ci)
 		 *
 		 * Quoting from page 3-4 of: "VIA Eden ESP Processor Datasheet"
 		 * http://www.via.com.tw/download/mainboards/6/14/Eden20v115.pdf
-		 * 
+		 *
 		 * 1. The CMPXCHG8B instruction is provided and always enabled,
 		 *however, it appears disabled in the corresponding CPUID
 		 *function bit 0 to avoid a bug in an early version of
@@ -646,7 +646,7 @@ cpu_probe_c3(struct cpu_info *ci)
 	if (ci->ci_feat_val[4] & CPUID_VIA_DO_ACE) {
 		msr = rdmsr(MSR_VIA_ACE);
 		wrmsr(MSR_VIA_ACE, msr & ~VIA_ACE_ALTINST);
-	} 
+	}
 
 	/*
 	 * Determine L1 cache/TLB info.
@@ -714,7 +714,7 @@ cpu_probe_geode(struct cpu_info *ci)
 
 	if (memcmp("Geode by NSC", ci->ci_vendor, 12) != 0 ||
 	CPUID_TO_FAMILY(ci->ci_signature) != 5)
-		return;
+		return;
 
 	cpu_probe_cyrix_cmn(ci);
 	cpu_probe_amd_cache(ci);



CVS commit: src/sys/ufs/ufs

2020-04-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 20 03:57:02 UTC 2020

Modified Files:
src/sys/ufs/ufs: ufs_bmap.c

Log Message:
handle negative small block numbers for extattr


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/ufs/ufs/ufs_bmap.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/ufs/ufs/ufs_bmap.c
diff -u src/sys/ufs/ufs/ufs_bmap.c:1.52 src/sys/ufs/ufs/ufs_bmap.c:1.53
--- src/sys/ufs/ufs/ufs_bmap.c:1.52	Sat Mar 18 01:33:06 2017
+++ src/sys/ufs/ufs/ufs_bmap.c	Sun Apr 19 23:57:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs_bmap.c,v 1.52 2017/03/18 05:33:06 riastradh Exp $	*/
+/*	$NetBSD: ufs_bmap.c,v 1.53 2020/04/20 03:57:02 christos Exp $	*/
 
 /*
  * Copyright (c) 1989, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.52 2017/03/18 05:33:06 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ufs_bmap.c,v 1.53 2020/04/20 03:57:02 christos Exp $");
 
 #include 
 #include 
@@ -190,6 +190,13 @@ ufs_bmaparray(struct vnode *vp, daddr_t 
 			}
 		}
 		return (0);
+	} else if (bn < 0 && bn >= -UFS_NXADDR) {
+		KASSERT(ump->um_fstype == UFS2);
+		daddr = ufs_rw64(ip->i_ffs2_extb[-1 - bn], UFS_MPNEEDSWAP(ump));
+		*bnp = blkptrtodb(ump, daddr);
+		if (*bnp == 0)
+			*bnp = -1;
+		return 0;
 	}
 
 	xap = ap == NULL ? a : ap;



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

2020-04-19 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Apr 20 03:00:33 UTC 2020

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

Log Message:
 Fix typo to make compilable.


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/arch/xen/xen/xbdback_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/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.80 src/sys/arch/xen/xen/xbdback_xenbus.c:1.81
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.80	Sun Apr 19 20:53:20 2020
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Mon Apr 20 03:00:33 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbdback_xenbus.c,v 1.80 2020/04/19 20:53:20 jdolecek Exp $  */
+/*  $NetBSD: xbdback_xenbus.c,v 1.81 2020/04/20 03:00:33 msaitoh Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.80 2020/04/19 20:53:20 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.81 2020/04/20 03:00:33 msaitoh Exp $");
 
 #include 
 #include 
@@ -1580,7 +1580,7 @@ xbdback_co_do_io(struct xbdback_instance
 	case BLKIF_OP_READ:
 	case BLKIF_OP_WRITE:
 		start_offset = (vaddr_t)xbd_io->xio_buf.b_data;
-		KASSERT(xbd_io->xio_buf.b_bcount + start_offset < VDB_VA_SIZE);
+		KASSERT(xbd_io->xio_buf.b_bcount + start_offset < VBD_VA_SIZE);
 		xbd_io->xio_buf.b_data = (void *)
 		(start_offset + xbd_io->xio_vaddr);
 #ifdef DIAGNOSTIC



CVS commit: src/sys/arch/sparc/stand/ofwboot

2020-04-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Apr 20 02:04:44 UTC 2020

Modified Files:
src/sys/arch/sparc/stand/ofwboot: Makefile

Log Message:
More -Wno-error=address-of-packed-member to placate clang.


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/sparc/stand/ofwboot/Makefile

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

Modified files:

Index: src/sys/arch/sparc/stand/ofwboot/Makefile
diff -u src/sys/arch/sparc/stand/ofwboot/Makefile:1.38 src/sys/arch/sparc/stand/ofwboot/Makefile:1.39
--- src/sys/arch/sparc/stand/ofwboot/Makefile:1.38	Sat Apr  8 19:53:23 2017
+++ src/sys/arch/sparc/stand/ofwboot/Makefile	Mon Apr 20 02:04:44 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.38 2017/04/08 19:53:23 christos Exp $
+#	$NetBSD: Makefile,v 1.39 2020/04/20 02:04:44 riastradh Exp $
 
 .include 
 
@@ -38,6 +38,11 @@ CPPFLAGS+=	-DSUPPORT_DHCP
 #CPPFLAGS+=	-DNETIF_DEBUG 
 #CPPFLAGS+=	-D_DEBUG
 
+# Follow the suit of Makefile.kern.inc; needed for the lfs64 union
+# accessors -- they don't actually dereference the resulting pointer,
+# just use it for type-checking.
+CWARNFLAGS.clang+=	-Wno-error=address-of-packed-member
+
 LINKS+=		${BINDIR}/ofwboot ${BINDIR}/ofwboot.net
 
 NOMAN=		# defined



CVS commit: src/usr.bin/kdump

2020-04-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 20 00:35:42 UTC 2020

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

Log Message:
Understand xattr ktruser records


To generate a diff of this commit:
cvs rdiff -u -r1.136 -r1.137 src/usr.bin/kdump/kdump.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/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.136 src/usr.bin/kdump/kdump.c:1.137
--- src/usr.bin/kdump/kdump.c:1.136	Fri Apr  3 02:13:07 2020
+++ src/usr.bin/kdump/kdump.c	Sun Apr 19 20:35:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.136 2020/04/03 06:13:07 wiz Exp $	*/
+/*	$NetBSD: kdump.c,v 1.137 2020/04/20 00:35:41 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.136 2020/04/03 06:13:07 wiz Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.137 2020/04/20 00:35:41 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -1213,6 +1213,36 @@ ktruser_soname(const char *name, const v
 }
 
 static void
+ktruser_xattr_name(const char *name, const void *buf, size_t len)
+{
+	printf("%.*s: [%*s]\n", KTR_USER_MAXIDLEN, name, (int)len,
+	(const char *)buf);
+}
+
+static void
+ktruser_xattr_val(const char *name, const void *buf, size_t len)
+{
+	const uint8_t *p = buf;
+	printf("%.*s: ", KTR_USER_MAXIDLEN, name);
+	for (size_t i = 0; i < len; i++)
+		printf("%.2x", *p++);
+	printf("\n");
+}
+
+static void
+ktruser_xattr_list(const char *name, const void *buf, size_t len)
+{
+	const uint8_t *p = buf, *ep = p + len;
+	printf("%.*s:", KTR_USER_MAXIDLEN, name);
+	while (p < ep) {
+		int l = *p++;
+		printf(" %.*s", l, p);
+		p += l;
+	}
+	printf("\n");
+}
+
+static void
 ktruser_control(const char *name, const void *buf, size_t len)
 {
 	struct cmsghdr m;
@@ -1266,6 +1296,9 @@ static struct {
 	{ "mbsoname", ktruser_soname },
 	{ "mbcontrol", ktruser_control },
 	{ "malloc", ktruser_malloc },
+	{ "xattr-name", ktruser_xattr_name },
+	{ "xattr-val", ktruser_xattr_val },
+	{ "xattr-list", ktruser_xattr_list },
 	{ NULL,	ktruser_misc },
 };
 



CVS commit: src/sys/kern

2020-04-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr 20 00:34:58 UTC 2020

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

Log Message:
Fix the ktrace calls, the data is in user space.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/kern/vfs_xattr.c

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

Modified files:

Index: src/sys/kern/vfs_xattr.c
diff -u src/sys/kern/vfs_xattr.c:1.33 src/sys/kern/vfs_xattr.c:1.34
--- src/sys/kern/vfs_xattr.c:1.33	Fri Sep  5 05:20:59 2014
+++ src/sys/kern/vfs_xattr.c	Sun Apr 19 20:34:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_xattr.c,v 1.33 2014/09/05 09:20:59 matt Exp $	*/
+/*	$NetBSD: vfs_xattr.c,v 1.34 2020/04/20 00:34:58 christos Exp $	*/
 
 /*-
  * Copyright (c) 2005, 2008 The NetBSD Foundation, Inc.
@@ -68,7 +68,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_xattr.c,v 1.33 2014/09/05 09:20:59 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_xattr.c,v 1.34 2020/04/20 00:34:58 christos Exp $");
 
 #include 
 #include 
@@ -251,7 +251,7 @@ extattr_set_vp(struct vnode *vp, int att
 	cnt = nbytes;
 
 	ktrkuser("xattr-name", (void *)__UNCONST(attrname), strlen(attrname));
-	ktrkuser("xattr-val", __UNCONST(data), nbytes);
+	ktruser("xattr-val", __UNCONST(data), nbytes, 0);
 
 	error = VOP_SETEXTATTR(vp, attrnamespace, attrname, , l->l_cred);
 	cnt -= auio.uio_resid;
@@ -314,7 +314,7 @@ extattr_get_vp(struct vnode *vp, int att
 		cnt -= auio.uio_resid;
 		retval[0] = cnt;
 
-		ktrkuser("xattr-val", data, cnt);
+		ktruser("xattr-val", data, cnt, 0);
 	} else
 		retval[0] = size;
 
@@ -392,7 +392,7 @@ extattr_list_vp(struct vnode *vp, int at
 		cnt -= auio.uio_resid;
 		retval[0] = cnt;
 
-		ktrkuser("xattr-list", data, cnt);
+		ktruser("xattr-list", data, cnt, 0);
 	} else
 		retval[0] = size;
 



CVS commit: src/sys/kern

2020-04-19 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Apr 19 23:05:05 UTC 2020

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

Log Message:
lwp_wait(): don't need to check for process exit, cv_wait_sig() does it.


To generate a diff of this commit:
cvs rdiff -u -r1.233 -r1.234 src/sys/kern/kern_lwp.c

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

Modified files:

Index: src/sys/kern/kern_lwp.c
diff -u src/sys/kern/kern_lwp.c:1.233 src/sys/kern/kern_lwp.c:1.234
--- src/sys/kern/kern_lwp.c:1.233	Sat Apr  4 20:20:12 2020
+++ src/sys/kern/kern_lwp.c	Sun Apr 19 23:05:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_lwp.c,v 1.233 2020/04/04 20:20:12 thorpej Exp $	*/
+/*	$NetBSD: kern_lwp.c,v 1.234 2020/04/19 23:05:04 ad Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2006, 2007, 2008, 2009, 2019, 2020
@@ -211,7 +211,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.233 2020/04/04 20:20:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_lwp.c,v 1.234 2020/04/19 23:05:04 ad Exp $");
 
 #include "opt_ddb.h"
 #include "opt_lockdebug.h"
@@ -740,13 +740,11 @@ lwp_wait(struct lwp *l, lwpid_t lid, lwp
 		}
 
 		/*
-		 * Break out if the process is exiting, or if all LWPs are
-		 * in _lwp_wait().  There are other ways to hang the process
-		 * with _lwp_wait(), but the sleep is interruptable so
-		 * little point checking for them.
+		 * Break out if all LWPs are in _lwp_wait().  There are
+		 * other ways to hang the process with _lwp_wait(), but the
+		 * sleep is interruptable so little point checking for them.
 		 */
-		if ((p->p_sflag & PS_WEXIT) != 0 ||
-		p->p_nlwpwait == p->p_nlwps) {
+		if (p->p_nlwpwait == p->p_nlwps) {
 			error = EDEADLK;
 			break;
 		}



CVS commit: src/usr.sbin/postinstall

2020-04-19 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Apr 19 22:10:24 UTC 2020

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

Log Message:
postinstall: ensure contents_owner fix fails on find errors

The issue is that find won't pass anything to xargs and that returns 0.
So replace the usage of xargs with -exec.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 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.19 src/usr.sbin/postinstall/postinstall.in:1.20
--- src/usr.sbin/postinstall/postinstall.in:1.19	Thu Apr  9 15:24:31 2020
+++ src/usr.sbin/postinstall/postinstall.in	Sun Apr 19 22:10:24 2020
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall.in,v 1.19 2020/04/09 15:24:31 roy Exp $
+# $NetBSD: postinstall.in,v 1.20 2020/04/19 22:10:24 roy Exp $
 #
 # Copyright (c) 2002-2015 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -750,8 +750,8 @@ contents_owner()
 		fi
 	elif [ "${_op}" = "fix" ]; then
 		find "${_dir}" \( \( ! -user "${_user}" \) -o \
-		\( ! -group "${_grp}" \) \) -a -print0 \
-		| xargs -0 chown "${_user}:${_grp}"
+		\( ! -group "${_grp}" \) \) \
+		-exec chown "${_user}:${_grp}" -- {} \;
 	fi
 }
 



CVS commit: src/sys/kern

2020-04-19 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Apr 19 21:55:37 UTC 2020

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

Log Message:
comment


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/kern/subr_vmem.c

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

Modified files:

Index: src/sys/kern/subr_vmem.c
diff -u src/sys/kern/subr_vmem.c:1.101 src/sys/kern/subr_vmem.c:1.102
--- src/sys/kern/subr_vmem.c:1.101	Sun Apr 19 21:11:42 2020
+++ src/sys/kern/subr_vmem.c	Sun Apr 19 21:55:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_vmem.c,v 1.101 2020/04/19 21:11:42 ad Exp $	*/
+/*	$NetBSD: subr_vmem.c,v 1.102 2020/04/19 21:55:37 ad Exp $	*/
 
 /*-
  * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi,
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.101 2020/04/19 21:11:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.102 2020/04/19 21:55:37 ad Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -920,7 +920,7 @@ vmem_fit(const bt_t *bt, vmem_size_t siz
 /*  vmem API */
 
 /*
- * vmem_create_internal: creates a vmem arena.
+ * vmem_init: creates a vmem arena.
  */
 
 vmem_t *



CVS commit: src/sys/uvm

2020-04-19 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Apr 19 21:53:38 UTC 2020

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

Log Message:
uvm_aio_aiodone_pages(): only call uvm_pageout_done() if work was done for
the page daemon.


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

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

Modified files:

Index: src/sys/uvm/uvm_pager.c
diff -u src/sys/uvm/uvm_pager.c:1.124 src/sys/uvm/uvm_pager.c:1.125
--- src/sys/uvm/uvm_pager.c:1.124	Tue Apr  7 19:15:23 2020
+++ src/sys/uvm/uvm_pager.c	Sun Apr 19 21:53:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_pager.c,v 1.124 2020/04/07 19:15:23 ad Exp $	*/
+/*	$NetBSD: uvm_pager.c,v 1.125 2020/04/19 21:53:38 ad Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.124 2020/04/07 19:15:23 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_pager.c,v 1.125 2020/04/19 21:53:38 ad Exp $");
 
 #include "opt_uvmhist.h"
 #include "opt_readahead.h"
@@ -487,7 +487,9 @@ uvm_aio_aiodone_pages(struct vm_page **p
 		}
 #endif /* defined(VMSWAP) */
 	}
-	uvm_pageout_done(pageout_done);
+	if (pageout_done != 0) {
+		uvm_pageout_done(pageout_done);
+	}
 	if (!swap) {
 		uvm_page_unbusy(pgs, npages);
 		rw_exit(slock);



CVS commit: src/sys/compat/ossaudio

2020-04-19 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sun Apr 19 21:37:00 UTC 2020

Modified Files:
src/sys/compat/ossaudio: ossaudio.c

Log Message:
ossaudio: Avoid giving userland uninitialized memory. Noticed by maxv.

The uninitalized field in this structure is `fillers`, an array that
simply reserves space for later changes in OSSv4, which this version
of the OSS compat layer (specifically for Linux applications) makes no
effort to implement.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/compat/ossaudio/ossaudio.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/ossaudio/ossaudio.c
diff -u src/sys/compat/ossaudio/ossaudio.c:1.82 src/sys/compat/ossaudio/ossaudio.c:1.83
--- src/sys/compat/ossaudio/ossaudio.c:1.82	Sun Apr 19 13:44:51 2020
+++ src/sys/compat/ossaudio/ossaudio.c	Sun Apr 19 21:37:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.82 2020/04/19 13:44:51 nia Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.83 2020/04/19 21:37:00 nia Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.82 2020/04/19 13:44:51 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.83 2020/04/19 21:37:00 nia Exp $");
 
 #include 
 #include 
@@ -1103,6 +1103,7 @@ oss_ioctl_mixer(struct lwp *lwp, const s
 			__func__, error));
 			goto out;
 		}
+		memset(, 0, sizeof omi);
 		omi.modify_counter = 1;
 		strncpy(omi.id, adev.name, sizeof omi.id);
 		strncpy(omi.name, adev.name, sizeof omi.name);



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

2020-04-19 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Apr 19 21:24:36 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
PR port-arm/55186: tests crash arm pmap

pmap_clearbit(): take execbits into account in the fastpath.


To generate a diff of this commit:
cvs rdiff -u -r1.410 -r1.411 src/sys/arch/arm/arm32/pmap.c

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

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.410 src/sys/arch/arm/arm32/pmap.c:1.411
--- src/sys/arch/arm/arm32/pmap.c:1.410	Sun Apr 19 19:36:49 2020
+++ src/sys/arch/arm/arm32/pmap.c	Sun Apr 19 21:24:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.410 2020/04/19 19:36:49 kre Exp $	*/
+/*	$NetBSD: pmap.c,v 1.411 2020/04/19 21:24:36 ad Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -192,7 +192,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.410 2020/04/19 19:36:49 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.411 2020/04/19 21:24:36 ad Exp $");
 
 #include 
 #include 
@@ -2376,7 +2376,7 @@ pmap_clearbit(struct vm_page_md *md, pad
 		/*
 		 * Anything to do?
 		 */
-		if ((oflags & maskbits) == 0) {
+		if ((oflags & maskbits) == 0 && execbits == 0) {
 			pv = SLIST_NEXT(pv, pv_link);
 			continue;
 		}



CVS commit: src/sys

2020-04-19 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Apr 19 21:11:43 UTC 2020

Modified Files:
src/sys/kern: subr_vmem.c
src/sys/sys: vmem_impl.h

Log Message:
- Fix uneven performance with "bursty" vmem arenas.  Adjust locking so that
  the mutex is acquired and released only once in the happy path.  Align
  tags to cachelines.  Size the hash table according to the maximum count of
  boundary tags over the interval just gone, not the instantaneous count,
  and decay that maximum value by 50%+1 after each rehash.  Round up to the
  next power of two to eliminate divisions.  Do the rehash check unlocked.

- Hash bucket size is sizeof(vmem_hashlist), not size of a pointer to same.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/kern/subr_vmem.c
cvs rdiff -u -r1.3 -r1.4 src/sys/sys/vmem_impl.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/subr_vmem.c
diff -u src/sys/kern/subr_vmem.c:1.100 src/sys/kern/subr_vmem.c:1.101
--- src/sys/kern/subr_vmem.c:1.100	Sat Dec 21 14:50:34 2019
+++ src/sys/kern/subr_vmem.c	Sun Apr 19 21:11:42 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_vmem.c,v 1.100 2019/12/21 14:50:34 ad Exp $	*/
+/*	$NetBSD: subr_vmem.c,v 1.101 2020/04/19 21:11:42 ad Exp $	*/
 
 /*-
  * Copyright (c)2006,2007,2008,2009 YAMAMOTO Takashi,
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.100 2019/12/21 14:50:34 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_vmem.c,v 1.101 2020/04/19 21:11:42 ad Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -205,6 +205,7 @@ vmem_kick_pdaemon(void)
 /*  boundary tag */
 
 static int bt_refill(vmem_t *vm);
+static int bt_refill_locked(vmem_t *vm);
 
 static void *
 pool_page_alloc_vmem_meta(struct pool *pp, int flags)
@@ -234,13 +235,13 @@ struct pool_allocator pool_allocator_vme
 };
 
 static int
-bt_refill(vmem_t *vm)
+bt_refill_locked(vmem_t *vm)
 {
 	bt_t *bt;
 
-	VMEM_LOCK(vm);
+	VMEM_ASSERT_LOCKED(vm);
+
 	if (vm->vm_nfreetags > BT_MINRESERVE) {
-		VMEM_UNLOCK(vm);
 		return 0;
 	}
 
@@ -269,29 +270,40 @@ bt_refill(vmem_t *vm)
 	}
 
 	if (vm->vm_nfreetags <= BT_MINRESERVE) {
-		VMEM_UNLOCK(vm);
 		return ENOMEM;
 	}
 
-	VMEM_UNLOCK(vm);
-
 	if (kmem_meta_arena != NULL) {
+		VMEM_UNLOCK(vm);
 		(void)bt_refill(kmem_arena);
 		(void)bt_refill(kmem_va_meta_arena);
 		(void)bt_refill(kmem_meta_arena);
+		VMEM_LOCK(vm);
 	}
 
 	return 0;
 }
 
+static int
+bt_refill(vmem_t *vm)
+{
+	int rv;
+
+	VMEM_LOCK(vm);
+	rv = bt_refill_locked(vm);
+	VMEM_UNLOCK(vm);
+	return rv;
+}
+
 static bt_t *
 bt_alloc(vmem_t *vm, vm_flag_t flags)
 {
 	bt_t *bt;
-	VMEM_LOCK(vm);
+
+	VMEM_ASSERT_LOCKED(vm);
+
 	while (vm->vm_nfreetags <= BT_MINRESERVE && (flags & VM_POPULATING) == 0) {
-		VMEM_UNLOCK(vm);
-		if (bt_refill(vm)) {
+		if (bt_refill_locked(vm)) {
 			if ((flags & VM_NOSLEEP) != 0) {
 return NULL;
 			}
@@ -306,14 +318,12 @@ bt_alloc(vmem_t *vm, vm_flag_t flags)
 			 */
 
 			vmem_kick_pdaemon();
-			kpause("btalloc", false, 1, NULL);
+			kpause("btalloc", false, 1, >vm_lock);
 		}
-		VMEM_LOCK(vm);
 	}
 	bt = LIST_FIRST(>vm_freetags);
 	LIST_REMOVE(bt, bt_freelist);
 	vm->vm_nfreetags--;
-	VMEM_UNLOCK(vm);
 
 	return bt;
 }
@@ -322,10 +332,10 @@ static void
 bt_free(vmem_t *vm, bt_t *bt)
 {
 
-	VMEM_LOCK(vm);
+	VMEM_ASSERT_LOCKED(vm);
+
 	LIST_INSERT_HEAD(>vm_freetags, bt, bt_freelist);
 	vm->vm_nfreetags++;
-	VMEM_UNLOCK(vm);
 }
 
 static void
@@ -334,9 +344,10 @@ bt_freetrim(vmem_t *vm, int freelimit)
 	bt_t *t;
 	LIST_HEAD(, vmem_btag) tofree;
 
+	VMEM_ASSERT_LOCKED(vm);
+
 	LIST_INIT();
 
-	VMEM_LOCK(vm);
 	while (vm->vm_nfreetags > freelimit) {
 		bt_t *bt = LIST_FIRST(>vm_freetags);
 		LIST_REMOVE(bt, bt_freelist);
@@ -423,7 +434,7 @@ bt_hashhead(vmem_t *vm, vmem_addr_t addr
 	unsigned int hash;
 
 	hash = hash32_buf(, sizeof(addr), HASH32_BUF_INIT);
-	list = >vm_hashlist[hash % vm->vm_hashsize];
+	list = >vm_hashlist[hash & vm->vm_hashmask];
 
 	return list;
 }
@@ -463,7 +474,9 @@ bt_insbusy(vmem_t *vm, bt_t *bt)
 
 	list = bt_hashhead(vm, bt->bt_start);
 	LIST_INSERT_HEAD(list, bt, bt_hashlist);
-	vm->vm_nbusytag++;
+	if (++vm->vm_nbusytag > vm->vm_maxbusytag) {
+		vm->vm_maxbusytag = vm->vm_nbusytag;
+	}
 	vm->vm_inuse += bt->bt_size;
 }
 
@@ -676,8 +689,8 @@ vmem_subsystem_init(vmem_t *vm)
 	uvm_km_kmem_alloc, uvm_km_kmem_free, kmem_va_meta_arena,
 	0, VM_NOSLEEP | VM_BOOTSTRAP, IPL_VM);
 
-	pool_init(_btag_pool, sizeof(bt_t), 0, 0, PR_PHINPAGE,
-		"vmembt", _allocator_vmem_meta, IPL_VM);
+	pool_init(_btag_pool, sizeof(bt_t), coherency_unit, 0,
+	PR_PHINPAGE, "vmembt", _allocator_vmem_meta, IPL_VM);
 }
 #endif /* defined(_KERNEL) */
 
@@ -688,6 +701,7 @@ vmem_add1(vmem_t *vm, vmem_addr_t addr, 
 	bt_t *btspan;
 	bt_t *btfree;
 
+	VMEM_ASSERT_LOCKED(vm);
 	KASSERT((flags & (VM_SLEEP|VM_NOSLEEP)) != 0);
 	KASSERT((~flags & (VM_SLEEP|VM_NOSLEEP)) 

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

2020-04-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Apr 19 20:53:20 UTC 2020

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

Log Message:
SLIST_INIT() xbdi->xbdi_va_free just for clarity


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/arch/xen/xen/xbdback_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/xbdback_xenbus.c
diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.79 src/sys/arch/xen/xen/xbdback_xenbus.c:1.80
--- src/sys/arch/xen/xen/xbdback_xenbus.c:1.79	Sun Apr 19 18:47:40 2020
+++ src/sys/arch/xen/xen/xbdback_xenbus.c	Sun Apr 19 20:53:20 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbdback_xenbus.c,v 1.79 2020/04/19 18:47:40 jdolecek Exp $  */
+/*  $NetBSD: xbdback_xenbus.c,v 1.80 2020/04/19 20:53:20 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.79 2020/04/19 18:47:40 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.80 2020/04/19 20:53:20 jdolecek Exp $");
 
 #include 
 #include 
@@ -449,6 +449,7 @@ xbdback_xenbus_create(struct xenbus_devi
 	xbusd->xbusd_otherend_changed = xbdback_frontend_changed;
 	xbdi->xbdi_xbusd = xbusd;
 
+	SLIST_INIT(>xbdi_va_free);
 	for (i = 0; i < BLKIF_RING_SIZE; i++) {
 		xbdi->xbdi_va[i].xv_vaddr = uvm_km_alloc(kernel_map,
 		VBD_VA_SIZE, 0, UVM_KMF_VAONLY|UVM_KMF_WAITVA);



CVS commit: src/lib/libpthread

2020-04-19 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Apr 19 20:47:04 UTC 2020

Modified Files:
src/lib/libpthread: pthread_tsd.c

Log Message:
Improve TSD behavior

Optimistically check whether the key has been used by this thread
already and avoid locking in that case. This avoids the atomic operation
in the hot path. When the value is set to non-NULL for the first time,
put the entry on the to-be-freed list and keep it their until
destruction or thread exit. Setting the key to NULL and back is common
enough and updating the list is more expensive than the extra check on
the final round.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/lib/libpthread/pthread_tsd.c

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

Modified files:

Index: src/lib/libpthread/pthread_tsd.c
diff -u src/lib/libpthread/pthread_tsd.c:1.21 src/lib/libpthread/pthread_tsd.c:1.22
--- src/lib/libpthread/pthread_tsd.c:1.21	Sun Apr 19 20:46:04 2020
+++ src/lib/libpthread/pthread_tsd.c	Sun Apr 19 20:47:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_tsd.c,v 1.21 2020/04/19 20:46:04 joerg Exp $	*/
+/*	$NetBSD: pthread_tsd.c,v 1.22 2020/04/19 20:47:03 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_tsd.c,v 1.21 2020/04/19 20:46:04 joerg Exp $");
+__RCSID("$NetBSD: pthread_tsd.c,v 1.22 2020/04/19 20:47:03 joerg Exp $");
 
 /* Functions and structures dealing with thread-specific data */
 #include 
@@ -173,14 +173,17 @@ pthread_key_create(pthread_key_t *key, v
  * elements. When an element is used it is inserted into the appropriate
  * key bucket of pthread__tsd_list. This means that ptqe_prev == NULL,
  * means that the element is not threaded, ptqe_prev != NULL it is
- * already part of the list. When we set to a NULL value we delete from the
- * list if it was in the list, and when we set to non-NULL value, we insert
- * in the list if it was not already there.
+ * already part of the list. If a key is set to a non-NULL value for the
+ * first time, it is added to the list.
  *
  * We keep this global array of lists of threads that have called
  * pthread_set_specific with non-null values, for each key so that
  * we don't have to check all threads for non-NULL values in
- * pthread_key_destroy
+ * pthread_key_destroy.
+ *
+ * The assumption here is that a concurrent pthread_key_delete is already
+ * undefined behavior. The mutex is taken only once per thread/key
+ * combination.
  *
  * We could keep an accounting of the number of specific used
  * entries per thread, so that we can update pt_havespecific when we delete
@@ -193,21 +196,15 @@ pthread__add_specific(pthread_t self, pt
 
 	pthread__assert(key >= 0 && key < pthread_keys_max);
 
-	pthread_mutex_lock(_mutex);
 	pthread__assert(pthread__tsd_destructors[key] != NULL);
 	pt = >pt_specific[key];
 	self->pt_havespecific = 1;
-	if (value) {
-		if (pt->pts_next.ptqe_prev == NULL)
-			PTQ_INSERT_HEAD(__tsd_list[key], pt, pts_next);
-	} else {
-		if (pt->pts_next.ptqe_prev != NULL) {
-			PTQ_REMOVE(__tsd_list[key], pt, pts_next);
-			pt->pts_next.ptqe_prev = NULL;
-		}
+	if (value && !pt->pts_next.ptqe_prev) {
+		pthread_mutex_lock(_mutex);
+		PTQ_INSERT_HEAD(__tsd_list[key], pt, pts_next);
+		pthread_mutex_unlock(_mutex);
 	}
 	pt->pts_value = __UNCONST(value);
-	pthread_mutex_unlock(_mutex);
 
 	return 0;
 }
@@ -373,7 +370,7 @@ pthread__destroy_tsd(pthread_t self)
 destructor = NULL;
 
 			pthread_mutex_unlock(_mutex);
-			if (destructor != NULL) {
+			if (destructor != NULL && val != NULL) {
 done = 0;
 (*destructor)(val);
 			}



CVS commit: src/lib/libpthread

2020-04-19 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sun Apr 19 20:46:04 UTC 2020

Modified Files:
src/lib/libpthread: pthread_tsd.c

Log Message:
Reinit TSD mutex in the child to avoid issues with former waiters


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/lib/libpthread/pthread_tsd.c

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

Modified files:

Index: src/lib/libpthread/pthread_tsd.c
diff -u src/lib/libpthread/pthread_tsd.c:1.20 src/lib/libpthread/pthread_tsd.c:1.21
--- src/lib/libpthread/pthread_tsd.c:1.20	Sun Feb 16 17:45:11 2020
+++ src/lib/libpthread/pthread_tsd.c	Sun Apr 19 20:46:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread_tsd.c,v 1.20 2020/02/16 17:45:11 kamil Exp $	*/
+/*	$NetBSD: pthread_tsd.c,v 1.21 2020/04/19 20:46:04 joerg Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pthread_tsd.c,v 1.20 2020/02/16 17:45:11 kamil Exp $");
+__RCSID("$NetBSD: pthread_tsd.c,v 1.21 2020/04/19 20:46:04 joerg Exp $");
 
 /* Functions and structures dealing with thread-specific data */
 #include 
@@ -73,6 +73,12 @@ pthread_tsd_postfork(void)
 	pthread_mutex_unlock(_mutex);
 }
 
+static void
+pthread_tsd_postfork_child(void)
+{
+	pthread_mutex_init(_mutex, NULL);
+}
+
 void *
 pthread_tsd_init(size_t *tlen)
 {
@@ -80,7 +86,7 @@ pthread_tsd_init(size_t *tlen)
 	size_t alen;
 	char *arena;
 
-	pthread_atfork(pthread_tsd_prefork, pthread_tsd_postfork, pthread_tsd_postfork);
+	pthread_atfork(pthread_tsd_prefork, pthread_tsd_postfork, pthread_tsd_postfork_child);
 
 	if ((pkm = pthread__getenv("PTHREAD_KEYS_MAX")) != NULL) {
 		pthread_keys_max = (int)strtol(pkm, NULL, 0);



CVS commit: src/sys/rump/librump/rumpkern

2020-04-19 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Apr 19 20:41:31 UTC 2020

Modified Files:
src/sys/rump/librump/rumpkern: sleepq.c

Log Message:
good grief..


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/rump/librump/rumpkern/sleepq.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/rump/librump/rumpkern/sleepq.c
diff -u src/sys/rump/librump/rumpkern/sleepq.c:1.18 src/sys/rump/librump/rumpkern/sleepq.c:1.19
--- src/sys/rump/librump/rumpkern/sleepq.c:1.18	Thu Mar 26 22:40:10 2020
+++ src/sys/rump/librump/rumpkern/sleepq.c	Sun Apr 19 20:41:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sleepq.c,v 1.18 2020/03/26 22:40:10 ad Exp $	*/
+/*	$NetBSD: sleepq.c,v 1.19 2020/04/19 20:41:30 ad Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.18 2020/03/26 22:40:10 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.19 2020/04/19 20:41:30 ad Exp $");
 
 #include 
 #include 
@@ -62,7 +62,8 @@ sleepq_init(sleepq_t *sq)
 }
 
 void
-sleepq_enqueue(sleepq_t *sq, wchan_t wc, const char *wmsg, syncobj_t *sob)
+sleepq_enqueue(sleepq_t *sq, wchan_t wc, const char *wmsg, syncobj_t *sob,
+bool catch_p)
 {
 	struct lwp *l = curlwp;
 



CVS commit: src/sys

2020-04-19 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Apr 19 20:35:29 UTC 2020

Modified Files:
src/sys/kern: kern_condvar.c kern_sleepq.c kern_synch.c kern_timeout.c
kern_turnstile.c sys_lwp.c sys_select.c
src/sys/sys: sleepq.h

Log Message:
Set LW_SINTR earlier so it doesn't pose a problem for doing interruptable
waits with turnstiles (not currently done).


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/kern/kern_condvar.c
cvs rdiff -u -r1.65 -r1.66 src/sys/kern/kern_sleepq.c
cvs rdiff -u -r1.346 -r1.347 src/sys/kern/kern_synch.c
cvs rdiff -u -r1.60 -r1.61 src/sys/kern/kern_timeout.c
cvs rdiff -u -r1.38 -r1.39 src/sys/kern/kern_turnstile.c
cvs rdiff -u -r1.76 -r1.77 src/sys/kern/sys_lwp.c
cvs rdiff -u -r1.53 -r1.54 src/sys/kern/sys_select.c
cvs rdiff -u -r1.28 -r1.29 src/sys/sys/sleepq.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_condvar.c
diff -u src/sys/kern/kern_condvar.c:1.46 src/sys/kern/kern_condvar.c:1.47
--- src/sys/kern/kern_condvar.c:1.46	Mon Apr 13 15:54:45 2020
+++ src/sys/kern/kern_condvar.c	Sun Apr 19 20:35:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_condvar.c,v 1.46 2020/04/13 15:54:45 maxv Exp $	*/
+/*	$NetBSD: kern_condvar.c,v 1.47 2020/04/19 20:35:29 ad Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.46 2020/04/13 15:54:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.47 2020/04/19 20:35:29 ad Exp $");
 
 #include 
 #include 
@@ -116,7 +116,7 @@ cv_destroy(kcondvar_t *cv)
  *	condition variable, and increment the number of waiters.
  */
 static inline void
-cv_enter(kcondvar_t *cv, kmutex_t *mtx, lwp_t *l)
+cv_enter(kcondvar_t *cv, kmutex_t *mtx, lwp_t *l, bool catch_p)
 {
 	sleepq_t *sq;
 	kmutex_t *mp;
@@ -129,7 +129,7 @@ cv_enter(kcondvar_t *cv, kmutex_t *mtx, 
 	mp = sleepq_hashlock(cv);
 	sq = CV_SLEEPQ(cv);
 	sleepq_enter(sq, l, mp);
-	sleepq_enqueue(sq, cv, CV_WMESG(cv), _syncobj);
+	sleepq_enqueue(sq, cv, CV_WMESG(cv), _syncobj, catch_p);
 	mutex_exit(mtx);
 	KASSERT(cv_has_waiters(cv));
 }
@@ -169,7 +169,7 @@ cv_wait(kcondvar_t *cv, kmutex_t *mtx)
 
 	KASSERT(mutex_owned(mtx));
 
-	cv_enter(cv, mtx, l);
+	cv_enter(cv, mtx, l, false);
 	(void)sleepq_block(0, false);
 	mutex_enter(mtx);
 }
@@ -190,7 +190,7 @@ cv_wait_sig(kcondvar_t *cv, kmutex_t *mt
 
 	KASSERT(mutex_owned(mtx));
 
-	cv_enter(cv, mtx, l);
+	cv_enter(cv, mtx, l, true);
 	error = sleepq_block(0, true);
 	mutex_enter(mtx);
 	return error;
@@ -213,7 +213,7 @@ cv_timedwait(kcondvar_t *cv, kmutex_t *m
 
 	KASSERT(mutex_owned(mtx));
 
-	cv_enter(cv, mtx, l);
+	cv_enter(cv, mtx, l, false);
 	error = sleepq_block(timo, false);
 	mutex_enter(mtx);
 	return error;
@@ -238,7 +238,7 @@ cv_timedwait_sig(kcondvar_t *cv, kmutex_
 
 	KASSERT(mutex_owned(mtx));
 
-	cv_enter(cv, mtx, l);
+	cv_enter(cv, mtx, l, true);
 	error = sleepq_block(timo, true);
 	mutex_enter(mtx);
 	return error;

Index: src/sys/kern/kern_sleepq.c
diff -u src/sys/kern/kern_sleepq.c:1.65 src/sys/kern/kern_sleepq.c:1.66
--- src/sys/kern/kern_sleepq.c:1.65	Mon Apr 13 15:54:45 2020
+++ src/sys/kern/kern_sleepq.c	Sun Apr 19 20:35:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_sleepq.c,v 1.65 2020/04/13 15:54:45 maxv Exp $	*/
+/*	$NetBSD: kern_sleepq.c,v 1.66 2020/04/19 20:35:29 ad Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008, 2009, 2019, 2020 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.65 2020/04/13 15:54:45 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.66 2020/04/19 20:35:29 ad Exp $");
 
 #include 
 #include 
@@ -210,13 +210,15 @@ sleepq_insert(sleepq_t *sq, lwp_t *l, sy
  *	lock) must have be released (see sleeptab_lookup(), sleepq_enter()).
  */
 void
-sleepq_enqueue(sleepq_t *sq, wchan_t wchan, const char *wmesg, syncobj_t *sobj)
+sleepq_enqueue(sleepq_t *sq, wchan_t wchan, const char *wmesg, syncobj_t *sobj,
+bool catch_p)
 {
 	lwp_t *l = curlwp;
 
 	KASSERT(lwp_locked(l, NULL));
 	KASSERT(l->l_stat == LSONPROC);
 	KASSERT(l->l_wchan == NULL && l->l_sleepq == NULL);
+	KASSERT((l->l_flag & LW_SINTR) == 0);
 
 	l->l_syncobj = sobj;
 	l->l_wchan = wchan;
@@ -224,6 +226,8 @@ sleepq_enqueue(sleepq_t *sq, wchan_t wch
 	l->l_wmesg = wmesg;
 	l->l_slptime = 0;
 	l->l_stat = LSSLEEP;
+	if (catch_p)
+		l->l_flag |= LW_SINTR;
 
 	sleepq_insert(sq, l, sobj);
 
@@ -254,13 +258,9 @@ sleepq_block(int timo, bool catch_p)
 
 	/*
 	 * If sleeping interruptably, check for pending signals, exits or
-	 * core dump events.  XXX The set of LW_SINTR here assumes no unlock
-	 * between sleepq_enqueue() and sleepq_block().  Unlock between
-	 * those only happens with turnstiles, which never set catch_p. 
-	 * Ugly but safe.
+	 * core dump events.
 	 */
 	if (catch_p) {
-		l->l_flag |= 

CVS commit: src/sys

2020-04-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Apr 19 20:32:00 UTC 2020

Modified Files:
src/sys/compat/linux/common: linux_misc.c linux_sched.c
src/sys/compat/linux32/common: linux32_sysinfo.c
src/sys/compat/netbsd32: netbsd32_execve.c
src/sys/kern: kern_exec.c kern_exit.c kern_proc.c
src/sys/miscfs/procfs: procfs_linux.c procfs_vfsops.c
src/sys/rump/librump/rumpkern: lwproc.c

Log Message:
- Only increment nprocs when we're creating a new process, not just
  when allocating a PID.
- Per above, proc_free_pid() no longer decrements nprocs.  It's now done
  in proc_free() right after proc_free_pid().
- Ensure nprocs is accessed using atomics everywhere.


To generate a diff of this commit:
cvs rdiff -u -r1.247 -r1.248 src/sys/compat/linux/common/linux_misc.c
cvs rdiff -u -r1.73 -r1.74 src/sys/compat/linux/common/linux_sched.c
cvs rdiff -u -r1.10 -r1.11 src/sys/compat/linux32/common/linux32_sysinfo.c
cvs rdiff -u -r1.41 -r1.42 src/sys/compat/netbsd32/netbsd32_execve.c
cvs rdiff -u -r1.496 -r1.497 src/sys/kern/kern_exec.c
cvs rdiff -u -r1.287 -r1.288 src/sys/kern/kern_exit.c
cvs rdiff -u -r1.243 -r1.244 src/sys/kern/kern_proc.c
cvs rdiff -u -r1.80 -r1.81 src/sys/miscfs/procfs/procfs_linux.c
cvs rdiff -u -r1.104 -r1.105 src/sys/miscfs/procfs/procfs_vfsops.c
cvs rdiff -u -r1.44 -r1.45 src/sys/rump/librump/rumpkern/lwproc.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/linux/common/linux_misc.c
diff -u src/sys/compat/linux/common/linux_misc.c:1.247 src/sys/compat/linux/common/linux_misc.c:1.248
--- src/sys/compat/linux/common/linux_misc.c:1.247	Tue Dec 31 13:07:13 2019
+++ src/sys/compat/linux/common/linux_misc.c	Sun Apr 19 20:31:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_misc.c,v 1.247 2019/12/31 13:07:13 ad Exp $	*/
+/*	$NetBSD: linux_misc.c,v 1.248 2020/04/19 20:31:59 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.247 2019/12/31 13:07:13 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.248 2020/04/19 20:31:59 thorpej Exp $");
 
 #include 
 #include 
@@ -1360,7 +1360,7 @@ linux_sys_sysinfo(struct lwp *l, const s
 	si.totalswap = (u_long)uvmexp.swpages * uvmexp.pagesize;
 	si.freeswap = 
 	(u_long)(uvmexp.swpages - uvmexp.swpginuse) * uvmexp.pagesize;
-	si.procs = nprocs;
+	si.procs = atomic_load_relaxed();
 
 	/* The following are only present in newer Linux kernels. */
 	si.totalbig = 0;

Index: src/sys/compat/linux/common/linux_sched.c
diff -u src/sys/compat/linux/common/linux_sched.c:1.73 src/sys/compat/linux/common/linux_sched.c:1.74
--- src/sys/compat/linux/common/linux_sched.c:1.73	Sat Nov 23 19:42:52 2019
+++ src/sys/compat/linux/common/linux_sched.c	Sun Apr 19 20:31:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_sched.c,v 1.73 2019/11/23 19:42:52 ad Exp $	*/
+/*	$NetBSD: linux_sched.c,v 1.74 2020/04/19 20:31:59 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2019 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.73 2019/11/23 19:42:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_sched.c,v 1.74 2020/04/19 20:31:59 thorpej Exp $");
 
 #include 
 #include 
@@ -182,7 +182,7 @@ linux_clone_nptl(struct lwp *l, const st
 	void *parent_tidptr, *tls, *child_tidptr;
 	vaddr_t uaddr;
 	lwpid_t lid;
-	int flags, tnprocs, error;
+	int flags, error;
 
 	p = l->l_proc;
 	flags = SCARG(uap, flags);
@@ -190,17 +190,8 @@ linux_clone_nptl(struct lwp *l, const st
 	tls = SCARG(uap, tls);
 	child_tidptr = SCARG(uap, child_tidptr);
 
-	tnprocs = atomic_inc_uint_nv();
-	if (__predict_false(tnprocs >= maxproc) ||
-	kauth_authorize_process(l->l_cred, KAUTH_PROCESS_FORK, p,
-	KAUTH_ARG(tnprocs), NULL, NULL) != 0) {
-		atomic_dec_uint();
-		return EAGAIN;
-	}
-
 	uaddr = uvm_uarea_alloc();
 	if (__predict_false(uaddr == 0)) {
-		atomic_dec_uint();
 		return ENOMEM;
 	}
 
@@ -209,7 +200,6 @@ linux_clone_nptl(struct lwp *l, const st
 	>l_sigmask, >l_sigstk);
 	if (__predict_false(error)) {
 		DPRINTF(("%s: lwp_create error=%d\n", __func__, error));
-		atomic_dec_uint();
 		uvm_uarea_free(uaddr);
 		return error;
 	}

Index: src/sys/compat/linux32/common/linux32_sysinfo.c
diff -u src/sys/compat/linux32/common/linux32_sysinfo.c:1.10 src/sys/compat/linux32/common/linux32_sysinfo.c:1.11
--- src/sys/compat/linux32/common/linux32_sysinfo.c:1.10	Tue Dec 31 13:07:13 2019
+++ src/sys/compat/linux32/common/linux32_sysinfo.c	Sun Apr 19 20:31:59 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_sysinfo.c,v 1.10 2019/12/31 13:07:13 ad Exp $ */
+/*	$NetBSD: linux32_sysinfo.c,v 1.11 2020/04/19 20:31:59 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: linux32_sysinfo.c,v 1.10 

CVS commit: [bouyer-xenpvh] src/sys/arch/xen

2020-04-19 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Apr 19 20:29:30 UTC 2020

Modified Files:
src/sys/arch/xen/conf [bouyer-xenpvh]: files.xen files.xen.pv
src/sys/arch/xen/x86 [bouyer-xenpvh]: hypervisor_machdep.c
src/sys/arch/xen/xen [bouyer-xenpvh]: evtchn.c

Log Message:
Move xen_ipi.c to XENPV only.
Make sure we don't need to send events to remote CPUs (outside of IPIs)


To generate a diff of this commit:
cvs rdiff -u -r1.180.2.4 -r1.180.2.5 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/sys/arch/xen/conf/files.xen.pv
cvs rdiff -u -r1.36.8.4 -r1.36.8.5 src/sys/arch/xen/x86/hypervisor_machdep.c
cvs rdiff -u -r1.88.2.8 -r1.88.2.9 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/conf/files.xen
diff -u src/sys/arch/xen/conf/files.xen:1.180.2.4 src/sys/arch/xen/conf/files.xen:1.180.2.5
--- src/sys/arch/xen/conf/files.xen:1.180.2.4	Thu Apr 16 19:23:50 2020
+++ src/sys/arch/xen/conf/files.xen	Sun Apr 19 20:29:30 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.180.2.4 2020/04/16 19:23:50 bouyer Exp $
+#	$NetBSD: files.xen,v 1.180.2.5 2020/04/19 20:29:30 bouyer Exp $
 
 defflag	opt_xen.h			XEN XENPVH XENPVHVM
 
@@ -7,7 +7,6 @@ file	arch/xen/x86/xen_intr.c			xen
 file	arch/xen/xen/xen_machdep.c		xen
 file	arch/xen/xen/evtchn.c			xen
 file	arch/xen/xen/xengnt.c			xen
-file	arch/xen/x86/xen_ipi.c			multiprocessor & xen
 file	arch/xen/x86/xen_mainbus.c		xen
 file	arch/xen/xen/xen_clock.c		xen
 

Index: src/sys/arch/xen/conf/files.xen.pv
diff -u src/sys/arch/xen/conf/files.xen.pv:1.1.2.2 src/sys/arch/xen/conf/files.xen.pv:1.1.2.3
--- src/sys/arch/xen/conf/files.xen.pv:1.1.2.2	Thu Apr 16 19:23:50 2020
+++ src/sys/arch/xen/conf/files.xen.pv	Sun Apr 19 20:29:30 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen.pv,v 1.1.2.2 2020/04/16 19:23:50 bouyer Exp $
+#	$NetBSD: files.xen.pv,v 1.1.2.3 2020/04/19 20:29:30 bouyer Exp $
 
 file	arch/xen/x86/autoconf.c		xenpv
 file	arch/xen/x86/x86_xpmap.c	xenpv
@@ -10,6 +10,8 @@ file	arch/xen/x86/xen_bus_dma.c	machdep 
 file	arch/xen/x86/consinit.c		machdep & xenpv
 file	arch/xen/x86/pintr.c		machdep & dom0ops & xenpv
 
+file	arch/xen/x86/xen_ipi.c			multiprocessor & xenpv
+
 #
 # System bus types
 #

Index: src/sys/arch/xen/x86/hypervisor_machdep.c
diff -u src/sys/arch/xen/x86/hypervisor_machdep.c:1.36.8.4 src/sys/arch/xen/x86/hypervisor_machdep.c:1.36.8.5
--- src/sys/arch/xen/x86/hypervisor_machdep.c:1.36.8.4	Sat Apr 18 15:06:18 2020
+++ src/sys/arch/xen/x86/hypervisor_machdep.c	Sun Apr 19 20:29:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hypervisor_machdep.c,v 1.36.8.4 2020/04/18 15:06:18 bouyer Exp $	*/
+/*	$NetBSD: hypervisor_machdep.c,v 1.36.8.5 2020/04/19 20:29:30 bouyer Exp $	*/
 
 /*
  *
@@ -54,7 +54,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.36.8.4 2020/04/18 15:06:18 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor_machdep.c,v 1.36.8.5 2020/04/19 20:29:30 bouyer Exp $");
 
 #include 
 #include 
@@ -291,6 +291,7 @@ do_hypervisor_callback(struct intrframe 
 #endif
 }
 
+#if 0
 void
 hypervisor_send_event(struct cpu_info *ci, unsigned int ev)
 {
@@ -323,6 +324,7 @@ hypervisor_send_event(struct cpu_info *c
 		}
 	}
 }
+#endif
 
 void
 hypervisor_unmask_event(unsigned int ev)
@@ -422,6 +424,8 @@ hypervisor_set_ipending(uint32_t imask, 
 	KASSERT(ci->ci_isources[sir] != NULL);
 	ci->ci_isources[sir]->ipl_evt_mask1 |= 1UL << l1;
 	ci->ci_isources[sir]->ipl_evt_mask2[l1] |= 1UL << l2;
+	KASSERT(ci == curcpu());
+#if 0
 	if (__predict_false(ci != curcpu())) {
 		if (xen_send_ipi(ci, XEN_IPI_HVCB)) {
 			panic("hypervisor_set_ipending: "
@@ -429,6 +433,7 @@ hypervisor_set_ipending(uint32_t imask, 
 			(int) ci->ci_cpuid, ci->ci_vcpuid);
 		}
 	}
+#endif
 }
 
 void

Index: src/sys/arch/xen/xen/evtchn.c
diff -u src/sys/arch/xen/xen/evtchn.c:1.88.2.8 src/sys/arch/xen/xen/evtchn.c:1.88.2.9
--- src/sys/arch/xen/xen/evtchn.c:1.88.2.8	Sun Apr 19 19:39:11 2020
+++ src/sys/arch/xen/xen/evtchn.c	Sun Apr 19 20:29:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: evtchn.c,v 1.88.2.8 2020/04/19 19:39:11 bouyer Exp $	*/
+/*	$NetBSD: evtchn.c,v 1.88.2.9 2020/04/19 20:29:30 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -54,7 +54,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.8 2020/04/19 19:39:11 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: evtchn.c,v 1.88.2.9 2020/04/19 20:29:30 bouyer Exp $");
 
 #include "opt_xen.h"
 #include "isa.h"
@@ -376,12 +376,15 @@ evtchn_do_event(int evtch, struct intrfr
 	mutex_spin_enter([evtch]);
 	ih = evtsource[evtch]->ev_handlers;
 	while (ih != NULL) {
+		KASSERT(ih->ih_cpu == ci);
+#if 0
 		if (ih->ih_cpu != ci) {
 			hypervisor_send_event(ih->ih_cpu, evtch);
 			iplmask &= ~(1 << XEN_IPL2SIR(ih->ih_level));
 			ih = ih->ih_evt_next;
 			continue;
 		}
+#endif
 		if (ih->ih_level <= ilevel) {
 #ifdef IRQ_DEBUG
 		if 

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

2020-04-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Apr 19 20:07:54 UTC 2020

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

Log Message:
make privpgops const


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/xen/xen/privcmd.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/privcmd.c
diff -u src/sys/arch/xen/xen/privcmd.c:1.54 src/sys/arch/xen/xen/privcmd.c:1.55
--- src/sys/arch/xen/xen/privcmd.c:1.54	Tue Apr  7 08:14:42 2020
+++ src/sys/arch/xen/xen/privcmd.c	Sun Apr 19 20:07:53 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: privcmd.c,v 1.54 2020/04/07 08:14:42 jdolecek Exp $ */
+/* $NetBSD: privcmd.c,v 1.55 2020/04/19 20:07:53 jdolecek Exp $ */
 
 /*-
  * Copyright (c) 2004 Christian Limpach.
@@ -27,7 +27,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.54 2020/04/07 08:14:42 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.55 2020/04/19 20:07:53 jdolecek Exp $");
 
 #include 
 #include 
@@ -440,7 +440,7 @@ privcmd_ioctl(void *v)
 	return error;
 }
 
-static struct uvm_pagerops privpgops = {
+static const struct uvm_pagerops privpgops = {
   .pgo_reference = privpgop_reference,
   .pgo_detach = privpgop_detach,
   .pgo_fault = privpgop_fault,



CVS commit: [bouyer-xenpvh] src/sys/arch

2020-04-19 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Apr 19 19:39:11 UTC 2020

Modified Files:
src/sys/arch/x86/include [bouyer-xenpvh]: intr.h pic.h
src/sys/arch/x86/pci [bouyer-xenpvh]: msipic.c
src/sys/arch/x86/x86 [bouyer-xenpvh]: i8259.c intr.c ioapic.c lapic.c
src/sys/arch/xen/include [bouyer-xenpvh]: intr.h
src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_intr.c
src/sys/arch/xen/xen [bouyer-xenpvh]: evtchn.c xen_clock.c

Log Message:
Add per-PIC callbacks for interrupt_get_devname(), interrupt_get_assigned()
and interrupt_get_count(). Implement Xen-specific callbacks for
PIC_XEN and use the x86 one for others.
In event_set_handler(), call intr_allocate_io_intrsource() so that
events appears in interrupt list (intrctl list).


To generate a diff of this commit:
cvs rdiff -u -r1.61.6.4 -r1.61.6.5 src/sys/arch/x86/include/intr.h
cvs rdiff -u -r1.9 -r1.9.14.1 src/sys/arch/x86/include/pic.h
cvs rdiff -u -r1.20 -r1.20.6.1 src/sys/arch/x86/pci/msipic.c
cvs rdiff -u -r1.23.10.1 -r1.23.10.2 src/sys/arch/x86/x86/i8259.c
cvs rdiff -u -r1.150.6.4 -r1.150.6.5 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.63 -r1.63.8.1 src/sys/arch/x86/x86/ioapic.c
cvs rdiff -u -r1.76.6.3 -r1.76.6.4 src/sys/arch/x86/x86/lapic.c
cvs rdiff -u -r1.53.6.2 -r1.53.6.3 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.21.2.6 -r1.21.2.7 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.88.2.7 -r1.88.2.8 src/sys/arch/xen/xen/evtchn.c
cvs rdiff -u -r1.1.2.3 -r1.1.2.4 src/sys/arch/xen/xen/xen_clock.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/intr.h
diff -u src/sys/arch/x86/include/intr.h:1.61.6.4 src/sys/arch/x86/include/intr.h:1.61.6.5
--- src/sys/arch/x86/include/intr.h:1.61.6.4	Sun Apr 19 11:40:30 2020
+++ src/sys/arch/x86/include/intr.h	Sun Apr 19 19:39:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.61.6.4 2020/04/19 11:40:30 bouyer Exp $	*/
+/*	$NetBSD: intr.h,v 1.61.6.5 2020/04/19 19:39:10 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001, 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc.
@@ -39,6 +39,7 @@
 
 #ifdef _KERNEL
 #include 
+#include 
 #else
 #include 
 #endif
@@ -237,6 +238,10 @@ int x86_send_ipi(struct cpu_info *, int)
 void x86_broadcast_ipi(int);
 void x86_ipi_handler(void);
 
+void x86_intr_get_devname(const char *, char *, size_t);
+void x86_intr_get_assigned(const char *, kcpuset_t *);
+uint64_t x86_intr_get_count(const char *, u_int);
+
 #ifndef XENPV
 extern void (* const ipifunc[X86_NIPI])(struct cpu_info *);
 #endif

Index: src/sys/arch/x86/include/pic.h
diff -u src/sys/arch/x86/include/pic.h:1.9 src/sys/arch/x86/include/pic.h:1.9.14.1
--- src/sys/arch/x86/include/pic.h:1.9	Sat Nov  4 10:26:14 2017
+++ src/sys/arch/x86/include/pic.h	Sun Apr 19 19:39:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pic.h,v 1.9 2017/11/04 10:26:14 cherry Exp $	*/
+/*	$NetBSD: pic.h,v 1.9.14.1 2020/04/19 19:39:10 bouyer Exp $	*/
 
 #ifndef _X86_PIC_H
 #define _X86_PIC_H
@@ -23,6 +23,10 @@ struct pic {
 	struct intrstub *pic_edge_stubs;
 	struct ioapic_softc *pic_ioapic; /* if pic_type == PIC_IOAPIC */
 	struct msipic *pic_msipic; /* if (pic_type == PIC_MSI) || (pic_type == PIC_MSIX) */
+	/* interface for subr_interrupt.c */
+	void (*pic_intr_get_devname)(const char *, char *, size_t);
+	void (*pic_intr_get_assigned)(const char *, kcpuset_t *);
+	uint64_t (*pic_intr_get_count)(const char *, u_int);
 };
 
 /*

Index: src/sys/arch/x86/pci/msipic.c
diff -u src/sys/arch/x86/pci/msipic.c:1.20 src/sys/arch/x86/pci/msipic.c:1.20.6.1
--- src/sys/arch/x86/pci/msipic.c:1.20	Mon Dec  2 03:06:51 2019
+++ src/sys/arch/x86/pci/msipic.c	Sun Apr 19 19:39:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msipic.c,v 1.20 2019/12/02 03:06:51 msaitoh Exp $	*/
+/*	$NetBSD: msipic.c,v 1.20.6.1 2020/04/19 19:39:10 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2015 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.20 2019/12/02 03:06:51 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.20.6.1 2020/04/19 19:39:10 bouyer Exp $");
 
 #include "opt_intrdebug.h"
 
@@ -436,6 +436,9 @@ static struct pic msi_pic_tmpl = {
 	.pic_hwunmask = msi_hwunmask,
 	.pic_addroute = msi_addroute,
 	.pic_delroute = msi_delroute,
+	.pic_intr_get_devname = x86_intr_get_devname,
+	.pic_intr_get_assigned = x86_intr_get_assigned,
+	.pic_intr_get_count = x86_intr_get_count,
 };
 
 /*
@@ -611,6 +614,9 @@ static struct pic msix_pic_tmpl = {
 	.pic_hwunmask = msix_hwunmask,
 	.pic_addroute = msix_addroute,
 	.pic_delroute = msix_delroute,
+	.pic_intr_get_devname = x86_intr_get_devname,
+	.pic_intr_get_assigned = x86_intr_get_assigned,
+	.pic_intr_get_count = x86_intr_get_count,
 };
 
 struct pic *

Index: src/sys/arch/x86/x86/i8259.c
diff -u src/sys/arch/x86/x86/i8259.c:1.23.10.1 src/sys/arch/x86/x86/i8259.c:1.23.10.2
--- src/sys/arch/x86/x86/i8259.c:1.23.10.1	Sun Apr 12 17:25:52 

CVS commit: src/sbin/fsck_ffs

2020-04-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 19 19:37:07 UTC 2020

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

Log Message:
Enable the code to clean the extattr blocks


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sbin/fsck_ffs/pass1.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/pass1.c
diff -u src/sbin/fsck_ffs/pass1.c:1.58 src/sbin/fsck_ffs/pass1.c:1.59
--- src/sbin/fsck_ffs/pass1.c:1.58	Tue Feb 13 06:20:08 2018
+++ src/sbin/fsck_ffs/pass1.c	Sun Apr 19 15:37:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pass1.c,v 1.58 2018/02/13 11:20:08 hannken Exp $	*/
+/*	$NetBSD: pass1.c,v 1.59 2020/04/19 19:37:06 christos Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)pass1.c	8.6 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: pass1.c,v 1.58 2018/02/13 11:20:08 hannken Exp $");
+__RCSID("$NetBSD: pass1.c,v 1.59 2020/04/19 19:37:06 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -423,7 +423,6 @@ checkinode(ino_t inumber, struct inodesc
 	else
 		idesc->id_type = ADDR;
 	(void)ckinode(dp, idesc);
-#ifdef notyet
 	if (is_ufs2 && iswap32(dp->dp2.di_extsize) > 0) {
 		int ret, offset;
 		idesc->id_type = ADDR;
@@ -443,7 +442,6 @@ checkinode(ino_t inumber, struct inodesc
 break;
 		}
 	}
-#endif
 	idesc->id_entryno *= btodb(sblock->fs_fsize);
 	if (is_ufs2)
 		blocks = iswap64(dp->dp2.di_blocks);



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

2020-04-19 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Apr 19 19:36:49 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Give UVMHIST_LOG() the 6 args it requires.   Unbreak builds.


To generate a diff of this commit:
cvs rdiff -u -r1.409 -r1.410 src/sys/arch/arm/arm32/pmap.c

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

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.409 src/sys/arch/arm/arm32/pmap.c:1.410
--- src/sys/arch/arm/arm32/pmap.c:1.409	Sun Apr 19 08:50:54 2020
+++ src/sys/arch/arm/arm32/pmap.c	Sun Apr 19 19:36:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.409 2020/04/19 08:50:54 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.410 2020/04/19 19:36:49 kre Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -192,7 +192,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.409 2020/04/19 08:50:54 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.410 2020/04/19 19:36:49 kre Exp $");
 
 #include 
 #include 
@@ -2760,8 +2760,8 @@ pmap_flush_page(struct vm_page_md *md, p
 
 	KASSERT(!(md->pvh_attrs & PVF_NC));
 
-	UVMHIST_LOG(maphist, "md %#jx (attrs=%#jx)",(uintptr_t)md,
-	md->pvh_attrs);
+	UVMHIST_LOG(maphist, "md %#jx (attrs=%#jx)", (uintptr_t)md,
+	md->pvh_attrs, 0, 0);
 
 	const size_t scache_line_size = arm_scache.dcache_line_size;
 



CVS commit: src/share/man/man5

2020-04-19 Thread David H. Gutteridge
Module Name:src
Committed By:   gutteridge
Date:   Sun Apr 19 19:20:32 UTC 2020

Modified Files:
src/share/man/man5: fstab.5

Log Message:
fstab.5: note the first field is a placeholder for some FSes

Addresses PR misc/52607. (I suppose something about this could also be
added to the man pages for the mount commands for each applicable file
system, but I think this should suffice.)


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/share/man/man5/fstab.5

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/man5/fstab.5
diff -u src/share/man/man5/fstab.5:1.46 src/share/man/man5/fstab.5:1.47
--- src/share/man/man5/fstab.5:1.46	Sat Apr  4 15:32:42 2020
+++ src/share/man/man5/fstab.5	Sun Apr 19 19:20:32 2020
@@ -1,4 +1,4 @@
-.\"	$NetBSD: fstab.5,v 1.46 2020/04/04 15:32:42 jdolecek Exp $
+.\"	$NetBSD: fstab.5,v 1.47 2020/04/19 19:20:32 gutteridge Exp $
 .\"
 .\" Copyright (c) 1980, 1989, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)fstab.5	8.1 (Berkeley) 6/5/93
 .\"
-.Dd September 15, 2019
+.Dd April 19, 2020
 .Dt FSTAB 5
 .Os
 .Sh NAME
@@ -78,10 +78,17 @@ and not the character special file name.
 If a program needs the character special file name,
 the program must create it by appending a
 .Dq r
-after the
-last
+after the last
 .Dq /
 in the special file name.
+(Note that for some file systems, e.g.,
+.Em kernfs ,
+.Em procfs ,
+and
+.Em tmpfs ,
+this field has no applicable use, and any string may be supplied as a
+placeholder.
+It is present simply for consistency of argument number and order.)
 .Pp
 If the first field is of the form
 .Dq NAME=



CVS commit: src/sys/external/bsd/drm2/dist/drm/nouveau

2020-04-19 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sun Apr 19 19:12:38 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau: nouveau_nv50_display.c
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu:
nouveau_nvkm_subdev_mmu_nv44.c

Log Message:
Add missing BUS_DMA_COHERENT hints


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c
cvs rdiff -u -r1.3 -r1.4 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_nv44.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/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c:1.11 src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c:1.12
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c:1.11	Fri Feb 14 14:34:58 2020
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nouveau_nv50_display.c	Sun Apr 19 19:12:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_nv50_display.c,v 1.11 2020/02/14 14:34:58 maya Exp $	*/
+/*	$NetBSD: nouveau_nv50_display.c,v 1.12 2020/04/19 19:12:37 jmcneill Exp $	*/
 
 /*
  * Copyright 2011 Red Hat Inc.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nv50_display.c,v 1.11 2020/02/14 14:34:58 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nv50_display.c,v 1.12 2020/04/19 19:12:37 jmcneill Exp $");
 
 #include 
 
@@ -297,7 +297,7 @@ nv50_dmac_create(struct nvif_device *dev
 	}
 	/* XXX errno NetBSD->Linux */
 	ret = -bus_dmamem_map(dmat, >dmaseg, 1, PAGE_SIZE, >dmakva,
-	BUS_DMA_WAITOK);
+	BUS_DMA_WAITOK | BUS_DMA_COHERENT);
 	if (ret) {
 		bus_dmamap_destroy(dmat, dmac->dmamap);
 		bus_dmamem_free(dmat, >dmaseg, 1);

Index: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_nv44.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_nv44.c:1.3 src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_nv44.c:1.4
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_nv44.c:1.3	Mon Aug 27 07:41:09 2018
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/subdev/mmu/nouveau_nvkm_subdev_mmu_nv44.c	Sun Apr 19 19:12:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_nvkm_subdev_mmu_nv44.c,v 1.3 2018/08/27 07:41:09 riastradh Exp $	*/
+/*	$NetBSD: nouveau_nvkm_subdev_mmu_nv44.c,v 1.4 2020/04/19 19:12:37 jmcneill Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -24,7 +24,7 @@
  * Authors: Ben Skeggs
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_mmu_nv44.c,v 1.3 2018/08/27 07:41:09 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_subdev_mmu_nv44.c,v 1.4 2020/04/19 19:12:37 jmcneill Exp $");
 
 #include "nv04.h"
 
@@ -193,7 +193,7 @@ fail1:		bus_dmamem_free(dmat, >null
 
 	/* XXX errno NetBSD->Linux */
 	ret = -bus_dmamem_map(dmat, >nullseg, 1, nullsz,
-	>nullp, BUS_DMA_WAITOK);
+	>nullp, BUS_DMA_WAITOK | BUS_DMA_COHERENT);
 	if (ret) {
 fail2:		bus_dmamap_destroy(dmat, mmu->nullmap);
 		goto fail1;



CVS commit: src/sys/arch/xen

2020-04-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Apr 19 18:47:40 UTC 2020

Modified Files:
src/sys/arch/xen/include: xen_shm.h
src/sys/arch/xen/x86: xen_shm_machdep.c
src/sys/arch/xen/xen: hypervisor.c xbdback_xenbus.c

Log Message:
change interface for xen_shm_map() so that caller always supplies the VA,
it now fails only if the Xen hypercall fails, in which case the failure
is final

change xbdback to pre-allocate KVA on xbdback attach (and free on detach),
so it has always KVA to map the request pages

remove no longer needed KVA allocation failure handling


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/xen/include/xen_shm.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/xen/x86/xen_shm_machdep.c
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/xen/xen/xbdback_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/include/xen_shm.h
diff -u src/sys/arch/xen/include/xen_shm.h:1.10 src/sys/arch/xen/include/xen_shm.h:1.11
--- src/sys/arch/xen/include/xen_shm.h:1.10	Tue Jan  8 19:59:24 2019
+++ src/sys/arch/xen/include/xen_shm.h	Sun Apr 19 18:47:40 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xen_shm.h,v 1.10 2019/01/08 19:59:24 jdolecek Exp $  */
+/*  $NetBSD: xen_shm.h,v 1.11 2020/04/19 18:47:40 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -27,7 +27,7 @@
 
 #include "opt_xen.h"
 
-#define XENSHM_MAX_PAGES_PER_REQUEST (MAXPHYS >> PAGE_SHIFT)
+#define XENSHM_MAX_PAGES_PER_REQUEST ((MAXPHYS + PAGE_SIZE) >> PAGE_SHIFT)
 
 /*
  * Helper routines for the backend drivers. This implement the necessary
@@ -35,10 +35,8 @@
  * space, do I/O to it, and unmap it.
  */
 
-int  xen_shm_map(int, int, grant_ref_t *, vaddr_t *, grant_handle_t *, int);
+int  xen_shm_map(int, int, grant_ref_t *, vaddr_t, grant_handle_t *, int);
 void xen_shm_unmap(vaddr_t, int, grant_handle_t *);
-int xen_shm_callback(int (*)(void *), void *);
 
 /* flags for xen_shm_map() */
-#define XSHM_CALLBACK 0x01	/* called from a callback */
 #define XSHM_RO 0x02		/* map the guest's memory read-only */

Index: src/sys/arch/xen/x86/xen_shm_machdep.c
diff -u src/sys/arch/xen/x86/xen_shm_machdep.c:1.14 src/sys/arch/xen/x86/xen_shm_machdep.c:1.15
--- src/sys/arch/xen/x86/xen_shm_machdep.c:1.14	Mon Apr 13 00:27:16 2020
+++ src/sys/arch/xen/x86/xen_shm_machdep.c	Sun Apr 19 18:47:40 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xen_shm_machdep.c,v 1.14 2020/04/13 00:27:16 chs Exp $  */
+/*  $NetBSD: xen_shm_machdep.c,v 1.15 2020/04/19 18:47:40 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xen_shm_machdep.c,v 1.14 2020/04/13 00:27:16 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xen_shm_machdep.c,v 1.15 2020/04/19 18:47:40 jdolecek Exp $");
 
 #include 
 #include 
@@ -55,71 +55,12 @@ __KERNEL_RCSID(0, "$NetBSD: xen_shm_mach
  * available.
  */
 
-/* Grab enough VM space to map an entire vbd ring. */
-/* Xen3 linux guests seems to eat more pages, gives enough for 10 vbd rings */
-#define BLKIF_RING_SIZE __RING_SIZE((blkif_sring_t *)0, PAGE_SIZE)
-#define XENSHM_NPAGES (BLKIF_RING_SIZE * (BLKIF_MAX_SEGMENTS_PER_REQUEST + 1) * 10)
-
-/* vm space management */
-static vmem_t *xen_shm_arena __read_mostly;
-
-/* callbacks are registered in a FIFO list. */
-static SIMPLEQ_HEAD(xen_shm_callback_head, xen_shm_callback_entry)
-xen_shm_callbacks;
-
-struct xen_shm_callback_entry {
-	SIMPLEQ_ENTRY(xen_shm_callback_entry) xshmc_entries;
-	int (*xshmc_callback)(void *); /* our callback */
-	void *xshmc_arg; /* cookie passed to the callback */
-};
-
-/* a pool of struct xen_shm_callback_entry */
-static struct pool xen_shm_callback_pool;
-
-#ifdef DEBUG
-/* for ratecheck(9) */
-static struct timeval xen_shm_errintvl = { 60, 0 };  /* a minute, each */
-#endif
-
-void
-xen_shm_init(void)
-{
-	vaddr_t xen_shm_base_address;
-	vaddr_t xen_shm_end_address;
-	u_long xen_shm_base_address_pg;
-	vsize_t xen_shm_size;
-
-	SIMPLEQ_INIT(_shm_callbacks);
-	pool_init(_shm_callback_pool, sizeof(struct xen_shm_callback_entry),
-	0, 0, 0, "xshmc", NULL, IPL_VM);
-	/* ensure we'll always get items */
-	pool_prime(_shm_callback_pool, 1);
-
-	xen_shm_size = (XENSHM_NPAGES * PAGE_SIZE);
-
-	xen_shm_base_address = uvm_km_alloc(kernel_map, xen_shm_size, 0,
-	UVM_KMF_VAONLY);
-	xen_shm_end_address = xen_shm_base_address + xen_shm_size;
-	xen_shm_base_address_pg = xen_shm_base_address >> PAGE_SHIFT;
-	if (xen_shm_base_address == 0) {
-		panic("xen_shm_init no VM space");
-	}
-	xen_shm_arena = vmem_create("xen_shm", xen_shm_base_address_pg,
-	(xen_shm_end_address >> PAGE_SHIFT) - 1 - xen_shm_base_address_pg,
-	1, NULL, NULL, NULL, 1, VM_NOSLEEP, IPL_VM);
-	if (xen_shm_arena == NULL) {
-		panic("xen_shm_init no arena");
-	}
-}
-
 int
-xen_shm_map(int 

CVS commit: src/tests/lib/libi386

2020-04-19 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Apr 19 18:07:00 UTC 2020

Modified Files:
src/tests/lib/libi386: Makefile

Log Message:
Define TESTSDIR even when not amd64 so the Atffile will be
installed in the correct location.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libi386/Makefile

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/libi386/Makefile
diff -u src/tests/lib/libi386/Makefile:1.1 src/tests/lib/libi386/Makefile:1.2
--- src/tests/lib/libi386/Makefile:1.1	Sun Apr 19 13:22:58 2020
+++ src/tests/lib/libi386/Makefile	Sun Apr 19 18:07:00 2020
@@ -1,9 +1,10 @@
-# $NetBSD: Makefile,v 1.1 2020/04/19 13:22:58 maxv Exp $
+# $NetBSD: Makefile,v 1.2 2020/04/19 18:07:00 kre Exp $
 
 .include 
 
-.if ${MACHINE} == "amd64"
 TESTSDIR=	${TESTSBASE}/lib/libi386
+
+.if ${MACHINE} == "amd64"
 COPTS+=		-m32
 LDFLAGS+=	-m32
 LDADD+=		-li386



CVS commit: src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device

2020-04-19 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Apr 19 18:02:36 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device:
nouveau_nvkm_engine_device_base.c

Log Message:
Match Linux's criterion for byte-swapping on big-endian CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 \

src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_base.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/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_base.c
diff -u src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_base.c:1.9 src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_base.c:1.10
--- src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_base.c:1.9	Fri Feb 14 04:35:20 2020
+++ src/sys/external/bsd/drm2/dist/drm/nouveau/nvkm/engine/device/nouveau_nvkm_engine_device_base.c	Sun Apr 19 18:02:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveau_nvkm_engine_device_base.c,v 1.9 2020/02/14 04:35:20 riastradh Exp $	*/
+/*	$NetBSD: nouveau_nvkm_engine_device_base.c,v 1.10 2020/04/19 18:02:36 riastradh Exp $	*/
 
 /*
  * Copyright 2012 Red Hat Inc.
@@ -24,7 +24,7 @@
  * Authors: Ben Skeggs
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_device_base.c,v 1.9 2020/02/14 04:35:20 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nouveau_nvkm_engine_device_base.c,v 1.10 2020/04/19 18:02:36 riastradh Exp $");
 
 #include "priv.h"
 #include "acpi.h"
@@ -2386,7 +2386,7 @@ nvkm_device_ctor(const struct nvkm_devic
 #ifndef __BIG_ENDIAN
 		if (bus_space_read_stream_4(mmiot, mmioh, 4) != 0)
 #else
-		if (bus_space_read_stream_4(mmiot, mmioh, 4) != 1)
+		if (bus_space_read_stream_4(mmiot, mmioh, 4) == 0)
 #endif
 		{
 			bus_space_write_stream_4(mmiot, mmioh, 4, 0x0101);



CVS commit: src/sys/external/bsd/drm2/dist/include/drm

2020-04-19 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Apr 19 17:49:42 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/include/drm: drmP.h

Log Message:
Include dev/sysmon/sysmonvar.h for sysmon_pswitch.

Somehow only triggered by the compat build (which shouldn't have been
enabled!)


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/external/bsd/drm2/dist/include/drm/drmP.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/external/bsd/drm2/dist/include/drm/drmP.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.40 src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.41
--- src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.40	Sun Apr 19 17:19:13 2020
+++ src/sys/external/bsd/drm2/dist/include/drm/drmP.h	Sun Apr 19 17:49:41 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drmP.h,v 1.40 2020/04/19 17:19:13 maya Exp $	*/
+/*	$NetBSD: drmP.h,v 1.41 2020/04/19 17:49:41 maya Exp $	*/
 
 /*
  * Internal Header for the Direct Rendering Manager
@@ -67,6 +67,7 @@
 #include 
 
 #ifdef __NetBSD__
+#include 
 #include 
 #include 
 #include 



CVS commit: src/sys/modules/compat_netbsd32

2020-04-19 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Apr 19 17:40:50 UTC 2020

Modified Files:
src/sys/modules/compat_netbsd32: Makefile

Log Message:
Turn off compat drm.
XXX issue security advisory


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/modules/compat_netbsd32/Makefile

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

Modified files:

Index: src/sys/modules/compat_netbsd32/Makefile
diff -u src/sys/modules/compat_netbsd32/Makefile:1.32 src/sys/modules/compat_netbsd32/Makefile:1.33
--- src/sys/modules/compat_netbsd32/Makefile:1.32	Thu Mar 12 15:02:29 2020
+++ src/sys/modules/compat_netbsd32/Makefile	Sun Apr 19 17:40:49 2020
@@ -1,13 +1,13 @@
-#	$NetBSD: Makefile,v 1.32 2020/03/12 15:02:29 pgoyette Exp $
+#	$NetBSD: Makefile,v 1.33 2020/04/19 17:40:49 maya Exp $
 
 .include "../Makefile.inc"
 .include "../Makefile.assym"
 
 KMOD=	compat_netbsd32
 
-.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
-NETBSD32_DRMKMS?=yes
-.endif
+#.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
+#NETBSD32_DRMKMS?=yes
+#.endif
 
 CPPFLAGS+=	-DCOMPAT_NETBSD32
 CPPFLAGS+=	-DEXEC_ELF32 -DEXEC_ELF64



CVS commit: src/sys/external/bsd/drm2/dist

2020-04-19 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Sun Apr 19 17:19:13 UTC 2020

Modified Files:
src/sys/external/bsd/drm2/dist/drm: drm_drv.c drm_probe_helper.c
src/sys/external/bsd/drm2/dist/include/drm: drmP.h

Log Message:
For drm drivers and on monitor hotplug, report a 'display-cycle' hotkey click

If powerd is running, it will invoke the script
/etc/powerd/actions/display-cycle


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/external/bsd/drm2/dist/drm/drm_drv.c
cvs rdiff -u -r1.4 -r1.5 \
src/sys/external/bsd/drm2/dist/drm/drm_probe_helper.c
cvs rdiff -u -r1.39 -r1.40 src/sys/external/bsd/drm2/dist/include/drm/drmP.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/external/bsd/drm2/dist/drm/drm_drv.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_drv.c:1.13 src/sys/external/bsd/drm2/dist/drm/drm_drv.c:1.14
--- src/sys/external/bsd/drm2/dist/drm/drm_drv.c:1.13	Thu Mar  5 07:46:59 2020
+++ src/sys/external/bsd/drm2/dist/drm/drm_drv.c	Sun Apr 19 17:19:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_drv.c,v 1.13 2020/03/05 07:46:59 riastradh Exp $	*/
+/*	$NetBSD: drm_drv.c,v 1.14 2020/04/19 17:19:13 maya Exp $	*/
 
 /*
  * Created: Fri Jan 19 10:48:35 2001 by fa...@acm.org
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.13 2020/03/05 07:46:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_drv.c,v 1.14 2020/04/19 17:19:13 maya Exp $");
 
 #include 
 #include 
@@ -660,6 +660,14 @@ struct drm_device *drm_dev_alloc(struct 
 	kref_init(>ref);
 	dev->dev = parent;
 	dev->driver = driver;
+#ifdef __NetBSD__
+	dev->sc_monitor_hotplug.smpsw_name = PSWITCH_HK_DISPLAY_CYCLE;
+	dev->sc_monitor_hotplug.smpsw_type = PSWITCH_TYPE_HOTKEY;
+
+	ret = sysmon_pswitch_register(>sc_monitor_hotplug);
+	if (ret)
+		goto err_pswitch;
+#endif
 
 	INIT_LIST_HEAD(>filelist);
 	INIT_LIST_HEAD(>ctxlist);
@@ -727,6 +735,10 @@ err_free:
 	mutex_destroy(>master_mutex);
 	mutex_destroy(>ctxlist_mutex);
 	mutex_destroy(>struct_mutex);
+#ifdef __NetBSD__
+err_pswitch:
+	sysmon_pswitch_unregister(>sc_monitor_hotplug);
+#endif
 	kfree(dev);
 	return NULL;
 }
@@ -739,6 +751,10 @@ static void drm_dev_release(struct kref 
 	if (drm_core_check_feature(dev, DRIVER_GEM))
 		drm_gem_destroy(dev);
 
+#ifdef __NetBSD__
+	sysmon_pswitch_unregister(>sc_monitor_hotplug);
+#endif
+
 	drm_legacy_ctxbitmap_cleanup(dev);
 	drm_ht_remove(>map_hash);
 	drm_fs_inode_free(dev->anon_inode);

Index: src/sys/external/bsd/drm2/dist/drm/drm_probe_helper.c
diff -u src/sys/external/bsd/drm2/dist/drm/drm_probe_helper.c:1.4 src/sys/external/bsd/drm2/dist/drm/drm_probe_helper.c:1.5
--- src/sys/external/bsd/drm2/dist/drm/drm_probe_helper.c:1.4	Fri Feb 14 14:34:57 2020
+++ src/sys/external/bsd/drm2/dist/drm/drm_probe_helper.c	Sun Apr 19 17:19:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_probe_helper.c,v 1.4 2020/02/14 14:34:57 maya Exp $	*/
+/*	$NetBSD: drm_probe_helper.c,v 1.5 2020/04/19 17:19:13 maya Exp $	*/
 
 /*
  * Copyright (c) 2006-2008 Intel Corporation
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: drm_probe_helper.c,v 1.4 2020/02/14 14:34:57 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: drm_probe_helper.c,v 1.5 2020/04/19 17:19:13 maya Exp $");
 
 #include 
 #include 
@@ -328,6 +328,9 @@ EXPORT_SYMBOL(drm_helper_probe_single_co
  */
 void drm_kms_helper_hotplug_event(struct drm_device *dev)
 {
+#ifdef __NetBSD__
+	sysmon_pswitch_event(>sc_monitor_hotplug, PSWITCH_EVENT_PRESSED);
+#endif
 	/* send a uevent + call fbdev */
 	drm_sysfs_hotplug_event(dev);
 	if (dev->mode_config.funcs->output_poll_changed)

Index: src/sys/external/bsd/drm2/dist/include/drm/drmP.h
diff -u src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.39 src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.40
--- src/sys/external/bsd/drm2/dist/include/drm/drmP.h:1.39	Thu Mar  5 08:36:53 2020
+++ src/sys/external/bsd/drm2/dist/include/drm/drmP.h	Sun Apr 19 17:19:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: drmP.h,v 1.39 2020/03/05 08:36:53 riastradh Exp $	*/
+/*	$NetBSD: drmP.h,v 1.40 2020/04/19 17:19:13 maya Exp $	*/
 
 /*
  * Internal Header for the Direct Rendering Manager
@@ -903,6 +903,7 @@ struct drm_device {
 	int irq;
 #ifdef __NetBSD__
 	struct drm_bus_irq_cookie *irq_cookie;
+	struct sysmon_pswitch sc_monitor_hotplug;
 #endif
 
 	/*



CVS commit: src/sys/dev/i2c

2020-04-19 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sun Apr 19 17:08:14 UTC 2020

Modified Files:
src/sys/dev/i2c: i2c_exec.c

Log Message:
In iic_acquire_bus(), unlock the bus lock if the back-end returns an
error from its acquire-bus function.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/i2c/i2c_exec.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/i2c/i2c_exec.c
diff -u src/sys/dev/i2c/i2c_exec.c:1.15 src/sys/dev/i2c/i2c_exec.c:1.16
--- src/sys/dev/i2c/i2c_exec.c:1.15	Thu Jan  2 16:18:37 2020
+++ src/sys/dev/i2c/i2c_exec.c	Sun Apr 19 17:08:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2c_exec.c,v 1.15 2020/01/02 16:18:37 thorpej Exp $	*/
+/*	$NetBSD: i2c_exec.c,v 1.16 2020/04/19 17:08:14 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i2c_exec.c,v 1.15 2020/01/02 16:18:37 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i2c_exec.c,v 1.16 2020/04/19 17:08:14 thorpej Exp $");
 
 #include 
 #include 
@@ -141,6 +141,10 @@ iic_acquire_bus(i2c_tag_t tag, int flags
 		error = (*tag->ic_acquire_bus)(tag->ic_cookie, flags);
 	}
 
+	if (__predict_false(error)) {
+		mutex_exit(>ic_bus_lock);
+	}
+
 	return error;
 }
 



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

2020-04-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Apr 19 16:45:09 UTC 2020

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

Log Message:
fix calculation of remaining bytes in xbd_diskstart_submit() for second
part of exactly I/O over 32KB when the remaining size was less than 1 page,
loop just finished without filling the last segment

triggered by anita run by Manuel


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/xen/xen/xbd_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/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.120 src/sys/arch/xen/xen/xbd_xenbus.c:1.121
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.120	Sat Apr 18 23:24:49 2020
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Sun Apr 19 16:45:08 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.120 2020/04/18 23:24:49 jdolecek Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.121 2020/04/19 16:45:08 jdolecek Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.120 2020/04/18 23:24:49 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.121 2020/04/19 16:45:08 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -850,6 +850,7 @@ again:
 		if (bp->b_error == 0)
 			bp->b_resid = 0;
 
+		KASSERT(xbdreq->req_dmamap->dm_nsegs > 0);
 		for (seg = 0; seg < xbdreq->req_dmamap->dm_nsegs; seg++) {
 			/*
 			 * We are not allowing persistent mappings, so
@@ -1045,6 +1046,7 @@ xbdioctl(dev_t dev, u_long cmd, void *da
 		mutex_enter(>sc_lock);
 		while ((xbdreq = SLIST_FIRST(>sc_xbdreq_head)) == NULL)
 			cv_wait(>sc_req_cv, >sc_lock);
+		KASSERT(!RING_FULL(>sc_ring));
 
 		SLIST_REMOVE_HEAD(>sc_xbdreq_head, req_next);
 		req = RING_GET_REQUEST(>sc_ring,
@@ -1139,6 +1141,7 @@ xbd_diskstart(device_t self, struct buf 
 		error = EAGAIN;
 		goto out;
 	}
+	KASSERT(!RING_FULL(>sc_ring));
 
 	if ((sc->sc_features & BLKIF_FEATURE_INDIRECT) == 0
 	&& bp->b_bcount > XBD_MAX_CHUNK) {
@@ -1170,6 +1173,8 @@ xbd_diskstart(device_t self, struct buf 
 		error = EINVAL;
 		goto out;
 	}
+	KASSERTMSG(xbdreq->req_dmamap->dm_nsegs > 0,
+	"dm_nsegs == 0 with bcount %d", bp->b_bcount);
 
 	for (int seg = 0; seg < xbdreq->req_dmamap->dm_nsegs; seg++) {
 		KASSERT(seg < __arraycount(xbdreq->req_gntref));
@@ -1212,6 +1217,7 @@ xbd_diskstart(device_t self, struct buf 
 	bp, 0, xbdreq->req_dmamap, xbdreq->req_gntref);
 
 	if (bp->b_bcount > XBD_MAX_CHUNK) {
+		KASSERT(!RING_FULL(>sc_ring));
 		struct xbd_req *xbdreq2 = SLIST_FIRST(>sc_xbdreq_head);
 		KASSERT(xbdreq2 != NULL); /* Checked earlier */
 		SLIST_REMOVE_HEAD(>sc_xbdreq_head, req_next);
@@ -1258,7 +1264,7 @@ xbd_diskstart_submit(struct xbd_xenbus_s
 		bus_dma_segment_t *ds = >dm_segs[dmaseg];
 
 		ma = ds->ds_addr;
-		nbytes = imin(ds->ds_len, size);
+		nbytes = ds->ds_len;
 
 		if (start > 0) {
 			if (start >= nbytes) {
@@ -1285,6 +1291,7 @@ xbd_diskstart_submit(struct xbd_xenbus_s
 
 		reqseg->gref = gntref[dmaseg];
 	}
+	KASSERT(segidx > 0);
 	req->nr_segments = segidx;
 	sc->sc_ring.req_prod_pvt++;
 }



CVS commit: src/share/misc

2020-04-19 Thread Ignatios Souvatzis
Module Name:src
Committed By:   is
Date:   Sun Apr 19 15:58:53 UTC 2020

Modified Files:
src/share/misc: inter.phone

Log Message:
New Greek National Numbering Plan, according to the EETT decision published
in the Greek Government Gazette 127 B/8.2.2001


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/share/misc/inter.phone

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

Modified files:

Index: src/share/misc/inter.phone
diff -u src/share/misc/inter.phone:1.32 src/share/misc/inter.phone:1.33
--- src/share/misc/inter.phone:1.32	Wed Mar  4 22:24:46 2020
+++ src/share/misc/inter.phone	Sun Apr 19 15:58:53 2020
@@ -1,5 +1,5 @@
 # Country Code : City Code : City : Country
-#	$NetBSD: inter.phone,v 1.32 2020/03/04 22:24:46 fcambus Exp $
+#	$NetBSD: inter.phone,v 1.33 2020/04/19 15:58:53 is Exp $
 #	@(#)inter.phone	8.1 (Berkeley) 6/9/93
 7:317:Akmola:Republic of Kazakhstan
 7:329:Aktau:Republic of Kazakhstan
@@ -50,19 +50,19 @@
 27:21:Cape Town:South Africa
 27:31:Durban:South Africa
 27:51:Bloemfontein:South Africa
-30:1:Athens:Greece
-30:1:Piraeus:Greece
-30:241:Rhodes:Greece
-30:31:Thessaloniki:Greece
-30:321:Serrai:Greece
-30:41:Larissa:Greece
-30:421:Volos:Greece
-30:51:Kavala:Greece
-30:521:Drama:Greece
-30:61:Patrai:Greece
-30:651:Ioannina:Greece
-30:721:Kalamata:Greece
-30:81:Iraklion (Crete):Greece
+30:21:Athens:Greece
+30:21:Piraeus:Greece
+30:2241:Rhodes:Greece
+30:231:Thessaloniki:Greece
+30:2321:Serrai:Greece
+30:241:Larissa:Greece
+30:2421:Volos:Greece
+30:251:Kavala:Greece
+30:2521:Drama:Greece
+30:261:Patrai:Greece
+30:2651:Ioannina:Greece
+30:2721:Kalamata:Greece
+30:281:Iraklion (Crete):Greece
 31:10:Rotterdam:Netherlands
 31:13:Tilburg:Netherlands
 31:20:Amsterdam:Netherlands



CVS commit: src/sys/ufs/ffs

2020-04-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 19 13:59:13 UTC 2020

Modified Files:
src/sys/ufs/ffs: ffs_extattr.c

Log Message:
- add locking
- wrap wapbl around truncating, ffs_extwrite does it on its own.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/ufs/ffs/ffs_extattr.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/ufs/ffs/ffs_extattr.c
diff -u src/sys/ufs/ffs/ffs_extattr.c:1.1 src/sys/ufs/ffs/ffs_extattr.c:1.2
--- src/sys/ufs/ffs/ffs_extattr.c:1.1	Sat Apr 18 15:18:34 2020
+++ src/sys/ufs/ffs/ffs_extattr.c	Sun Apr 19 09:59:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_extattr.c,v 1.1 2020/04/18 19:18:34 christos Exp $	*/
+/*	$NetBSD: ffs_extattr.c,v 1.2 2020/04/19 13:59:13 christos Exp $	*/
 
 /*-
  * SPDX-License-Identifier: (BSD-2-Clause-FreeBSD AND BSD-3-Clause)
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ffs_extattr.c,v 1.1 2020/04/18 19:18:34 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ffs_extattr.c,v 1.2 2020/04/19 13:59:13 christos Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ffs.h"
@@ -478,34 +478,13 @@ ffs_rdextattr(u_char **p, struct vnode *
 static void
 ffs_lock_ea(struct vnode *vp)
 {
-#if 0
-	struct inode *ip;
-
-	ip = VTOI(vp);
-	VI_LOCK(vp);
-	while (ip->i_flag & IN_EA_LOCKED) {
-		UFS_INODE_SET_FLAG(ip, IN_EA_LOCKWAIT);
-		msleep(>i_ea_refs, >v_interlock, PINOD + 2, "ufs_ea",
-		0);
-	}
-	UFS_INODE_SET_FLAG(ip, IN_EA_LOCKED);
-	VI_UNLOCK(vp);
-#endif
+	genfs_node_wrlock(vp);
 }
 
 static void
 ffs_unlock_ea(struct vnode *vp)
 {
-#if 0
-	struct inode *ip;
-
-	ip = VTOI(vp);
-	VI_LOCK(vp);
-	if (ip->i_flag & IN_EA_LOCKWAIT)
-		wakeup(>i_ea_refs);
-	ip->i_flag &= ~(IN_EA_LOCKED | IN_EA_LOCKWAIT);
-	VI_UNLOCK(vp);
-#endif
+	genfs_node_unlock(vp);
 }
 
 static int
@@ -573,16 +552,17 @@ ffs_close_ea(struct vnode *vp, int commi
 		luio.uio_resid = ip->i_ea_len;
 		luio.uio_vmspace = vmspace_kernel();
 		luio.uio_rw = UIO_WRITE;
-		if ((error = UFS_WAPBL_BEGIN(vp->v_mount)) != 0) {
-			ffs_unlock_ea(vp);
-			return error;
-		}
 
 		/* XXX: I'm not happy about truncating to zero size */
-		if (ip->i_ea_len < dp->di_extsize)
+		if (ip->i_ea_len < dp->di_extsize) {
+			if ((error = UFS_WAPBL_BEGIN(vp->v_mount)) != 0) {
+ffs_unlock_ea(vp);
+return error;
+			}
 			error = ffs_truncate(vp, 0, IO_EXT, cred);
+			UFS_WAPBL_END(vp->v_mount);
+		}
 		error = ffs_extwrite(vp, , IO_EXT | IO_SYNC, cred);
-		UFS_WAPBL_END(vp->v_mount);
 	}
 	if (--ip->i_ea_refs == 0) {
 		free(ip->i_ea_area, M_TEMP);



CVS commit: [phil-wifi] src/sys/dev/usb

2020-04-19 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun Apr 19 13:57:23 UTC 2020

Modified Files:
src/sys/dev/usb [phil-wifi]: if_urtwn.c

Log Message:
Initial 11n support for urtwn.

Compile tested only... More to come.


To generate a diff of this commit:
cvs rdiff -u -r1.59.2.12 -r1.59.2.13 src/sys/dev/usb/if_urtwn.c

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

Modified files:

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.59.2.12 src/sys/dev/usb/if_urtwn.c:1.59.2.13
--- src/sys/dev/usb/if_urtwn.c:1.59.2.12	Fri Apr 17 13:44:37 2020
+++ src/sys/dev/usb/if_urtwn.c	Sun Apr 19 13:57:23 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.59.2.12 2020/04/17 13:44:37 martin Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.59.2.13 2020/04/19 13:57:23 nat Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.42 2015/02/10 23:25:46 mpi Exp $	*/
 
 /*-
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.12 2020/04/17 13:44:37 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_urtwn.c,v 1.59.2.13 2020/04/19 13:57:23 nat Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1651,9 +1651,10 @@ urtwn_ra_init(struct ieee80211vap *vap)
 	}
 	if (ic->ic_curmode == IEEE80211_MODE_11B) {
 		mode = R92C_RAID_11B;
-	} else {
+	} else if (ic->ic_curmode == IEEE80211_MODE_11G) {
 		mode = R92C_RAID_11BG;
-	}
+	} else /* mode = IEEE80211_MODE_11NG */
+		mode = R92C_RAID_11GN;
 	DPRINTFN(DBG_INIT, ("%s: %s: mode=%#x rates=%#x, basicrates=%#x, "
 	"maxrate=%zx, maxbasicrate=%zx\n",
 	device_xname(sc->sc_dev), __func__, mode, rates, basicrates,
@@ -2153,10 +2154,11 @@ urtwn_newstate_cb(struct urtwn_softc *sc
 
 		if (ic->ic_curmode == IEEE80211_MODE_11B) {
 			urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 0);
-		} else {
+		} else if (ic->ic_curmode == IEEE80211_MODE_11G) {
 			/* 802.11b/g */
 			urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 3);
-		}
+		} else /* IEEE_MODE_11NG */
+			urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 12); /* MCS 0 */
 
 		/* Enable Rx of data frames. */
 		urtwn_write_2(sc, R92C_RXFLTMAP2, 0x);
@@ -2464,10 +2466,11 @@ urtwn_newstate(struct ieee80211vap *vap,
 
 		if (ic->ic_curmode == IEEE80211_MODE_11B) {
 			urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 0);
-		} else {
+		} else if (ic->ic_curmode == IEEE80211_MODE_11G) {
 			/* 802.11b/g */
 			urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 3);
-		}
+		} else /* IEEE_MODE_11NG */
+			urtwn_write_1(sc, R92C_INIRTS_RATE_SEL, 12); /* MCS 0 */
 
 		/* Enable Rx of data frames. */
 		urtwn_write_2(sc, R92C_RXFLTMAP2, 0x);
@@ -3090,6 +3093,9 @@ urtwn_tx(struct urtwn_softc *sc, struct 
 		R92C_TXDW0_OWN | R92C_TXDW0_FSG | R92C_TXDW0_LSG);
 	}
 
+	if (ic->ic_curmode == IEEE80211_MODE_11NG)
+		txd->txdw5 |= htole32(R92C_TXDW5_SGI);
+
 	if (IEEE80211_IS_MULTICAST(wh->i_addr1))
 		txd->txdw0 |= htole32(R92C_TXDW0_BMCAST);
 
@@ -3104,8 +3110,10 @@ urtwn_tx(struct urtwn_softc *sc, struct 
 	type == IEEE80211_FC0_TYPE_DATA) {
 		if (ic->ic_curmode == IEEE80211_MODE_11B)
 			raid = R92C_RAID_11B;
-		else
+		else if (ic->ic_curmode == IEEE80211_MODE_11G)
 			raid = R92C_RAID_11BG;
+		else	/* IEEE80211_MODE_11NG */
+			raid = R92C_RAID_11GN;
 		DPRINTFN(DBG_TX,
 		("%s: %s: data packet: tid=%d, raid=%d\n",
 		device_xname(sc->sc_dev), __func__, tid, raid));
@@ -3657,6 +3665,7 @@ urtwn_getradiocaps(struct ieee80211com *
 	memset(bands, 0, sizeof(bands));
 	setbit(bands, IEEE80211_MODE_11B);
 	setbit(bands, IEEE80211_MODE_11G);
+	setbit(bands, IEEE80211_MODE_11NG);
 	ieee80211_add_channel_list_2ghz(chans, maxchans, nchans,
 	urtwn_chan_2ghz, nitems(urtwn_chan_2ghz), bands, 0);
 }



CVS commit: src

2020-04-19 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sun Apr 19 13:44:51 UTC 2020

Modified Files:
src/lib/libossaudio: ossaudio.c
src/sys/compat/ossaudio: ossaudio.c

Log Message:
ossaudio: Implement SNDCTL_DSP_(SET|GET)TRIGGER.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/lib/libossaudio/ossaudio.c
cvs rdiff -u -r1.81 -r1.82 src/sys/compat/ossaudio/ossaudio.c

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

Modified files:

Index: src/lib/libossaudio/ossaudio.c
diff -u src/lib/libossaudio/ossaudio.c:1.42 src/lib/libossaudio/ossaudio.c:1.43
--- src/lib/libossaudio/ossaudio.c:1.42	Sun Apr 19 11:27:40 2020
+++ src/lib/libossaudio/ossaudio.c	Sun Apr 19 13:44:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.42 2020/04/19 11:27:40 nia Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.43 2020/04/19 13:44:50 nia Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: ossaudio.c,v 1.42 2020/04/19 11:27:40 nia Exp $");
+__RCSID("$NetBSD: ossaudio.c,v 1.43 2020/04/19 13:44:50 nia Exp $");
 
 /*
  * This is an OSS (Linux) sound API emulator.
@@ -501,43 +501,35 @@ audio_ioctl(int fd, unsigned long com, v
 		retval = ioctl(fd, AUDIO_GETPROPS, );
 		if (retval < 0)
 			return retval;
-		idat = DSP_CAP_TRIGGER; /* pretend we have trigger */
+		idat = DSP_CAP_TRIGGER;
 		if (idata & AUDIO_PROP_FULLDUPLEX)
 			idat |= DSP_CAP_DUPLEX;
 		if (idata & AUDIO_PROP_MMAP)
 			idat |= DSP_CAP_MMAP;
 		INTARG = idat;
 		break;
-#if 0
-	case SNDCTL_DSP_GETTRIGGER:
+	case SNDCTL_DSP_SETTRIGGER:
 		retval = ioctl(fd, AUDIO_GETBUFINFO, );
 		if (retval < 0)
 			return retval;
-		idat = (tmpinfo.play.pause ? 0 : PCM_ENABLE_OUTPUT) |
-		   (tmpinfo.record.pause ? 0 : PCM_ENABLE_INPUT);
-		retval = copyout(, SCARG(uap, data), sizeof idat);
-		if (retval < 0)
-			return retval;
-		break;
-	case SNDCTL_DSP_SETTRIGGER:
 		AUDIO_INITINFO();
-		retval = copyin(SCARG(uap, data), , sizeof idat);
-		if (retval < 0)
-			return retval;
-		tmpinfo.play.pause = (idat & PCM_ENABLE_OUTPUT) == 0;
-		tmpinfo.record.pause = (idat & PCM_ENABLE_INPUT) == 0;
-		(void) ioctl(fd, AUDIO_SETINFO, );
-		retval = copyout(, SCARG(uap, data), sizeof idat);
+		if (tmpinfo.mode & AUMODE_PLAY)
+			tmpinfo.play.pause = (INTARG & PCM_ENABLE_OUTPUT) == 0;
+		if (tmpinfo.mode & AUMODE_RECORD)
+			tmpinfo.record.pause = (INTARG & PCM_ENABLE_INPUT) == 0;
+		(void)ioctl(fd, AUDIO_SETINFO, );
+		/* FALLTHRU */
+	case SNDCTL_DSP_GETTRIGGER:
+		retval = ioctl(fd, AUDIO_GETBUFINFO, );
 		if (retval < 0)
 			return retval;
+		idat = 0;
+		if ((tmpinfo.mode & AUMODE_PLAY) && !tmpinfo.play.pause)
+			idat |= PCM_ENABLE_OUTPUT;
+		if ((tmpinfo.mode & AUMODE_RECORD) && !tmpinfo.record.pause)
+			idat |= PCM_ENABLE_INPUT;
+		INTARG = idat;
 		break;
-#else
-	case SNDCTL_DSP_GETTRIGGER:
-	case SNDCTL_DSP_SETTRIGGER:
-		/* XXX Do nothing for now. */
-		INTARG = PCM_ENABLE_OUTPUT;
-		break;
-#endif
 	case SNDCTL_DSP_GETIPTR:
 		retval = ioctl(fd, AUDIO_GETIOFFS, );
 		if (retval < 0)

Index: src/sys/compat/ossaudio/ossaudio.c
diff -u src/sys/compat/ossaudio/ossaudio.c:1.81 src/sys/compat/ossaudio/ossaudio.c:1.82
--- src/sys/compat/ossaudio/ossaudio.c:1.81	Wed Apr 15 16:39:06 2020
+++ src/sys/compat/ossaudio/ossaudio.c	Sun Apr 19 13:44:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.81 2020/04/15 16:39:06 nia Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.82 2020/04/19 13:44:51 nia Exp $	*/
 
 /*-
  * Copyright (c) 1997, 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.81 2020/04/15 16:39:06 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ossaudio.c,v 1.82 2020/04/19 13:44:51 nia Exp $");
 
 #include 
 #include 
@@ -715,7 +715,7 @@ oss_ioctl_audio(struct lwp *l, const str
 			 __func__, error));
 			goto out;
 		}
-		idat = OSS_DSP_CAP_TRIGGER; /* pretend we have trigger */
+		idat = OSS_DSP_CAP_TRIGGER;
 		if (idata & AUDIO_PROP_FULLDUPLEX)
 			idat |= OSS_DSP_CAP_DUPLEX;
 		if (idata & AUDIO_PROP_MMAP)
@@ -730,64 +730,45 @@ oss_ioctl_audio(struct lwp *l, const str
 			goto out;
 		}
 		break;
-#if 0
-	case OSS_SNDCTL_DSP_GETTRIGGER:
-		error = ioctlf(fp, AUDIO_GETBUFINFO, );
-		if (error) {
-			DPRINTF(("%s: AUDIO_GETBUFINFO %d\n",
-			 __func__, error));
-			goto out;
-		}
-		idat = (tmpinfo.play.pause ? 0 : OSS_PCM_ENABLE_OUTPUT) |
-		   (tmpinfo.record.pause ? 0 : OSS_PCM_ENABLE_INPUT);
-		error = copyout(, SCARG(uap, data), sizeof idat);
-		if (error) {
-			DPRINTF(("%s: SNDCTL_DSP_SETRIGGER %x = %d\n",
-			__func__, idat, error));
-			goto out;
-		}
-		break;
 	case OSS_SNDCTL_DSP_SETTRIGGER:
-		error = ioctlf(fp, AUDIO_GETBUFINFO, , p);
+		error = copyin(SCARG(uap, data), , sizeof idat);
 		if (error) {
-			DPRINTF(("%s: AUDIO_GETBUFINFO %d\n",
+			DPRINTF(("%s: SNDCTL_DSP_SETTRIGGER: %d\n",
 			 __func__, error));
 			goto out;
 		}
-		error = 

CVS commit: src/sys/kern

2020-04-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun Apr 19 13:26:18 UTC 2020

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

Log Message:
Destroy anonymous device vnodes on reboot once the last file system
got unmounted and the mount list is empty.

PR kern/54969: Disk cache is no longer flushed on shutdown


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/kern/vfs_mount.c

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

Modified files:

Index: src/sys/kern/vfs_mount.c
diff -u src/sys/kern/vfs_mount.c:1.78 src/sys/kern/vfs_mount.c:1.79
--- src/sys/kern/vfs_mount.c:1.78	Mon Apr 13 19:23:18 2020
+++ src/sys/kern/vfs_mount.c	Sun Apr 19 13:26:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_mount.c,v 1.78 2020/04/13 19:23:18 ad Exp $	*/
+/*	$NetBSD: vfs_mount.c,v 1.79 2020/04/19 13:26:17 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2020 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.78 2020/04/13 19:23:18 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_mount.c,v 1.79 2020/04/19 13:26:17 hannken Exp $");
 
 #include 
 #include 
@@ -115,6 +115,8 @@ static struct vnode *vfs_vnode_iterator_
 /* Root filesystem. */
 vnode_t *			rootvnode;
 
+extern struct mount		*dead_rootmount;
+
 /* Mounted filesystem list. */
 static TAILQ_HEAD(mountlist, mountlist_entry) mountlist;
 static kmutex_t			mountlist_lock __cacheline_aligned;
@@ -1020,6 +1022,7 @@ bool
 vfs_unmountall1(struct lwp *l, bool force, bool verbose)
 {
 	struct mount *mp;
+	mount_iterator_t *iter;
 	bool any_error = false, progress = false;
 	uint64_t gen;
 	int error;
@@ -1054,6 +1057,24 @@ vfs_unmountall1(struct lwp *l, bool forc
 	if (any_error && verbose) {
 		printf("WARNING: some file systems would not unmount\n");
 	}
+
+	/* If the mountlist is empty destroy anonymous device vnodes. */
+	mountlist_iterator_init();
+	if (mountlist_iterator_next(iter) == NULL) {
+		struct vnode_iterator *marker;
+		vnode_t *vp;
+
+		vfs_vnode_iterator_init(dead_rootmount, );
+		while ((vp = vfs_vnode_iterator_next(marker, NULL, NULL))) {
+			if (vp->v_type == VCHR || vp->v_type == VBLK)
+vgone(vp);
+			else
+vrele(vp);
+		}
+		vfs_vnode_iterator_destroy(marker);
+	}
+	mountlist_iterator_destroy(iter);
+
 	return progress;
 }
 



CVS commit: src/sys/kern

2020-04-19 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun Apr 19 13:25:00 UTC 2020

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

Log Message:
Take some pressure from vdrain lock:

- Use cv_signal() instead of cv_broadcast(), there is only one waiter.
- No need to signal if number of vnodes doesn't increase.
- Use kpause(1) instead of yield().


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/kern/vfs_vnode.c

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

Modified files:

Index: src/sys/kern/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.120 src/sys/kern/vfs_vnode.c:1.121
--- src/sys/kern/vfs_vnode.c:1.120	Mon Apr 13 19:23:18 2020
+++ src/sys/kern/vfs_vnode.c	Sun Apr 19 13:25:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.120 2020/04/13 19:23:18 ad Exp $	*/
+/*	$NetBSD: vfs_vnode.c,v 1.121 2020/04/19 13:25:00 hannken Exp $	*/
 
 /*-
  * Copyright (c) 1997-2011, 2019, 2020 The NetBSD Foundation, Inc.
@@ -155,7 +155,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.120 2020/04/13 19:23:18 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_vnode.c,v 1.121 2020/04/19 13:25:00 hannken Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pax.h"
@@ -519,8 +519,9 @@ lru_requeue(vnode_t *vp, vnodelst_t *lis
 		 */
 		numvnodes += d;
 	}
-	if (numvnodes > desiredvnodes || listhd == _list[LRU_VRELE])
-		cv_broadcast(_cv);
+	if ((d > 0 && numvnodes > desiredvnodes) ||
+	listhd == _list[LRU_VRELE])
+		cv_signal(_cv);
 	mutex_exit(_lock);
 }
 
@@ -686,9 +687,7 @@ vdrain_thread(void *cookie)
 		}
 
 		if (vdrain_retry) {
-			mutex_exit(_lock);
-			yield();
-			mutex_enter(_lock);
+			kpause("vdrainrt", false, 1, _lock);
 		} else {
 			vdrain_gen++;
 			cv_broadcast(_gen_cv);



CVS commit: src

2020-04-19 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sun Apr 19 13:22:58 UTC 2020

Modified Files:
src/distrib/sets/lists/debug: md.amd64
src/distrib/sets/lists/tests: md.amd64 mi
src/etc/mtree: NetBSD.dist.tests
src/tests/lib: Makefile
Added Files:
src/tests/lib/libi386: Makefile t_user_ldt.c

Log Message:
Add tests for USER_LDT.


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/distrib/sets/lists/debug/md.amd64
cvs rdiff -u -r1.7 -r1.8 src/distrib/sets/lists/tests/md.amd64
cvs rdiff -u -r1.835 -r1.836 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.161 -r1.162 src/etc/mtree/NetBSD.dist.tests
cvs rdiff -u -r1.32 -r1.33 src/tests/lib/Makefile
cvs rdiff -u -r0 -r1.1 src/tests/lib/libi386/Makefile \
src/tests/lib/libi386/t_user_ldt.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/md.amd64
diff -u src/distrib/sets/lists/debug/md.amd64:1.106 src/distrib/sets/lists/debug/md.amd64:1.107
--- src/distrib/sets/lists/debug/md.amd64:1.106	Mon Oct 28 15:42:07 2019
+++ src/distrib/sets/lists/debug/md.amd64	Sun Apr 19 13:22:58 2020
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.106 2019/10/28 15:42:07 pgoyette Exp $
+# $NetBSD: md.amd64,v 1.107 2020/04/19 13:22:58 maxv Exp $
 ./usr/lib/i386/12.202++_g.a			comp-c-debuglib		debuglib,compat,12.202xx
 ./usr/lib/i386/libi386_g.a			comp-c-debuglib		debuglib,compat
 ./usr/lib/i386/libiberty_g.a			comp-obsolete		obsolete
@@ -25,5 +25,6 @@
 ./usr/libdata/debug/usr/tests/kernel/arch/x86/t_ptrace_wait6.debug	tests-obsolete	obsolete
 ./usr/libdata/debug/usr/tests/kernel/arch/x86/t_ptrace_waitid.debug	tests-obsolete	obsolete
 ./usr/libdata/debug/usr/tests/kernel/arch/x86/t_ptrace_waitpid.debug	tests-obsolete	obsolete
+./usr/libdata/debug/usr/tests/lib/libi386/t_user_ldt.debug	tests-lib-debug	debug,atf
 ./usr/libdata/debug/usr/tests/lib/libnvmm/h_io_assist.debug	tests-lib-debug	debug,atf
 ./usr/libdata/debug/usr/tests/lib/libnvmm/h_mem_assist.debug	tests-lib-debug	debug,atf

Index: src/distrib/sets/lists/tests/md.amd64
diff -u src/distrib/sets/lists/tests/md.amd64:1.7 src/distrib/sets/lists/tests/md.amd64:1.8
--- src/distrib/sets/lists/tests/md.amd64:1.7	Tue Feb  5 13:00:03 2019
+++ src/distrib/sets/lists/tests/md.amd64	Sun Apr 19 13:22:58 2020
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.7 2019/02/05 13:00:03 maxv Exp $
+# $NetBSD: md.amd64,v 1.8 2020/04/19 13:22:58 maxv Exp $
 ./usr/tests/kernel/arch/x86/Atffile		tests-obsolete	obsolete
 ./usr/tests/kernel/arch/x86/Kyuafile		tests-obsolete	obsolete
 ./usr/tests/kernel/arch/x86/t_ptrace_wait	tests-obsolete	obsolete
@@ -7,6 +7,7 @@
 ./usr/tests/kernel/arch/x86/t_ptrace_wait6	tests-obsolete	obsolete
 ./usr/tests/kernel/arch/x86/t_ptrace_waitid	tests-obsolete	obsolete
 ./usr/tests/kernel/arch/x86/t_ptrace_waitpid	tests-obsolete	obsolete
+./usr/tests/lib/libi386/t_user_ldt		tests-lib-tests	compattestfile,atf
 ./usr/tests/lib/libnvmm/h_io_assist		tests-lib-tests	compattestfile,atf
 ./usr/tests/lib/libnvmm/t_io_assist		tests-lib-tests	compattestfile,atf
 ./usr/tests/lib/libnvmm/h_mem_assist		tests-lib-tests	compattestfile,atf

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.835 src/distrib/sets/lists/tests/mi:1.836
--- src/distrib/sets/lists/tests/mi:1.835	Sat Apr 11 01:51:14 2020
+++ src/distrib/sets/lists/tests/mi	Sun Apr 19 13:22:58 2020
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.835 2020/04/11 01:51:14 christos Exp $
+# $NetBSD: mi,v 1.836 2020/04/19 13:22:58 maxv Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -126,6 +126,7 @@
 ./usr/libdata/debug/usr/tests/lib/libeventtests-lib-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/libexecinfotests-lib-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/liblutoktests-lutok-debug	compattestfile,atf
+./usr/libdata/debug/usr/tests/lib/libi386tests-lib-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/libm	tests-lib-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/libnvmmtests-lib-debug		compattestfile,atf
 ./usr/libdata/debug/usr/tests/lib/libobjctests-lib-debug		compattestfile,atf
@@ -3467,6 +3468,9 @@
 ./usr/tests/lib/libexecinfo/Atffile		tests-lib-tests		compattestfile,atf
 ./usr/tests/lib/libexecinfo/Kyuafile		tests-lib-tests		compattestfile,atf,kyua
 ./usr/tests/lib/libexecinfo/t_backtrace		tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libi386tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libi386/Atffile			tests-lib-tests		compattestfile,atf
+./usr/tests/lib/libi386/Kyuafile		tests-lib-tests		compattestfile,atf,kyua
 ./usr/tests/lib/liblutok			tests-lutok-tests	compattestfile,atf
 ./usr/tests/lib/liblutok/Atffile		tests-lutok-tests	compattestfile,atf,kyua
 ./usr/tests/lib/liblutok/Kyuafile		tests-lutok-tests	compattestfile,atf,kyua

Index: 

CVS commit: [bouyer-xenpvh] src/sys/arch

2020-04-19 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Sun Apr 19 11:40:31 UTC 2020

Modified Files:
src/sys/arch/x86/include [bouyer-xenpvh]: intr.h
src/sys/arch/x86/x86 [bouyer-xenpvh]: intr.c x86_softintr.c
src/sys/arch/xen/include [bouyer-xenpvh]: evtchn.h
src/sys/arch/xen/x86 [bouyer-xenpvh]: xen_intr.c
src/sys/arch/xen/xen [bouyer-xenpvh]: evtchn.c

Log Message:
Add a struct pic * member to struct intrhand.
This will be used for interrupt_get_count()
For Xen remplace pic_type with a pointer to the pic, and add a pointer
to intrhand, in struct pintrhand
Make event_set_handler return the pointer to struct intrhand.
Don't allocate a fake intrhand in xen_intr_establish_xname(), use the
one returned by event_set_handler().


To generate a diff of this commit:
cvs rdiff -u -r1.61.6.3 -r1.61.6.4 src/sys/arch/x86/include/intr.h
cvs rdiff -u -r1.150.6.3 -r1.150.6.4 src/sys/arch/x86/x86/intr.c
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/sys/arch/x86/x86/x86_softintr.c
cvs rdiff -u -r1.28 -r1.28.2.1 src/sys/arch/xen/include/evtchn.h
cvs rdiff -u -r1.21.2.5 -r1.21.2.6 src/sys/arch/xen/x86/xen_intr.c
cvs rdiff -u -r1.88.2.6 -r1.88.2.7 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/x86/include/intr.h
diff -u src/sys/arch/x86/include/intr.h:1.61.6.3 src/sys/arch/x86/include/intr.h:1.61.6.4
--- src/sys/arch/x86/include/intr.h:1.61.6.3	Thu Apr 16 08:46:35 2020
+++ src/sys/arch/x86/include/intr.h	Sun Apr 19 11:40:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.61.6.3 2020/04/16 08:46:35 bouyer Exp $	*/
+/*	$NetBSD: intr.h,v 1.61.6.4 2020/04/19 11:40:30 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001, 2006, 2007, 2008, 2019 The NetBSD Foundation, Inc.
@@ -130,19 +130,7 @@ struct intrsource {
  */
 
 struct intrhand {
-#if defined(XEN)
-	/*
-	 * Note: This is transitional and will go away.
-	 * The only current consumer is xen_intr_disestablish()
-	 *
-	 * We ought to use a union here, but too much effort.
-	 * We use this field to tear down the cookie handed to us
-	 * via x86/intr.c:intr_disestablish();
-	 * Interestingly, the intr_establish_xname() function returns
-	 * a "void *" - so we abuse this for now.
-	 */
-	int	pic_type; /* Overloading wrt struct pintrhand */
-#endif
+	struct pic *ih_pic;
 	int	(*ih_fun)(void *);
 	void	*ih_arg;
 	int	ih_level;

Index: src/sys/arch/x86/x86/intr.c
diff -u src/sys/arch/x86/x86/intr.c:1.150.6.3 src/sys/arch/x86/x86/intr.c:1.150.6.4
--- src/sys/arch/x86/x86/intr.c:1.150.6.3	Thu Apr 16 09:45:57 2020
+++ src/sys/arch/x86/x86/intr.c	Sun Apr 19 11:40:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.150.6.3 2020/04/16 09:45:57 bouyer Exp $	*/
+/*	$NetBSD: intr.c,v 1.150.6.4 2020/04/19 11:40:30 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.150.6.3 2020/04/16 09:45:57 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.150.6.4 2020/04/19 11:40:30 bouyer Exp $");
 
 #include "opt_intrdebug.h"
 #include "opt_multiprocessor.h"
@@ -880,6 +880,7 @@ intr_establish_xname(int legacy_irq, str
 		/* nothing */;
 	}
 
+	ih->ih_pic = pic;
 	ih->ih_fun = ih->ih_realfun = handler;
 	ih->ih_arg = ih->ih_realarg = arg;
 	ih->ih_prevp = p;
@@ -1302,6 +1303,7 @@ cpu_intr_init(struct cpu_info *ci)
 	isp = kmem_zalloc(sizeof(*isp), KM_SLEEP);
 	isp->is_recurse = Xrecurse_lapic_ltimer;
 	isp->is_resume = Xresume_lapic_ltimer;
+	fake_timer_intrhand.ih_pic = _pic;
 	fake_timer_intrhand.ih_level = IPL_CLOCK;
 	isp->is_handlers = _timer_intrhand;
 	isp->is_pic = _pic;
@@ -1315,6 +1317,7 @@ cpu_intr_init(struct cpu_info *ci)
 	isp = kmem_zalloc(sizeof(*isp), KM_SLEEP);
 	isp->is_recurse = Xrecurse_lapic_ipi;
 	isp->is_resume = Xresume_lapic_ipi;
+	fake_ipi_intrhand.ih_pic = _pic;
 	fake_ipi_intrhand.ih_level = IPL_HIGH;
 	isp->is_handlers = _ipi_intrhand;
 	isp->is_pic = _pic;

Index: src/sys/arch/x86/x86/x86_softintr.c
diff -u src/sys/arch/x86/x86/x86_softintr.c:1.1.2.1 src/sys/arch/x86/x86/x86_softintr.c:1.1.2.2
--- src/sys/arch/x86/x86/x86_softintr.c:1.1.2.1	Sat Apr 11 18:26:07 2020
+++ src/sys/arch/x86/x86/x86_softintr.c	Sun Apr 19 11:40:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_softintr.c,v 1.1.2.1 2020/04/11 18:26:07 bouyer Exp $	*/
+/*	$NetBSD: x86_softintr.c,v 1.1.2.2 2020/04/19 11:40:30 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2007, 2008, 2009, 2019 The NetBSD Foundation, Inc.
@@ -133,7 +133,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_softintr.c,v 1.1.2.1 2020/04/11 18:26:07 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_softintr.c,v 1.1.2.2 2020/04/19 11:40:30 bouyer Exp $");
 
 #include 
 #include 
@@ -226,6 +226,7 @@ x86_init_preempt(struct cpu_info *ci)
 	isp = kmem_zalloc(sizeof(*isp), KM_SLEEP);
 	isp->is_recurse = Xrecurse_preempt;
 	isp->is_resume = Xresume_preempt;
+	

CVS commit: src/lib/libossaudio

2020-04-19 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Sun Apr 19 11:27:40 UTC 2020

Modified Files:
src/lib/libossaudio: ossaudio.c

Log Message:
ossaudio: Make SNDCTL_DSP_[GET|SET][PLAY|RECORD]VOL closer to OSSv4

Problems in the previous code include returning values in the 0-255
range NetBSD uses instead of the 0-100 range OSSv4 expects, using
AUDIO_GETBUFINFO (which doesn't even return the mixer bits), and
not encoding channels as specified: "level=(left)|(right << 8)".

In reality, setting the gain in this way (through /dev/audio rather
than /dev/mixer) doesn't seem to work properly, and the mixer-set
value seems to be retained.

However, these changes at least ensure that the return values are
correct and the balance is set correctly.

I've only found one application using this API (audio/audacious), and
OSSv4 support in it is currently disabled precisely because it breaks
when it attempts to set the track volume using it.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/lib/libossaudio/ossaudio.c

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

Modified files:

Index: src/lib/libossaudio/ossaudio.c
diff -u src/lib/libossaudio/ossaudio.c:1.41 src/lib/libossaudio/ossaudio.c:1.42
--- src/lib/libossaudio/ossaudio.c:1.41	Wed Apr 15 16:39:06 2020
+++ src/lib/libossaudio/ossaudio.c	Sun Apr 19 11:27:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ossaudio.c,v 1.41 2020/04/15 16:39:06 nia Exp $	*/
+/*	$NetBSD: ossaudio.c,v 1.42 2020/04/19 11:27:40 nia Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: ossaudio.c,v 1.41 2020/04/15 16:39:06 nia Exp $");
+__RCSID("$NetBSD: ossaudio.c,v 1.42 2020/04/19 11:27:40 nia Exp $");
 
 /*
  * This is an OSS (Linux) sound API emulator.
@@ -48,6 +48,7 @@ __RCSID("$NetBSD: ossaudio.c,v 1.41 2020
 #include 
 #include 
 #include 
+#include 
 
 #include "soundcard.h"
 #undef ioctl
@@ -63,6 +64,9 @@ __RCSID("$NetBSD: ossaudio.c,v 1.41 2020
 
 static struct audiodevinfo *getdevinfo(int);
 
+static int getvol(u_int, u_char);
+static void setvol(int, int, bool);
+
 static void setchannels(int, int, int);
 static void setblocksize(int, struct audio_info *);
 
@@ -635,41 +639,23 @@ audio_ioctl(int fd, unsigned long com, v
 		tmpaudioinfo->next_rec_engine = 0;
 		argp = tmpaudioinfo;
 		break;
-	case SNDCTL_DSP_GETPLAYVOL:
-		retval = ioctl(fd, AUDIO_GETBUFINFO, );
-		if (retval < 0)
-			return retval;
-		*(uint *)argp = tmpinfo.play.gain;
-		break;
 	case SNDCTL_DSP_SETPLAYVOL:
-		retval = ioctl(fd, AUDIO_GETBUFINFO, );
-		if (retval < 0)
-			return retval;
-		if (*(uint *)argp > 255)
-			tmpinfo.play.gain = 255;
-		else
-			tmpinfo.play.gain = *(uint *)argp;
-		retval = ioctl(fd, AUDIO_SETINFO, );
-		if (retval < 0)
-			return retval;
-		break;
-	case SNDCTL_DSP_GETRECVOL:
-		retval = ioctl(fd, AUDIO_GETBUFINFO, );
+		setvol(fd, INTARG, false);
+		/* FALLTHRU */
+	case SNDCTL_DSP_GETPLAYVOL:
+		retval = ioctl(fd, AUDIO_GETINFO, );
 		if (retval < 0)
 			return retval;
-		*(uint *)argp = tmpinfo.record.gain;
+		INTARG = getvol(tmpinfo.play.gain, tmpinfo.play.balance);
 		break;
 	case SNDCTL_DSP_SETRECVOL:
-		retval = ioctl(fd, AUDIO_GETBUFINFO, );
-		if (retval < 0)
-			return retval;
-		if (*(uint *)argp > 255)
-			tmpinfo.record.gain = 255;
-		else
-			tmpinfo.record.gain = *(uint *)argp;
-		retval = ioctl(fd, AUDIO_SETINFO, );
+		setvol(fd, INTARG, true);
+		/* FALLTHRU */
+	case SNDCTL_DSP_GETRECVOL:
+		retval = ioctl(fd, AUDIO_GETINFO, );
 		if (retval < 0)
 			return retval;
+		INTARG = getvol(tmpinfo.record.gain, tmpinfo.record.balance);
 		break;
 	case SNDCTL_DSP_SKIP:
 	case SNDCTL_DSP_SILENCE:
@@ -1047,6 +1033,53 @@ mixer_ioctl(int fd, unsigned long com, v
 	return 0;
 }
 
+static int
+getvol(u_int gain, u_char balance)
+{
+	u_int l, r;
+
+	if (balance == AUDIO_MID_BALANCE) {
+		l = r = gain;
+	} else if (balance < AUDIO_MID_BALANCE) {
+		l = gain;
+		r = (balance * gain) / AUDIO_MID_BALANCE;
+	} else {
+		r = gain;
+		l = ((AUDIO_RIGHT_BALANCE - balance) * gain)
+		/ AUDIO_MID_BALANCE;
+	}
+
+	return TO_OSSVOL(l) | (TO_OSSVOL(r) << 8);
+}
+
+static void
+setvol(int fd, int volume, bool record)
+{
+	u_int lgain, rgain;
+	struct audio_info tmpinfo;
+	struct audio_prinfo *prinfo;
+
+	AUDIO_INITINFO();
+	prinfo = record ?  : 
+
+	lgain = FROM_OSSVOL((volume >> 0) & 0xff);
+	rgain = FROM_OSSVOL((volume >> 8) & 0xff);
+
+	if (lgain == rgain) {
+		prinfo->gain = lgain;
+		prinfo->balance = AUDIO_MID_BALANCE;
+	} else if (lgain < rgain) {
+		prinfo->gain = rgain;
+		prinfo->balance = AUDIO_RIGHT_BALANCE -
+		(AUDIO_MID_BALANCE * lgain) / rgain;
+	} else {
+		prinfo->gain = lgain;
+		prinfo->balance = (AUDIO_MID_BALANCE * rgain) / lgain;
+	}
+
+	(void)ioctl(fd, AUDIO_SETINFO, );
+}
+
 /*
  * When AUDIO_SETINFO fails to set a channel count, the application's chosen
  * number is out of range of what the kernel allows.



CVS commit: src/sys/external/mit/xen-include-public/dist/xen/include/public/io

2020-04-19 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Apr 19 11:01:36 UTC 2020

Modified Files:
src/sys/external/mit/xen-include-public/dist/xen/include/public/io:
blkif.h

Log Message:
revert previous, it actually doesn't help so no reason to diverge from xen


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/sys/external/mit/xen-include-public/dist/xen/include/public/io/blkif.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/external/mit/xen-include-public/dist/xen/include/public/io/blkif.h
diff -u src/sys/external/mit/xen-include-public/dist/xen/include/public/io/blkif.h:1.2 src/sys/external/mit/xen-include-public/dist/xen/include/public/io/blkif.h:1.3
--- src/sys/external/mit/xen-include-public/dist/xen/include/public/io/blkif.h:1.2	Thu Apr 16 15:58:13 2020
+++ src/sys/external/mit/xen-include-public/dist/xen/include/public/io/blkif.h	Sun Apr 19 11:01:35 2020
@@ -653,20 +653,14 @@ struct blkif_request_indirect {
 uint8_toperation;/* BLKIF_OP_INDIRECT*/
 uint8_tindirect_op;  /* BLKIF_OP_{READ/WRITE}*/
 uint16_t   nr_segments;  /* number of segments   */
-#ifndef __i386__
-uint32_t	   _pad1;
-#endif
 uint64_t   id;   /* private guest value, echoed in resp  */
 blkif_sector_t sector_number;/* start sector idx on disk (r/w only)  */
 blkif_vdev_t   handle;   /* same as for read/write requests  */
-uint16_t   _pad2;
 grant_ref_tindirect_grefs[BLKIF_MAX_INDIRECT_PAGES_PER_REQUEST];
-#ifndef __i386__
-uint32_t   _pad3;/* Make it 64 byte aligned */
-#else
-uint64_t   _pad3;/* Make it 64 byte aligned */
+#ifdef __i386__
+uint64_t   pad;  /* Make it 64 byte aligned on i386  */
 #endif
-} __packed;
+};
 typedef struct blkif_request_indirect blkif_request_indirect_t;
 
 struct blkif_response {



CVS commit: src/sys/uvm

2020-04-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Apr 19 08:59:53 UTC 2020

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

Log Message:
Fix UVMHIST_LOG compile on 32bit platforms


To generate a diff of this commit:
cvs rdiff -u -r1.380 -r1.381 src/sys/uvm/uvm_map.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_map.c
diff -u src/sys/uvm/uvm_map.c:1.380 src/sys/uvm/uvm_map.c:1.381
--- src/sys/uvm/uvm_map.c:1.380	Sat Apr 18 17:22:26 2020
+++ src/sys/uvm/uvm_map.c	Sun Apr 19 08:59:53 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_map.c,v 1.380 2020/04/18 17:22:26 riastradh Exp $	*/
+/*	$NetBSD: uvm_map.c,v 1.381 2020/04/19 08:59:53 skrll Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.380 2020/04/18 17:22:26 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_map.c,v 1.381 2020/04/19 08:59:53 skrll Exp $");
 
 #include "opt_ddb.h"
 #include "opt_pax.h"
@@ -4960,7 +4960,7 @@ uvm_voaddr_acquire(struct vm_map * const
 	if (result) {
 		UVMHIST_LOG(maphist,
 		"<- done OK (type=%jd,owner=#%jx,offset=%jx)",
-		voaddr->type, voaddr->uobj, voaddr->offset, 0);
+		voaddr->type, (uintptr_t)voaddr->uobj, voaddr->offset, 0);
 	} else {
 		UVMHIST_LOG(maphist,"<- done (failed)",0,0,0,0);
 	}



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

2020-04-19 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Apr 19 08:50:54 UTC 2020

Modified Files:
src/sys/arch/arm/arm32: pmap.c

Log Message:
Fix typo in UVMHIST_LOG


To generate a diff of this commit:
cvs rdiff -u -r1.408 -r1.409 src/sys/arch/arm/arm32/pmap.c

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

Modified files:

Index: src/sys/arch/arm/arm32/pmap.c
diff -u src/sys/arch/arm/arm32/pmap.c:1.408 src/sys/arch/arm/arm32/pmap.c:1.409
--- src/sys/arch/arm/arm32/pmap.c:1.408	Sat Apr 18 10:46:32 2020
+++ src/sys/arch/arm/arm32/pmap.c	Sun Apr 19 08:50:54 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.408 2020/04/18 10:46:32 skrll Exp $	*/
+/*	$NetBSD: pmap.c,v 1.409 2020/04/19 08:50:54 skrll Exp $	*/
 
 /*
  * Copyright 2003 Wasabi Systems, Inc.
@@ -192,7 +192,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.408 2020/04/18 10:46:32 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.409 2020/04/19 08:50:54 skrll Exp $");
 
 #include 
 #include 
@@ -2760,7 +2760,7 @@ pmap_flush_page(struct vm_page_md *md, p
 
 	KASSERT(!(md->pvh_attrs & PVF_NC));
 
-	UVMHIST_LOg(maphist, "md %#jx (attrs=%#jx)",(uintptr_t)md,
+	UVMHIST_LOG(maphist, "md %#jx (attrs=%#jx)",(uintptr_t)md,
 	md->pvh_attrs);
 
 	const size_t scache_line_size = arm_scache.dcache_line_size;



CVS commit: src/sys

2020-04-19 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Apr 19 08:18:19 UTC 2020

Modified Files:
src/sys/arch/arm/imx: imx23_digfilt.c
src/sys/arch/arm/xscale: pxa2x0_ac97.c
src/sys/dev/pci: auvia.c esm.c sv.c

Log Message:
Fix round_blocksize not to return 0.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/imx/imx23_digfilt.c
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/xscale/pxa2x0_ac97.c
cvs rdiff -u -r1.85 -r1.86 src/sys/dev/pci/auvia.c
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/pci/esm.c
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/pci/sv.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/imx/imx23_digfilt.c
diff -u src/sys/arch/arm/imx/imx23_digfilt.c:1.2 src/sys/arch/arm/imx/imx23_digfilt.c:1.3
--- src/sys/arch/arm/imx/imx23_digfilt.c:1.2	Wed May  8 13:40:14 2019
+++ src/sys/arch/arm/imx/imx23_digfilt.c	Sun Apr 19 08:18:19 2020
@@ -1,4 +1,4 @@
-/* $Id: imx23_digfilt.c,v 1.2 2019/05/08 13:40:14 isaki Exp $ */
+/* $Id: imx23_digfilt.c,v 1.3 2020/04/19 08:18:19 isaki Exp $ */
 
 /*
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -380,6 +380,8 @@ const audio_params_t *param)
 		blocksize = DIGFILT_BLOCKSIZE_MAX;
 	else
 		blocksize = bs & ~(DIGFILT_BLOCKSIZE_ROUND-1);
+	if (blocksize < DIGFILT_BLOCKSIZE_ROUND)
+		blocksize = DIGFILT_BLOCKSIZE_ROUND;
 
 	return blocksize;
 }

Index: src/sys/arch/arm/xscale/pxa2x0_ac97.c
diff -u src/sys/arch/arm/xscale/pxa2x0_ac97.c:1.17 src/sys/arch/arm/xscale/pxa2x0_ac97.c:1.18
--- src/sys/arch/arm/xscale/pxa2x0_ac97.c:1.17	Sat Jun  8 08:02:37 2019
+++ src/sys/arch/arm/xscale/pxa2x0_ac97.c	Sun Apr 19 08:18:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pxa2x0_ac97.c,v 1.17 2019/06/08 08:02:37 isaki Exp $	*/
+/*	$NetBSD: pxa2x0_ac97.c,v 1.18 2020/04/19 08:18:19 isaki Exp $	*/
 
 /*
  * Copyright (c) 2003, 2005 Wasabi Systems, Inc.
@@ -593,7 +593,10 @@ static int
 acu_round_blocksize(void *arg, int blk, int mode, const audio_params_t *param)
 {
 
-	return (blk & ~0x1f);
+	blk = (blk & ~0x1f);
+	if (blk < 0x20)
+		blk = 0x20;
+	return blk;
 }
 
 static int

Index: src/sys/dev/pci/auvia.c
diff -u src/sys/dev/pci/auvia.c:1.85 src/sys/dev/pci/auvia.c:1.86
--- src/sys/dev/pci/auvia.c:1.85	Fri Feb 28 13:31:03 2020
+++ src/sys/dev/pci/auvia.c	Sun Apr 19 08:18:19 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: auvia.c,v 1.85 2020/02/28 13:31:03 isaki Exp $	*/
+/*	$NetBSD: auvia.c,v 1.86 2020/04/19 08:18:19 isaki Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.85 2020/02/28 13:31:03 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: auvia.c,v 1.86 2020/04/19 08:18:19 isaki Exp $");
 
 #include 
 #include 
@@ -749,7 +749,10 @@ auvia_round_blocksize(void *addr, int bl
 	if (sc->sc_flags & AUVIA_FLAGS_VT8233 && blk < 288)
 		blk = 288;
 
-	return (blk & -32);
+	blk = (blk & -32);
+	if (blk < 32)
+		blk = 32;
+	return blk;
 }
 
 static int

Index: src/sys/dev/pci/esm.c
diff -u src/sys/dev/pci/esm.c:1.64 src/sys/dev/pci/esm.c:1.65
--- src/sys/dev/pci/esm.c:1.64	Sat Oct  5 01:30:28 2019
+++ src/sys/dev/pci/esm.c	Sun Apr 19 08:18:19 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: esm.c,v 1.64 2019/10/05 01:30:28 mrg Exp $  */
+/*  $NetBSD: esm.c,v 1.65 2020/04/19 08:18:19 isaki Exp $  */
 
 /*-
  * Copyright (c) 2002, 2003 Matt Fredette
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: esm.c,v 1.64 2019/10/05 01:30:28 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: esm.c,v 1.65 2020/04/19 08:18:19 isaki Exp $");
 
 #include 
 #include 
@@ -1186,6 +1186,8 @@ esm_round_blocksize(void *sc, int blk, i
 	("esm_round_blocksize(%p, 0x%x)", sc, blk));
 
 	blk &= ~0x3f;		/* keep good alignment */
+	if (blk < 0x40)
+		blk = 0x40;
 
 	DPRINTF(ESM_DEBUG_PARAM, (" = 0x%x\n", blk));
 

Index: src/sys/dev/pci/sv.c
diff -u src/sys/dev/pci/sv.c:1.57 src/sys/dev/pci/sv.c:1.58
--- src/sys/dev/pci/sv.c:1.57	Mon Oct 28 18:38:43 2019
+++ src/sys/dev/pci/sv.c	Sun Apr 19 08:18:19 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: sv.c,v 1.57 2019/10/28 18:38:43 joerg Exp $ */
+/*  $NetBSD: sv.c,v 1.58 2020/04/19 08:18:19 isaki Exp $ */
 /*  $OpenBSD: sv.c,v 1.2 1998/07/13 01:50:15 csapuntz Exp $ */
 
 /*
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.57 2019/10/28 18:38:43 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sv.c,v 1.58 2020/04/19 08:18:19 isaki Exp $");
 
 #include 
 #include 
@@ -679,7 +679,10 @@ sv_round_blocksize(void *addr, int blk, 
 const audio_params_t *param)
 {
 
-	return blk & -32;	/* keep good alignment */
+	blk = blk & -32;	/* keep good alignment */
+	if (blk < 32)
+		blk = 32;
+	return blk;
 }
 
 static int