CVS commit: src/usr.sbin/puffs/mount_9p

2020-05-26 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed May 27 03:25:13 UTC 2020

Modified Files:
src/usr.sbin/puffs/mount_9p: node.c

Log Message:
puffs9p_node_rename - 9P rename is done with Twstat and can only
change the last pathname component.  Return EXDEV for attempts to move
a file to a different directory to make mv(1) fall back to copying.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/puffs/mount_9p/node.c

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

Modified files:

Index: src/usr.sbin/puffs/mount_9p/node.c
diff -u src/usr.sbin/puffs/mount_9p/node.c:1.27 src/usr.sbin/puffs/mount_9p/node.c:1.28
--- src/usr.sbin/puffs/mount_9p/node.c:1.27	Wed May 27 00:36:07 2020
+++ src/usr.sbin/puffs/mount_9p/node.c	Wed May 27 03:25:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: node.c,v 1.27 2020/05/27 00:36:07 uwe Exp $	*/
+/*	$NetBSD: node.c,v 1.28 2020/05/27 03:25:13 uwe Exp $	*/
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: node.c,v 1.27 2020/05/27 00:36:07 uwe Exp $");
+__RCSID("$NetBSD: node.c,v 1.28 2020/05/27 03:25:13 uwe Exp $");
 #endif /* !lint */
 
 #include 
@@ -572,22 +572,22 @@ puffs9p_node_rmdir(struct puffs_usermoun
 	return rv;
 }
 
-/*
- * 9P supports renames only for files within a directory
- * from what I could tell.  So just support in-directory renames
- * for now.
- */ 
-int
-puffs9p_node_rename(struct puffs_usermount *pu, void *opc, void *src,
-	const struct puffs_cn *pcn_src, void *targ_dir, void *targ,
-	const struct puffs_cn *pcn_targ)
+int
+puffs9p_node_rename(struct puffs_usermount *pu,
+		void *src_dir, void *src, const struct puffs_cn *pcn_src,
+		void *targ_dir, void *targ, const struct puffs_cn *pcn_targ)
 {
 	AUTOVAR(pu);
 	struct puffs_node *pn_src = src;
 	struct p9pnode *p9n_src = pn_src->pn_data;
 
-	if (opc != targ_dir) {
-		rv = EOPNOTSUPP;
+	/*
+	 * 9P rename can only change the last pathname component.
+	 * Return EXDEV for attempts to move a file to a different
+	 * directory to make mv(1) fall back to copying.
+	 */
+	if (src_dir != targ_dir) {
+		rv = EXDEV;
 		goto out;
 	}
 



CVS commit: src/sys

2020-05-26 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 27 02:04:38 UTC 2020

Modified Files:
src/sys/rump/include/rump: rump_namei.h
src/sys/sys: namei.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.111 -r1.112 src/sys/sys/namei.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/rump/include/rump/rump_namei.h
diff -u src/sys/rump/include/rump/rump_namei.h:1.44 src/sys/rump/include/rump/rump_namei.h:1.45
--- src/sys/rump/include/rump/rump_namei.h:1.44	Tue May 26 22:06:11 2020
+++ src/sys/rump/include/rump/rump_namei.h	Wed May 27 02:04:38 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: rump_namei.h,v 1.44 2020/05/26 22:06:11 ad Exp $	*/
+/*	$NetBSD: rump_namei.h,v 1.45 2020/05/27 02:04:38 rin Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.56 2020/05/26 22:05:52 ad Exp 
+ *   from: NetBSD: namei.src,v 1.57 2020/05/27 02:03:30 rin Exp 
  */
 
 #ifndef _RUMP_RUMP_NAMEI_H_
@@ -31,6 +31,7 @@
 #define RUMP_NAMEI_ISDOTDOT	0x0002000
 #define RUMP_NAMEI_MAKEENTRY	0x0004000
 #define RUMP_NAMEI_ISLASTCN	0x0008000
+#define RUMP_NAMEI_WILLBEDIR	0x001
 #define RUMP_NAMEI_ISWHITEOUT	0x002
 #define RUMP_NAMEI_DOWHITEOUT	0x004
 #define RUMP_NAMEI_REQUIREDIR	0x008

Index: src/sys/sys/namei.h
diff -u src/sys/sys/namei.h:1.111 src/sys/sys/namei.h:1.112
--- src/sys/sys/namei.h:1.111	Tue May 26 22:06:11 2020
+++ src/sys/sys/namei.h	Wed May 27 02:04:37 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: namei.h,v 1.111 2020/05/26 22:06:11 ad Exp $	*/
+/*	$NetBSD: namei.h,v 1.112 2020/05/27 02:04:37 rin Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.56 2020/05/26 22:05:52 ad Exp 
+ *   from: NetBSD: namei.src,v 1.57 2020/05/27 02:03:30 rin Exp 
  */
 
 /*
@@ -171,7 +171,7 @@ struct nameidata {
 #define	ISDOTDOT	0x0002000	/* current component name is .. */
 #define	MAKEENTRY	0x0004000	/* entry is to be added to name cache */
 #define	ISLASTCN	0x0008000	/* this is last component of pathname */
-NAMIEFL	WILLBEDIR	0x001	/* new files will be dirs */
+#define	WILLBEDIR	0x001	/* new files will be dirs */
 #define	ISWHITEOUT	0x002	/* found whiteout */
 #define	DOWHITEOUT	0x004	/* do whiteouts */
 #define	REQUIREDIR	0x008	/* must be a directory */
@@ -367,6 +367,7 @@ struct	nchstats _NAMEI_CACHE_STATS(uint6
 #define NAMEI_ISDOTDOT	0x0002000
 #define NAMEI_MAKEENTRY	0x0004000
 #define NAMEI_ISLASTCN	0x0008000
+#define NAMEI_WILLBEDIR	0x001
 #define NAMEI_ISWHITEOUT	0x002
 #define NAMEI_DOWHITEOUT	0x004
 #define NAMEI_REQUIREDIR	0x008



CVS commit: src/sys/sys

2020-05-26 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 27 02:03:30 UTC 2020

Modified Files:
src/sys/sys: namei.src

Log Message:
Fix typo.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/sys/namei.src

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

Modified files:

Index: src/sys/sys/namei.src
diff -u src/sys/sys/namei.src:1.56 src/sys/sys/namei.src:1.57
--- src/sys/sys/namei.src:1.56	Tue May 26 22:05:52 2020
+++ src/sys/sys/namei.src	Wed May 27 02:03:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: namei.src,v 1.56 2020/05/26 22:05:52 ad Exp $	*/
+/*	$NetBSD: namei.src,v 1.57 2020/05/27 02:03:30 rin Exp $	*/
 
 /*
  * Copyright (c) 1985, 1989, 1991, 1993
@@ -163,7 +163,7 @@ NAMEIFL	RDONLY		0x0001000	/* lookup with
 NAMEIFL	ISDOTDOT	0x0002000	/* current component name is .. */
 NAMEIFL	MAKEENTRY	0x0004000	/* entry is to be added to name cache */
 NAMEIFL	ISLASTCN	0x0008000	/* this is last component of pathname */
-NAMIEFL	WILLBEDIR	0x001	/* new files will be dirs */
+NAMEIFL	WILLBEDIR	0x001	/* new files will be dirs */
 NAMEIFL	ISWHITEOUT	0x002	/* found whiteout */
 NAMEIFL	DOWHITEOUT	0x004	/* do whiteouts */
 NAMEIFL	REQUIREDIR	0x008	/* must be a directory */



CVS commit: src/usr.sbin/puffs/mount_9p

2020-05-26 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed May 27 00:36:08 UTC 2020

Modified Files:
src/usr.sbin/puffs/mount_9p: node.c

Log Message:
noderemove - do not call puffs_setback here.  noderemove is called
from rename (for existing target) and calling setback is not
appropriate in that context.  Do that call instead directly in the
callers (remove, rmdir).

>From Nicola Girardi, part of PR/54829.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/usr.sbin/puffs/mount_9p/node.c

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

Modified files:

Index: src/usr.sbin/puffs/mount_9p/node.c
diff -u src/usr.sbin/puffs/mount_9p/node.c:1.26 src/usr.sbin/puffs/mount_9p/node.c:1.27
--- src/usr.sbin/puffs/mount_9p/node.c:1.26	Wed May 27 00:05:22 2020
+++ src/usr.sbin/puffs/mount_9p/node.c	Wed May 27 00:36:07 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: node.c,v 1.26 2020/05/27 00:05:22 uwe Exp $	*/
+/*	$NetBSD: node.c,v 1.27 2020/05/27 00:36:07 uwe Exp $	*/
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: node.c,v 1.26 2020/05/27 00:05:22 uwe Exp $");
+__RCSID("$NetBSD: node.c,v 1.27 2020/05/27 00:36:07 uwe Exp $");
 #endif /* !lint */
 
 #include 
@@ -533,9 +533,6 @@ noderemove(struct puffs_usermount *pu, s
 	}
 
  out:
-	if (rv == 0)
-		puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2);
-
 	RETURN(rv);
 }
 
@@ -543,24 +540,36 @@ int
 puffs9p_node_remove(struct puffs_usermount *pu, void *opc, void *targ,
 	const struct puffs_cn *pcn)
 {
+	struct puffs_cc *pcc = puffs_cc_getcc(pu);
 	struct puffs_node *pn = targ;
+	int rv;
 
 	if (pn->pn_va.va_type == VDIR)
 		return EISDIR;
 
-	return noderemove(pu, pn);
+	rv = noderemove(pu, pn);
+	if (rv == 0)
+		puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2);
+
+	return rv;
 }
 
 int
 puffs9p_node_rmdir(struct puffs_usermount *pu, void *opc, void *targ,
 	const struct puffs_cn *pcn)
 {
+	struct puffs_cc *pcc = puffs_cc_getcc(pu);
 	struct puffs_node *pn = targ;
+	int rv;
 
 	if (pn->pn_va.va_type != VDIR)
 		return ENOTDIR;
 
-	return noderemove(pu, pn);
+	rv = noderemove(pu, pn);
+	if (rv == 0)
+		puffs_setback(pcc, PUFFS_SETBACK_NOREF_N2);
+
+	return rv;
 }
 
 /*



CVS commit: src/usr.sbin/puffs/mount_9p

2020-05-26 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Wed May 27 00:05:22 UTC 2020

Modified Files:
src/usr.sbin/puffs/mount_9p: node.c

Log Message:
puffs9p_node_rename - noderename takes puffs_node, not p9pnode, but
this goes undetected b/c pn_data we pass is a pointer to void.

>From Nicola Girardi, part of PR/54829.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/usr.sbin/puffs/mount_9p/node.c

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

Modified files:

Index: src/usr.sbin/puffs/mount_9p/node.c
diff -u src/usr.sbin/puffs/mount_9p/node.c:1.25 src/usr.sbin/puffs/mount_9p/node.c:1.26
--- src/usr.sbin/puffs/mount_9p/node.c:1.25	Tue May 26 22:54:43 2020
+++ src/usr.sbin/puffs/mount_9p/node.c	Wed May 27 00:05:22 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: node.c,v 1.25 2020/05/26 22:54:43 uwe Exp $	*/
+/*	$NetBSD: node.c,v 1.26 2020/05/27 00:05:22 uwe Exp $	*/
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: node.c,v 1.25 2020/05/26 22:54:43 uwe Exp $");
+__RCSID("$NetBSD: node.c,v 1.26 2020/05/27 00:05:22 uwe Exp $");
 #endif /* !lint */
 
 #include 
@@ -586,7 +586,7 @@ puffs9p_node_rename(struct puffs_usermou
 	if (targ) {
 		struct puffs_node *pn_targ = targ;
 
-		rv = noderemove(pu, pn_targ->pn_data);
+		rv = noderemove(pu,  pn_targ);
 		if (rv)
 			goto out;
 	}



CVS commit: src/sys/kern

2020-05-26 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue May 26 23:08:56 UTC 2020

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

Log Message:
Avoid taking lwp_lock when calling process_sstep() for sibling LWPs

This makes the code consistend between single-threaded and multi-threaded
code.


To generate a diff of this commit:
cvs rdiff -u -r1.81 -r1.82 src/sys/kern/sys_ptrace_common.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/sys_ptrace_common.c
diff -u src/sys/kern/sys_ptrace_common.c:1.81 src/sys/kern/sys_ptrace_common.c:1.82
--- src/sys/kern/sys_ptrace_common.c:1.81	Sat May 23 23:42:43 2020
+++ src/sys/kern/sys_ptrace_common.c	Tue May 26 23:08:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_ptrace_common.c,v 1.81 2020/05/23 23:42:43 ad Exp $	*/
+/*	$NetBSD: sys_ptrace_common.c,v 1.82 2020/05/26 23:08:56 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -118,7 +118,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.81 2020/05/23 23:42:43 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_ptrace_common.c,v 1.82 2020/05/26 23:08:56 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ptrace.h"
@@ -1421,16 +1421,13 @@ do_ptrace(struct ptrace_methods *ptm, st
 		 * the requested thread, and clear it for other threads.
 		 */
 		LIST_FOREACH(lt2, >p_lwps, l_sibling) {
-			if (ISSET(lt2->l_pflag, LP_SINGLESTEP)) {
-lwp_lock(lt2);
-process_sstep(lt2, 1);
-lwp_unlock(lt2);
-			} else if (lt != lt2) {
-lwp_lock(lt2);
-process_sstep(lt2, 0);
-lwp_unlock(lt2);
-			}
+			error = process_sstep(lt2,
+			ISSET(lt2->l_pflag, LP_SINGLESTEP));
+			if (error)
+break;
 		}
+		if (error)
+			break;
 		error = process_sstep(lt,
 		ISSET(lt->l_pflag, LP_SINGLESTEP) || req == PT_STEP);
 		if (error)



CVS commit: src/usr.sbin/puffs/mount_9p

2020-05-26 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue May 26 22:54:43 UTC 2020

Modified Files:
src/usr.sbin/puffs/mount_9p: ninepuffs.h node.c

Log Message:
Use the typedef to declare tag in AUTOVAR.  Do not allocate 9P tags in
advance in AUTOVAR, do it right before we need them.  Do no reuse tags.
If we are going to use sequential tags, we might as well try to make
them really sequential.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/usr.sbin/puffs/mount_9p/ninepuffs.h
cvs rdiff -u -r1.24 -r1.25 src/usr.sbin/puffs/mount_9p/node.c

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

Modified files:

Index: src/usr.sbin/puffs/mount_9p/ninepuffs.h
diff -u src/usr.sbin/puffs/mount_9p/ninepuffs.h:1.15 src/usr.sbin/puffs/mount_9p/ninepuffs.h:1.16
--- src/usr.sbin/puffs/mount_9p/ninepuffs.h:1.15	Mon Oct 28 02:59:25 2019
+++ src/usr.sbin/puffs/mount_9p/ninepuffs.h	Tue May 26 22:54:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: ninepuffs.h,v 1.15 2019/10/28 02:59:25 ozaki-r Exp $	*/
+/*	$NetBSD: ninepuffs.h,v 1.16 2020/05/26 22:54:43 uwe Exp $	*/
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -64,7 +64,7 @@ typedef uint32_t p9pfid_t;
 #define AUTOVAR(pu)			\
 	struct puffs_cc *pcc = puffs_cc_getcc(pu);			\
 	struct puffs9p *p9p = puffs_getspecific(pu);			\
-	uint16_t tag = NEXTTAG(p9p);	\
+	p9ptag_t tag;			\
 	struct puffs_framebuf *pb = p9pbuf_makeout();			\
 	int rv = 0
 

Index: src/usr.sbin/puffs/mount_9p/node.c
diff -u src/usr.sbin/puffs/mount_9p/node.c:1.24 src/usr.sbin/puffs/mount_9p/node.c:1.25
--- src/usr.sbin/puffs/mount_9p/node.c:1.24	Tue May 26 22:08:11 2020
+++ src/usr.sbin/puffs/mount_9p/node.c	Tue May 26 22:54:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: node.c,v 1.24 2020/05/26 22:08:11 uwe Exp $	*/
+/*	$NetBSD: node.c,v 1.25 2020/05/26 22:54:43 uwe Exp $	*/
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: node.c,v 1.24 2020/05/26 22:08:11 uwe Exp $");
+__RCSID("$NetBSD: node.c,v 1.25 2020/05/26 22:54:43 uwe Exp $");
 #endif /* !lint */
 
 #include 
@@ -57,6 +57,7 @@ do_getattr(struct puffs_usermount *pu, s
 	AUTOVAR(pu);
 	struct p9pnode *p9n = pn->pn_data;
 
+	tag = NEXTTAG(p9p);
 	p9pbuf_put_1(pb, P9PROTO_T_STAT);
 	p9pbuf_put_2(pb, tag);
 	p9pbuf_put_4(pb, p9n->fid_base);
@@ -97,6 +98,7 @@ puffs9p_node_lookup(struct puffs_usermou
 	struct qid9p newqid;
 	uint16_t nqid;
 
+	tag = NEXTTAG(p9p);
 	p9pbuf_put_1(pb, P9PROTO_T_WALK);
 	p9pbuf_put_2(pb, tag);
 	p9pbuf_put_4(pb, p9n_dir->fid_base);
@@ -232,6 +234,7 @@ puffs9p_node_setattr(struct puffs_usermo
 	struct puffs_node *pn = opc;
 	struct p9pnode *p9n = pn->pn_data;
 
+	tag = NEXTTAG(p9p);
 	p9pbuf_put_1(pb, P9PROTO_T_WSTAT);
 	p9pbuf_put_2(pb, tag);
 	p9pbuf_put_4(pb, p9n->fid_base);
@@ -327,6 +330,7 @@ puffs9p_node_read(struct puffs_usermount
 
 	nread = 0;
 	while (*resid > 0 && (uint64_t)(offset+nread) < pn->pn_va.va_size) {
+		tag = NEXTTAG(p9p);
 		p9pbuf_put_1(pb, P9PROTO_T_READ);
 		p9pbuf_put_2(pb, tag);
 		p9pbuf_put_4(pb, p9n->fid_read);
@@ -374,6 +378,7 @@ puffs9p_node_write(struct puffs_usermoun
 	while (*resid > 0) {
 		chunk = MIN(*resid, p9p->maxreq-32);
 
+		tag = NEXTTAG(p9p);
 		p9pbuf_put_1(pb, P9PROTO_T_WRITE);
 		p9pbuf_put_2(pb, tag);
 		p9pbuf_put_4(pb, p9n->fid_write);
@@ -425,6 +430,7 @@ nodecreate(struct puffs_usermount *pu, s
 	if (rv)
 		goto out;
 
+	tag = NEXTTAG(p9p);
 	p9pbuf_put_1(pb, P9PROTO_T_CREATE);
 	p9pbuf_put_2(pb, tag);
 	p9pbuf_put_4(pb, nfid);
@@ -448,6 +454,7 @@ nodecreate(struct puffs_usermount *pu, s
 	nfid = NEXTFID(p9p);
 
 	p9pbuf_recycleout(pb);
+	tag = NEXTTAG(p9p);
 	p9pbuf_put_1(pb, P9PROTO_T_WALK);
 	p9pbuf_put_2(pb, tag);
 	p9pbuf_put_4(pb, p9n->fid_base);
@@ -506,6 +513,7 @@ noderemove(struct puffs_usermount *pu, s
 	if (rv)
 		goto out;
 
+	tag = NEXTTAG(p9p);
 	p9pbuf_put_1(pb, P9PROTO_T_REMOVE);
 	p9pbuf_put_2(pb, tag);
 	p9pbuf_put_4(pb, testfid);
@@ -583,6 +591,7 @@ puffs9p_node_rename(struct puffs_usermou
 			goto out;
 	}
 
+	tag = NEXTTAG(p9p);
 	p9pbuf_put_1(pb, P9PROTO_T_WSTAT);
 	p9pbuf_put_2(pb, tag);
 	p9pbuf_put_4(pb, p9n_src->fid_base);



CVS commit: src/usr.sbin/puffs/mount_9p

2020-05-26 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue May 26 22:33:05 UTC 2020

Modified Files:
src/usr.sbin/puffs/mount_9p: nineproto.c

Log Message:
Do not allocate 9P tags in advance, do it right before we need them.
If we are going to use sequential tags, we might as well try to make
them really sequential.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/usr.sbin/puffs/mount_9p/nineproto.c

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

Modified files:

Index: src/usr.sbin/puffs/mount_9p/nineproto.c
diff -u src/usr.sbin/puffs/mount_9p/nineproto.c:1.12 src/usr.sbin/puffs/mount_9p/nineproto.c:1.13
--- src/usr.sbin/puffs/mount_9p/nineproto.c:1.12	Tue May 26 19:41:36 2020
+++ src/usr.sbin/puffs/mount_9p/nineproto.c	Tue May 26 22:33:04 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nineproto.c,v 1.12 2020/05/26 19:41:36 uwe Exp $	*/
+/*	$NetBSD: nineproto.c,v 1.13 2020/05/26 22:33:04 uwe Exp $	*/
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: nineproto.c,v 1.12 2020/05/26 19:41:36 uwe Exp $");
+__RCSID("$NetBSD: nineproto.c,v 1.13 2020/05/26 22:33:04 uwe Exp $");
 #endif /* !lint */
 
 #include 
@@ -233,11 +233,12 @@ proto_cc_dupfid(struct puffs_usermount *
 	struct puffs_cc *pcc = puffs_cc_getcc(pu);
 	struct puffs9p *p9p = puffs_getspecific(pu);
 	struct puffs_framebuf *pb;
-	p9ptag_t tag = NEXTTAG(p9p);
+	p9ptag_t tag;
 	uint16_t qids;
 	int rv = 0;
 
 	pb = p9pbuf_makeout();
+	tag = NEXTTAG(p9p);
 	p9pbuf_put_1(pb, P9PROTO_T_WALK);
 	p9pbuf_put_2(pb, tag);
 	p9pbuf_put_4(pb, oldfid);
@@ -260,10 +261,11 @@ proto_cc_clunkfid(struct puffs_usermount
 	struct puffs_cc *pcc = puffs_cc_getcc(pu);
 	struct puffs9p *p9p = puffs_getspecific(pu);
 	struct puffs_framebuf *pb;
-	p9ptag_t tag = NEXTTAG(p9p);
+	p9ptag_t tag;
 	int rv = 0;
 
 	pb = p9pbuf_makeout();
+	tag = NEXTTAG(p9p);
 	p9pbuf_put_1(pb, P9PROTO_T_CLUNK);
 	p9pbuf_put_2(pb, tag);
 	p9pbuf_put_4(pb, fid);
@@ -294,7 +296,7 @@ proto_cc_open(struct puffs_usermount *pu
 	struct puffs_cc *pcc = puffs_cc_getcc(pu);
 	struct puffs9p *p9p = puffs_getspecific(pu);
 	struct puffs_framebuf *pb;
-	p9ptag_t tag = NEXTTAG(p9p);
+	p9ptag_t tag;
 	int rv;
 
 	rv = proto_cc_dupfid(pu, fid, newfid);
@@ -302,6 +304,7 @@ proto_cc_open(struct puffs_usermount *pu
 		return rv;
 
 	pb = p9pbuf_makeout();
+	tag = NEXTTAG(p9p);
 	p9pbuf_put_1(pb, P9PROTO_T_OPEN);
 	p9pbuf_put_2(pb, tag);
 	p9pbuf_put_4(pb, newfid);



CVS commit: src/usr.sbin/puffs/mount_9p

2020-05-26 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue May 26 22:08:11 UTC 2020

Modified Files:
src/usr.sbin/puffs/mount_9p: node.c

Log Message:
puffs9p_node_lookup - use the right type for tfid.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/puffs/mount_9p/node.c

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

Modified files:

Index: src/usr.sbin/puffs/mount_9p/node.c
diff -u src/usr.sbin/puffs/mount_9p/node.c:1.23 src/usr.sbin/puffs/mount_9p/node.c:1.24
--- src/usr.sbin/puffs/mount_9p/node.c:1.23	Fri Jun  7 05:34:34 2019
+++ src/usr.sbin/puffs/mount_9p/node.c	Tue May 26 22:08:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: node.c,v 1.23 2019/06/07 05:34:34 ozaki-r Exp $	*/
+/*	$NetBSD: node.c,v 1.24 2020/05/26 22:08:11 uwe Exp $	*/
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: node.c,v 1.23 2019/06/07 05:34:34 ozaki-r Exp $");
+__RCSID("$NetBSD: node.c,v 1.24 2020/05/26 22:08:11 uwe Exp $");
 #endif /* !lint */
 
 #include 
@@ -93,7 +93,7 @@ puffs9p_node_lookup(struct puffs_usermou
 	struct vattr va;
 	struct puffs_node *pn, *pn_dir = opc;
 	struct p9pnode *p9n_dir = pn_dir->pn_data;
-	p9ptag_t tfid = NEXTFID(p9p);
+	p9pfid_t tfid = NEXTFID(p9p);
 	struct qid9p newqid;
 	uint16_t nqid;
 



CVS commit: src/sys

2020-05-26 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue May 26 22:06:12 UTC 2020

Modified Files:
src/sys/rump/include/rump: rump_namei.h
src/sys/sys: namei.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/rump/include/rump/rump_namei.h
cvs rdiff -u -r1.110 -r1.111 src/sys/sys/namei.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/rump/include/rump/rump_namei.h
diff -u src/sys/rump/include/rump/rump_namei.h:1.43 src/sys/rump/include/rump/rump_namei.h:1.44
--- src/sys/rump/include/rump/rump_namei.h:1.43	Tue May 12 23:18:03 2020
+++ src/sys/rump/include/rump/rump_namei.h	Tue May 26 22:06:11 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: rump_namei.h,v 1.43 2020/05/12 23:18:03 ad Exp $	*/
+/*	$NetBSD: rump_namei.h,v 1.44 2020/05/26 22:06:11 ad Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.54 2020/05/12 23:17:41 ad Exp 
+ *   from: NetBSD: namei.src,v 1.56 2020/05/26 22:05:52 ad Exp 
  */
 
 #ifndef _RUMP_RUMP_NAMEI_H_
@@ -35,6 +35,6 @@
 #define RUMP_NAMEI_DOWHITEOUT	0x004
 #define RUMP_NAMEI_REQUIREDIR	0x008
 #define RUMP_NAMEI_CREATEDIR	0x020
-#define RUMP_NAMEI_PARAMASK	0x02ef800
+#define RUMP_NAMEI_PARAMASK	0x02ff800
 
 #endif /* _RUMP_RUMP_NAMEI_H_ */

Index: src/sys/sys/namei.h
diff -u src/sys/sys/namei.h:1.110 src/sys/sys/namei.h:1.111
--- src/sys/sys/namei.h:1.110	Sat May 16 18:31:53 2020
+++ src/sys/sys/namei.h	Tue May 26 22:06:11 2020
@@ -1,11 +1,11 @@
-/*	$NetBSD: namei.h,v 1.110 2020/05/16 18:31:53 christos Exp $	*/
+/*	$NetBSD: namei.h,v 1.111 2020/05/26 22:06:11 ad Exp $	*/
 
 
 /*
  * WARNING: GENERATED FILE.  DO NOT EDIT
  * (edit namei.src and run make namei in src/sys/sys)
  *   by:   NetBSD: gennameih.awk,v 1.5 2009/12/23 14:17:19 pooka Exp 
- *   from: NetBSD: namei.src,v 1.54 2020/05/12 23:17:41 ad Exp 
+ *   from: NetBSD: namei.src,v 1.56 2020/05/26 22:05:52 ad Exp 
  */
 
 /*
@@ -171,7 +171,7 @@ struct nameidata {
 #define	ISDOTDOT	0x0002000	/* current component name is .. */
 #define	MAKEENTRY	0x0004000	/* entry is to be added to name cache */
 #define	ISLASTCN	0x0008000	/* this is last component of pathname */
-#define	WILLBEDIR	0x001	/* new files will be dirs; */
+NAMIEFL	WILLBEDIR	0x001	/* new files will be dirs */
 #define	ISWHITEOUT	0x002	/* found whiteout */
 #define	DOWHITEOUT	0x004	/* do whiteouts */
 #define	REQUIREDIR	0x008	/* must be a directory */
@@ -371,6 +371,6 @@ struct	nchstats _NAMEI_CACHE_STATS(uint6
 #define NAMEI_DOWHITEOUT	0x004
 #define NAMEI_REQUIREDIR	0x008
 #define NAMEI_CREATEDIR	0x020
-#define NAMEI_PARAMASK	0x02ef800
+#define NAMEI_PARAMASK	0x02ff800
 
 #endif /* !_SYS_NAMEI_H_ */



CVS commit: src/sys/sys

2020-05-26 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue May 26 22:05:52 UTC 2020

Modified Files:
src/sys/sys: namei.src

Log Message:
Catch up after recent ACL changes


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/sys/namei.src

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

Modified files:

Index: src/sys/sys/namei.src
diff -u src/sys/sys/namei.src:1.55 src/sys/sys/namei.src:1.56
--- src/sys/sys/namei.src:1.55	Sat May 16 18:31:53 2020
+++ src/sys/sys/namei.src	Tue May 26 22:05:52 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: namei.src,v 1.55 2020/05/16 18:31:53 christos Exp $	*/
+/*	$NetBSD: namei.src,v 1.56 2020/05/26 22:05:52 ad Exp $	*/
 
 /*
  * Copyright (c) 1985, 1989, 1991, 1993
@@ -163,11 +163,12 @@ NAMEIFL	RDONLY		0x0001000	/* lookup with
 NAMEIFL	ISDOTDOT	0x0002000	/* current component name is .. */
 NAMEIFL	MAKEENTRY	0x0004000	/* entry is to be added to name cache */
 NAMEIFL	ISLASTCN	0x0008000	/* this is last component of pathname */
+NAMIEFL	WILLBEDIR	0x001	/* new files will be dirs */
 NAMEIFL	ISWHITEOUT	0x002	/* found whiteout */
 NAMEIFL	DOWHITEOUT	0x004	/* do whiteouts */
 NAMEIFL	REQUIREDIR	0x008	/* must be a directory */
 NAMEIFL	CREATEDIR	0x020	/* trailing slashes are ok */
-NAMEIFL	PARAMASK	0x02ef800	/* mask of parameter descriptors */
+NAMEIFL	PARAMASK	0x02ff800	/* mask of parameter descriptors */
 
 /*
  * Initialization of a nameidata structure.
@@ -290,7 +291,7 @@ bool	cache_lookup_raw(struct vnode *, co
 bool	cache_lookup_linked(struct vnode *, const char *, size_t,
 			struct vnode **, krwlock_t **, kauth_cred_t);
 int	cache_revlookup(struct vnode *, struct vnode **, char **, char *,
-			bool, int);
+			bool, accmode_t);
 int	cache_diraccess(struct vnode *, int);
 void	cache_enter(struct vnode *, struct vnode *,
 			const char *, size_t, uint32_t);



CVS commit: src/sys/uvm

2020-05-26 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue May 26 21:52:12 UTC 2020

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

Log Message:
uvm_page_array_fill(): return ENOENT in all cases when nothing's left.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/uvm/uvm_page_array.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_page_array.c
diff -u src/sys/uvm/uvm_page_array.c:1.8 src/sys/uvm/uvm_page_array.c:1.9
--- src/sys/uvm/uvm_page_array.c:1.8	Mon May 25 22:01:26 2020
+++ src/sys/uvm/uvm_page_array.c	Tue May 26 21:52:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page_array.c,v 1.8 2020/05/25 22:01:26 ad Exp $	*/
+/*	$NetBSD: uvm_page_array.c,v 1.9 2020/05/26 21:52:12 ad Exp $	*/
 
 /*-
  * Copyright (c)2011 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_page_array.c,v 1.8 2020/05/25 22:01:26 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page_array.c,v 1.9 2020/05/26 21:52:12 ad Exp $");
 
 #include 
 #include 
@@ -140,6 +140,7 @@ uvm_page_array_fill(struct uvm_page_arra
 	const int flags = ar->ar_flags;
 	const bool dense = (flags & UVM_PAGE_ARRAY_FILL_DENSE) != 0;
 	const bool backward = (flags & UVM_PAGE_ARRAY_FILL_BACKWARD) != 0;
+	int error = 0;
 
 	if (nwant != 0 && nwant < maxpages) {
 		maxpages = nwant;
@@ -172,8 +173,7 @@ uvm_page_array_fill(struct uvm_page_arra
 			 * if dense or looking for tagged entries (or
 			 * working backwards), fail right away.
 			 */
-			uvm_page_array_clear(ar);
-			return ENOENT;
+			npages = 0;
 		} else {
 			/*
 			 * there's nothing else to be found with the current
@@ -187,17 +187,16 @@ uvm_page_array_fill(struct uvm_page_arra
 			npages = 1;
 			ar->ar_pages[0] = NULL;
 		}
+		error = ENOENT;
 	}
 	KASSERT(npages <= maxpages);
 	ar->ar_npages = npages;
 	ar->ar_idx = 0;
 #if defined(DEBUG)
-	for (i = 0; i < ar->ar_npages; i++) {
+	for (i = 0; error == 0 && i < ar->ar_npages; i++) {
 		struct vm_page * const pg = ar->ar_pages[i];
 
-		if (pg == NULL) {
-			continue;
-		}
+		KASSERT(pg != NULL);
 		KDASSERT(pg->uobject == uobj);
 		if (backward) {
 			KDASSERT(pg->offset <= off);
@@ -210,7 +209,7 @@ uvm_page_array_fill(struct uvm_page_arra
 		}
 	}
 #endif /* defined(DEBUG) */
-	return 0;
+	return error;
 }
 
 /*



CVS commit: src/include

2020-05-26 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue May 26 21:49:30 UTC 2020

Modified Files:
src/include: stdlib.h

Log Message:
Avoid depending on namespace pollution in stdlib.h.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/include/stdlib.h

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

Modified files:

Index: src/include/stdlib.h
diff -u src/include/stdlib.h:1.121 src/include/stdlib.h:1.122
--- src/include/stdlib.h:1.121	Sat Jan  5 09:16:46 2019
+++ src/include/stdlib.h	Tue May 26 21:49:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: stdlib.h,v 1.121 2019/01/05 09:16:46 maya Exp $	*/
+/*	$NetBSD: stdlib.h,v 1.122 2020/05/26 21:49:29 joerg Exp $	*/
 
 /*-
  * Copyright (c) 1990, 1993
@@ -272,7 +272,7 @@ uint32_t arc4random(void);
 void	 arc4random_stir(void);
 void	 arc4random_buf(void *, size_t);
 uint32_t arc4random_uniform(uint32_t);
-void	 arc4random_addrandom(u_char *, int);
+void	 arc4random_addrandom(unsigned char *, int);
 char	*getbsize(int *, long *);
 char	*cgetcap(char *, const char *, int);
 int	 cgetclose(void);



CVS commit: src/sys/dev/usb

2020-05-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May 26 19:55:43 UTC 2020

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

Log Message:
s/0/NULL/ for pointer (usb_async_proc)


To generate a diff of this commit:
cvs rdiff -u -r1.185 -r1.186 src/sys/dev/usb/usb.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/usb.c
diff -u src/sys/dev/usb/usb.c:1.185 src/sys/dev/usb/usb.c:1.186
--- src/sys/dev/usb/usb.c:1.185	Tue May 26 19:51:14 2020
+++ src/sys/dev/usb/usb.c	Tue May 26 19:55:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb.c,v 1.185 2020/05/26 19:51:14 skrll Exp $	*/
+/*	$NetBSD: usb.c,v 1.186 2020/05/26 19:55:43 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.185 2020/05/26 19:51:14 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.186 2020/05/26 19:55:43 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -724,7 +724,7 @@ usbopen(dev_t dev, int flag, int mode, s
 			return EBUSY;
 		usb_dev_open = 1;
 		mutex_enter(_lock);
-		usb_async_proc = 0;
+		usb_async_proc = NULL;
 		mutex_exit(_lock);
 		return 0;
 	}
@@ -804,7 +804,7 @@ usbclose(dev_t dev, int flag, int mode,
 
 	if (unit == USB_DEV_MINOR) {
 		mutex_enter(_lock);
-		usb_async_proc = 0;
+		usb_async_proc = NULL;
 		mutex_exit(_lock);
 		usb_dev_open = 0;
 	}
@@ -831,7 +831,7 @@ usbioctl(dev_t devt, u_long cmd, void *d
 			if (*(int *)data)
 usb_async_proc = l->l_proc;
 			else
-usb_async_proc = 0;
+usb_async_proc = NULL;
 			mutex_exit(_lock);
 			return 0;
 



CVS commit: src/sys/dev/usb

2020-05-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May 26 19:51:15 UTC 2020

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

Log Message:
Misc whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/sys/dev/usb/usb.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/usb.c
diff -u src/sys/dev/usb/usb.c:1.184 src/sys/dev/usb/usb.c:1.185
--- src/sys/dev/usb/usb.c:1.184	Sat May 23 23:42:42 2020
+++ src/sys/dev/usb/usb.c	Tue May 26 19:51:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb.c,v 1.184 2020/05/23 23:42:42 ad Exp $	*/
+/*	$NetBSD: usb.c,v 1.185 2020/05/26 19:51:14 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.184 2020/05/23 23:42:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.185 2020/05/26 19:51:14 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -137,7 +137,7 @@ struct usb_softc {
 #if 0
 	device_t	sc_dev;		/* base device */
 #endif
-	struct usbd_bus *sc_bus;		/* USB controller */
+	struct usbd_bus *sc_bus;	/* USB controller */
 	struct usbd_port sc_port;	/* dummy port for root hub */
 
 	struct lwp	*sc_event_thread;
@@ -264,8 +264,6 @@ static void usb_childdet(device_t, devic
 static int usb_once_init(void);
 static void usb_doattach(device_t);
 
-
-
 CFATTACH_DECL3_NEW(usb, sizeof(struct usb_softc),
 usb_match, usb_attach, usb_detach, usb_activate, NULL, usb_childdet,
 DVF_DETACH_SHUTDOWN);



CVS commit: src/usr.sbin/puffs/mount_9p

2020-05-26 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue May 26 19:41:36 UTC 2020

Modified Files:
src/usr.sbin/puffs/mount_9p: nineproto.c

Log Message:
proto_getstat - g/c debug printfs.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/usr.sbin/puffs/mount_9p/nineproto.c

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

Modified files:

Index: src/usr.sbin/puffs/mount_9p/nineproto.c
diff -u src/usr.sbin/puffs/mount_9p/nineproto.c:1.11 src/usr.sbin/puffs/mount_9p/nineproto.c:1.12
--- src/usr.sbin/puffs/mount_9p/nineproto.c:1.11	Fri Jun  7 05:34:34 2019
+++ src/usr.sbin/puffs/mount_9p/nineproto.c	Tue May 26 19:41:36 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: nineproto.c,v 1.11 2019/06/07 05:34:34 ozaki-r Exp $	*/
+/*	$NetBSD: nineproto.c,v 1.12 2020/05/26 19:41:36 uwe Exp $	*/
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: nineproto.c,v 1.11 2019/06/07 05:34:34 ozaki-r Exp $");
+__RCSID("$NetBSD: nineproto.c,v 1.12 2020/05/26 19:41:36 uwe Exp $");
 #endif /* !lint */
 
 #include 
@@ -138,8 +138,6 @@ proto_getstat(struct puffs_usermount *pu
 		*rs = size+2; /* compensate for size field itself */
 
 	GETFIELD(p9pbuf_get_2, , 2);
-	if (v16)
-		printf("%d\n", v16);
 	GETFIELD(p9pbuf_get_4, , 4);
 	GETFIELD(proto_getqid, , 13);
 	GETFIELD(p9pbuf_get_4, , 4);
@@ -150,8 +148,6 @@ proto_getstat(struct puffs_usermount *pu
 	GETSTR(, );
 	GETSTR(, );
 
-	if (rdev)
-		printf("%d\n", rdev);
 	vap->va_rdev = rdev;
 	vap->va_mode = mode & 0777; /* may contain other uninteresting bits */
 	vap->va_atime.tv_sec = atime;



CVS commit: src/usr.sbin/puffs/mount_9p

2020-05-26 Thread Valeriy E. Ushakov
Module Name:src
Committed By:   uwe
Date:   Tue May 26 19:38:14 UTC 2020

Modified Files:
src/usr.sbin/puffs/mount_9p: subr.c

Log Message:
getdfwithoffset - do not issue dummy read to seek to offset zero on a
newly opened fid as it's already there.  This is redundant and also
seems to confuse inferno when issued against the root directory.  Now
you can ls the mount point of

styxlisten -A 'tcp!*!styx' export /

While here fix the seek logic to actually repeatedly seek forward
instead of always doing it from zero.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/puffs/mount_9p/subr.c

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

Modified files:

Index: src/usr.sbin/puffs/mount_9p/subr.c
diff -u src/usr.sbin/puffs/mount_9p/subr.c:1.7 src/usr.sbin/puffs/mount_9p/subr.c:1.8
--- src/usr.sbin/puffs/mount_9p/subr.c:1.7	Fri Jun  7 05:34:34 2019
+++ src/usr.sbin/puffs/mount_9p/subr.c	Tue May 26 19:38:14 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr.c,v 1.7 2019/06/07 05:34:34 ozaki-r Exp $	*/
+/*	$NetBSD: subr.c,v 1.8 2020/05/26 19:38:14 uwe Exp $	*/
 
 /*
  * Copyright (c) 2007  Antti Kantee.  All Rights Reserved.
@@ -27,7 +27,7 @@
 
 #include 
 #ifndef lint
-__RCSID("$NetBSD: subr.c,v 1.7 2019/06/07 05:34:34 ozaki-r Exp $");
+__RCSID("$NetBSD: subr.c,v 1.8 2020/05/26 19:38:14 uwe Exp $");
 #endif /* !lint */
 
 #include 
@@ -104,11 +104,7 @@ getdfwithoffset(struct puffs_usermount *
 {
 	struct puffs_cc *pcc = puffs_cc_getcc(pu);
 	struct puffs9p *p9p = puffs_getspecific(pu);
-	struct puffs_framebuf *pb;
 	struct dirfid *dfp = NULL;
-	p9ptag_t tag = NEXTTAG(p9p);
-	off_t curoff, advance;
-	uint32_t count;
 	int rv;
 
 	LIST_FOREACH(dfp, >dir_openlist, entries) {
@@ -120,52 +116,57 @@ getdfwithoffset(struct puffs_usermount *
 	}
 
 	/* didn't get off easy?  damn, do manual labour */
-	pb = p9pbuf_makeout();
 	dfp = ecalloc(1, sizeof(struct dirfid));
 	dfp->fid = NEXTFID(p9p);
 	rv = proto_cc_open(pu, p9n->fid_base, dfp->fid, P9PROTO_OMODE_READ);
 	if (rv)
 		goto out;
 
-	for (curoff = 0;;) {
-		advance = wantoff - curoff;
+	off_t curoff = 0;
+	if (wantoff != 0) {
+		struct puffs_framebuf *pb = p9pbuf_makeout();
+		for (;;) {
+			off_t advance = wantoff - curoff;
+
+			p9ptag_t tag = NEXTTAG(p9p);
+			p9pbuf_put_1(pb, P9PROTO_T_READ);
+			p9pbuf_put_2(pb, tag);
+			p9pbuf_put_4(pb, dfp->fid);
+			p9pbuf_put_8(pb, curoff);
+			p9pbuf_put_4(pb, advance);
+			GETRESPONSE(pb);
+
+			if (p9pbuf_get_type(pb) != P9PROTO_R_READ) {
+rv = proto_handle_rerror(pu, pb);
+puffs_framebuf_destroy(pb);
+goto out;
+			}
+
+			/*
+			 * Check how many bytes we got.  If we got the
+			 * amount we wanted, we are at the correct position.
+			 * If we got zero bytes, either the directory
+			 * doesn't "support" the seek offset we want
+			 * (someone has probably inserted an entry
+			 * meantime) or we at the end of directory.
+			 * Either way, let the upper layer deal with it.
+			 */
+			uint32_t count;
+			p9pbuf_get_4(pb, );
+			curoff += count;
+			if (count == advance || count == 0)
+break;
 
-		tag = NEXTTAG(p9p);
-		p9pbuf_put_1(pb, P9PROTO_T_READ);  
-		p9pbuf_put_2(pb, tag);
-		p9pbuf_put_4(pb, dfp->fid);   
-		p9pbuf_put_8(pb, 0);
-		p9pbuf_put_4(pb, advance);   
-		GETRESPONSE(pb);
-
-		if (p9pbuf_get_type(pb) != P9PROTO_R_READ) {
-			rv = proto_handle_rerror(pu, pb);
-			goto out;
+			p9pbuf_recycleout(pb);
 		}
-
-		/*
-		 * Check how many bytes we got.  If we got the amount we
-		 * wanted, we are at the correct position.  If we got
-		 * zero bytes, either the directory doesn't "support" the
-		 * seek offset we want (someone has probably inserted an
-		 * entry meantime) or we at the end of directory.  Either
-		 * way, let the upper layer deal with it.
-		 */
-		p9pbuf_get_4(pb, );
-		curoff += count;
-		if (count == advance || count == 0)
-			break;
-
-		p9pbuf_recycleout(pb);
+		puffs_framebuf_destroy(pb);
 	}
-	puffs_framebuf_destroy(pb);
 
 	dfp->seekoff = curoff;
 	*rfid = dfp;
 	return 0;
 
  out:
-	puffs_framebuf_destroy(pb);
 	free(dfp);
 	return rv;
 }



CVS commit: src/share/mk

2020-05-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 26 19:29:59 UTC 2020

Modified Files:
src/share/mk: bsd.own.mk

Log Message:
Move sun2 and alpha to new binutils


To generate a diff of this commit:
cvs rdiff -u -r1.1192 -r1.1193 src/share/mk/bsd.own.mk

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

Modified files:

Index: src/share/mk/bsd.own.mk
diff -u src/share/mk/bsd.own.mk:1.1192 src/share/mk/bsd.own.mk:1.1193
--- src/share/mk/bsd.own.mk:1.1192	Sun May 24 17:09:49 2020
+++ src/share/mk/bsd.own.mk	Tue May 26 15:29:59 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.own.mk,v 1.1192 2020/05/24 21:09:49 rin Exp $
+#	$NetBSD: bsd.own.mk,v 1.1193 2020/05/26 19:29:59 christos Exp $
 
 # This needs to be before bsd.init.mk
 .if defined(BSD_MK_COMPAT_FILE)
@@ -165,7 +165,8 @@ EXTERNAL_GDB_SUBDIR=		/does/not/exist
 .if ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "i386" || \
 ${MACHINE_ARCH} == "powerpc64" || ${MACHINE_ARCH} == "powerpc" || \
 ${MACHINE_CPU} == "aarch64" || ${MACHINE_CPU} == "arm" || \
-${MACHINE_ARCH} == "hppa" || ${MACHINE_ARCH} == "sparc64" 
+${MACHINE_ARCH} == "hppa" || ${MACHINE_ARCH} == "sparc64" || \
+${MACHINE} == "sun2" || ${MACHINE} == "alpha"
 HAVE_BINUTILS?=	234
 .else
 HAVE_BINUTILS?=	231



CVS commit: src/sys/dev/pci

2020-05-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 26 19:07:50 UTC 2020

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

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.1400 -r1.1401 src/sys/dev/pci/pcidevs.h
cvs rdiff -u -r1.1399 -r1.1400 src/sys/dev/pci/pcidevs_data.h

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

Modified files:

Index: src/sys/dev/pci/pcidevs.h
diff -u src/sys/dev/pci/pcidevs.h:1.1400 src/sys/dev/pci/pcidevs.h:1.1401
--- src/sys/dev/pci/pcidevs.h:1.1400	Fri May  1 10:38:59 2020
+++ src/sys/dev/pci/pcidevs.h	Tue May 26 19:07:49 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs.h,v 1.1400 2020/05/01 10:38:59 jmcneill Exp $	*/
+/*	$NetBSD: pcidevs.h,v 1.1401 2020/05/26 19:07:49 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1413 2020/05/01 10:38:35 jmcneill Exp
+ *	NetBSD: pcidevs,v 1.1414 2020/05/26 19:07:14 martin Exp
  */
 
 /*
@@ -7253,6 +7253,7 @@
 #define	PCI_PRODUCT_REALTEK_RTL8188EE	0x8179		/* RTL8188EE Wireless LAN 802.11n PCI-E NIC */
 #define	PCI_PRODUCT_REALTEK_RT8180	0x8180		/* 8180 802.11b */
 #define	PCI_PRODUCT_REALTEK_RT8185	0x8185		/* 8185 802.11a/b/g */
+#define	PCI_PRODUCT_REALTEK_RTL8192EE	0x818b		/* RTL8192EE Wireless LAN 802.11n PCI-E NIC */
 
 /* Red Hat products */
 #define	PCI_PRODUCT_REDHAT_PPB	0x0001		/* Qemu PCI-PCI */

Index: src/sys/dev/pci/pcidevs_data.h
diff -u src/sys/dev/pci/pcidevs_data.h:1.1399 src/sys/dev/pci/pcidevs_data.h:1.1400
--- src/sys/dev/pci/pcidevs_data.h:1.1399	Fri May  1 10:38:59 2020
+++ src/sys/dev/pci/pcidevs_data.h	Tue May 26 19:07:49 2020
@@ -1,10 +1,10 @@
-/*	$NetBSD: pcidevs_data.h,v 1.1399 2020/05/01 10:38:59 jmcneill Exp $	*/
+/*	$NetBSD: pcidevs_data.h,v 1.1400 2020/05/26 19:07:49 martin Exp $	*/
 
 /*
  * THIS FILE IS AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: pcidevs,v 1.1413 2020/05/01 10:38:35 jmcneill Exp
+ *	NetBSD: pcidevs,v 1.1414 2020/05/26 19:07:14 martin Exp
  */
 
 /*
@@ -12839,414 +12839,416 @@ static const uint16_t pci_products[] = {
 	32812, 7653, 0,
 	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RT8185, 
 	32817, 32822, 0,
+	PCI_VENDOR_REALTEK, PCI_PRODUCT_REALTEK_RTL8192EE, 
+	32834, 4759, 4534, 32784, 18807, 19419, 0,
 	PCI_VENDOR_REDHAT, PCI_PRODUCT_REDHAT_PPB, 
-	32834, 8506, 0,
+	32844, 8506, 0,
 	PCI_VENDOR_REDHAT, PCI_PRODUCT_REDHAT_QXL, 
-	32839, 234, 0,
+	32849, 234, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7780, 
-	32843, 615, 6422, 0,
+	32853, 615, 6422, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7785, 
-	32850, 615, 6422, 0,
+	32860, 615, 6422, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7757_PBI, 
-	32857, 8140, 32864, 32874, 0,
+	32867, 8140, 32874, 32884, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7757_PPB, 
-	32857, 9405, 6530, 32880, 0,
+	32867, 9405, 6530, 32890, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_SH7757_PS, 
-	32857, 8140, 14243, 32886, 0,
+	32867, 8140, 14243, 32896, 0,
 	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_PD720201, 
-	32891, 6912, 8200, 6920, 6422, 0,
-	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_PD720202, 
 	32901, 6912, 8200, 6920, 6422, 0,
+	PCI_VENDOR_RENESAS, PCI_PRODUCT_RENESAS_PD720202, 
+	32911, 6912, 8200, 6920, 6422, 0,
 	PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C465, 
-	32911, 15428, 6530, 0,
+	32921, 15428, 6530, 0,
 	PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C466, 
-	32917, 15428, 6530, 0,
+	32927, 15428, 6530, 0,
 	PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C475, 
-	32923, 15428, 6530, 0,
+	32933, 15428, 6530, 0,
 	PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_RL5C476, 
-	32929, 15428, 6530, 0,
+	32939, 15428, 6530, 0,
 	PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C477, 
-	32935, 15428, 6530, 0,
+	32945, 15428, 6530, 0,
 	PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C478, 
-	32941, 15428, 6530, 0,
+	32951, 15428, 6530, 0,
 	PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C551, 
-	32947, 15428, 32953, 0,
+	32957, 15428, 32963, 0,
 	PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C552, 
-	32969, 15428, 32953, 0,
+	32979, 15428, 32963, 0,
 	PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_RL5C576, 
-	32975, 8732, 12243, 6422, 0,
+	32985, 8732, 12243, 6422, 0,
 	PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C592, 
-	32982, 15428, 32988, 0,
+	32992, 15428, 32998, 0,
 	PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C593, 
-	33010, 15428, 32988, 0,
+	33020, 15428, 32998, 0,
 	PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C821, 
-	33016, 15428, 33022, 0,
+	33026, 15428, 33032, 0,
 	PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C822, 
-	33042, 15428, 33022, 0,
+	33052, 15428, 33032, 0,
 	PCI_VENDOR_RICOH, PCI_PRODUCT_RICOH_Rx5C832, 
-	

CVS commit: src/sys/dev/pci

2020-05-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 26 19:07:14 UTC 2020

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

Log Message:
Add RTL8192EE Wireless LAN 802.11n PCI-E NIC


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

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1413 src/sys/dev/pci/pcidevs:1.1414
--- src/sys/dev/pci/pcidevs:1.1413	Fri May  1 10:38:35 2020
+++ src/sys/dev/pci/pcidevs	Tue May 26 19:07:14 2020
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1413 2020/05/01 10:38:35 jmcneill Exp $
+$NetBSD: pcidevs,v 1.1414 2020/05/26 19:07:14 martin Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -7246,6 +7246,7 @@ product REALTEK RTL8192CE	0x8178	RTL8192
 product REALTEK RTL8188EE	0x8179	RTL8188EE Wireless LAN 802.11n PCI-E NIC
 product REALTEK RT8180		0x8180	8180 802.11b
 product REALTEK RT8185		0x8185	8185 802.11a/b/g
+product REALTEK RTL8192EE	0x818b	RTL8192EE Wireless LAN 802.11n PCI-E NIC
 
 /* Red Hat products */
 product REDHAT PPB		0x0001	Qemu PCI-PCI



CVS commit: src/tests/rump/modautoload

2020-05-26 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue May 26 18:52:29 UTC 2020

Modified Files:
src/tests/rump/modautoload: Makefile

Log Message:
Fix alpha build (relocation truncated to fit: GPREL16 against symbol ...)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47230


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/tests/rump/modautoload/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/rump/modautoload/Makefile
diff -u src/tests/rump/modautoload/Makefile:1.11 src/tests/rump/modautoload/Makefile:1.12
--- src/tests/rump/modautoload/Makefile:1.11	Sat May 16 08:54:27 2020
+++ src/tests/rump/modautoload/Makefile	Tue May 26 14:52:29 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.11 2020/05/16 12:54:27 christos Exp $
+#	$NetBSD: Makefile,v 1.12 2020/05/26 18:52:29 christos Exp $
 #
 
 .include 
@@ -14,6 +14,9 @@ SRCS.t_modautoload+=	t_modautoload.c
 # on amd64.  This is the reason we keep this test in its own
 # subdirectory -- otherwise the LDADD lines would get a little hairy.
 LDFLAGS+=	-Wl,-E
+.if ${MACHINE} == "alpha"
+LDFLAGS+=	-Wl,--no-relax
+.endif
 LDADD+= \
 -Wl,--whole-archive -Wl,-Bstatic \
 	-lrumpvfs_nofifofs -lrumpvfs -lrump \



CVS commit: src/sys/kern

2020-05-26 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue May 26 18:38:37 UTC 2020

Modified Files:
src/sys/kern: vfs_cache.c vfs_lookup.c vfs_subr.c vfs_vnode.c

Log Message:
Make vcache_tryvget() lockless.  Reviewed by hannken@.


To generate a diff of this commit:
cvs rdiff -u -r1.143 -r1.144 src/sys/kern/vfs_cache.c
cvs rdiff -u -r1.219 -r1.220 src/sys/kern/vfs_lookup.c
cvs rdiff -u -r1.487 -r1.488 src/sys/kern/vfs_subr.c
cvs rdiff -u -r1.122 -r1.123 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_cache.c
diff -u src/sys/kern/vfs_cache.c:1.143 src/sys/kern/vfs_cache.c:1.144
--- src/sys/kern/vfs_cache.c:1.143	Sat May 16 18:31:50 2020
+++ src/sys/kern/vfs_cache.c	Tue May 26 18:38:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_cache.c,v 1.143 2020/05/16 18:31:50 christos Exp $	*/
+/*	$NetBSD: vfs_cache.c,v 1.144 2020/05/26 18:38:37 ad Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -172,7 +172,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.143 2020/05/16 18:31:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.144 2020/05/26 18:38:37 ad Exp $");
 
 #define __NAMECACHE_PRIVATE
 #ifdef _KERNEL_OPT
@@ -582,13 +582,8 @@ cache_lookup(struct vnode *dvp, const ch
 		return hit;
 	}
 	vp = ncp->nc_vp;
-	mutex_enter(vp->v_interlock);
-	rw_exit(>vi_nc_lock);
-
-	/*
-	 * Unlocked except for the vnode interlock.  Call vcache_tryvget().
-	 */
 	error = vcache_tryvget(vp);
+	rw_exit(>vi_nc_lock);
 	if (error) {
 		KASSERT(error == EBUSY);
 		/*
@@ -821,9 +816,8 @@ cache_revlookup(struct vnode *vp, struct
 		}
 
 		dvp = ncp->nc_dvp;
-		mutex_enter(dvp->v_interlock);
-		rw_exit(>vi_nc_listlock);
 		error = vcache_tryvget(dvp);
+		rw_exit(>vi_nc_listlock);
 		if (error) {
 			KASSERT(error == EBUSY);
 			if (bufp)

Index: src/sys/kern/vfs_lookup.c
diff -u src/sys/kern/vfs_lookup.c:1.219 src/sys/kern/vfs_lookup.c:1.220
--- src/sys/kern/vfs_lookup.c:1.219	Wed Apr 22 21:35:52 2020
+++ src/sys/kern/vfs_lookup.c	Tue May 26 18:38:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_lookup.c,v 1.219 2020/04/22 21:35:52 ad Exp $	*/
+/*	$NetBSD: vfs_lookup.c,v 1.220 2020/05/26 18:38:37 ad Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.219 2020/04/22 21:35:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.220 2020/05/26 18:38:37 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_magiclinks.h"
@@ -1354,9 +1354,7 @@ lookup_fastforward(struct namei_state *s
 		foundobj->v_type != VDIR ||
 		(foundobj->v_type == VDIR &&
 		foundobj->v_mountedhere != NULL)) {
-			mutex_enter(foundobj->v_interlock);
 			error = vcache_tryvget(foundobj);
-			/* v_interlock now unheld */
 			if (error != 0) {
 foundobj = NULL;
 error = EOPNOTSUPP;
@@ -1381,9 +1379,7 @@ lookup_fastforward(struct namei_state *s
 	 * let lookup_once() take care of it.
 	 */
 	if (searchdir != *searchdir_ret) {
-		mutex_enter(searchdir->v_interlock);
 		error2 = vcache_tryvget(searchdir);
-		/* v_interlock now unheld */
 		KASSERT(plock != NULL);
 		rw_exit(plock);
 		if (__predict_true(error2 == 0)) {

Index: src/sys/kern/vfs_subr.c
diff -u src/sys/kern/vfs_subr.c:1.487 src/sys/kern/vfs_subr.c:1.488
--- src/sys/kern/vfs_subr.c:1.487	Sat May 16 18:31:50 2020
+++ src/sys/kern/vfs_subr.c	Tue May 26 18:38:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_subr.c,v 1.487 2020/05/16 18:31:50 christos Exp $	*/
+/*	$NetBSD: vfs_subr.c,v 1.488 2020/05/26 18:38:37 ad Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2007, 2008, 2019, 2020
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.487 2020/05/16 18:31:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_subr.c,v 1.488 2020/05/26 18:38:37 ad Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ddb.h"
@@ -730,18 +730,15 @@ lazy_sync_vnode(struct vnode *vp)
 	KASSERT(mutex_owned(_data_lock));
 
 	synced = false;
-	/* We are locking in the wrong direction. */
-	if (mutex_tryenter(vp->v_interlock)) {
+	if (vcache_tryvget(vp) == 0) {
 		mutex_exit(_data_lock);
-		if (vcache_tryvget(vp) == 0) {
-			if (vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT) == 0) {
-synced = true;
-(void) VOP_FSYNC(vp, curlwp->l_cred,
-FSYNC_LAZY, 0, 0);
-vput(vp);
-			} else
-vrele(vp);
-		}
+		if (vn_lock(vp, LK_EXCLUSIVE | LK_NOWAIT) == 0) {
+			synced = true;
+			(void) VOP_FSYNC(vp, curlwp->l_cred,
+			FSYNC_LAZY, 0, 0);
+			vput(vp);
+		} else
+			vrele(vp);
 		mutex_enter(_data_lock);
 	}
 	return synced;

Index: src/sys/kern/vfs_vnode.c
diff -u src/sys/kern/vfs_vnode.c:1.122 src/sys/kern/vfs_vnode.c:1.123
--- src/sys/kern/vfs_vnode.c:1.122	Mon May 18 08:27:54 2020
+++ src/sys/kern/vfs_vnode.c	Tue May 26 18:38:37 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_vnode.c,v 1.122 2020/05/18 08:27:54 hannken Exp $	*/

CVS commit: src/sys/dev/hyperv

2020-05-26 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue May 26 16:08:55 UTC 2020

Modified Files:
src/sys/dev/hyperv: vmbus.c vmbusvar.h

Log Message:
vmbus(4): Do not call hyperv_dma_alloc() in interrupt context.

The channel offer and rescind process is performed on another context.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/hyperv/vmbus.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/hyperv/vmbusvar.h

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

Modified files:

Index: src/sys/dev/hyperv/vmbus.c
diff -u src/sys/dev/hyperv/vmbus.c:1.10 src/sys/dev/hyperv/vmbus.c:1.11
--- src/sys/dev/hyperv/vmbus.c:1.10	Tue May 26 16:00:06 2020
+++ src/sys/dev/hyperv/vmbus.c	Tue May 26 16:08:55 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmbus.c,v 1.10 2020/05/26 16:00:06 nonaka Exp $	*/
+/*	$NetBSD: vmbus.c,v 1.11 2020/05/26 16:08:55 nonaka Exp $	*/
 /*	$OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.10 2020/05/26 16:00:06 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.11 2020/05/26 16:08:55 nonaka Exp $");
 
 #include 
 #include 
@@ -103,10 +103,14 @@ static void	vmbus_channel_detach(struct 
 static void	vmbus_channel_pause(struct vmbus_channel *);
 static uint32_t	vmbus_channel_unpause(struct vmbus_channel *);
 static uint32_t	vmbus_channel_ready(struct vmbus_channel *);
+static void	vmbus_chevq_enqueue(struct vmbus_softc *, int, void *);
+static void	vmbus_process_chevq(void *);
+static void	vmbus_chevq_thread(void *);
 static void	vmbus_devq_enqueue(struct vmbus_softc *, int,
 		struct vmbus_channel *);
 static void	vmbus_process_devq(void *);
 static void	vmbus_devq_thread(void *);
+static void	vmbus_subchannel_devq_thread(void *);
 
 static struct vmbus_softc *vmbus_sc;
 
@@ -841,15 +845,33 @@ vmbus_channel_response(struct vmbus_soft
 static void
 vmbus_channel_offer(struct vmbus_softc *sc, struct vmbus_chanmsg_hdr *hdr)
 {
+	struct vmbus_chanmsg_choffer *co;
 
-	vmbus_process_offer(sc, (struct vmbus_chanmsg_choffer *)hdr);
+	co = kmem_intr_alloc(sizeof(*co), KM_NOSLEEP);
+	if (co == NULL) {
+		device_printf(sc->sc_dev,
+		"failed to allocate an offer object\n");
+		return;
+	}
+
+	memcpy(co, hdr, sizeof(*co));
+	vmbus_chevq_enqueue(sc, VMBUS_CHEV_TYPE_OFFER, co);
 }
 
 static void
 vmbus_channel_rescind(struct vmbus_softc *sc, struct vmbus_chanmsg_hdr *hdr)
 {
+	struct vmbus_chanmsg_chrescind *cr;
+ 
+	cr = kmem_intr_alloc(sizeof(*cr), KM_NOSLEEP);
+	if (cr == NULL) {
+		device_printf(sc->sc_dev,
+		"failed to allocate an rescind object\n");
+		return;
+	}
 
-	vmbus_process_rescind(sc, (struct vmbus_chanmsg_chrescind *)hdr);
+	memcpy(cr, hdr, sizeof(*cr));
+	vmbus_chevq_enqueue(sc, VMBUS_CHEV_TYPE_RESCIND, cr);
 }
 
 static void
@@ -906,16 +928,48 @@ vmbus_channel_scan(struct vmbus_softc *s
 	struct vmbus_chanmsg_hdr hdr;
 	struct vmbus_chanmsg_choffer rsp;
 
+	TAILQ_INIT(>sc_prichans);
+	mutex_init(>sc_prichan_lock, MUTEX_DEFAULT, IPL_NET);
 	TAILQ_INIT(>sc_channels);
 	mutex_init(>sc_channel_lock, MUTEX_DEFAULT, IPL_NET);
 
+	/*
+	 * This queue serializes vmbus channel offer and rescind messages.
+	 */
+	SIMPLEQ_INIT(>sc_chevq);
+	mutex_init(>sc_chevq_lock, MUTEX_DEFAULT, IPL_NET);
+	cv_init(>sc_chevq_cv, "hvchevcv");
+	if (kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL,
+	vmbus_chevq_thread, sc, NULL, "hvchevq") != 0) {
+		DPRINTF("%s: failed to create prich chevq thread\n",
+		device_xname(sc->sc_dev));
+		return -1;
+	}
+
+	/*
+	 * This queue serializes vmbus devices' attach and detach
+	 * for channel offer and rescind messages.
+	 */
 	SIMPLEQ_INIT(>sc_devq);
 	mutex_init(>sc_devq_lock, MUTEX_DEFAULT, IPL_NET);
 	cv_init(>sc_devq_cv, "hvdevqcv");
+	if (kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL,
+	vmbus_devq_thread, sc, NULL, "hvdevq") != 0) {
+		DPRINTF("%s: failed to create prich devq thread\n",
+		device_xname(sc->sc_dev));
+		return -1;
+	}
 
+	/*
+	 * This queue handles sub-channel detach, so that vmbus
+	 * device's detach running in sc_devq can drain its sub-channels.
+	 */
+	SIMPLEQ_INIT(>sc_subch_devq);
+	mutex_init(>sc_subch_devq_lock, MUTEX_DEFAULT, IPL_NET);
+	cv_init(>sc_subch_devq_cv, "hvsdvqcv");
 	if (kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL,
-	vmbus_devq_thread, sc, NULL, "hvoffer") != 0) {
-		DPRINTF("%s: failed to create offer thread\n",
+	vmbus_subchannel_devq_thread, sc, NULL, "hvsdevq") != 0) {
+		DPRINTF("%s: failed to create subch devq thread\n",
 		device_xname(sc->sc_dev));
 		return -1;
 	}
@@ -932,6 +986,9 @@ vmbus_channel_scan(struct vmbus_softc *s
 	while (!ISSET(sc->sc_flags, VMBUS_SCFLAG_OFFERS_DELIVERED))
 		tsleep(>sc_devq, PRIBIO, "hvscan", 1);
 
+	mutex_enter(>sc_chevq_lock);
+	vmbus_process_chevq(sc);
+	mutex_exit(>sc_chevq_lock);
 	mutex_enter(>sc_devq_lock);
 	vmbus_process_devq(sc);
 	mutex_exit(>sc_devq_lock);
@@ 

CVS commit: src/sys/dev/hyperv

2020-05-26 Thread NONAKA Kimihiro
Module Name:src
Committed By:   nonaka
Date:   Tue May 26 16:00:06 UTC 2020

Modified Files:
src/sys/dev/hyperv: vmbus.c

Log Message:
vmbus(4): Fixed incorrect use of vmbus_wait() in vmbus_channel_scan().

Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/hyperv/vmbus.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/hyperv/vmbus.c
diff -u src/sys/dev/hyperv/vmbus.c:1.9 src/sys/dev/hyperv/vmbus.c:1.10
--- src/sys/dev/hyperv/vmbus.c:1.9	Mon May 25 10:14:58 2020
+++ src/sys/dev/hyperv/vmbus.c	Tue May 26 16:00:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vmbus.c,v 1.9 2020/05/25 10:14:58 nonaka Exp $	*/
+/*	$NetBSD: vmbus.c,v 1.10 2020/05/26 16:00:06 nonaka Exp $	*/
 /*	$OpenBSD: hyperv.c,v 1.43 2017/06/27 13:56:15 mikeb Exp $	*/
 
 /*-
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.9 2020/05/25 10:14:58 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vmbus.c,v 1.10 2020/05/26 16:00:06 nonaka Exp $");
 
 #include 
 #include 
@@ -76,9 +76,6 @@ static int	vmbus_cmd(struct vmbus_softc 
 		int);
 static int	vmbus_start(struct vmbus_softc *, struct vmbus_msg *, paddr_t);
 static int	vmbus_reply(struct vmbus_softc *, struct vmbus_msg *);
-static void	vmbus_wait(struct vmbus_softc *,
-		int (*done)(struct vmbus_softc *, struct vmbus_msg *),
-		struct vmbus_msg *, void *, const char *);
 static uint16_t vmbus_intr_signal(struct vmbus_softc *, paddr_t);
 static void	vmbus_event_proc(void *, struct cpu_info *);
 static void	vmbus_event_proc_compat(void *, struct cpu_info *);
@@ -642,36 +639,26 @@ vmbus_reply_done(struct vmbus_softc *sc,
 static int
 vmbus_reply(struct vmbus_softc *sc, struct vmbus_msg *msg)
 {
+	int s;
 
 	if (msg->msg_flags & MSGF_NOQUEUE)
 		return 0;
 
-	vmbus_wait(sc, vmbus_reply_done, msg, msg, "hvreply");
-
-	mutex_enter(>sc_rsp_lock);
-	TAILQ_REMOVE(>sc_rsps, msg, msg_entry);
-	mutex_exit(>sc_rsp_lock);
-
-	return 0;
-}
-
-static void
-vmbus_wait(struct vmbus_softc *sc,
-int (*cond)(struct vmbus_softc *, struct vmbus_msg *),
-struct vmbus_msg *msg, void *wchan, const char *wmsg)
-{
-	int s;
-
-	while (!cond(sc, msg)) {
+	while (!vmbus_reply_done(sc, msg)) {
 		if (msg->msg_flags & MSGF_NOSLEEP) {
 			delay(1000);
 			s = splnet();
 			hyperv_intr();
 			splx(s);
 		} else
-			tsleep(wchan, PRIBIO, wmsg ? wmsg : "hvwait",
-			mstohz(1));
+			tsleep(msg, PRIBIO, "hvreply", 1);
 	}
+
+	mutex_enter(>sc_rsp_lock);
+	TAILQ_REMOVE(>sc_rsps, msg, msg_entry);
+	mutex_exit(>sc_rsp_lock);
+
+	return 0;
 }
 
 static uint16_t
@@ -914,13 +901,6 @@ hyperv_guid_sprint(struct hyperv_guid *g
 }
 
 static int
-vmbus_channel_scan_done(struct vmbus_softc *sc, struct vmbus_msg *msg __unused)
-{
-
-	return ISSET(sc->sc_flags, VMBUS_SCFLAG_OFFERS_DELIVERED);
-}
-
-static int
 vmbus_channel_scan(struct vmbus_softc *sc)
 {
 	struct vmbus_chanmsg_hdr hdr;
@@ -949,8 +929,8 @@ vmbus_channel_scan(struct vmbus_softc *s
 		return -1;
 	}
 
-	vmbus_wait(sc, vmbus_channel_scan_done, (struct vmbus_msg *),
-	>sc_devq, "hvscan");
+	while (!ISSET(sc->sc_flags, VMBUS_SCFLAG_OFFERS_DELIVERED))
+		tsleep(>sc_devq, PRIBIO, "hvscan", 1);
 
 	mutex_enter(>sc_devq_lock);
 	vmbus_process_devq(sc);



CVS commit: src/sys/dev/audio

2020-05-26 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue May 26 15:20:16 UTC 2020

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

Log Message:
audio: Only restart recording mixer on resume if it's already been started


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/dev/audio/audio.c

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

Modified files:

Index: src/sys/dev/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.73 src/sys/dev/audio/audio.c:1.74
--- src/sys/dev/audio/audio.c:1.73	Tue May 26 11:43:00 2020
+++ src/sys/dev/audio/audio.c	Tue May 26 15:20:16 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.73 2020/05/26 11:43:00 nia Exp $	*/
+/*	$NetBSD: audio.c,v 1.74 2020/05/26 15:20:16 nia Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.73 2020/05/26 11:43:00 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.74 2020/05/26 15:20:16 nia Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -7789,7 +7789,7 @@ audio_resume(device_t dv, const pmf_qual
 
 	if (!sc->sc_pbusy)
 		audio_pmixer_start(sc, true);
-	if (!sc->sc_rbusy)
+	if (!sc->sc_rbusy && sc->sc_ropens > 0)
 		audio_rmixer_start(sc);
 
 	audio_exlock_mutex_exit(sc);



CVS commit: src/usr.sbin/sysinst

2020-05-26 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue May 26 15:20:45 UTC 2020

Modified Files:
src/usr.sbin/sysinst: msg.mi.en msg.mi.es msg.mi.fr

Log Message:
it's "its"


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/usr.sbin/sysinst/msg.mi.en
cvs rdiff -u -r1.23 -r1.24 src/usr.sbin/sysinst/msg.mi.es
cvs rdiff -u -r1.27 -r1.28 src/usr.sbin/sysinst/msg.mi.fr

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

Modified files:

Index: src/usr.sbin/sysinst/msg.mi.en
diff -u src/usr.sbin/sysinst/msg.mi.en:1.29 src/usr.sbin/sysinst/msg.mi.en:1.30
--- src/usr.sbin/sysinst/msg.mi.en:1.29	Mon May 18 21:19:36 2020
+++ src/usr.sbin/sysinst/msg.mi.en	Tue May 26 15:20:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.en,v 1.29 2020/05/18 21:19:36 jmcneill Exp $	*/
+/*	$NetBSD: msg.mi.en,v 1.30 2020/05/26 15:20:45 snj Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1251,7 +1251,7 @@ message	mp_already_exists	{$0 already de
 
 message ptnsize_replace_existing
 {This is an already existing partition. 
-To change it's size, the partition will need to be deleted and later
+To change its size, the partition will need to be deleted and later
 recreated.  All data in this partition will be lost.
 
 Would you like to delete this partition and continue?}

Index: src/usr.sbin/sysinst/msg.mi.es
diff -u src/usr.sbin/sysinst/msg.mi.es:1.23 src/usr.sbin/sysinst/msg.mi.es:1.24
--- src/usr.sbin/sysinst/msg.mi.es:1.23	Mon May 18 21:19:36 2020
+++ src/usr.sbin/sysinst/msg.mi.es	Tue May 26 15:20:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.es,v 1.23 2020/05/18 21:19:36 jmcneill Exp $	*/
+/*	$NetBSD: msg.mi.es,v 1.24 2020/05/26 15:20:45 snj Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1301,7 +1301,7 @@ message	mp_already_exists	{$0 already de
 
 message ptnsize_replace_existing
 {This is an already existing partition. 
-To change it's size, the partition will need to be deleted and later
+To change its size, the partition will need to be deleted and later
 recreated.  All data in this partition will be lost.
 
 Would you like to delete this partition and continue?}

Index: src/usr.sbin/sysinst/msg.mi.fr
diff -u src/usr.sbin/sysinst/msg.mi.fr:1.27 src/usr.sbin/sysinst/msg.mi.fr:1.28
--- src/usr.sbin/sysinst/msg.mi.fr:1.27	Mon May 18 21:19:36 2020
+++ src/usr.sbin/sysinst/msg.mi.fr	Tue May 26 15:20:45 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: msg.mi.fr,v 1.27 2020/05/18 21:19:36 jmcneill Exp $	*/
+/*	$NetBSD: msg.mi.fr,v 1.28 2020/05/26 15:20:45 snj Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1353,7 +1353,7 @@ message	mp_already_exists	{$0 already de
 
 message ptnsize_replace_existing
 {This is an already existing partition. 
-To change it's size, the partition will need to be deleted and later
+To change its size, the partition will need to be deleted and later
 recreated.  All data in this partition will be lost.
 
 Would you like to delete this partition and continue?}



CVS commit: src/sys/arch

2020-05-26 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Tue May 26 14:03:21 UTC 2020

Modified Files:
src/sys/arch/amd64/conf: XEN3_DOM0
src/sys/arch/i386/conf: XEN3PAE_DOM0

Log Message:
put back NO_PCI_MSI_MSIX, need to fix MSI issues reported in PR port-xen/55285
first


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/sys/arch/amd64/conf/XEN3_DOM0
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/i386/conf/XEN3PAE_DOM0

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

Modified files:

Index: src/sys/arch/amd64/conf/XEN3_DOM0
diff -u src/sys/arch/amd64/conf/XEN3_DOM0:1.180 src/sys/arch/amd64/conf/XEN3_DOM0:1.181
--- src/sys/arch/amd64/conf/XEN3_DOM0:1.180	Fri May 22 16:17:42 2020
+++ src/sys/arch/amd64/conf/XEN3_DOM0	Tue May 26 14:03:21 2020
@@ -1,4 +1,4 @@
-# $NetBSD: XEN3_DOM0,v 1.180 2020/05/22 16:17:42 jdolecek Exp $
+# $NetBSD: XEN3_DOM0,v 1.181 2020/05/26 14:03:21 jdolecek Exp $
 
 include 	"arch/amd64/conf/std.xen"
 
@@ -12,7 +12,7 @@ options 	INCLUDE_CONFIG_FILE	# embed con
 #options 	UVMHIST_PRINT
 #options 	SYSCALL_DEBUG
 
-#ident		"XEN3_DOM0-$Revision: 1.180 $"
+#ident		"XEN3_DOM0-$Revision: 1.181 $"
 
 maxusers	32		# estimated number of users
 
@@ -224,6 +224,7 @@ pci*		at hypervisor? bus ?
 pci*		at pchb? bus ?
 ppb*		at pci? dev ? function ?	# PCI-PCI bridges
 pci*		at ppb? bus ?
+options 	NO_PCI_MSI_MSIX
 
 # pci backend devices, used for PCI pass-through. To export a PCI device
 # to a domU, the device has to be attached to the pciback driver in the dom0.

Index: src/sys/arch/i386/conf/XEN3PAE_DOM0
diff -u src/sys/arch/i386/conf/XEN3PAE_DOM0:1.28 src/sys/arch/i386/conf/XEN3PAE_DOM0:1.29
--- src/sys/arch/i386/conf/XEN3PAE_DOM0:1.28	Fri May 22 16:17:42 2020
+++ src/sys/arch/i386/conf/XEN3PAE_DOM0	Tue May 26 14:03:21 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: XEN3PAE_DOM0,v 1.28 2020/05/22 16:17:42 jdolecek Exp $
+#	$NetBSD: XEN3PAE_DOM0,v 1.29 2020/05/26 14:03:21 jdolecek Exp $
 #
 #	XEN3_0: Xen 3.0 domain0 kernel
 
@@ -212,6 +212,7 @@ balloon*	at xenbus?		# Xen balloon devic
 # PCI bus support
 pci*		at hypervisor? bus ?
 pci*		at pchb? bus ?
+options 	NO_PCI_MSI_MSIX
 
 # PCI bridges
 ichlpcib* at pci? dev ? function ?	# Intel ICH PCI-ISA w/ timecounter,



CVS commit: src/sys/dev/ic

2020-05-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue May 26 13:24:53 UTC 2020

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

Log Message:
Make the readahead-while-sending-output code conditional in
com_common_putc(), only erquest readahead before interrupts are enabled
and when called from comcnputc().
Fixes PR kern/55286.


To generate a diff of this commit:
cvs rdiff -u -r1.358 -r1.359 src/sys/dev/ic/com.c

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

Modified files:

Index: src/sys/dev/ic/com.c
diff -u src/sys/dev/ic/com.c:1.358 src/sys/dev/ic/com.c:1.359
--- src/sys/dev/ic/com.c:1.358	Fri May  1 07:27:51 2020
+++ src/sys/dev/ic/com.c	Tue May 26 13:24:52 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: com.c,v 1.358 2020/05/01 07:27:51 simonb Exp $ */
+/* $NetBSD: com.c,v 1.359 2020/05/26 13:24:52 martin Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2004, 2008 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.358 2020/05/01 07:27:51 simonb Exp $");
+__KERNEL_RCSID(0, "$NetBSD: com.c,v 1.359 2020/05/26 13:24:52 martin Exp $");
 
 #include "opt_com.h"
 #include "opt_ddb.h"
@@ -159,7 +159,7 @@ int	com_to_tiocm(struct com_softc *);
 void	com_iflush(struct com_softc *);
 
 int	com_common_getc(dev_t, struct com_regs *);
-static void	com_common_putc(dev_t, struct com_regs *, int);
+static void	com_common_putc(dev_t, struct com_regs *, int, int);
 
 int	cominit(struct com_regs *, int, int, int, tcflag_t);
 
@@ -2399,12 +2399,12 @@ com_common_getc(dev_t dev, struct com_re
 }
 
 static void
-com_common_putc(dev_t dev, struct com_regs *regsp, int c)
+com_common_putc(dev_t dev, struct com_regs *regsp, int c, int with_readahead)
 {
 	int s = splserial();
 	int cin, stat, timo;
 
-	if (com_readaheadcount < MAX_READAHEAD
+	if (with_readahead && com_readaheadcount < MAX_READAHEAD
 	 && ISSET(stat = CSR_READ_1(regsp, COM_REG_LSR), LSR_RXRDY)) {
 		int cn_trapped = 0;
 		cin = CSR_READ_1(regsp, COM_REG_RXDATA);
@@ -2572,7 +2572,7 @@ void
 comcnputc(dev_t dev, int c)
 {
 
-	com_common_putc(dev, _info.regs, c);
+	com_common_putc(dev, _info.regs, c, cold);
 }
 
 void
@@ -2641,7 +2641,7 @@ void
 com_kgdb_putc(void *arg, int c)
 {
 
-	com_common_putc(NODEV, , c);
+	com_common_putc(NODEV, , c, 0);
 }
 #endif /* KGDB */
 



CVS commit: src/sys/dev/audio

2020-05-26 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue May 26 11:43:00 UTC 2020

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

Log Message:
audio: remove comment that is no longer valid


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/audio/audio.c

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

Modified files:

Index: src/sys/dev/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.72 src/sys/dev/audio/audio.c:1.73
--- src/sys/dev/audio/audio.c:1.72	Tue May 26 10:12:12 2020
+++ src/sys/dev/audio/audio.c	Tue May 26 11:43:00 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.72 2020/05/26 10:12:12 nia Exp $	*/
+/*	$NetBSD: audio.c,v 1.73 2020/05/26 11:43:00 nia Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.72 2020/05/26 10:12:12 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.73 2020/05/26 11:43:00 nia Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -7756,7 +7756,6 @@ audio_suspend(device_t dv, const pmf_qua
 		return error;
 	audio_mixer_capture(sc);
 
-	/* Halts mixers but don't clear busy flag for resume */
 	if (sc->sc_pbusy) {
 		audio_pmixer_halt(sc);
 	}



CVS commit: src/sys

2020-05-26 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue May 26 10:37:25 UTC 2020

Modified Files:
src/sys/arch/xen/conf: files.xen
src/sys/arch/xen/xen: hypervisor.c privcmd.c
src/sys/arch/xen/xenbus: xenbus_probe.c
src/sys/miscfs/kernfs: files.kernfs

Log Message:
Add need-flags for kernfs.
Compile Xen kernfs support only if kernfs is compiled in the kernel.
Should fix MODULAR build.


To generate a diff of this commit:
cvs rdiff -u -r1.185 -r1.186 src/sys/arch/xen/conf/files.xen
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/xen/xen/hypervisor.c
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/xen/xen/privcmd.c
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/xen/xenbus/xenbus_probe.c
cvs rdiff -u -r1.6 -r1.7 src/sys/miscfs/kernfs/files.kernfs

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.185 src/sys/arch/xen/conf/files.xen:1.186
--- src/sys/arch/xen/conf/files.xen:1.185	Tue May  5 17:02:01 2020
+++ src/sys/arch/xen/conf/files.xen	Tue May 26 10:37:24 2020
@@ -1,4 +1,4 @@
-#	$NetBSD: files.xen,v 1.185 2020/05/05 17:02:01 bouyer Exp $
+#	$NetBSD: files.xen,v 1.186 2020/05/26 10:37:24 bouyer Exp $
 
 defflag	opt_xen.h			XEN XENPVH XENPVHVM PAE DOM0OPS
 
@@ -27,7 +27,7 @@ device xenbus {[id = -1]}
 attach xenbus at xendevbus
 file arch/xen/xenbus/xenbus_client.c xenbus needs-flag
 file arch/xen/xenbus/xenbus_comms.c xenbus needs-flag
-file arch/xen/xenbus/xenbus_dev.c xenbus needs-flag
+file arch/xen/xenbus/xenbus_dev.c xenbus & kernfs
 file arch/xen/xenbus/xenbus_probe.c xenbus needs-flag
 file arch/xen/xenbus/xenbus_xs.c xenbus needs-flag
 

Index: src/sys/arch/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.85 src/sys/arch/xen/xen/hypervisor.c:1.86
--- src/sys/arch/xen/xen/hypervisor.c:1.85	Thu May 21 21:12:31 2020
+++ src/sys/arch/xen/xen/hypervisor.c	Tue May 26 10:37:25 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.85 2020/05/21 21:12:31 ad Exp $ */
+/* $NetBSD: hypervisor.c,v 1.86 2020/05/26 10:37:25 bouyer Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.85 2020/05/21 21:12:31 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.86 2020/05/26 10:37:25 bouyer Exp $");
 
 #include 
 #include 
@@ -65,6 +65,7 @@ __KERNEL_RCSID(0, "$NetBSD: hypervisor.c
 #include "isa.h"
 #include "pci.h"
 #include "acpica.h"
+#include "kernfs.h"
 
 #include "opt_xen.h"
 #include "opt_mpbios.h"
@@ -778,10 +779,12 @@ kernfs_parentdir_t *kernxen_pkt;
 void
 xenkernfs_init(void)
 {
+#if NKERNFS > 0
 	kernfs_entry_t *dkt;
 
 	KERNFS_ALLOCENTRY(dkt, KM_SLEEP);
 	KERNFS_INITENTRY(dkt, DT_DIR, "xen", NULL, KFSsubdir, VDIR, DIR_MODE);
 	kernfs_addentry(NULL, dkt);
 	kernxen_pkt = KERNFS_ENTOPARENTDIR(dkt);
+#endif
 }

Index: src/sys/arch/xen/xen/privcmd.c
diff -u src/sys/arch/xen/xen/privcmd.c:1.58 src/sys/arch/xen/xen/privcmd.c:1.59
--- src/sys/arch/xen/xen/privcmd.c:1.58	Tue May 26 10:11:56 2020
+++ src/sys/arch/xen/xen/privcmd.c	Tue May 26 10:37:25 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: privcmd.c,v 1.58 2020/05/26 10:11:56 bouyer Exp $ */
+/* $NetBSD: privcmd.c,v 1.59 2020/05/26 10:37:25 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2004 Christian Limpach.
@@ -27,7 +27,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.58 2020/05/26 10:11:56 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.59 2020/05/26 10:37:25 bouyer Exp $");
 
 #include 
 #include 
@@ -782,7 +782,6 @@ privcmd_ioctl(void *v)
 	case IOCTL_PRIVCMD_MMAPBATCH_V2:
 		return privcmd_mmapbatch_v2(ap);
 
-
 	case IOCTL_PRIVCMD_MMAP_RESOURCE:
 		return privcmd_mmap_resource(ap);
 

Index: src/sys/arch/xen/xenbus/xenbus_probe.c
diff -u src/sys/arch/xen/xenbus/xenbus_probe.c:1.54 src/sys/arch/xen/xenbus/xenbus_probe.c:1.55
--- src/sys/arch/xen/xenbus/xenbus_probe.c:1.54	Thu May 14 13:18:55 2020
+++ src/sys/arch/xen/xenbus/xenbus_probe.c	Tue May 26 10:37:25 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: xenbus_probe.c,v 1.54 2020/05/14 13:18:55 jdolecek Exp $ */
+/* $NetBSD: xenbus_probe.c,v 1.55 2020/05/26 10:37:25 bouyer Exp $ */
 /**
  * Talks to Xen Store to figure out what devices we have.
  *
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.54 2020/05/14 13:18:55 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenbus_probe.c,v 1.55 2020/05/26 10:37:25 bouyer Exp $");
 
 #if 0
 #define DPRINTK(fmt, args...) \
@@ -56,6 +56,8 @@ __KERNEL_RCSID(0, "$NetBSD: xenbus_probe
 
 #include "xenbus_comms.h"
 
+#include "kernfs.h"
+
 static int  xenbus_match(device_t, cfdata_t, void *);
 static void xenbus_attach(device_t, device_t, void *);
 static int  xenbus_print(void *, const char *);
@@ -719,8 +721,10 @@ xenbus_probe_init(void *unused)
 #endif /* DOM0OPS */
 	}
 
+#if NKERNFS > 0
 	

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

2020-05-26 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue May 26 10:36:20 UTC 2020

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

Log Message:
Always enable declarations needed by privcmd.c


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/sys/external/mit/xen-include-public/dist/xen/include/public/memory.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/memory.h
diff -u src/sys/external/mit/xen-include-public/dist/xen/include/public/memory.h:1.1.1.1 src/sys/external/mit/xen-include-public/dist/xen/include/public/memory.h:1.2
--- src/sys/external/mit/xen-include-public/dist/xen/include/public/memory.h:1.1.1.1	Sat Feb  2 08:03:48 2019
+++ src/sys/external/mit/xen-include-public/dist/xen/include/public/memory.h	Tue May 26 10:36:20 2020
@@ -374,7 +374,7 @@ struct xen_pod_target {
 };
 typedef struct xen_pod_target xen_pod_target_t;
 
-#if defined(__XEN__) || defined(__XEN_TOOLS__)
+#if 1 /* defined(__XEN__) || defined(__XEN_TOOLS__) XXX needed for privcmd.c */
 
 #ifndef uint64_aligned_t
 #define uint64_aligned_t uint64_t



CVS commit: src/sys/arch/xen

2020-05-26 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue May 26 10:11:56 UTC 2020

Modified Files:
src/sys/arch/xen/include: xenio.h
src/sys/arch/xen/xen: privcmd.c

Log Message:
Implement new ioctl, needed by Xen 4.13:
IOCTL_PRIVCMD_MMAPBATCH_V2
IOCTL_PRIVCMD_MMAP_RESOURCE
IOCTL_GNTDEV_MMAP_GRANT_REF
IOCTL_GNTDEV_ALLOC_GRANT_REF


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/xen/include/xenio.h
cvs rdiff -u -r1.57 -r1.58 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/include/xenio.h
diff -u src/sys/arch/xen/include/xenio.h:1.11 src/sys/arch/xen/include/xenio.h:1.12
--- src/sys/arch/xen/include/xenio.h:1.11	Thu Jul  7 06:55:40 2016
+++ src/sys/arch/xen/include/xenio.h	Tue May 26 10:11:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: xenio.h,v 1.11 2016/07/07 06:55:40 msaitoh Exp $	*/
+/*	$NetBSD: xenio.h,v 1.12 2020/05/26 10:11:56 bouyer Exp $	*/
 
 /**
  * privcmd.h
@@ -114,9 +114,92 @@ typedef struct oprivcmd_hypercall
  */
 #define IOCTL_PRIVCMD_INITDOMAIN_EVTCHN \
 _IOR('P', 5, int)
+
 #define IOCTL_PRIVCMD_MMAPBATCH_V2  \
 _IOW('P', 6, privcmd_mmapbatch_v2_t)
 
+/*
+ * @cmd: IOCTL_PRIVCMD_MMAP_RESOURCE
+ * @arg _mmap_resource_t
+ * Return: 
+ * map the specified resource at the provided virtual address
+ */ 
+
+typedef struct privcmd_mmap_resource {
+domid_t dom;
+	uint32_t type;
+	uint32_t id;
+	uint32_t idx; 
+	uint64_t num; 
+	uint64_t addr;
+} privcmd_mmap_resource_t;
+
+#define IOCTL_PRIVCMD_MMAP_RESOURCE  \
+_IOW('P', 7, privcmd_mmap_resource_t)
+
+/*
+ * @cmd: IOCTL_GNTDEV_MMAP_GRANT_REF
+ * @arg _gntdev_mmap_grant_ref
+ * Return: 
+ * map the grant references at the virtual address provided by caller
+ * The grant ref already exists (e.g. comes from a remote domain)
+ */ 
+struct ioctl_gntdev_grant_ref {
+	/* The domain ID of the grant to be mapped. */
+	uint32_t domid;
+	/* The grant reference of the grant to be mapped. */
+	uint32_t ref;
+};
+
+struct ioctl_gntdev_grant_notify {
+	ssize_t offset;
+	uint32_t action;
+	uint32_t event_channel_port;
+};
+#define UNMAP_NOTIFY_CLEAR_BYTE 0x1
+#define UNMAP_NOTIFY_SEND_EVENT 0x2
+
+struct ioctl_gntdev_mmap_grant_ref {
+	/* The number of grants to be mapped. */
+	uint32_t count;
+	uint32_t pad;
+	/* The virtual address where they should be mapped */
+	void *va;
+	/* notify action */
+	struct ioctl_gntdev_grant_notify notify;
+	/* Array of grant references, of size @count. */
+	struct ioctl_gntdev_grant_ref *refs;
+};
+
+#define IOCTL_GNTDEV_MMAP_GRANT_REF \
+_IOW('P', 8, struct ioctl_gntdev_mmap_grant_ref)
+
+/*
+ * @cmd: IOCTL_GNTDEV_ALLOC_GRANT_REF
+ * @arg _gntdev_alloc_grant_ref
+ * Return: 
+ * Allocate local memory and grant it to a remote domain.
+ * local memory is mmaped at the virtual address provided by caller
+ */ 
+
+struct ioctl_gntdev_alloc_grant_ref {
+	/* IN parameters */ 
+	uint16_t domid;
+	uint16_t flags;
+	uint32_t count;
+	void *va;
+	/* notify action */
+	struct ioctl_gntdev_grant_notify notify;
+	/* Variable OUT parameter */  
+	uint32_t *gref_ids; 
+};
+
+#define IOCTL_GNTDEV_ALLOC_GRANT_REF \
+_IOW('P', 9, struct ioctl_gntdev_alloc_grant_ref)
+
+#define GNTDEV_ALLOC_FLAG_WRITABLE 0x01
+
+
 /* Interface to /dev/xenevt */
 /* EVTCHN_RESET: Clear and reinit the event buffer. Clear error condition. */
 #define EVTCHN_RESET  _IO('E', 1)

Index: src/sys/arch/xen/xen/privcmd.c
diff -u src/sys/arch/xen/xen/privcmd.c:1.57 src/sys/arch/xen/xen/privcmd.c:1.58
--- src/sys/arch/xen/xen/privcmd.c:1.57	Tue May  5 17:02:01 2020
+++ src/sys/arch/xen/xen/privcmd.c	Tue May 26 10:11:56 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: privcmd.c,v 1.57 2020/05/05 17:02:01 bouyer Exp $ */
+/* $NetBSD: privcmd.c,v 1.58 2020/05/26 10:11:56 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2004 Christian Limpach.
@@ -27,7 +27,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.57 2020/05/05 17:02:01 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 1.58 2020/05/26 10:11:56 bouyer Exp $");
 
 #include 
 #include 
@@ -47,29 +47,68 @@ __KERNEL_RCSID(0, "$NetBSD: privcmd.c,v 
 #include 
 #include 
 #include 
+#include 
 
 #define	PRIVCMD_MODE	(S_IRUSR)
 
 /* Magic value is used to mark invalid pages.
  * This must be a value within the page-offset.
  * Page-aligned values including 0x0 are used by the guest.
- */ 
+ */
 #define INVALID_PAGE	0xfff
 
+typedef enum _privcmd_type {
+	PTYPE_PRIVCMD,
+	PTYPE_GNTDEV_REF,
+	PTYPE_GNTDEV_ALLOC
+} privcmd_type;
+
+struct privcmd_object_privcmd {
+paddr_t *maddr; /* array of machine address to map */
+int domid;
+boolno_translate;
+};
+
+struct privcmd_object_gntref {
+struct ioctl_gntdev_grant_notify notify;
+	struct gnttab_map_grant_ref ops[1]; /* variable length */
+};
+
+struct 

CVS commit: src/sys/dev/audio

2020-05-26 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue May 26 10:12:12 UTC 2020

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

Log Message:
audio: Restore compat with Solaris for 8-bit LINEAR.

It's always signed, unless it's LINEAR8.

PR kern/55175


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/dev/audio/audio.c

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

Modified files:

Index: src/sys/dev/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.71 src/sys/dev/audio/audio.c:1.72
--- src/sys/dev/audio/audio.c:1.71	Tue May 26 10:07:29 2020
+++ src/sys/dev/audio/audio.c	Tue May 26 10:12:12 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.71 2020/05/26 10:07:29 nia Exp $	*/
+/*	$NetBSD: audio.c,v 1.72 2020/05/26 10:12:12 nia Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.71 2020/05/26 10:07:29 nia Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.72 2020/05/26 10:12:12 nia Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -6120,13 +6120,17 @@ static int
 audio_check_params(audio_format2_t *p)
 {
 
-	/* Convert obsoleted AUDIO_ENCODING_PCM* */
-	/* XXX Is this conversion right? */
+	/*
+	 * Convert obsolete AUDIO_ENCODING_PCM encodings.
+	 * 
+	 * AUDIO_ENCODING_PCM16 == AUDIO_ENCODING_LINEAR
+	 * So, it's always signed, as in SunOS.
+	 *
+	 * AUDIO_ENCODING_PCM8 == AUDIO_ENCODING_LINEAR8
+	 * So, it's always unsigned, as in SunOS.
+	 */
 	if (p->encoding == AUDIO_ENCODING_PCM16) {
-		if (p->precision == 8)
-			p->encoding = AUDIO_ENCODING_ULINEAR;
-		else
-			p->encoding = AUDIO_ENCODING_SLINEAR;
+		p->encoding = AUDIO_ENCODING_SLINEAR;
 	} else if (p->encoding == AUDIO_ENCODING_PCM8) {
 		if (p->precision == 8)
 			p->encoding = AUDIO_ENCODING_ULINEAR;



CVS commit: src/sys/arch

2020-05-26 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Tue May 26 10:10:32 UTC 2020

Modified Files:
src/sys/arch/x86/include: pmap.h
src/sys/arch/x86/x86: pmap.c
src/sys/arch/xen/include: xenpmap.h
src/sys/arch/xen/x86: x86_xpmap.c

Log Message:
Ajust pmap_enter_ma() for upcoming new Xen privcmd ioctl:
pass flags to xpq_update_foreign()
Introduce a pmap MD flag: PMAP_MD_XEN_NOTR, which cause xpq_update_foreign()
to use the MMU_PT_UPDATE_NO_TRANSLATE flag.
make xpq_update_foreign() return the raw Xen error. This will cause
pmap_enter_ma() to return a negative error number in this case, but the
only user of this code path is privcmd.c and it can deal with it.

Add pmap_enter_gnt()m which maps a set of Xen grant entries at the
specified va in the specified pmap. Use the hooks implemented for EPT to
keep track of mapped grand entries in the pmap, and unmap them
when pmap_remove() is called. This requires pmap_remove() to be split
into a pmap_remove_locked(), to be called from pmap_remove_gnt().


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.393 -r1.394 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/xen/include/xenpmap.h
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/xen/x86/x86_xpmap.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/pmap.h
diff -u src/sys/arch/x86/include/pmap.h:1.120 src/sys/arch/x86/include/pmap.h:1.121
--- src/sys/arch/x86/include/pmap.h:1.120	Fri May  8 00:49:42 2020
+++ src/sys/arch/x86/include/pmap.h	Tue May 26 10:10:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.120 2020/05/08 00:49:42 riastradh Exp $	*/
+/*	$NetBSD: pmap.h,v 1.121 2020/05/26 10:10:31 bouyer Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -283,7 +283,7 @@ struct pmap {
 	uint64_t pm_ncsw;		/* for assertions */
 	LIST_HEAD(,vm_page) pm_gc_ptp;	/* PTPs queued for free */
 
-	/* Used by NVMM. */
+	/* Used by NVMM and Xen */
 	int (*pm_enter)(struct pmap *, vaddr_t, paddr_t, vm_prot_t, u_int);
 	bool (*pm_extract)(struct pmap *, vaddr_t, paddr_t *);
 	void (*pm_remove)(struct pmap *, vaddr_t, vaddr_t);

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.393 src/sys/arch/x86/x86/pmap.c:1.394
--- src/sys/arch/x86/x86/pmap.c:1.393	Tue May 19 21:14:20 2020
+++ src/sys/arch/x86/x86/pmap.c	Tue May 26 10:10:31 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.393 2020/05/19 21:14:20 ad Exp $	*/
+/*	$NetBSD: pmap.c,v 1.394 2020/05/26 10:10:31 bouyer Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017, 2019, 2020 The NetBSD Foundation, Inc.
@@ -130,7 +130,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.393 2020/05/19 21:14:20 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.394 2020/05/26 10:10:31 bouyer Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -151,6 +151,7 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.3
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2850,7 +2851,7 @@ pmap_create(void)
 	pmap->pm_hiexec = 0;
 #endif
 
-	/* Used by NVMM. */
+	/* Used by NVMM and Xen */
 	pmap->pm_enter = NULL;
 	pmap->pm_extract = NULL;
 	pmap->pm_remove = NULL;
@@ -4109,13 +4110,8 @@ pmap_remove_pte(struct pmap *pmap, struc
 	return true;
 }
 
-/*
- * pmap_remove: mapping removal function.
- *
- * => caller should not be holding any pmap locks
- */
-void
-pmap_remove(struct pmap *pmap, vaddr_t sva, vaddr_t eva)
+static void
+pmap_remove_locked(struct pmap *pmap, vaddr_t sva, vaddr_t eva)
 {
 	pt_entry_t *ptes;
 	pd_entry_t pde;
@@ -4126,12 +4122,8 @@ pmap_remove(struct pmap *pmap, vaddr_t s
 	struct pmap *pmap2;
 	int lvl;
 
-	if (__predict_false(pmap->pm_remove != NULL)) {
-		(*pmap->pm_remove)(pmap, sva, eva);
-		return;
-	}
+	KASSERT(mutex_owned(>pm_lock));
 
-	mutex_enter(>pm_lock);
 	pmap_map_ptes(pmap, , , );
 
 	/*
@@ -4195,6 +4187,23 @@ pmap_remove(struct pmap *pmap, vaddr_t s
 		}
 	}
 	pmap_unmap_ptes(pmap, pmap2);
+}
+
+/*
+ * pmap_remove: mapping removal function.
+ *
+ * => caller should not be holding any pmap locks
+ */
+void
+pmap_remove(struct pmap *pmap, vaddr_t sva, vaddr_t eva)
+{
+	if (__predict_false(pmap->pm_remove != NULL)) {
+		(*pmap->pm_remove)(pmap, sva, eva);
+		return;
+	}
+
+	mutex_enter(>pm_lock);
+	pmap_remove_locked(pmap, sva, eva);
 	mutex_exit(>pm_lock);
 }
 
@@ -4966,7 +4975,7 @@ pmap_enter_ma(struct pmap *pmap, vaddr_t
 continue;
 			}
 			error = xpq_update_foreign(
-			vtomach((vaddr_t)ptep), npte, domid);
+			vtomach((vaddr_t)ptep), npte, domid, flags);
 			splx(s);
 			if (error) {
 /* Undo pv_entry tracking - oof. */
@@ -5071,6 +5080,330 @@ same_pa:
 	return 0;
 }
 
+#if defined(XEN) && defined(DOM0OPS)
+
+struct pmap_data_gnt {
+	SLIST_ENTRY(pmap_data_gnt) pd_gnt_list;
+	vaddr_t pd_gnt_sva; 
+	vaddr_t pd_gnt_eva; /* range 

CVS commit: src/sys/dev/audio

2020-05-26 Thread Nia Alarie
Module Name:src
Committed By:   nia
Date:   Tue May 26 10:07:29 UTC 2020

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

Log Message:
audio: Fix logic for resuming when the device is in use.

audio_[r/p]mixer_start should never be called when the device is
marked busy.

Resolves a panic on resume when audio is playing, PR kern/55301


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/audio/audio.c

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

Modified files:

Index: src/sys/dev/audio/audio.c
diff -u src/sys/dev/audio/audio.c:1.70 src/sys/dev/audio/audio.c:1.71
--- src/sys/dev/audio/audio.c:1.70	Sat May 23 23:42:42 2020
+++ src/sys/dev/audio/audio.c	Tue May 26 10:07:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.70 2020/05/23 23:42:42 ad Exp $	*/
+/*	$NetBSD: audio.c,v 1.71 2020/05/26 10:07:29 nia Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.70 2020/05/23 23:42:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.71 2020/05/26 10:07:29 nia Exp $");
 
 #ifdef _KERNEL_OPT
 #include "audio.h"
@@ -7755,11 +7755,9 @@ audio_suspend(device_t dv, const pmf_qua
 	/* Halts mixers but don't clear busy flag for resume */
 	if (sc->sc_pbusy) {
 		audio_pmixer_halt(sc);
-		sc->sc_pbusy = true;
 	}
 	if (sc->sc_rbusy) {
 		audio_rmixer_halt(sc);
-		sc->sc_rbusy = true;
 	}
 
 #ifdef AUDIO_PM_IDLE
@@ -7786,9 +7784,9 @@ audio_resume(device_t dv, const pmf_qual
 	AUDIO_INITINFO();
 	audio_hw_setinfo(sc, , NULL);
 
-	if (sc->sc_pbusy)
+	if (!sc->sc_pbusy)
 		audio_pmixer_start(sc, true);
-	if (sc->sc_rbusy)
+	if (!sc->sc_rbusy)
 		audio_rmixer_start(sc);
 
 	audio_exlock_mutex_exit(sc);



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

2020-05-26 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue May 26 09:16:33 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: locore.S

Log Message:
clang assembler evaluates #'\r' as #0x72. Grrr


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/aarch64/aarch64/locore.S

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.61 src/sys/arch/aarch64/aarch64/locore.S:1.62
--- src/sys/arch/aarch64/aarch64/locore.S:1.61	Tue May 26 07:23:57 2020
+++ src/sys/arch/aarch64/aarch64/locore.S	Tue May 26 09:16:33 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.61 2020/05/26 07:23:57 ryo Exp $	*/
+/*	$NetBSD: locore.S,v 1.62 2020/05/26 09:16:33 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -38,7 +38,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.61 2020/05/26 07:23:57 ryo Exp $")
+RCSID("$NetBSD: locore.S,v 1.62 2020/05/26 09:16:33 ryo Exp $")
 
 #ifdef AARCH64_DEVICE_MEM_STRONGLY_ORDERED
 #define	MAIR_DEVICE_MEM		MAIR_DEVICE_nGnRnE
@@ -574,7 +574,7 @@ ENTRY_NP(uartputs)
 1:
 	cmp	x0, #'\n'
 	bne	2f
-	mov	x0, #'\r'
+	mov	x0, #0x0d	/* '\r' */
 	bl	uartputc
 	mov	x0, #'\n'
 2:
@@ -680,7 +680,7 @@ tinyprintf_loop:
 	cmp	x0, #'\n'
 	bne	1f
 	/* '\n' -> '\r', '\n' */
-	mov	x0, #'\r'
+	mov	x0, #0x0d	/* '\r' */
 	bl	uartputc
 	mov	x0, #'\n'
 1:



CVS commit: src/external/cddl/osnet

2020-05-26 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Tue May 26 08:39:27 UTC 2020

Modified Files:
src/external/cddl/osnet/dist/uts/common/fs/zfs: zfs_vfsops.c
src/external/cddl/osnet/sys/sys: vnode.h

Log Message:
Replace vp->v_count with vrefcnt(vp) and
remove now unneeded "#define v_count ...".


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 \
src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c
cvs rdiff -u -r1.16 -r1.17 src/external/cddl/osnet/sys/sys/vnode.h

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

Modified files:

Index: src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c
diff -u src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.27 src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.28
--- src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c:1.27	Mon Apr 13 19:23:17 2020
+++ src/external/cddl/osnet/dist/uts/common/fs/zfs/zfs_vfsops.c	Tue May 26 08:39:27 2020
@@ -2311,7 +2311,11 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolea
 	for (zp = list_head(>z_all_znodes); zp != NULL;
 	zp = list_next(>z_all_znodes, zp))
 		if (zp->z_sa_hdl) {
+#ifdef __NetBSD__
+			ASSERT(vrefcnt(ZTOV(zp)) >= 0);
+#else
 			ASSERT(ZTOV(zp)->v_count >= 0);
+#endif
 			zfs_znode_dmu_fini(zp);
 		}
 	mutex_exit(>z_znodes_lock);

Index: src/external/cddl/osnet/sys/sys/vnode.h
diff -u src/external/cddl/osnet/sys/sys/vnode.h:1.16 src/external/cddl/osnet/sys/sys/vnode.h:1.17
--- src/external/cddl/osnet/sys/sys/vnode.h:1.16	Mon Apr 13 19:23:17 2020
+++ src/external/cddl/osnet/sys/sys/vnode.h	Tue May 26 08:39:27 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vnode.h,v 1.16 2020/04/13 19:23:17 ad Exp $	*/
+/*	$NetBSD: vnode.h,v 1.17 2020/05/26 08:39:27 hannken Exp $	*/
 
 /*
  * CDDL HEADER START
@@ -135,7 +135,6 @@ typedef int (**vnodeops_t)(void *);
 #define	vop_fid_args	vop_vptofh_args
 #define	a_fid		a_fhp
 
-#define	v_count		v_usecount
 #define	v_object	v_uobj
 
 struct vop_vptofh_args {



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

2020-05-26 Thread Ryo Shimizu
Module Name:src
Committed By:   ryo
Date:   Tue May 26 07:23:57 UTC 2020

Modified Files:
src/sys/arch/aarch64/aarch64: locore.S

Log Message:
fixed that BTI trap will be occured when AP jumps to mp_vstart on 
ARMV85_BTI+SMP evironment.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/aarch64/aarch64/locore.S

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

Modified files:

Index: src/sys/arch/aarch64/aarch64/locore.S
diff -u src/sys/arch/aarch64/aarch64/locore.S:1.60 src/sys/arch/aarch64/aarch64/locore.S:1.61
--- src/sys/arch/aarch64/aarch64/locore.S:1.60	Fri May 15 04:55:40 2020
+++ src/sys/arch/aarch64/aarch64/locore.S	Tue May 26 07:23:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.60 2020/05/15 04:55:40 ryo Exp $	*/
+/*	$NetBSD: locore.S,v 1.61 2020/05/26 07:23:57 ryo Exp $	*/
 
 /*
  * Copyright (c) 2017 Ryo Shimizu 
@@ -38,7 +38,7 @@
 #include 
 #include "assym.h"
 
-RCSID("$NetBSD: locore.S,v 1.60 2020/05/15 04:55:40 ryo Exp $")
+RCSID("$NetBSD: locore.S,v 1.61 2020/05/26 07:23:57 ryo Exp $")
 
 #ifdef AARCH64_DEVICE_MEM_STRONGLY_ORDERED
 #define	MAIR_DEVICE_MEM		MAIR_DEVICE_nGnRnE
@@ -436,6 +436,7 @@ ENTRY_NP(cpu_mpstart)
 	br	x20
 
 mp_vstart:
+	hint	0x24		/* bti j */
 	CPU_DPRINTREG("PC   = ", x20)
 
 	/* set exception vector */



CVS commit: src/sys/dev/usb

2020-05-26 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue May 26 07:03:23 UTC 2020

Modified Files:
src/sys/dev/usb: ohci.c uhci.c

Log Message:
Copyright maintenance


To generate a diff of this commit:
cvs rdiff -u -r1.308 -r1.309 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.302 -r1.303 src/sys/dev/usb/uhci.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/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.308 src/sys/dev/usb/ohci.c:1.309
--- src/sys/dev/usb/ohci.c:1.308	Sun May 24 07:42:51 2020
+++ src/sys/dev/usb/ohci.c	Tue May 26 07:03:22 2020
@@ -1,13 +1,14 @@
-/*	$NetBSD: ohci.c,v 1.308 2020/05/24 07:42:51 skrll Exp $	*/
+/*	$NetBSD: ohci.c,v 1.309 2020/05/26 07:03:22 skrll Exp $	*/
 
 /*
- * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 2004, 2005, 2012, 2016, 2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
  * by Lennart Augustsson (lenn...@augustsson.net) at
- * Carlstedt Research & Technology, Jared D. McNeill (jmcne...@invisible.ca)
- * and Matthew R. Green (m...@eterna.com.au).
+ * Carlstedt Research & Technology, Jared D. McNeill (jmcne...@invisible.ca),
+ * Matthew R. Green (m...@eterna.com.au), and Nick Hudson.
+ *
  * This code is derived from software contributed to The NetBSD Foundation
  * by Charles M. Hannum.
  *
@@ -41,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.308 2020/05/24 07:42:51 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.309 2020/05/26 07:03:22 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"

Index: src/sys/dev/usb/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.302 src/sys/dev/usb/uhci.c:1.303
--- src/sys/dev/usb/uhci.c:1.302	Mon May 25 13:55:31 2020
+++ src/sys/dev/usb/uhci.c	Tue May 26 07:03:22 2020
@@ -1,13 +1,13 @@
-/*	$NetBSD: uhci.c,v 1.302 2020/05/25 13:55:31 skrll Exp $	*/
+/*	$NetBSD: uhci.c,v 1.303 2020/05/26 07:03:22 skrll Exp $	*/
 
 /*
- * Copyright (c) 1998, 2004, 2011, 2012 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 2004, 2011, 2012, 2016, 2020 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
  * by Lennart Augustsson (lenn...@augustsson.net) at
- * Carlstedt Research & Technology, Jared D. McNeill (jmcne...@invisible.ca)
- * and Matthew R. Green (m...@eterna.com.au).
+ * Carlstedt Research & Technology, Jared D. McNeill (jmcne...@invisible.ca),
+ * Matthew R. Green (m...@eterna.com.au) and Nick Hudson.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.302 2020/05/25 13:55:31 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.303 2020/05/26 07:03:22 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"