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

2021-06-29 Thread David A. Holland
Module Name:src
Committed By:   dholland
Date:   Tue Jun 29 22:38:10 UTC 2021

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
Add parsepath for rumpfs in place of using cn_consume.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/rump/librump/rumpvfs/rumpfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.163 src/sys/rump/librump/rumpvfs/rumpfs.c:1.164
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.163	Tue Jun 29 22:34:09 2021
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Tue Jun 29 22:38:10 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.163 2021/06/29 22:34:09 dholland Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.164 2021/06/29 22:38:10 dholland Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.163 2021/06/29 22:34:09 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.164 2021/06/29 22:38:10 dholland Exp $");
 
 #include 
 #include 
@@ -61,6 +61,7 @@ __KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1
 #include 
 #include 
 
+static int rump_vop_parsepath(void *);
 static int rump_vop_lookup(void *);
 static int rump_vop_getattr(void *);
 static int rump_vop_setattr(void *);
@@ -90,7 +91,7 @@ static int rump_vop_fcntl(void *);
 int (**rump_vnodeop_p)(void *);
 const struct vnodeopv_entry_desc rump_vnodeop_entries[] = {
 	{ _default_desc, vn_default_error },
-	{ _parsepath_desc, genfs_parsepath },
+	{ _parsepath_desc, rump_vop_parsepath },
 	{ _lookup_desc, rump_vop_lookup },
 	{ _getattr_desc, rump_vop_getattr },
 	{ _setattr_desc, rump_vop_setattr },
@@ -634,6 +635,33 @@ rumpfs_update(int flags, struct vnode *v
 }
 
 /*
+ * parsepath for rump file systems - check for etfs entries.
+ */
+static int
+rump_vop_parsepath(void *v)
+{
+	struct vop_parsepath_args /* {
+		struct vnode *a_dvp;
+		const char *a_name;
+		size_t *a_retval;
+	}; */ *ap = v;
+	struct etfs *et;
+	bool found;
+
+	/* check for etfs */
+	if (ap->a_dvp == rootvnode) {
+		mutex_enter(_lock);
+		found = etfs_find(ap->a_name, , false);
+		mutex_exit(_lock);
+		if (found) {
+			*ap->a_retval = et->et_keylen;
+			return 0;
+		}
+	}
+	return genfs_parsepath(v);
+}
+
+/*
  * Simple lookup for rump file systems.
  *
  * uhm, this is twisted.  C F C C, hope of C C F C looming
@@ -654,7 +682,6 @@ rump_vop_lookup(void *v)
 	struct etfs *et;
 	bool dotdot = (cnp->cn_flags & ISDOTDOT) != 0;
 	int rv = 0;
-	const char *cp;
 
 	*vpp = NULL;
 
@@ -687,19 +714,18 @@ rump_vop_lookup(void *v)
 		mutex_exit(_lock);
 
 		if (found) {
+			if (et->et_keylen != cnp->cn_namelen) {
+/*
+ * This can theoretically happen if an
+ * etfs entry is added or removed
+ * while lookups are being done as we
+ * don't hold etfs_lock across here
+ * and parsepath. Won't ordinarily be
+ * the case. No biggie, just retry.
+ */
+return ERESTART;
+			}
 			rn = et->et_rn;
-			cnp->cn_consume += et->et_keylen - cnp->cn_namelen;
-			/*
-			 * consume trailing slashes if any and clear
-			 * REQUIREDIR if we consumed the full path.
-			 */
-			cp = >cn_nameptr[cnp->cn_namelen];
-			cp += cnp->cn_consume;
-			KASSERT(*cp == '\0' || *cp == '/');
-			if (*cp == '\0' && rn->rn_va.va_type != VDIR)
-cnp->cn_flags &= ~REQUIREDIR;
-			while (*cp++ == '/')
-cnp->cn_consume++;
 			goto getvnode;
 		}
 	}



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

2021-04-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Apr 25 15:12:02 UTC 2021

Modified Files:
src/sys/rump/librump/rumpkern/arch/mips: Makefile.inc

Log Message:
mipsn64* is native 64


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/rump/librump/rumpkern/arch/mips/Makefile.inc

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

Modified files:

Index: src/sys/rump/librump/rumpkern/arch/mips/Makefile.inc
diff -u src/sys/rump/librump/rumpkern/arch/mips/Makefile.inc:1.3 src/sys/rump/librump/rumpkern/arch/mips/Makefile.inc:1.4
--- src/sys/rump/librump/rumpkern/arch/mips/Makefile.inc:1.3	Wed Apr 22 16:10:56 2015
+++ src/sys/rump/librump/rumpkern/arch/mips/Makefile.inc	Sun Apr 25 11:12:02 2021
@@ -1,6 +1,8 @@
-# $NetBSD: Makefile.inc,v 1.3 2015/04/22 20:10:56 pooka Exp $
+# $NetBSD: Makefile.inc,v 1.4 2021/04/25 15:12:02 christos Exp $
 
+.if empty(MACHINE_ARCH:Mmipsn64*)
 CPPFLAGS+=	-DARCH_ELFSIZE=32
+.endif
 
 .PATH:	${RUMPTOP}/librump/rumpkern/arch/generic
 SRCS+=	rump_generic_abi.c



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

2021-03-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar 14 22:56:39 UTC 2021

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

Log Message:
provide generic cas for _LP64


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/librump/rumpkern/atomic_cas_generic.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/atomic_cas_generic.c
diff -u src/sys/rump/librump/rumpkern/atomic_cas_generic.c:1.2 src/sys/rump/librump/rumpkern/atomic_cas_generic.c:1.3
--- src/sys/rump/librump/rumpkern/atomic_cas_generic.c:1.2	Fri Dec 18 17:37:18 2009
+++ src/sys/rump/librump/rumpkern/atomic_cas_generic.c	Sun Mar 14 18:56:39 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: atomic_cas_generic.c,v 1.2 2009/12/18 22:37:18 pooka Exp $	*/
+/*	$NetBSD: atomic_cas_generic.c,v 1.3 2021/03/14 22:56:39 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atomic_cas_generic.c,v 1.2 2009/12/18 22:37:18 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atomic_cas_generic.c,v 1.3 2021/03/14 22:56:39 christos Exp $");
 
 /*
  * This is basically common/lib/libc/atomic/atomic_init_testset.c
@@ -45,7 +45,7 @@ __KERNEL_RCSID(0, "$NetBSD: atomic_cas_g
 #define	I16	I2 I2 I2 I2 I2 I2 I2 I2
 #define	I128	I16 I16 I16 I16 I16 I16 I16 I16
 
-static __cpu_simple_lock_t atomic_locks[128] = { I128 };
+static __cpu_simple_lock_t atomic_locks32[128] = { I128 };
 
 uint32_t
 _atomic_cas_32(volatile uint32_t *ptr, uint32_t old, uint32_t new)
@@ -53,7 +53,7 @@ _atomic_cas_32(volatile uint32_t *ptr, u
 	__cpu_simple_lock_t *lock;
 	uint32_t ret;
 
-	lock = _locks[((uintptr_t)ptr >> 3) & 127];
+	lock = _locks32[((uintptr_t)ptr >> 3) & 127];
 	__cpu_simple_lock(lock);
 	ret = *ptr;
 	if (__predict_true(ret == old)) {
@@ -65,23 +65,62 @@ _atomic_cas_32(volatile uint32_t *ptr, u
 }
 
 #undef atomic_cas_32
+atomic_op_alias(atomic_cas_32,_atomic_cas_32)
+atomic_op_alias(atomic_cas_32_ni,_atomic_cas_32)
+__strong_alias(_atomic_cas_32_ni,_atomic_cas_32)
+
+#ifdef _LP64
+static __cpu_simple_lock_t atomic_locks64[128] = { I128 };
+
+uint64_t
+_atomic_cas_64(volatile uint64_t *ptr, uint64_t old, uint64_t new)
+{
+	__cpu_simple_lock_t *lock;
+	uint64_t ret;
+
+	lock = _locks64[((uintptr_t)ptr >> 4) & 127];
+	__cpu_simple_lock(lock);
+	ret = *ptr;
+	if (__predict_true(ret == old)) {
+		*ptr = new;
+	}
+	__cpu_simple_unlock(lock);
+
+	return ret;
+}
+
+#undef atomic_cas_64
+atomic_op_alias(atomic_cas_64,_atomic_cas_64)
+atomic_op_alias(atomic_cas_64_ni,_atomic_cas_64)
+__strong_alias(_atomic_cas_64_ni,_atomic_cas_64)
+
+#endif
+
 #undef atomic_cas_uint
 #undef atomic_cas_ulong
 #undef atomic_cas_ptr
 
-atomic_op_alias(atomic_cas_32,_atomic_cas_32)
 atomic_op_alias(atomic_cas_uint,_atomic_cas_32)
 __strong_alias(_atomic_cas_uint,_atomic_cas_32)
-atomic_op_alias(atomic_cas_ulong,_atomic_cas_32)
-__strong_alias(_atomic_cas_ulong,_atomic_cas_32)
-atomic_op_alias(atomic_cas_ptr,_atomic_cas_32)
-__strong_alias(_atomic_cas_ptr,_atomic_cas_32)
-
-atomic_op_alias(atomic_cas_32_ni,_atomic_cas_32)
-__strong_alias(_atomic_cas_32_ni,_atomic_cas_32)
 atomic_op_alias(atomic_cas_uint_ni,_atomic_cas_32)
 __strong_alias(_atomic_cas_uint_ni,_atomic_cas_32)
+
+#ifdef _LP64
+atomic_op_alias(atomic_cas_ulong,_atomic_cas_64)
+__strong_alias(_atomic_cas_ulong,_atomic_cas_64)
+atomic_op_alias(atomic_cas_ulong_ni,_atomic_cas_64)
+__strong_alias(_atomic_cas_ulong_ni,_atomic_cas_64)
+atomic_op_alias(atomic_cas_ptr,_atomic_cas_64)
+__strong_alias(_atomic_cas_ptr,_atomic_cas_64)
+atomic_op_alias(atomic_cas_ptr_ni,_atomic_cas_64)
+__strong_alias(_atomic_cas_ptr_ni,_atomic_cas_64)
+#else
+atomic_op_alias(atomic_cas_ulong,_atomic_cas_32)
+__strong_alias(_atomic_cas_ulong,_atomic_cas_32)
 atomic_op_alias(atomic_cas_ulong_ni,_atomic_cas_32)
 __strong_alias(_atomic_cas_ulong_ni,_atomic_cas_32)
+atomic_op_alias(atomic_cas_ptr,_atomic_cas_32)
+__strong_alias(_atomic_cas_ptr,_atomic_cas_32)
 atomic_op_alias(atomic_cas_ptr_ni,_atomic_cas_32)
 __strong_alias(_atomic_cas_ptr_ni,_atomic_cas_32)
+#endif



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

2021-01-17 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sun Jan 17 22:32:25 UTC 2021

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

Log Message:
rump_component_init() is called recursively, so LIST_FOREACH_SAFE is not
actually safe, since the recursive calls can result in elements other than
the current element being removed from the list.  instead use an explicit
marker element to do safe list traversal.


To generate a diff of this commit:
cvs rdiff -u -r1.352 -r1.353 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.352 src/sys/rump/librump/rumpkern/rump.c:1.353
--- src/sys/rump/librump/rumpkern/rump.c:1.352	Sat Jan 16 23:50:49 2021
+++ src/sys/rump/librump/rumpkern/rump.c	Sun Jan 17 22:32:25 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.352 2021/01/16 23:50:49 chs Exp $	*/
+/*	$NetBSD: rump.c,v 1.353 2021/01/17 22:32:25 chs Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.352 2021/01/16 23:50:49 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.353 2021/01/17 22:32:25 chs Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -605,14 +605,22 @@ rump_component_count(enum rump_component
 void
 rump_component_init(enum rump_component_type type)
 {
-	struct rump_component *rc, *rc_safe;
+	struct rump_component *rc, *rc_next, rc_marker;
 
 	KASSERT(curlwp == bootlwp);
 	KASSERT(!compinited[type]);
-	LIST_FOREACH_SAFE(rc, , rc_entries, rc_safe) {
+
+	rc_marker.rc_type = RUMP_COMPONENT_MAX;
+	rc_marker.rc_init = NULL;
+	for (rc = LIST_FIRST(); rc != NULL; rc = rc_next) {
 		if (rc->rc_type == type) {
+			LIST_INSERT_AFTER(rc, _marker, rc_entries);
 			rc->rc_init();
 			LIST_REMOVE(rc, rc_entries);
+			rc_next = LIST_NEXT(_marker, rc_entries);
+			LIST_REMOVE(_marker, rc_entries);
+		} else {
+			rc_next = LIST_NEXT(rc, rc_entries);
 		}
 	}
 	compinited[type] = 1;



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

2021-01-16 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Jan 16 23:50:49 UTC 2021

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

Log Message:
remove a const to allow building with QUEUEDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.351 -r1.352 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.351 src/sys/rump/librump/rumpkern/rump.c:1.352
--- src/sys/rump/librump/rumpkern/rump.c:1.351	Sun Dec  6 09:03:29 2020
+++ src/sys/rump/librump/rumpkern/rump.c	Sat Jan 16 23:50:49 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.351 2020/12/06 09:03:29 skrll Exp $	*/
+/*	$NetBSD: rump.c,v 1.352 2021/01/16 23:50:49 chs Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.351 2020/12/06 09:03:29 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.352 2021/01/16 23:50:49 chs Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -605,7 +605,7 @@ rump_component_count(enum rump_component
 void
 rump_component_init(enum rump_component_type type)
 {
-	const struct rump_component *rc, *rc_safe;
+	struct rump_component *rc, *rc_safe;
 
 	KASSERT(curlwp == bootlwp);
 	KASSERT(!compinited[type]);



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

2020-12-08 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Dec  9 00:03:32 UTC 2020

Modified Files:
src/sys/rump/librump/rumpvfs: vm_vfs.c

Log Message:
make rump's uvm_aio_aiodone_pages() look more like the kernel version.
fixes some more rumpy assertions.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/rump/librump/rumpvfs/vm_vfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/vm_vfs.c
diff -u src/sys/rump/librump/rumpvfs/vm_vfs.c:1.40 src/sys/rump/librump/rumpvfs/vm_vfs.c:1.41
--- src/sys/rump/librump/rumpvfs/vm_vfs.c:1.40	Thu Oct 22 03:05:17 2020
+++ src/sys/rump/librump/rumpvfs/vm_vfs.c	Wed Dec  9 00:03:32 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_vfs.c,v 1.40 2020/10/22 03:05:17 chs Exp $	*/
+/*	$NetBSD: vm_vfs.c,v 1.41 2020/12/09 00:03:32 chs Exp $	*/
 
 /*
  * Copyright (c) 2008-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.40 2020/10/22 03:05:17 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.41 2020/12/09 00:03:32 chs Exp $");
 
 #include 
 
@@ -48,6 +48,16 @@ uvm_aio_aiodone_pages(struct vm_page **p
 		pg = pgs[i];
 		KASSERT((pg->flags & PG_PAGEOUT) == 0 ||
 			(pg->flags & PG_FAKE) == 0);
+
+		if (pg->flags & PG_FAKE) {
+			KASSERT(!write);
+			pg->flags &= ~PG_FAKE;
+			KASSERT(uvm_pagegetdirty(pg) == UVM_PAGE_STATUS_CLEAN);
+			uvm_pagelock(pg);
+			uvm_pageenqueue(pg);
+			uvm_pageunlock(pg);
+		}
+
 	}
 	uvm_page_unbusy(pgs, npages);
 	rw_exit(uobj->vmobjlock);



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

2020-12-06 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Dec  6 09:03:29 UTC 2020

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

Log Message:
Fix build after interval timers refectoring by thorpej@


To generate a diff of this commit:
cvs rdiff -u -r1.350 -r1.351 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.350 src/sys/rump/librump/rumpkern/rump.c:1.351
--- src/sys/rump/librump/rumpkern/rump.c:1.350	Wed Nov  4 22:06:39 2020
+++ src/sys/rump/librump/rumpkern/rump.c	Sun Dec  6 09:03:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.350 2020/11/04 22:06:39 christos Exp $	*/
+/*	$NetBSD: rump.c,v 1.351 2020/12/06 09:03:29 skrll Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.350 2020/11/04 22:06:39 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.351 2020/12/06 09:03:29 skrll Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -412,7 +412,6 @@ rump_init_callback(void (*cpuinit_callba
 	resource_init();
 	procinit_sysctl();
 	time_init();
-	time_init2();
 	config_init();
 
 	/* start page baroness */



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

2020-12-05 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Sat Dec  5 19:08:50 UTC 2020

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

Log Message:
update the rump copy of uvm_page_unbusy() to match the real version,
in particular handle PG_PAGEOUT.  fixes a few atf tests.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.190 src/sys/rump/librump/rumpkern/vm.c:1.191
--- src/sys/rump/librump/rumpkern/vm.c:1.190	Thu Jun 11 19:20:46 2020
+++ src/sys/rump/librump/rumpkern/vm.c	Sat Dec  5 19:08:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.190 2020/06/11 19:20:46 ad Exp $	*/
+/*	$NetBSD: vm.c,v 1.191 2020/12/05 19:08:50 chs Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.190 2020/06/11 19:20:46 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.191 2020/12/05 19:08:50 chs Exp $");
 
 #include 
 #include 
@@ -673,26 +673,51 @@ void
 uvm_page_unbusy(struct vm_page **pgs, int npgs)
 {
 	struct vm_page *pg;
-	int i;
+	int i, pageout_done;
 
 	KASSERT(npgs > 0);
-	KASSERT(rw_write_held(pgs[0]->uobject->vmobjlock));
 
+	pageout_done = 0;
 	for (i = 0; i < npgs; i++) {
 		pg = pgs[i];
-		if (pg == NULL)
+		if (pg == NULL || pg == PGO_DONTCARE) {
 			continue;
+		}
 
+#if 0
+		KASSERT(uvm_page_owner_locked_p(pg, true));
+#else
+		/*
+		 * uvm_page_owner_locked_p() is not available in rump,
+		 * and rump doesn't support amaps anyway.
+		 */
+		KASSERT(rw_write_held(pg->uobject->vmobjlock));
+#endif
 		KASSERT(pg->flags & PG_BUSY);
+
+		if (pg->flags & PG_PAGEOUT) {
+			pg->flags &= ~PG_PAGEOUT;
+			pg->flags |= PG_RELEASED;
+			pageout_done++;
+			atomic_inc_uint();
+		}
 		if (pg->flags & PG_RELEASED) {
+			KASSERT(pg->uobject != NULL ||
+			(pg->uanon != NULL && pg->uanon->an_ref > 0));
+			pg->flags &= ~PG_RELEASED;
 			uvm_pagefree(pg);
 		} else {
+			KASSERT((pg->flags & PG_FAKE) == 0);
 			pg->flags &= ~PG_BUSY;
 			uvm_pagelock(pg);
 			uvm_pagewakeup(pg);
 			uvm_pageunlock(pg);
+			UVM_PAGE_OWN(pg, NULL);
 		}
 	}
+	if (pageout_done != 0) {
+		uvm_pageout_done(pageout_done);
+	}
 }
 
 void



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

2020-10-21 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Thu Oct 22 03:05:17 UTC 2020

Modified Files:
src/sys/rump/librump/rumpvfs: vm_vfs.c

Log Message:
fix an incorrect assertion in the previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/rump/librump/rumpvfs/vm_vfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/vm_vfs.c
diff -u src/sys/rump/librump/rumpvfs/vm_vfs.c:1.39 src/sys/rump/librump/rumpvfs/vm_vfs.c:1.40
--- src/sys/rump/librump/rumpvfs/vm_vfs.c:1.39	Sun Oct 18 18:22:29 2020
+++ src/sys/rump/librump/rumpvfs/vm_vfs.c	Thu Oct 22 03:05:17 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm_vfs.c,v 1.39 2020/10/18 18:22:29 chs Exp $	*/
+/*	$NetBSD: vm_vfs.c,v 1.40 2020/10/22 03:05:17 chs Exp $	*/
 
 /*
  * Copyright (c) 2008-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.39 2020/10/18 18:22:29 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm_vfs.c,v 1.40 2020/10/22 03:05:17 chs Exp $");
 
 #include 
 
@@ -46,7 +46,8 @@ uvm_aio_aiodone_pages(struct vm_page **p
 	rw_enter(uobj->vmobjlock, RW_WRITER);
 	for (i = 0; i < npages; i++) {
 		pg = pgs[i];
-		KASSERT((pg->flags & PG_FAKE) == 0);
+		KASSERT((pg->flags & PG_PAGEOUT) == 0 ||
+			(pg->flags & PG_FAKE) == 0);
 	}
 	uvm_page_unbusy(pgs, npages);
 	rw_exit(uobj->vmobjlock);



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

2020-09-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Sep 27 00:34:44 UTC 2020

Modified Files:
src/sys/rump/librump/rumpnet: net_stub.c

Log Message:
rump: Add weak alias for bridge_calc_link_state


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/rump/librump/rumpnet/net_stub.c

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

Modified files:

Index: src/sys/rump/librump/rumpnet/net_stub.c
diff -u src/sys/rump/librump/rumpnet/net_stub.c:1.39 src/sys/rump/librump/rumpnet/net_stub.c:1.40
--- src/sys/rump/librump/rumpnet/net_stub.c:1.39	Sun Sep 27 00:17:56 2020
+++ src/sys/rump/librump/rumpnet/net_stub.c	Sun Sep 27 00:34:44 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: net_stub.c,v 1.39 2020/09/27 00:17:56 roy Exp $	*/
+/*	$NetBSD: net_stub.c,v 1.40 2020/09/27 00:34:44 roy Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.39 2020/09/27 00:17:56 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.40 2020/09/27 00:34:44 roy Exp $");
 
 #include 
 #include 
@@ -64,6 +64,7 @@ rumpnet_stub(void)
 __weak_alias(bridge_ifdetach,rumpnet_stub);
 __weak_alias(bridge_output,rumpnet_stub);
 __weak_alias(bridge_calc_csum_flags,rumpnet_stub);
+__weak_alias(bridge_calc_link_state,rumpnet_stub);
 
 /* agr */
 __weak_alias(agr_input,rumpnet_stub);



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

2020-09-26 Thread Roy Marples
Module Name:src
Committed By:   roy
Date:   Sun Sep 27 00:17:56 UTC 2020

Modified Files:
src/sys/rump/librump/rumpnet: net_stub.c

Log Message:
rump: Try to fix build


To generate a diff of this commit:
cvs rdiff -u -r1.38 -r1.39 src/sys/rump/librump/rumpnet/net_stub.c

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

Modified files:

Index: src/sys/rump/librump/rumpnet/net_stub.c
diff -u src/sys/rump/librump/rumpnet/net_stub.c:1.38 src/sys/rump/librump/rumpnet/net_stub.c:1.39
--- src/sys/rump/librump/rumpnet/net_stub.c:1.38	Fri Aug 28 06:20:44 2020
+++ src/sys/rump/librump/rumpnet/net_stub.c	Sun Sep 27 00:17:56 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: net_stub.c,v 1.38 2020/08/28 06:20:44 ozaki-r Exp $	*/
+/*	$NetBSD: net_stub.c,v 1.39 2020/09/27 00:17:56 roy Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.38 2020/08/28 06:20:44 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.39 2020/09/27 00:17:56 roy Exp $");
 
 #include 
 #include 
@@ -77,6 +77,7 @@ __weak_alias(pppoedisc_input,rumpnet_stu
 /* vlan */
 __weak_alias(vlan_input,rumpnet_stub);
 __weak_alias(vlan_ifdetach,rumpnet_stub);
+__weak_alias(vlan_link_state_changed,rumpnet_stub);
 
 /* ipsec */
 /* FIXME: should modularize netipsec and reduce reverse symbol references */



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

2020-08-01 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  1 22:30:57 UTC 2020

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

Log Message:
Define kthread_fpu_enter/exit for rump.

XXX Not 100% sure that it's safe to touch curlwp->l_flag in this
context, but this change will make progress, at least.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/rump/librump/rumpkern/threads.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/threads.c
diff -u src/sys/rump/librump/rumpkern/threads.c:1.26 src/sys/rump/librump/rumpkern/threads.c:1.27
--- src/sys/rump/librump/rumpkern/threads.c:1.26	Fri Apr 21 19:16:10 2017
+++ src/sys/rump/librump/rumpkern/threads.c	Sat Aug  1 22:30:57 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: threads.c,v 1.26 2017/04/21 19:16:10 kamil Exp $	*/
+/*	$NetBSD: threads.c,v 1.27 2020/08/01 22:30:57 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2009 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: threads.c,v 1.26 2017/04/21 19:16:10 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: threads.c,v 1.27 2020/08/01 22:30:57 riastradh Exp $");
 
 #include 
 #include 
@@ -247,6 +247,32 @@ kthread_join(struct lwp *l)
 	return rv;
 }
 
+int
+kthread_fpu_enter(void)
+{
+	struct lwp *l = curlwp;
+	int s;
+
+	KASSERTMSG(l->l_flag & LW_SYSTEM,
+	"%s is allowed only in kthreads", __func__);
+	s = l->l_flag & LW_SYSTEM_FPU;
+	l->l_flag |= LW_SYSTEM_FPU;
+
+	return s;
+}
+
+void
+kthread_fpu_exit(int s)
+{
+	struct lwp *l = curlwp;
+
+	KASSERT(s == (s & LW_SYSTEM_FPU));
+	KASSERTMSG(l->l_flag & LW_SYSTEM,
+	"%s is allowed only in kthreads", __func__);
+	KASSERT(l->l_flag & LW_SYSTEM_FPU);
+	l->l_flag ^= s ^ LW_SYSTEM_FPU;
+}
+
 /*
  * Create a non-kernel thread that is scheduled by a rump kernel hypercall.
  *



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

2020-06-30 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Jul  1 00:42:13 UTC 2020

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

Log Message:
copystr is now in libkern; don't redefine it in rumpcopy.c.

Should fix build breakage from the copystr changes.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/rump/librump/rumpkern/rumpcopy.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rumpcopy.c
diff -u src/sys/rump/librump/rumpkern/rumpcopy.c:1.24 src/sys/rump/librump/rumpkern/rumpcopy.c:1.25
--- src/sys/rump/librump/rumpkern/rumpcopy.c:1.24	Sun Apr  5 15:16:11 2020
+++ src/sys/rump/librump/rumpkern/rumpcopy.c	Wed Jul  1 00:42:13 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpcopy.c,v 1.24 2020/04/05 15:16:11 kamil Exp $	*/
+/*	$NetBSD: rumpcopy.c,v 1.25 2020/07/01 00:42:13 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpcopy.c,v 1.24 2020/04/05 15:16:11 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpcopy.c,v 1.25 2020/07/01 00:42:13 riastradh Exp $");
 
 #define	__UFETCHSTORE_PRIVATE
 #define	__UCAS_PRIVATE
@@ -84,24 +84,6 @@ copyout(const void *kaddr, void *uaddr, 
 }
 
 int
-copystr(const void *kfaddr, void *kdaddr, size_t len, size_t *done)
-{
-	uint8_t *to = kdaddr;
-	const uint8_t *from = kfaddr;
-	size_t actlen = 0;
-
-	while (len-- > 0 && (*to++ = *from++) != 0)
-		actlen++;
-
-	if (len+1 == 0 && *(to-1) != 0)
-		return ENAMETOOLONG;
-
-	if (done)
-		*done = actlen+1; /* + '\0' */
-	return 0;
-}
-
-int
 copyinstr(const void *uaddr, void *kaddr, size_t len, size_t *done)
 {
 	uint8_t *to;



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

2020-06-10 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Thu Jun 11 00:33:30 UTC 2020

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

Log Message:
Follow the syscall() logic and mask unsupported syscall ranges in rump

Avoids invalid pointer dereference from too large syscall numbers.


To generate a diff of this commit:
cvs rdiff -u -r1.348 -r1.349 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.348 src/sys/rump/librump/rumpkern/rump.c:1.349
--- src/sys/rump/librump/rumpkern/rump.c:1.348	Sat May 23 23:42:44 2020
+++ src/sys/rump/librump/rumpkern/rump.c	Thu Jun 11 00:33:30 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.348 2020/05/23 23:42:44 ad Exp $	*/
+/*	$NetBSD: rump.c,v 1.349 2020/06/11 00:33:30 kamil Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.348 2020/05/23 23:42:44 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.349 2020/06/11 00:33:30 kamil Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -756,7 +756,9 @@ rump_syscall(int num, void *data, size_t
 	p = curproc;
 	e = p->p_emul;
 #ifndef __HAVE_MINIMAL_EMUL
-	KASSERT(num > 0 && num < e->e_nsysent);
+	num &= e->e_nsysent - 1;
+#else
+	num &= SYS_NSYSENT - 1;
 #endif
 	callp = e->e_sysent + num;
 



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

2020-06-06 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Jun  6 22:31:41 UTC 2020

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

Log Message:
Correction to previous - set VI_PAGES correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.188 src/sys/rump/librump/rumpkern/vm.c:1.189
--- src/sys/rump/librump/rumpkern/vm.c:1.188	Wed Jun  3 22:25:49 2020
+++ src/sys/rump/librump/rumpkern/vm.c	Sat Jun  6 22:31:40 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.188 2020/06/03 22:25:49 ad Exp $	*/
+/*	$NetBSD: vm.c,v 1.189 2020/06/06 22:31:40 ad Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.188 2020/06/03 22:25:49 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.189 2020/06/06 22:31:40 ad Exp $");
 
 #include 
 #include 
@@ -176,7 +176,6 @@ uvm_pagealloc_strat(struct uvm_object *u
 		pool_cache_put(, pg);
 		return NULL;
 	}
-	uobj->uo_npages++;
 
 	if (UVM_OBJ_IS_VNODE(uobj)) {
 		if (uobj->uo_npages == 0) {
@@ -187,6 +186,7 @@ uvm_pagealloc_strat(struct uvm_object *u
 		}
 		pg->flags |= PG_FILE;
 	}
+	uobj->uo_npages++;
 
 	pg->flags = PG_CLEAN|PG_BUSY|PG_FAKE;
 	if (flags & UVM_PGA_ZERO) {



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

2020-06-03 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Jun  3 22:25:49 UTC 2020

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

Log Message:
PR kern/55032 (rump/rumpkern/t_vm:uvmwait test case now fails)

Work around issues with rump's pagedaemon emulation, including one that's
sensitive to timing effects (i.e. scheduler changes).  While here tidy up
some other stuff around the emulation of page alloc/free.


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.187 src/sys/rump/librump/rumpkern/vm.c:1.188
--- src/sys/rump/librump/rumpkern/vm.c:1.187	Tue Mar 17 18:31:38 2020
+++ src/sys/rump/librump/rumpkern/vm.c	Wed Jun  3 22:25:49 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.187 2020/03/17 18:31:38 ad Exp $	*/
+/*	$NetBSD: vm.c,v 1.188 2020/06/03 22:25:49 ad Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.187 2020/03/17 18:31:38 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.188 2020/06/03 22:25:49 ad Exp $");
 
 #include 
 #include 
@@ -69,7 +69,6 @@ __KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.187
 #include 
 
 kmutex_t vmpage_lruqueue_lock; /* non-free page lock */
-kmutex_t uvm_fpageqlock; /* free page lock, non-gpl license */
 kmutex_t uvm_swap_data_lock;
 
 struct uvmexp uvmexp;
@@ -172,13 +171,6 @@ uvm_pagealloc_strat(struct uvm_object *u
 	pg->offset = off;
 	pg->uobject = uobj;
 
-	if (UVM_OBJ_IS_VNODE(uobj) && uobj->uo_npages == 0) {
-		struct vnode *vp = (struct vnode *)uobj;
-		mutex_enter(vp->v_interlock);
-		vp->v_iflag |= VI_PAGES;
-		mutex_exit(vp->v_interlock);
-	}
-
 	if (radix_tree_insert_node(>uo_pages, off >> PAGE_SHIFT,
 	pg) != 0) {
 		pool_cache_put(, pg);
@@ -186,6 +178,16 @@ uvm_pagealloc_strat(struct uvm_object *u
 	}
 	uobj->uo_npages++;
 
+	if (UVM_OBJ_IS_VNODE(uobj)) {
+		if (uobj->uo_npages == 0) {
+			struct vnode *vp = (struct vnode *)uobj;
+			mutex_enter(vp->v_interlock);
+			vp->v_iflag |= VI_PAGES;
+			mutex_exit(vp->v_interlock);
+		}
+		pg->flags |= PG_FILE;
+	}
+
 	pg->flags = PG_CLEAN|PG_BUSY|PG_FAKE;
 	if (flags & UVM_PGA_ZERO) {
 		uvm_pagezero(pg);
@@ -201,6 +203,8 @@ uvm_pagealloc_strat(struct uvm_object *u
 		mutex_enter(_lruqueue_lock);
 		TAILQ_INSERT_TAIL(_lruqueue, pg, pageq.queue);
 		mutex_exit(_lruqueue_lock);
+	} else {
+		pg->flags |= PG_AOBJ;
 	}
 
 	return pg;
@@ -220,10 +224,7 @@ uvm_pagefree(struct vm_page *pg)
 	KASSERT(rw_write_held(uobj->vmobjlock));
 
 	mutex_enter(>interlock);
-	if (pg->pqflags & PQ_WANTED) {
-		pg->pqflags &= ~PQ_WANTED;
-		wakeup(pg);
-	}
+	uvm_pagewakeup(pg);
 	mutex_exit(>interlock);
 
 	uobj->uo_npages--;
@@ -367,11 +368,8 @@ uvm_init(void)
 	mutex_init(, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(_lruqueue_lock, MUTEX_DEFAULT, IPL_NONE);
 	mutex_init(_swap_data_lock, MUTEX_DEFAULT, IPL_NONE);
-
-	/* just to appease linkage */
-	mutex_init(_fpageqlock, MUTEX_SPIN, IPL_VM);
-
 	mutex_init(, MUTEX_DEFAULT, IPL_NONE);
+
 	cv_init(, "pdaemon");
 	cv_init(, "oomwait");
 
@@ -1141,16 +1139,14 @@ uvm_pageout(void *arg)
 
 	mutex_enter();
 	for (;;) {
-		if (!NEED_PAGEDAEMON()) {
-			kernel_map->flags &= ~VM_MAP_WANTVA;
-		}
-
 		if (pdaemon_waiters) {
 			pdaemon_waiters = 0;
 			cv_broadcast();
 		}
-
-		cv_wait(, );
+		if (!NEED_PAGEDAEMON()) {
+			kernel_map->flags &= ~VM_MAP_WANTVA;
+			cv_wait(, );
+		}
 		uvmexp.pdwoke++;
 
 		/* tell the world that we are hungry */
@@ -1202,22 +1198,6 @@ uvm_pageout(void *arg)
 		mutex_exit(_lruqueue_lock);
 
 		/*
-		 * Ok, someone is running with an object lock held.
-		 * We want to yield the host CPU to make sure the
-		 * thread is not parked on the host.  nanosleep
-		 * for the smallest possible time and hope we're back in
-		 * the game soon.
-		 */
-		if (cleaned == 0) {
-			rumpuser_clock_sleep(RUMPUSER_CLOCK_RELWALL, 0, 1);
-
-			skip = 0;
-
-			/* and here we go again */
-			goto again;
-		}
-
-		/*
 		 * And of course we need to reclaim the page cache
 		 * again to actually release memory.
 		 */
@@ -1249,8 +1229,6 @@ uvm_pageout(void *arg)
 		mutex_enter();
 		if (!succ && cleaned == 0 && pdaemon_waiters &&
 		uvmexp.paging == 0) {
-			rumpuser_dprintf("pagedaemoness: failed to reclaim "
-			"memory ... sleeping (deadlock?)\n");
 			kpause("pddlk", false, hz, );
 		}
 	}



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

2020-05-30 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat May 30 19:16:53 UTC 2020

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

Log Message:
Fix a lock order reversal that caused hangs.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/rump/librump/rumpkern/lwproc.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/lwproc.c
diff -u src/sys/rump/librump/rumpkern/lwproc.c:1.50 src/sys/rump/librump/rumpkern/lwproc.c:1.51
--- src/sys/rump/librump/rumpkern/lwproc.c:1.50	Sat May 23 23:42:44 2020
+++ src/sys/rump/librump/rumpkern/lwproc.c	Sat May 30 19:16:53 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: lwproc.c,v 1.50 2020/05/23 23:42:44 ad Exp $	*/
+/*  $NetBSD: lwproc.c,v 1.51 2020/05/30 19:16:53 ad Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #define RUMP__CURLWP_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.50 2020/05/23 23:42:44 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.51 2020/05/30 19:16:53 ad Exp $");
 
 #include 
 #include 
@@ -343,12 +343,10 @@ lwproc_freelwp(struct lwp *l)
 
 extern kmutex_t unruntime_lock;
 
-/*
- * called with p_lock held, releases lock before return
- */
-static void
-lwproc_makelwp(struct proc *p, struct lwp *l, bool doswitch, bool procmake)
+static struct lwp *
+lwproc_makelwp(struct proc *p, bool doswitch, bool procmake)
 {
+	struct lwp *l = kmem_zalloc(sizeof(*l), KM_SLEEP);
 
 	/*
 	 * Account the new lwp to the owner of the process.
@@ -365,6 +363,9 @@ lwproc_makelwp(struct proc *p, struct lw
 	l->l_mutex = _lock;
 
 	proc_alloc_lwpid(p, l);
+
+	mutex_enter(p->p_lock);
+	KASSERT((p->p_sflag & PS_RUMP_LWPEXIT) == 0);
 	LIST_INSERT_HEAD(>p_lwps, l, l_sibling);
 
 	l->l_fd = p->p_fd;
@@ -392,12 +393,13 @@ lwproc_makelwp(struct proc *p, struct lw
 	mutex_enter(_lock);
 	LIST_INSERT_HEAD(, l, l_list);
 	mutex_exit(_lock);
+
+	return l;
 }
 
 struct lwp *
 rump__lwproc_alloclwp(struct proc *p)
 {
-	struct lwp *l;
 	bool newproc = false;
 
 	if (p == NULL) {
@@ -405,13 +407,7 @@ rump__lwproc_alloclwp(struct proc *p)
 		newproc = true;
 	}
 
-	l = kmem_zalloc(sizeof(*l), KM_SLEEP);
-
-	mutex_enter(p->p_lock);
-	KASSERT((p->p_sflag & PS_RUMP_LWPEXIT) == 0);
-	lwproc_makelwp(p, l, false, newproc);
-
-	return l;
+	return lwproc_makelwp(p, false, newproc);
 }
 
 int
@@ -435,8 +431,12 @@ rump_lwproc_newlwp(pid_t pid)
 		kmem_free(l, sizeof(*l));
 		return EBUSY;
 	}
+	mutex_exit(p->p_lock);
 	mutex_exit(_lock);
-	lwproc_makelwp(p, l, true, false);
+
+	/* XXX what holds proc? */
+
+	lwproc_makelwp(p, true, false);
 
 	return 0;
 }
@@ -445,17 +445,13 @@ int
 rump_lwproc_rfork_vmspace(struct vmspace *vm, int flags)
 {
 	struct proc *p;
-	struct lwp *l;
 
 	if (flags & ~(RUMP_RFFDG|RUMP_RFCFDG) ||
 	(~flags & (RUMP_RFFDG|RUMP_RFCFDG)) == 0)
 		return EINVAL;
 
 	p = lwproc_newproc(curproc, vm, flags);
-	l = kmem_zalloc(sizeof(*l), KM_SLEEP);
-	mutex_enter(p->p_lock);
-	KASSERT((p->p_sflag & PS_RUMP_LWPEXIT) == 0);
-	lwproc_makelwp(p, l, true, true);
+	lwproc_makelwp(p, true, true);
 
 	return 0;
 }



CVS commit: src/sys/rump/librump

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

Modified Files:
src/sys/rump/librump/rumpkern: rumpkern_syscalls.c
src/sys/rump/librump/rumpnet: rumpnet_syscalls.c
src/sys/rump/librump/rumpvfs: rumpvfs_syscalls.c

Log Message:
regen for lpathconf.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/rump/librump/rumpkern/rumpkern_syscalls.c
cvs rdiff -u -r1.5 -r1.6 src/sys/rump/librump/rumpnet/rumpnet_syscalls.c
cvs rdiff -u -r1.7 -r1.8 src/sys/rump/librump/rumpvfs/rumpvfs_syscalls.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rumpkern_syscalls.c
diff -u src/sys/rump/librump/rumpkern/rumpkern_syscalls.c:1.5 src/sys/rump/librump/rumpkern/rumpkern_syscalls.c:1.6
--- src/sys/rump/librump/rumpkern/rumpkern_syscalls.c:1.5	Sun Sep 22 19:03:21 2019
+++ src/sys/rump/librump/rumpkern/rumpkern_syscalls.c	Wed May 27 14:26:29 2020
@@ -1,9 +1,9 @@
-/*	$NetBSD: rumpkern_syscalls.c,v 1.5 2019/09/22 23:03:21 christos Exp $	*/
+/*	$NetBSD: rumpkern_syscalls.c,v 1.6 2020/05/27 18:26:29 christos Exp $	*/
 
 /* AUTOMATICALLY GENERATED BY makerumpsyscalls.sh */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpkern_syscalls.c,v 1.5 2019/09/22 23:03:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpkern_syscalls.c,v 1.6 2020/05/27 18:26:29 christos Exp $");
 
 #include 
 

Index: src/sys/rump/librump/rumpnet/rumpnet_syscalls.c
diff -u src/sys/rump/librump/rumpnet/rumpnet_syscalls.c:1.5 src/sys/rump/librump/rumpnet/rumpnet_syscalls.c:1.6
--- src/sys/rump/librump/rumpnet/rumpnet_syscalls.c:1.5	Sun Sep 22 19:03:21 2019
+++ src/sys/rump/librump/rumpnet/rumpnet_syscalls.c	Wed May 27 14:26:29 2020
@@ -1,9 +1,9 @@
-/*	$NetBSD: rumpnet_syscalls.c,v 1.5 2019/09/22 23:03:21 christos Exp $	*/
+/*	$NetBSD: rumpnet_syscalls.c,v 1.6 2020/05/27 18:26:29 christos Exp $	*/
 
 /* AUTOMATICALLY GENERATED BY makerumpsyscalls.sh */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpnet_syscalls.c,v 1.5 2019/09/22 23:03:21 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpnet_syscalls.c,v 1.6 2020/05/27 18:26:29 christos Exp $");
 
 #include 
 

Index: src/sys/rump/librump/rumpvfs/rumpvfs_syscalls.c
diff -u src/sys/rump/librump/rumpvfs/rumpvfs_syscalls.c:1.7 src/sys/rump/librump/rumpvfs/rumpvfs_syscalls.c:1.8
--- src/sys/rump/librump/rumpvfs/rumpvfs_syscalls.c:1.7	Wed Sep 25 12:44:42 2019
+++ src/sys/rump/librump/rumpvfs/rumpvfs_syscalls.c	Wed May 27 14:26:29 2020
@@ -1,9 +1,9 @@
-/*	$NetBSD: rumpvfs_syscalls.c,v 1.7 2019/09/25 16:44:42 christos Exp $	*/
+/*	$NetBSD: rumpvfs_syscalls.c,v 1.8 2020/05/27 18:26:29 christos Exp $	*/
 
 /* AUTOMATICALLY GENERATED BY makerumpsyscalls.sh */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpvfs_syscalls.c,v 1.7 2019/09/25 16:44:42 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpvfs_syscalls.c,v 1.8 2020/05/27 18:26:29 christos Exp $");
 
 #include 
 
@@ -111,6 +111,7 @@ extern sy_call_t sys___getvfsstat90;
 extern sy_call_t sys___statvfs190;
 extern sy_call_t sys___fstatvfs190;
 extern sy_call_t sys___fhstatvfs190;
+extern sy_call_t sys_lpathconf;
 
 static const struct rump_onesyscall mysys[] = {
 	{ 5,	sys_open },
@@ -215,6 +216,7 @@ static const struct rump_onesyscall mysy
 	{ 484,	sys___statvfs190 },
 	{ 485,	sys___fstatvfs190 },
 	{ 486,	sys___fhstatvfs190 },
+	{ 499,	sys_lpathconf },
 };
 
 RUMP_COMPONENT(RUMP_COMPONENT_SYSCALL)



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

2020-05-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri May 15 00:04:02 UTC 2020

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
Undo previous, need to fix differently (fifofs is needed by other fs's and
fifo brings in rumpnet)


To generate a diff of this commit:
cvs rdiff -u -r1.159 -r1.160 src/sys/rump/librump/rumpvfs/rumpfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.159 src/sys/rump/librump/rumpvfs/rumpfs.c:1.160
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.159	Thu May 14 16:10:34 2020
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Thu May 14 20:04:02 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.159 2020/05/14 20:10:34 christos Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.160 2020/05/15 00:04:02 christos Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.159 2020/05/14 20:10:34 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.160 2020/05/15 00:04:02 christos Exp $");
 
 #include 
 #include 
@@ -88,6 +88,15 @@ static int rump_vop_advlock(void *);
 static int rump_vop_access(void *);
 static int rump_vop_fcntl(void *);
 
+int (**fifo_vnodeop_p)(void *);
+const struct vnodeopv_entry_desc fifo_vnodeop_entries[] = {
+	{ _default_desc, vn_default_error },
+	{ _putpages_desc, genfs_null_putpages },
+	{ NULL, NULL }
+};
+const struct vnodeopv_desc fifo_vnodeop_opv_desc =
+	{ _vnodeop_p, fifo_vnodeop_entries };
+
 int (**rump_vnodeop_p)(void *);
 const struct vnodeopv_entry_desc rump_vnodeop_entries[] = {
 	{ _default_desc, vn_default_error },



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

2020-05-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu May 14 20:10:34 UTC 2020

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
PR/55102: Kamil Rytarowski: Remove fifo stuff duplicated in fifo_vnops.c


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/rump/librump/rumpvfs/rumpfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.158 src/sys/rump/librump/rumpvfs/rumpfs.c:1.159
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.158	Sat Apr 25 11:42:15 2020
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Thu May 14 16:10:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.158 2020/04/25 15:42:15 bouyer Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.159 2020/05/14 20:10:34 christos Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.158 2020/04/25 15:42:15 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.159 2020/05/14 20:10:34 christos Exp $");
 
 #include 
 #include 
@@ -88,15 +88,6 @@ static int rump_vop_advlock(void *);
 static int rump_vop_access(void *);
 static int rump_vop_fcntl(void *);
 
-int (**fifo_vnodeop_p)(void *);
-const struct vnodeopv_entry_desc fifo_vnodeop_entries[] = {
-	{ _default_desc, vn_default_error },
-	{ _putpages_desc, genfs_null_putpages },
-	{ NULL, NULL }
-};
-const struct vnodeopv_desc fifo_vnodeop_opv_desc =
-	{ _vnodeop_p, fifo_vnodeop_entries };
-
 int (**rump_vnodeop_p)(void *);
 const struct vnodeopv_entry_desc rump_vnodeop_entries[] = {
 	{ _default_desc, vn_default_error },



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

2020-04-29 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Thu Apr 30 03:41:20 UTC 2020

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

Log Message:
No need for a lock around rnd_add_data any more.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/rump/librump/rumpkern/hyperentropy.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/hyperentropy.c
diff -u src/sys/rump/librump/rumpkern/hyperentropy.c:1.16 src/sys/rump/librump/rumpkern/hyperentropy.c:1.17
--- src/sys/rump/librump/rumpkern/hyperentropy.c:1.16	Thu Apr 30 03:40:53 2020
+++ src/sys/rump/librump/rumpkern/hyperentropy.c	Thu Apr 30 03:41:20 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperentropy.c,v 1.16 2020/04/30 03:40:53 riastradh Exp $	*/
+/*	$NetBSD: hyperentropy.c,v 1.17 2020/04/30 03:41:20 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2014 Antti Kantee.  All Rights Reserved.
@@ -26,18 +26,16 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.16 2020/04/30 03:40:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.17 2020/04/30 03:41:20 riastradh Exp $");
 
 #include 
 #include 
-#include 
 #include 
 
 #include 
 
 #include 
 
-static kmutex_t rndsrc_lock;
 static krndsource_t rndsrc;
 
 static void
@@ -56,9 +54,7 @@ feedrandom(size_t bytes, void *cookie __
 		n += MIN(nread, bytes - n);
 	}
 	if (n) {
-		mutex_enter(_lock);
 		rnd_add_data_sync(, rnddata, n, NBBY*n);
-		mutex_exit(_lock);
 	}
 	kmem_intr_free(rnddata, bytes);
 }
@@ -67,8 +63,6 @@ void
 rump_hyperentropy_init(void)
 {
 
-	mutex_init(_lock, MUTEX_DEFAULT, IPL_VM);
-
 	rndsource_setcb(, , NULL);
 	rnd_attach_source(, "rump_hyperent", RND_TYPE_VM,
 	RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);



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

2020-04-24 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Apr 24 13:34:47 UTC 2020

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

Log Message:
lwp0.l_lid needs to be 0.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/rump/librump/rumpkern/lwproc.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/lwproc.c
diff -u src/sys/rump/librump/rumpkern/lwproc.c:1.46 src/sys/rump/librump/rumpkern/lwproc.c:1.47
--- src/sys/rump/librump/rumpkern/lwproc.c:1.46	Fri Apr 24 03:56:12 2020
+++ src/sys/rump/librump/rumpkern/lwproc.c	Fri Apr 24 13:34:47 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: lwproc.c,v 1.46 2020/04/24 03:56:12 thorpej Exp $	*/
+/*  $NetBSD: lwproc.c,v 1.47 2020/04/24 13:34:47 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #define RUMP__CURLWP_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.46 2020/04/24 03:56:12 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.47 2020/04/24 13:34:47 thorpej Exp $");
 
 #include 
 #include 
@@ -52,7 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1
 #include "rump_curlwp.h"
 
 struct lwp lwp0 = {
-	.l_lid = 1,
+	.l_lid = 0,
 	.l_proc = ,
 	.l_fd = ,
 };



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

2020-04-23 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Fri Apr 24 03:56:12 UTC 2020

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

Log Message:
Adapt to LWP ID allocation changes.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/rump/librump/rumpkern/lwproc.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/lwproc.c
diff -u src/sys/rump/librump/rumpkern/lwproc.c:1.45 src/sys/rump/librump/rumpkern/lwproc.c:1.46
--- src/sys/rump/librump/rumpkern/lwproc.c:1.45	Sun Apr 19 20:32:00 2020
+++ src/sys/rump/librump/rumpkern/lwproc.c	Fri Apr 24 03:56:12 2020
@@ -1,4 +1,4 @@
-/*  $NetBSD: lwproc.c,v 1.45 2020/04/19 20:32:00 thorpej Exp $	*/
+/*  $NetBSD: lwproc.c,v 1.46 2020/04/24 03:56:12 thorpej Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #define RUMP__CURLWP_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.45 2020/04/19 20:32:00 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.46 2020/04/24 03:56:12 thorpej Exp $");
 
 #include 
 #include 
@@ -311,6 +311,7 @@ lwproc_freelwp(struct lwp *l)
 	KASSERT(l->l_refcnt == 0);
 
 	/* ok, zero references, continue with nuke */
+	proc_free_lwpid(p, l->l_lid);
 	LIST_REMOVE(l, l_sibling);
 	KASSERT(p->p_nlwps >= 1);
 	if (--p->p_nlwps == 0) {
@@ -361,7 +362,7 @@ lwproc_makelwp(struct proc *p, struct lw
 	l->l_refcnt = 1;
 	l->l_proc = p;
 
-	l->l_lid = p->p_nlwpid++;
+	proc_alloc_lwpid(p, l);
 	LIST_INSERT_HEAD(>p_lwps, l, l_sibling);
 
 	l->l_fd = p->p_fd;



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

2020-04-22 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Thu Apr 23 00:34:29 UTC 2020

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

Log Message:
rump doesn't own pnbuf_cache, externalize it


To generate a diff of this commit:
cvs rdiff -u -r1.344 -r1.345 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.344 src/sys/rump/librump/rumpkern/rump.c:1.345
--- src/sys/rump/librump/rumpkern/rump.c:1.344	Mon Mar 23 14:49:50 2020
+++ src/sys/rump/librump/rumpkern/rump.c	Thu Apr 23 00:34:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.344 2020/03/23 14:49:50 pgoyette Exp $	*/
+/*	$NetBSD: rump.c,v 1.345 2020/04/23 00:34:29 joerg Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.344 2020/03/23 14:49:50 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.345 2020/04/23 00:34:29 joerg Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -114,7 +114,7 @@ static  char rump_msgbuf[16*1024] __alig
 
 bool rump_ttycomponent = false;
 
-pool_cache_t pnbuf_cache;
+extern pool_cache_t pnbuf_cache;
 
 static int rump_inited;
 



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

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

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

Log Message:
good grief..


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/rump/librump/rumpkern/sleepq.c

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

Modified files:

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



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

2020-04-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sun Apr  5 15:16:11 UTC 2020

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

Log Message:
Return early on 0-sized transfers (usually to/from NULL-objects)

This logic is already present in subr_copy.c:copyin_vmspace() and
rumpcopy.c:copyinstr().

This avoids memcpy() calls for NULL objects that is Undefined Behavior,
allowed in the kernel space (-fno-delete-null-pointer-checks), but not
in userland.

Reported by UBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/rump/librump/rumpkern/rumpcopy.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rumpcopy.c
diff -u src/sys/rump/librump/rumpkern/rumpcopy.c:1.23 src/sys/rump/librump/rumpkern/rumpcopy.c:1.24
--- src/sys/rump/librump/rumpkern/rumpcopy.c:1.23	Sat Apr  6 03:06:28 2019
+++ src/sys/rump/librump/rumpkern/rumpcopy.c	Sun Apr  5 15:16:11 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpcopy.c,v 1.23 2019/04/06 03:06:28 thorpej Exp $	*/
+/*	$NetBSD: rumpcopy.c,v 1.24 2020/04/05 15:16:11 kamil Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpcopy.c,v 1.23 2019/04/06 03:06:28 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpcopy.c,v 1.24 2020/04/05 15:16:11 kamil Exp $");
 
 #define	__UFETCHSTORE_PRIVATE
 #define	__UCAS_PRIVATE
@@ -45,6 +45,9 @@ copyin(const void *uaddr, void *kaddr, s
 {
 	int error = 0;
 
+	if (len == 0)
+		return 0;
+
 	if (__predict_false(uaddr == NULL && len)) {
 		return EFAULT;
 	}
@@ -64,6 +67,9 @@ copyout(const void *kaddr, void *uaddr, 
 {
 	int error = 0;
 
+	if (len == 0)
+		return 0;
+
 	if (__predict_false(uaddr == NULL && len)) {
 		return EFAULT;
 	}
@@ -137,6 +143,9 @@ copyoutstr(const void *kaddr, void *uadd
 	size_t slen;
 	int error;
 
+	if (len == 0)
+		return 0;
+
 	if (__predict_false(uaddr == NULL && len)) {
 		return EFAULT;
 	}
@@ -160,6 +169,9 @@ int
 kcopy(const void *src, void *dst, size_t len)
 {
 
+	if (len == 0)
+		return 0;
+
 	memcpy(dst, src, len);
 	return 0;
 }



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

2020-04-04 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Sat Apr  4 19:24:51 UTC 2020

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
Avoid copying zero-sized objects (from the NULL address)

Detected with UBSan


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/rump/librump/rumpvfs/rumpfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.154 src/sys/rump/librump/rumpvfs/rumpfs.c:1.155
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.154	Fri Jan 17 20:08:09 2020
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Sat Apr  4 19:24:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.154 2020/01/17 20:08:09 ad Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.155 2020/04/04 19:24:51 kamil Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.154 2020/01/17 20:08:09 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.155 2020/04/04 19:24:51 kamil Exp $");
 
 #include 
 #include 
@@ -977,7 +977,8 @@ rump_vop_setattr(void *v)
 			return ENOSPC;
 
 		copylen = MIN(rn->rn_dlen, newlen);
-		memcpy(newdata, rn->rn_data, copylen);
+		if (copylen > 0)
+			memcpy(newdata, rn->rn_data, copylen);
 		memset((char *)newdata + copylen, 0, newlen - copylen);
 
 		if ((rn->rn_flags & RUMPNODE_EXTSTORAGE) == 0) {
@@ -1492,7 +1493,8 @@ rump_vop_write(void *v)
 			return ENOSPC;
 		rn->rn_dlen = newlen;
 		memset(rn->rn_data, 0, newlen);
-		memcpy(rn->rn_data, olddata, oldlen);
+		if (oldlen > 0)
+			memcpy(rn->rn_data, olddata, oldlen);
 		allocd = true;
 		uvm_vnp_setsize(vp, newlen);
 	}



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

2020-03-26 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Mar 26 22:40:10 UTC 2020

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

Log Message:
sleepq_t is now a LIST.  Forgot to commit earlier.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/rump/librump/rumpkern/sleepq.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/sleepq.c
diff -u src/sys/rump/librump/rumpkern/sleepq.c:1.17 src/sys/rump/librump/rumpkern/sleepq.c:1.18
--- src/sys/rump/librump/rumpkern/sleepq.c:1.17	Tue Jan 26 23:12:18 2016
+++ src/sys/rump/librump/rumpkern/sleepq.c	Thu Mar 26 22:40:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: sleepq.c,v 1.17 2016/01/26 23:12:18 pooka Exp $	*/
+/*	$NetBSD: sleepq.c,v 1.18 2020/03/26 22:40:10 ad Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.17 2016/01/26 23:12:18 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.18 2020/03/26 22:40:10 ad Exp $");
 
 #include 
 #include 
@@ -58,7 +58,7 @@ sleepq_init(sleepq_t *sq)
 
 	RUN_ONCE(, sqinit1);
 
-	TAILQ_INIT(sq);
+	LIST_INIT(sq);
 }
 
 void
@@ -69,7 +69,7 @@ sleepq_enqueue(sleepq_t *sq, wchan_t wc,
 	l->l_wchan = wc;
 	l->l_wmesg = wmsg;
 	l->l_sleepq = sq;
-	TAILQ_INSERT_TAIL(sq, l, l_sleepchain);
+	LIST_INSERT_HEAD(sq, l, l_sleepchain);
 }
 
 int
@@ -85,7 +85,7 @@ sleepq_block(int timo, bool catch)
 		error = cv_timedwait(_cv, mp, timo);
 		if (error == EWOULDBLOCK || error == EINTR) {
 			if (l->l_wchan) {
-TAILQ_REMOVE(l->l_sleepq, l, l_sleepchain);
+LIST_REMOVE(l, l_sleepchain);
 l->l_wchan = NULL;
 l->l_wmesg = NULL;
 			}
@@ -105,13 +105,13 @@ sleepq_wake(sleepq_t *sq, wchan_t wchan,
 	struct lwp *l, *l_next;
 	bool found = false;
 
-	for (l = TAILQ_FIRST(sq); l; l = l_next) {
-		l_next = TAILQ_NEXT(l, l_sleepchain);
+	for (l = LIST_FIRST(sq); l; l = l_next) {
+		l_next = LIST_NEXT(l, l_sleepchain);
 		if (l->l_wchan == wchan) {
 			found = true;
 			l->l_wchan = NULL;
 			l->l_wmesg = NULL;
-			TAILQ_REMOVE(sq, l, l_sleepchain);
+			LIST_REMOVE(l, l_sleepchain);
 			if (--expected == 0)
 break;
 		}
@@ -128,7 +128,7 @@ sleepq_unsleep(struct lwp *l, bool clean
 
 	l->l_wchan = NULL;
 	l->l_wmesg = NULL;
-	TAILQ_REMOVE(l->l_sleepq, l, l_sleepchain);
+	LIST_REMOVE(l, l_sleepchain);
 	cv_broadcast(_cv);
 
 	if (cleanup) {



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

2020-03-23 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Mar 23 14:49:50 UTC 2020

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

Log Message:
Don't attempt to detach an evcnt before attaching it.  If its not
already attached, we will panic.

It turns out that this check wasn't really needed anyway, it was
simply paranoia on my part.

Thanks to hannken@ for bringing this to my attention.


To generate a diff of this commit:
cvs rdiff -u -r1.343 -r1.344 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.343 src/sys/rump/librump/rumpkern/rump.c:1.344
--- src/sys/rump/librump/rumpkern/rump.c:1.343	Sun Mar 22 13:30:10 2020
+++ src/sys/rump/librump/rumpkern/rump.c	Mon Mar 23 14:49:50 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.343 2020/03/22 13:30:10 pgoyette Exp $	*/
+/*	$NetBSD: rump.c,v 1.344 2020/03/23 14:49:50 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.343 2020/03/22 13:30:10 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.344 2020/03/23 14:49:50 pgoyette Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -647,14 +647,12 @@ add_linkedin_modules(const struct modinf
 }
 
 /*
- * Add an evcnt.  Just in case it might already have been added, remove
- * it first.
+ * Add an evcnt.
  */
 static void
 add_static_evcnt(struct evcnt *ev)
 {
 
-	evcnt_detach(ev);
 	evcnt_attach_static(ev);
 }
 



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

2020-03-14 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Mar 14 19:54:06 UTC 2020

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

Log Message:
rump - page/object dirtyness tracking corrections.


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.184 src/sys/rump/librump/rumpkern/vm.c:1.185
--- src/sys/rump/librump/rumpkern/vm.c:1.184	Sun Feb 23 15:46:42 2020
+++ src/sys/rump/librump/rumpkern/vm.c	Sat Mar 14 19:54:06 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.184 2020/02/23 15:46:42 ad Exp $	*/
+/*	$NetBSD: vm.c,v 1.185 2020/03/14 19:54:06 ad Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.184 2020/02/23 15:46:42 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.185 2020/03/14 19:54:06 ad Exp $");
 
 #include 
 #include 
@@ -172,9 +172,11 @@ uvm_pagealloc_strat(struct uvm_object *u
 	pg->offset = off;
 	pg->uobject = uobj;
 
-	pg->flags = PG_CLEAN|PG_BUSY|PG_FAKE;
-	if (flags & UVM_PGA_ZERO) {
-		uvm_pagezero(pg);
+	if (UVM_OBJ_IS_VNODE(uobj) && uobj->uo_npages == 0) {
+		struct vnode *vp = (struct vnode *)uobj;
+		mutex_enter(vp->v_interlock);
+		vp->v_iflag |= VI_PAGES;
+		mutex_exit(vp->v_interlock);
 	}
 
 	if (radix_tree_insert_node(>uo_pages, off >> PAGE_SHIFT,
@@ -182,6 +184,12 @@ uvm_pagealloc_strat(struct uvm_object *u
 		pool_cache_put(, pg);
 		return NULL;
 	}
+	uobj->uo_npages++;
+
+	pg->flags = PG_CLEAN|PG_BUSY|PG_FAKE;
+	if (flags & UVM_PGA_ZERO) {
+		uvm_pagezero(pg);
+	}
 
 	/*
 	 * Don't put anons on the LRU page queue.  We can't flush them
@@ -195,8 +203,6 @@ uvm_pagealloc_strat(struct uvm_object *u
 		mutex_exit(_lruqueue_lock);
 	}
 
-	uobj->uo_npages++;
-
 	return pg;
 }
 
@@ -227,6 +233,13 @@ uvm_pagefree(struct vm_page *pg)
 		atomic_dec_uint(_onqueue);
 	}
 
+	if (UVM_OBJ_IS_VNODE(uobj) && uobj->uo_npages == 0) {
+		struct vnode *vp = (struct vnode *)uobj;
+		mutex_enter(vp->v_interlock);
+		vp->v_iflag &= ~VI_PAGES;
+		mutex_exit(vp->v_interlock);
+	}
+
 	mutex_destroy(>interlock);
 	pool_cache_put(, pg);
 }



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

2020-02-22 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Sun Feb 23 01:53:03 UTC 2020

Modified Files:
src/sys/rump/librump/rumpdev: rump_dev.c

Log Message:
no need to call config_init_mi() in rumpdev any more - rump_init() now calls
config_init(), and the sysctl shouldn't be needed

PR kern/55004


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/rump/librump/rumpdev/rump_dev.c

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

Modified files:

Index: src/sys/rump/librump/rumpdev/rump_dev.c
diff -u src/sys/rump/librump/rumpdev/rump_dev.c:1.27 src/sys/rump/librump/rumpdev/rump_dev.c:1.28
--- src/sys/rump/librump/rumpdev/rump_dev.c:1.27	Tue Jan 26 23:12:17 2016
+++ src/sys/rump/librump/rumpdev/rump_dev.c	Sun Feb 23 01:53:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_dev.c,v 1.27 2016/01/26 23:12:17 pooka Exp $	*/
+/*	$NetBSD: rump_dev.c,v 1.28 2020/02/23 01:53:03 jdolecek Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_dev.c,v 1.27 2016/01/26 23:12:17 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_dev.c,v 1.28 2020/02/23 01:53:03 jdolecek Exp $");
 
 #include 
 #include 
@@ -49,7 +49,6 @@ RUMP_COMPONENT(RUMP__FACTION_DEV)
 	KERNEL_LOCK(1, curlwp);
 
 	rump_mainbus_init();
-	config_init_mi();
 
 	rump_component_init(RUMP_COMPONENT_DEV);
 



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

2020-02-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Feb 22 21:45:35 UTC 2020

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

Log Message:
rump_init(): need to call config_init() now.

PR kern/55004 (Hundreds of file system tests now fail on real hardware)


To generate a diff of this commit:
cvs rdiff -u -r1.341 -r1.342 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.341 src/sys/rump/librump/rumpkern/rump.c:1.342
--- src/sys/rump/librump/rumpkern/rump.c:1.341	Tue Feb 18 20:23:17 2020
+++ src/sys/rump/librump/rumpkern/rump.c	Sat Feb 22 21:45:34 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.341 2020/02/18 20:23:17 chs Exp $	*/
+/*	$NetBSD: rump.c,v 1.342 2020/02/22 21:45:34 ad Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.341 2020/02/18 20:23:17 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.342 2020/02/22 21:45:34 ad Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -411,6 +411,7 @@ rump_init(void)
 	procinit_sysctl();
 	time_init();
 	time_init2();
+	config_init();
 
 	/* start page baroness */
 	if (rump_threads) {



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

2020-02-22 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Feb 22 21:44:51 UTC 2020

Modified Files:
src/sys/rump/librump/rumpkern: locks.c locks_up.c

Log Message:
rump rw_lock_op


To generate a diff of this commit:
cvs rdiff -u -r1.80 -r1.81 src/sys/rump/librump/rumpkern/locks.c
cvs rdiff -u -r1.10 -r1.11 src/sys/rump/librump/rumpkern/locks_up.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/locks.c
diff -u src/sys/rump/librump/rumpkern/locks.c:1.80 src/sys/rump/librump/rumpkern/locks.c:1.81
--- src/sys/rump/librump/rumpkern/locks.c:1.80	Mon Feb  5 05:00:48 2018
+++ src/sys/rump/librump/rumpkern/locks.c	Sat Feb 22 21:44:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locks.c,v 1.80 2018/02/05 05:00:48 ozaki-r Exp $	*/
+/*	$NetBSD: locks.c,v 1.81 2020/02/22 21:44:51 ad Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.80 2018/02/05 05:00:48 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.81 2020/02/22 21:44:51 ad Exp $");
 
 #include 
 #include 
@@ -358,6 +358,13 @@ rw_lock_held(krwlock_t *rw)
 	return rw_read_held(rw) || rw_write_held(rw);
 }
 
+krw_t
+rw_lock_op(krwlock_t *rw)
+{
+
+	return rw_write_held(rw) ? RW_WRITER : RW_READER;
+}
+
 /* curriculum vitaes */
 
 #define RUMPCV(cv) (*(struct rumpuser_cv **)(cv))

Index: src/sys/rump/librump/rumpkern/locks_up.c
diff -u src/sys/rump/librump/rumpkern/locks_up.c:1.10 src/sys/rump/librump/rumpkern/locks_up.c:1.11
--- src/sys/rump/librump/rumpkern/locks_up.c:1.10	Tue Jan 26 23:12:17 2016
+++ src/sys/rump/librump/rumpkern/locks_up.c	Sat Feb 22 21:44:51 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: locks_up.c,v 1.10 2016/01/26 23:12:17 pooka Exp $	*/
+/*	$NetBSD: locks_up.c,v 1.11 2020/02/22 21:44:51 ad Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locks_up.c,v 1.10 2016/01/26 23:12:17 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks_up.c,v 1.11 2020/02/22 21:44:51 ad Exp $");
 
 #include 
 #include 
@@ -317,6 +317,12 @@ rw_lock_held(krwlock_t *rw)
 	return uprw->uprw_owner || uprw->uprw_readers;
 }
 
+krw_t
+rw_lock_op(krwlock_t *rw)
+{
+
+	return rw_write_held(rw) ? RW_WRITER : RW_READER;
+}
 
 /*
  * Condvars are almost the same as in the MP case except that we



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

2020-02-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Mon Feb 10 03:23:29 UTC 2020

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

Log Message:
Initialize struct cpu_info::ci_cpuname (= ci_data.cpu_name) in rump.


To generate a diff of this commit:
cvs rdiff -u -r1.339 -r1.340 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.339 src/sys/rump/librump/rumpkern/rump.c:1.340
--- src/sys/rump/librump/rumpkern/rump.c:1.339	Thu Jan  2 15:42:27 2020
+++ src/sys/rump/librump/rumpkern/rump.c	Mon Feb 10 03:23:29 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.339 2020/01/02 15:42:27 thorpej Exp $	*/
+/*	$NetBSD: rump.c,v 1.340 2020/02/10 03:23:29 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.339 2020/01/02 15:42:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.340 2020/02/10 03:23:29 riastradh Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -383,6 +383,7 @@ rump_init(void)
 			rump_cpu_attach(ci);
 			ncpu++;
 		}
+		snprintf(ci->ci_cpuname, sizeof ci->ci_cpuname, "cpu%d", i);
 
 		callout_init_cpu(ci);
 		softint_init(ci);



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

2020-01-02 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Thu Jan  2 16:56:58 UTC 2020

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

Log Message:
rump: initialize pg->interlock


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.180 src/sys/rump/librump/rumpkern/vm.c:1.181
--- src/sys/rump/librump/rumpkern/vm.c:1.180	Tue Dec 31 23:32:05 2019
+++ src/sys/rump/librump/rumpkern/vm.c	Thu Jan  2 16:56:58 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.180 2019/12/31 23:32:05 ad Exp $	*/
+/*	$NetBSD: vm.c,v 1.181 2020/01/02 16:56:58 ad Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.180 2019/12/31 23:32:05 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.181 2020/01/02 16:56:58 ad Exp $");
 
 #include 
 #include 
@@ -167,6 +167,7 @@ uvm_pagealloc_strat(struct uvm_object *u
 	if (__predict_false(pg == NULL)) {
 		return NULL;
 	}
+	mutex_init(>interlock, MUTEX_DEFAULT, IPL_NONE);
 
 	pg->offset = off;
 	pg->uobject = uobj;
@@ -226,6 +227,7 @@ uvm_pagefree(struct vm_page *pg)
 		atomic_dec_uint(_onqueue);
 	}
 
+	mutex_destroy(>interlock);
 	pool_cache_put(, pg);
 }
 



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

2020-01-02 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Jan  2 08:49:10 UTC 2020

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

Log Message:
Add shutting_down variable for rump.


To generate a diff of this commit:
cvs rdiff -u -r1.193 -r1.194 src/sys/rump/librump/rumpkern/emul.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.193 src/sys/rump/librump/rumpkern/emul.c:1.194
--- src/sys/rump/librump/rumpkern/emul.c:1.193	Mon Dec 16 22:47:55 2019
+++ src/sys/rump/librump/rumpkern/emul.c	Thu Jan  2 08:49:10 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.193 2019/12/16 22:47:55 ad Exp $	*/
+/*	$NetBSD: emul.c,v 1.194 2020/01/02 08:49:10 martin Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.193 2019/12/16 22:47:55 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.194 2020/01/02 08:49:10 martin Exp $");
 
 #include 
 #include 
@@ -64,6 +64,7 @@ struct vnode *rootvp;
 dev_t rootdev = NODEV;
 
 const int schedppq = 1;
+int	shutting_down __read_mostly;	/* system is shutting down */
 struct timespec boottime;
 int cold = 1;
 int boothowto = AB_SILENT;



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

2019-12-31 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Tue Dec 31 23:32:05 UTC 2019

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

Log Message:
Fix rump.


To generate a diff of this commit:
cvs rdiff -u -r1.179 -r1.180 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.179 src/sys/rump/librump/rumpkern/vm.c:1.180
--- src/sys/rump/librump/rumpkern/vm.c:1.179	Tue Dec 31 13:07:13 2019
+++ src/sys/rump/librump/rumpkern/vm.c	Tue Dec 31 23:32:05 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.179 2019/12/31 13:07:13 ad Exp $	*/
+/*	$NetBSD: vm.c,v 1.180 2019/12/31 23:32:05 ad Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.179 2019/12/31 13:07:13 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.180 2019/12/31 23:32:05 ad Exp $");
 
 #include 
 #include 
@@ -416,6 +416,41 @@ uvm_availmem(void)
 	return uvmexp.free;
 }
 
+void
+uvm_pagelock(struct vm_page *pg)
+{
+
+	mutex_enter(>interlock);
+}
+
+void
+uvm_pagelock2(struct vm_page *pg1, struct vm_page *pg2)
+{
+
+	if (pg1 < pg2) {
+		mutex_enter(>interlock);
+		mutex_enter(>interlock);
+	} else {
+		mutex_enter(>interlock);
+		mutex_enter(>interlock);
+	}
+}
+
+void
+uvm_pageunlock(struct vm_page *pg)
+{
+
+	mutex_exit(>interlock);
+}
+
+void
+uvm_pageunlock2(struct vm_page *pg1, struct vm_page *pg2)
+{
+
+	mutex_exit(>interlock);
+	mutex_exit(>interlock);
+}
+
 /* where's your schmonz now? */
 #define PUNLIMIT(a)	\
 p->p_rlimit[a].rlim_cur = p->p_rlimit[a].rlim_max = RLIM_INFINITY;



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

2019-12-21 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sat Dec 21 12:59:13 UTC 2019

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

Log Message:
Add uvm_free(): returns number of free pages in system.


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.176 src/sys/rump/librump/rumpkern/vm.c:1.177
--- src/sys/rump/librump/rumpkern/vm.c:1.176	Sun Dec 15 21:11:35 2019
+++ src/sys/rump/librump/rumpkern/vm.c	Sat Dec 21 12:59:12 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.176 2019/12/15 21:11:35 ad Exp $	*/
+/*	$NetBSD: vm.c,v 1.177 2019/12/21 12:59:12 ad Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.176 2019/12/15 21:11:35 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.177 2019/12/21 12:59:12 ad Exp $");
 
 #include 
 #include 
@@ -409,6 +409,13 @@ uvm_pageunwire(struct vm_page *pg)
 	/* nada */
 }
 
+int
+uvm_free(void)
+{
+
+	return uvmexp.free;
+}
+
 /* where's your schmonz now? */
 #define PUNLIMIT(a)	\
 p->p_rlimit[a].rlim_cur = p->p_rlimit[a].rlim_max = RLIM_INFINITY;



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

2019-12-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Dec 15 14:21:34 UTC 2019

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

Log Message:
Initialize the module_hook synchronization variables in rump, too.

Fixes recently reported test failures for dev/sysmon/t_swsensor
and net/if_vlan/t_vlan


To generate a diff of this commit:
cvs rdiff -u -r1.337 -r1.338 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.337 src/sys/rump/librump/rumpkern/rump.c:1.338
--- src/sys/rump/librump/rumpkern/rump.c:1.337	Sat Dec  7 14:55:58 2019
+++ src/sys/rump/librump/rumpkern/rump.c	Sun Dec 15 14:21:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.337 2019/12/07 14:55:58 riastradh Exp $	*/
+/*	$NetBSD: rump.c,v 1.338 2019/12/15 14:21:34 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.337 2019/12/07 14:55:58 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.338 2019/12/15 14:21:34 pgoyette Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -52,6 +52,7 @@ __KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.3
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -412,6 +413,7 @@ rump_init(void)
 	iostat_init();
 	fd_sys_init();
 	module_init();
+	module_hook_init();
 	devsw_init();
 	pipe_init();
 	resource_init();



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

2019-12-07 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Dec  7 14:55:58 UTC 2019

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

Log Message:
Restore call to pserialize_init.

We need it after all for psz_lock on the event counter.


To generate a diff of this commit:
cvs rdiff -u -r1.336 -r1.337 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.336 src/sys/rump/librump/rumpkern/rump.c:1.337
--- src/sys/rump/librump/rumpkern/rump.c:1.336	Tue Dec  3 05:07:49 2019
+++ src/sys/rump/librump/rumpkern/rump.c	Sat Dec  7 14:55:58 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.336 2019/12/03 05:07:49 riastradh Exp $	*/
+/*	$NetBSD: rump.c,v 1.337 2019/12/07 14:55:58 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.336 2019/12/03 05:07:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.337 2019/12/07 14:55:58 riastradh Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -73,6 +73,7 @@ __KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.3
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -305,6 +306,7 @@ rump_init(void)
 
 	kprintf_init();
 	percpu_init();
+	pserialize_init();
 
 	kauth_init();
 



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

2019-12-01 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Dec  1 19:21:13 UTC 2019

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

Log Message:
Another instance of cpu_onproc to replace.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/rump/librump/rumpkern/scheduler.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/scheduler.c
diff -u src/sys/rump/librump/rumpkern/scheduler.c:1.46 src/sys/rump/librump/rumpkern/scheduler.c:1.47
--- src/sys/rump/librump/rumpkern/scheduler.c:1.46	Sun Dec  1 18:12:51 2019
+++ src/sys/rump/librump/rumpkern/scheduler.c	Sun Dec  1 19:21:13 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: scheduler.c,v 1.46 2019/12/01 18:12:51 ad Exp $	*/
+/*  $NetBSD: scheduler.c,v 1.47 2019/12/01 19:21:13 ad Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.46 2019/12/01 18:12:51 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.47 2019/12/01 19:21:13 ad Exp $");
 
 #include 
 #include 
@@ -449,7 +449,7 @@ rump_unschedule_cpu1(struct lwp *l, void
 	void *old;
 
 	ci = l->l_cpu;
-	ci->ci_curlwp = ci->ci_data.cpu_onproc = NULL;
+	ci->ci_curlwp = ci->ci_onproc = NULL;
 	rcpu = cpuinfo_to_rumpcpu(ci);
 
 	KASSERT(rcpu->rcpu_ci == ci);



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

2019-12-01 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Sun Dec  1 18:12:51 UTC 2019

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

Log Message:
cpu_onproc -> ci_onproc


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/rump/librump/rumpkern/scheduler.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/scheduler.c
diff -u src/sys/rump/librump/rumpkern/scheduler.c:1.45 src/sys/rump/librump/rumpkern/scheduler.c:1.46
--- src/sys/rump/librump/rumpkern/scheduler.c:1.45	Sat Nov 23 19:42:52 2019
+++ src/sys/rump/librump/rumpkern/scheduler.c	Sun Dec  1 18:12:51 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: scheduler.c,v 1.45 2019/11/23 19:42:52 ad Exp $	*/
+/*  $NetBSD: scheduler.c,v 1.46 2019/12/01 18:12:51 ad Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.45 2019/11/23 19:42:52 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.46 2019/12/01 18:12:51 ad Exp $");
 
 #include 
 #include 
@@ -377,7 +377,7 @@ rump_schedule_cpu_interlock(struct lwp *
 	 * in the case that an interrupt is scheduled immediately
 	 * after a user proc, but leave that for later.
 	 */
-	ci->ci_curlwp = ci->ci_data.cpu_onproc = l;
+	ci->ci_curlwp = ci->ci_onproc = l;
 }
 
 void



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

2019-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Mar 29 02:09:14 UTC 2019

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

Log Message:
fix the build (pnbuf_cache move to vfs_init.c)


To generate a diff of this commit:
cvs rdiff -u -r1.332 -r1.333 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.332 src/sys/rump/librump/rumpkern/rump.c:1.333
--- src/sys/rump/librump/rumpkern/rump.c:1.332	Wed Dec 26 17:16:27 2018
+++ src/sys/rump/librump/rumpkern/rump.c	Thu Mar 28 22:09:14 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.332 2018/12/26 22:16:27 thorpej Exp $	*/
+/*	$NetBSD: rump.c,v 1.333 2019/03/29 02:09:14 christos Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.332 2018/12/26 22:16:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.333 2019/03/29 02:09:14 christos Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -112,6 +112,8 @@ static  char rump_msgbuf[16*1024] __alig
 
 bool rump_ttycomponent = false;
 
+pool_cache_t pnbuf_cache;
+
 static void
 rump_aiodone_worker(struct work *wk, void *dummy)
 {



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

2019-03-09 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sat Mar  9 09:02:38 UTC 2019

Modified Files:
src/sys/rump/librump/rumpkern: emul.c lwproc.c

Log Message:
Rumpkernel has its own thread deallocation.  Add missing fstrans_lwp_dtor()
to lwproc_freelwp().

PR bin/50350: rump/rumpkern/t_sp/stress_{long,short} fail on Core 2 Quad


To generate a diff of this commit:
cvs rdiff -u -r1.189 -r1.190 src/sys/rump/librump/rumpkern/emul.c
cvs rdiff -u -r1.40 -r1.41 src/sys/rump/librump/rumpkern/lwproc.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.189 src/sys/rump/librump/rumpkern/emul.c:1.190
--- src/sys/rump/librump/rumpkern/emul.c:1.189	Wed Dec  5 19:56:49 2018
+++ src/sys/rump/librump/rumpkern/emul.c	Sat Mar  9 09:02:38 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.189 2018/12/05 19:56:49 christos Exp $	*/
+/*	$NetBSD: emul.c,v 1.190 2019/03/09 09:02:38 hannken Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.189 2018/12/05 19:56:49 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.190 2019/03/09 09:02:38 hannken Exp $");
 
 #include 
 #include 
@@ -292,6 +292,15 @@ rump_fstrans_done(struct mount *mp)
 }
 __weak_alias(fstrans_done,rump_fstrans_done);
 
+
+void rump_fstrans_lwp_dtor(struct lwp *);
+void
+rump_fstrans_lwp_dtor(struct lwp *l)
+{
+
+}
+__weak_alias(fstrans_lwp_dtor,rump_fstrans_lwp_dtor);
+
 /*
  * Provide weak aliases for tty routines used by printf.
  * They will be used unless the rumpkern_tty component is present.

Index: src/sys/rump/librump/rumpkern/lwproc.c
diff -u src/sys/rump/librump/rumpkern/lwproc.c:1.40 src/sys/rump/librump/rumpkern/lwproc.c:1.41
--- src/sys/rump/librump/rumpkern/lwproc.c:1.40	Sun Apr 24 07:45:10 2016
+++ src/sys/rump/librump/rumpkern/lwproc.c	Sat Mar  9 09:02:38 2019
@@ -1,4 +1,4 @@
-/*  $NetBSD: lwproc.c,v 1.40 2016/04/24 07:45:10 martin Exp $	*/
+/*  $NetBSD: lwproc.c,v 1.41 2019/03/09 09:02:38 hannken Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -28,11 +28,12 @@
 #define RUMP__CURLWP_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.40 2016/04/24 07:45:10 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.41 2019/03/09 09:02:38 hannken Exp $");
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -326,6 +327,7 @@ lwproc_freelwp(struct lwp *l)
 
 	if (l->l_name)
 		kmem_free(l->l_name, MAXCOMLEN);
+	fstrans_lwp_dtor(l);
 	lwp_finispecific(l);
 
 	lwproc_curlwpop(RUMPUSER_LWP_DESTROY, l);



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

2018-12-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Dec  5 19:56:49 UTC 2018

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

Log Message:
no more need for get_expose_address() here.


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/sys/rump/librump/rumpkern/emul.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.188 src/sys/rump/librump/rumpkern/emul.c:1.189
--- src/sys/rump/librump/rumpkern/emul.c:1.188	Fri Oct  5 20:17:06 2018
+++ src/sys/rump/librump/rumpkern/emul.c	Wed Dec  5 14:56:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.188 2018/10/06 00:17:06 christos Exp $	*/
+/*	$NetBSD: emul.c,v 1.189 2018/12/05 19:56:49 christos Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.188 2018/10/06 00:17:06 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.189 2018/12/05 19:56:49 christos Exp $");
 
 #include 
 #include 
@@ -402,9 +402,3 @@ cpu_getmodel(void)
 
 	return "rumpcore (virtual)";
 }
-
-bool
-get_expose_address(struct proc *p)
-{
-	return 1;
-}



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

2018-10-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Oct  6 00:17:06 UTC 2018

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

Log Message:
add get_expose_address()


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 src/sys/rump/librump/rumpkern/emul.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.187 src/sys/rump/librump/rumpkern/emul.c:1.188
--- src/sys/rump/librump/rumpkern/emul.c:1.187	Fri Oct  5 05:51:55 2018
+++ src/sys/rump/librump/rumpkern/emul.c	Fri Oct  5 20:17:06 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.187 2018/10/05 09:51:55 hannken Exp $	*/
+/*	$NetBSD: emul.c,v 1.188 2018/10/06 00:17:06 christos Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.187 2018/10/05 09:51:55 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.188 2018/10/06 00:17:06 christos Exp $");
 
 #include 
 #include 
@@ -402,3 +402,9 @@ cpu_getmodel(void)
 
 	return "rumpcore (virtual)";
 }
+
+bool
+get_expose_address(struct proc *p)
+{
+	return 1;
+}



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

2018-06-03 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Jun  4 02:29:53 UTC 2018

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
initialize the new gop_putrange method pointer in rumpfs_genfsops too.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.153 src/sys/rump/librump/rumpvfs/rumpfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.152 src/sys/rump/librump/rumpvfs/rumpfs.c:1.153
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.152	Mon Nov 20 17:00:35 2017
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Mon Jun  4 02:29:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.152 2017/11/20 17:00:35 martin Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.153 2018/06/04 02:29:53 chs Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.152 2017/11/20 17:00:35 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.153 2018/06/04 02:29:53 chs Exp $");
 
 #include 
 #include 
@@ -164,6 +164,7 @@ struct rumpfs_dent {
 struct genfs_ops rumpfs_genfsops = {
 	.gop_size = genfs_size,
 	.gop_write = genfs_gop_write,
+	.gop_putrange = genfs_gop_putrange,
 
 	/* optional */
 	.gop_alloc = NULL,



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

2018-05-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat May  5 23:42:00 UTC 2018

Modified Files:
src/sys/rump/librump/rumpnet: net_stub.c

Log Message:
add an empty stub


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/rump/librump/rumpnet/net_stub.c

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

Modified files:

Index: src/sys/rump/librump/rumpnet/net_stub.c
diff -u src/sys/rump/librump/rumpnet/net_stub.c:1.33 src/sys/rump/librump/rumpnet/net_stub.c:1.34
--- src/sys/rump/librump/rumpnet/net_stub.c:1.33	Sat Apr 28 10:21:03 2018
+++ src/sys/rump/librump/rumpnet/net_stub.c	Sat May  5 19:42:00 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: net_stub.c,v 1.33 2018/04/28 14:21:03 maxv Exp $	*/
+/*	$NetBSD: net_stub.c,v 1.34 2018/05/05 23:42:00 christos Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.33 2018/04/28 14:21:03 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.34 2018/05/05 23:42:00 christos Exp $");
 
 #include 
 #include 
@@ -34,6 +34,8 @@ __KERNEL_RCSID(0, "$NetBSD: net_stub.c,v
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
@@ -83,6 +85,12 @@ int ipsec_used;
 percpu_t *ipsecstat_percpu;
 u_int ipsec_spdgen;
 
+/* sysctl */
+void
+unp_sysctl_create(struct sysctllog **clog)
+{
+}
+
 __weak_alias(ah4_ctlinput,rumpnet_stub);
 __weak_alias(ah6_ctlinput,rumpnet_stub);
 __weak_alias(esp4_ctlinput,rumpnet_stub);



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

2018-04-12 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 12 21:39:00 UTC 2018

Modified Files:
src/sys/rump/librump/rumpnet: net_stub.c

Log Message:
remove now unused crap.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/rump/librump/rumpnet/net_stub.c

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

Modified files:

Index: src/sys/rump/librump/rumpnet/net_stub.c
diff -u src/sys/rump/librump/rumpnet/net_stub.c:1.31 src/sys/rump/librump/rumpnet/net_stub.c:1.32
--- src/sys/rump/librump/rumpnet/net_stub.c:1.31	Tue Feb 27 10:01:30 2018
+++ src/sys/rump/librump/rumpnet/net_stub.c	Thu Apr 12 17:38:59 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: net_stub.c,v 1.31 2018/02/27 15:01:30 maxv Exp $	*/
+/*	$NetBSD: net_stub.c,v 1.32 2018/04/12 21:38:59 christos Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.31 2018/02/27 15:01:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.32 2018/04/12 21:38:59 christos Exp $");
 
 #include 
 #include 
@@ -109,10 +109,3 @@ __weak_alias(key_sp_unref,rumpnet_stub);
 struct ifnet_head ifnet_list;
 struct pslist_head ifnet_pslist;
 kmutex_t ifnet_mtx;
-
-int
-compat_ifconf(u_long cmd, void *data)
-{
-
-	return EOPNOTSUPP;
-}



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

2018-02-27 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Tue Feb 27 14:45:43 UTC 2018

Modified Files:
src/sys/rump/librump/rumpnet: net_stub.c

Log Message:
Oops, forgot this file; I just merged two IPsec functions, so adapt
the rump stubs accordingly.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/rump/librump/rumpnet/net_stub.c

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

Modified files:

Index: src/sys/rump/librump/rumpnet/net_stub.c
diff -u src/sys/rump/librump/rumpnet/net_stub.c:1.29 src/sys/rump/librump/rumpnet/net_stub.c:1.30
--- src/sys/rump/librump/rumpnet/net_stub.c:1.29	Mon Feb 26 09:04:29 2018
+++ src/sys/rump/librump/rumpnet/net_stub.c	Tue Feb 27 14:45:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: net_stub.c,v 1.29 2018/02/26 09:04:29 maxv Exp $	*/
+/*	$NetBSD: net_stub.c,v 1.30 2018/02/27 14:45:43 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.29 2018/02/26 09:04:29 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: net_stub.c,v 1.30 2018/02/27 14:45:43 maxv Exp $");
 
 #include 
 #include 
@@ -89,17 +89,16 @@ __weak_alias(esp4_ctlinput,rumpnet_stub)
 __weak_alias(esp6_ctlinput,rumpnet_stub);
 __weak_alias(ipsec4_output,rumpnet_stub);
 __weak_alias(ipsec4_common_input,rumpnet_stub);
-__weak_alias(ipsec4_delete_pcbpolicy,rumpnet_stub);
 __weak_alias(ipsec4_forward,rumpnet_stub);
 __weak_alias(ipsec4_input,rumpnet_stub);
 __weak_alias(ipsec4_set_policy,rumpnet_stub);
 __weak_alias(ipsec6_common_input,rumpnet_stub);
 __weak_alias(ipsec6_input,rumpnet_stub);
 __weak_alias(ipsec6_check_policy,rumpnet_stub);
-__weak_alias(ipsec6_delete_pcbpolicy,rumpnet_stub);
-__weak_alias(ipsec6_get_policy,rumpnet_stub);
 __weak_alias(ipsec6_process_packet,rumpnet_stub);
 __weak_alias(ipsec6_set_policy,rumpnet_stub);
+__weak_alias(ipsec_get_policy,rumpnet_stub);
+__weak_alias(ipsec_delete_pcbpolicy,rumpnet_stub);
 __weak_alias(ipsec_hdrsiz,rumpnet_stub);
 __weak_alias(ipsec_in_reject,rumpnet_stub);
 __weak_alias(ipsec_init_policy,rumpnet_stub);



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

2018-02-04 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Feb  5 05:00:48 UTC 2018

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

Log Message:
Obtain proper initialized addresses of locks allocated by mutex_obj_alloc or 
rw_obj_alloc

Initialized addresses of locks allocated by mutex_obj_alloc or rw_obj_alloc
were not useful because the addresses were mutex_obj_alloc or rw_obj_alloc
itself. What we want to know are callers of them.

(forgot to commit)


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/rump/librump/rumpkern/locks.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/locks.c
diff -u src/sys/rump/librump/rumpkern/locks.c:1.79 src/sys/rump/librump/rumpkern/locks.c:1.80
--- src/sys/rump/librump/rumpkern/locks.c:1.79	Wed Dec 27 09:03:22 2017
+++ src/sys/rump/librump/rumpkern/locks.c	Mon Feb  5 05:00:48 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locks.c,v 1.79 2017/12/27 09:03:22 ozaki-r Exp $	*/
+/*	$NetBSD: locks.c,v 1.80 2018/02/05 05:00:48 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.79 2017/12/27 09:03:22 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.80 2018/02/05 05:00:48 ozaki-r Exp $");
 
 #include 
 #include 
@@ -66,9 +66,9 @@ static lockops_t rw_lockops = {
 	.lo_dump = NULL,
 };
 
-#define ALLOCK(lock, ops)\
+#define ALLOCK(lock, ops, return_address)		\
 	lockdebug_alloc(__func__, __LINE__, lock, ops,	\
-	(uintptr_t)__builtin_return_address(0))
+	return_address)
 #define FREELOCK(lock)	\
 	lockdebug_free(__func__, __LINE__, lock)
 #define WANTLOCK(lock, shar)\
@@ -83,7 +83,7 @@ static lockops_t rw_lockops = {
 #define BARRIER(lock, slp)\
 	lockdebug_barrier(__func__, __LINE__, lock, slp)
 #else
-#define ALLOCK(a, b)	do {} while (0)
+#define ALLOCK(a, b, c)	do {} while (0)
 #define FREELOCK(a)	do {} while (0)
 #define WANTLOCK(a, b)	do {} while (0)
 #define LOCKED(a, b)	do {} while (0)
@@ -105,8 +105,9 @@ static lockops_t rw_lockops = {
 
 #define RUMPMTX(mtx) (*(struct rumpuser_mtx *const*)(mtx))
 
+void _mutex_init(kmutex_t *, kmutex_type_t, int, uintptr_t);
 void
-mutex_init(kmutex_t *mtx, kmutex_type_t type, int ipl)
+_mutex_init(kmutex_t *mtx, kmutex_type_t type, int ipl, uintptr_t return_address)
 {
 	int ruflags = RUMPUSER_MTX_KMUTEX;
 	int isspin;
@@ -135,9 +136,16 @@ mutex_init(kmutex_t *mtx, kmutex_type_t 
 		ruflags |= RUMPUSER_MTX_SPIN;
 	rumpuser_mutex_init((struct rumpuser_mtx **)mtx, ruflags);
 	if (isspin)
-		ALLOCK(mtx, _spin_lockops);
+		ALLOCK(mtx, _spin_lockops, return_address);
 	else
-		ALLOCK(mtx, _adaptive_lockops);
+		ALLOCK(mtx, _adaptive_lockops, return_address);
+}
+
+void
+mutex_init(kmutex_t *mtx, kmutex_type_t type, int ipl)
+{
+
+	_mutex_init(mtx, type, ipl, (uintptr_t)__builtin_return_address(0));
 }
 
 void
@@ -238,14 +246,22 @@ krw2rumprw(const krw_t op)
 	}
 }
 
+void _rw_init(krwlock_t *, uintptr_t);
 void
-rw_init(krwlock_t *rw)
+_rw_init(krwlock_t *rw, uintptr_t return_address)
 {
 
 	CTASSERT(sizeof(krwlock_t) >= sizeof(void *));
 
 	rumpuser_rw_init((struct rumpuser_rw **)rw);
-	ALLOCK(rw, _lockops);
+	ALLOCK(rw, _lockops, return_address);
+}
+
+void
+rw_init(krwlock_t *rw)
+{
+
+	_rw_init(rw, (uintptr_t)__builtin_return_address(0));
 }
 
 void



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

2018-01-08 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Jan  9 04:55:43 UTC 2018

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

Log Message:
 Set mp_online = ture. I don't know the "best" location to set it true.
This change might fix PR#52886.


To generate a diff of this commit:
cvs rdiff -u -r1.330 -r1.331 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.330 src/sys/rump/librump/rumpkern/rump.c:1.331
--- src/sys/rump/librump/rumpkern/rump.c:1.330	Tue Nov 21 08:49:14 2017
+++ src/sys/rump/librump/rumpkern/rump.c	Tue Jan  9 04:55:43 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.330 2017/11/21 08:49:14 ozaki-r Exp $	*/
+/*	$NetBSD: rump.c,v 1.331 2018/01/09 04:55:43 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.330 2017/11/21 08:49:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.331 2018/01/09 04:55:43 msaitoh Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -392,6 +392,8 @@ rump_init(void)
 	/* Once all CPUs are detected, initialize the per-CPU cprng_fast.  */
 	cprng_fast_init();
 
+	mp_online = true;
+
 	/* CPUs are up.  allow kernel threads to run */
 	rump_thread_allow(NULL);
 



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

2017-12-27 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Dec 27 09:03:22 UTC 2017

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

Log Message:
rump: check if the mutex is surely owned by the caller in mutex_exit

Unlocking a not-owned mutex wasn't detected well (it could detect if the mutex
is not held by anyone but that's not enough). Let's check it (the check is the
same as normal kernel's mutex).

If LOCKDEBUG is enabled, give the check over LOCKDEBUG because it can provide
better debugging information.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/rump/librump/rumpkern/locks.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/locks.c
diff -u src/sys/rump/librump/rumpkern/locks.c:1.78 src/sys/rump/librump/rumpkern/locks.c:1.79
--- src/sys/rump/librump/rumpkern/locks.c:1.78	Wed Dec 27 09:01:53 2017
+++ src/sys/rump/librump/rumpkern/locks.c	Wed Dec 27 09:03:22 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locks.c,v 1.78 2017/12/27 09:01:53 ozaki-r Exp $	*/
+/*	$NetBSD: locks.c,v 1.79 2017/12/27 09:03:22 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.78 2017/12/27 09:01:53 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.79 2017/12/27 09:03:22 ozaki-r Exp $");
 
 #include 
 #include 
@@ -186,6 +186,9 @@ void
 mutex_exit(kmutex_t *mtx)
 {
 
+#ifndef LOCKDEBUG
+	KASSERT(mutex_owned(mtx));
+#endif
 	UNLOCKED(mtx, false);
 	rumpuser_mutex_exit(RUMPMTX(mtx));
 }



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

2017-12-27 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Dec 27 08:45:45 UTC 2017

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

Log Message:
Tweak LOCKDEBUG macros (NFC)


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/rump/librump/rumpkern/locks.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/locks.c
diff -u src/sys/rump/librump/rumpkern/locks.c:1.76 src/sys/rump/librump/rumpkern/locks.c:1.77
--- src/sys/rump/librump/rumpkern/locks.c:1.76	Mon Dec 25 09:13:40 2017
+++ src/sys/rump/librump/rumpkern/locks.c	Wed Dec 27 08:45:45 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locks.c,v 1.76 2017/12/25 09:13:40 ozaki-r Exp $	*/
+/*	$NetBSD: locks.c,v 1.77 2017/12/27 08:45:45 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.76 2017/12/25 09:13:40 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.77 2017/12/27 08:45:45 ozaki-r Exp $");
 
 #include 
 #include 
@@ -62,28 +62,28 @@ static lockops_t rw_lockops = {
 };
 
 #define ALLOCK(lock, ops)\
-lockdebug_alloc(__func__, __LINE__, lock, ops,	\
-(uintptr_t)__builtin_return_address(0))
-#define FREELOCK(lock)			\
-lockdebug_free(__func__, __LINE__, lock)
+	lockdebug_alloc(__func__, __LINE__, lock, ops,	\
+	(uintptr_t)__builtin_return_address(0))
+#define FREELOCK(lock)	\
+	lockdebug_free(__func__, __LINE__, lock)
 #define WANTLOCK(lock, shar)\
-lockdebug_wantlock(__func__, __LINE__, lock,	\
-(uintptr_t)__builtin_return_address(0), shar)
+	lockdebug_wantlock(__func__, __LINE__, lock,	\
+	(uintptr_t)__builtin_return_address(0), shar)
 #define LOCKED(lock, shar)\
-lockdebug_locked(__func__, __LINE__, lock, NULL,	\
-(uintptr_t)__builtin_return_address(0), shar)
-#define UNLOCKED(lock, shar)		\
-lockdebug_unlocked(__func__, __LINE__, lock,	\
-(uintptr_t)__builtin_return_address(0), shar)
-#define BARRIER(lock, slp)		\
-lockdebug_barrier(__func__, __LINE__, lock, slp)
+	lockdebug_locked(__func__, __LINE__, lock, NULL,\
+	(uintptr_t)__builtin_return_address(0), shar)
+#define UNLOCKED(lock, shar)\
+	lockdebug_unlocked(__func__, __LINE__, lock,	\
+	(uintptr_t)__builtin_return_address(0), shar)
+#define BARRIER(lock, slp)\
+	lockdebug_barrier(__func__, __LINE__, lock, slp)
 #else
-#define ALLOCK(a, b)
-#define FREELOCK(a)
-#define WANTLOCK(a, b)
-#define LOCKED(a, b)
-#define UNLOCKED(a, b)
-#define BARRIER(a, b)
+#define ALLOCK(a, b)	do {} while (0)
+#define FREELOCK(a)	do {} while (0)
+#define WANTLOCK(a, b)	do {} while (0)
+#define LOCKED(a, b)	do {} while (0)
+#define UNLOCKED(a, b)	do {} while (0)
+#define BARRIER(a, b)	do {} while (0)
 #endif
 
 /*



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

2017-11-21 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Nov 21 15:22:06 UTC 2017

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

Log Message:
Add missing inclusion of pserialize.h (fix build)


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/sys/rump/librump/rumpkern/emul.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.184 src/sys/rump/librump/rumpkern/emul.c:1.185
--- src/sys/rump/librump/rumpkern/emul.c:1.184	Tue Nov 21 08:49:14 2017
+++ src/sys/rump/librump/rumpkern/emul.c	Tue Nov 21 15:22:06 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.184 2017/11/21 08:49:14 ozaki-r Exp $	*/
+/*	$NetBSD: emul.c,v 1.185 2017/11/21 15:22:06 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.184 2017/11/21 08:49:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.185 2017/11/21 15:22:06 ozaki-r Exp $");
 
 #include 
 #include 
@@ -36,6 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.1
 #include 
 #include 
 #include 
+#include 
 #ifdef LOCKDEBUG
 #include 
 #endif



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

2017-11-20 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Nov 20 17:00:36 UTC 2017

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
When truncating a file make sure to update mtime.
This fixes PR kern/51762 for rumpfs.


To generate a diff of this commit:
cvs rdiff -u -r1.151 -r1.152 src/sys/rump/librump/rumpvfs/rumpfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.151 src/sys/rump/librump/rumpvfs/rumpfs.c:1.152
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.151	Mon Nov 20 00:01:05 2017
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Mon Nov 20 17:00:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.151 2017/11/20 00:01:05 christos Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.152 2017/11/20 17:00:35 martin Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.151 2017/11/20 00:01:05 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.152 2017/11/20 17:00:35 martin Exp $");
 
 #include 
 #include 
@@ -906,6 +906,7 @@ rump_vop_setattr(void *v)
 	}
 
 	int flags = 0;
+	getnanotime();
 	if (vap->va_atime.tv_sec != VNOVAL)
 		if (!(vp->v_mount->mnt_flag & MNT_NOATIME))
 			flags |= RUMPFS_ACCESS;
@@ -913,11 +914,13 @@ rump_vop_setattr(void *v)
 		flags |= RUMPFS_CHANGE | RUMPFS_MODIFY;
 		if (vp->v_mount->mnt_flag & MNT_RELATIME)
 			flags |= RUMPFS_ACCESS;
+	} else if (vap->va_size == 0) {
+		flags |= RUMPFS_MODIFY;
+		vap->va_mtime = now;
 	}
 	SETIFVAL(va_birthtime.tv_sec, time_t);
 	SETIFVAL(va_birthtime.tv_nsec, long);
 	flags |= RUMPFS_CHANGE;
-	getnanotime();
 	error = rumpfs_update(flags, vp, >va_atime, >va_mtime, );
 	if (error)
 		return error;



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

2017-11-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Nov 20 00:01:06 UTC 2017

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
PR/52738: Martin Husemann: rumpfs does not support mtime


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/rump/librump/rumpvfs/rumpfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.150 src/sys/rump/librump/rumpvfs/rumpfs.c:1.151
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.150	Sun May 28 12:37:16 2017
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Sun Nov 19 19:01:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.150 2017/05/28 16:37:16 hannken Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.151 2017/11/20 00:01:05 christos Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.150 2017/05/28 16:37:16 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.151 2017/11/20 00:01:05 christos Exp $");
 
 #include 
 #include 
@@ -614,6 +614,32 @@ freedir(struct rumpfs_node *rnd, struct 
 	}
 }
 
+#define	RUMPFS_ACCESS	1
+#define	RUMPFS_MODIFY	2
+#define	RUMPFS_CHANGE	4
+
+static int
+rumpfs_update(int flags, struct vnode *vp, const struct timespec *acc,
+const struct timespec *mod, const struct timespec *chg)
+{
+	struct rumpfs_node *rn = vp->v_data;
+
+	if (flags == 0)
+		return 0;
+
+	if (vp->v_mount->mnt_flag & MNT_RDONLY)
+		return EROFS;
+
+	if (flags & RUMPFS_ACCESS)
+		rn->rn_va.va_atime = *acc;
+	if (flags & RUMPFS_MODIFY)
+		rn->rn_va.va_mtime = *mod;
+	if (flags & RUMPFS_CHANGE)
+		rn->rn_va.va_ctime = *chg;
+
+	return 0;
+}
+
 /*
  * Simple lookup for rump file systems.
  *
@@ -858,6 +884,7 @@ rump_vop_setattr(void *v)
 	struct vattr *vap = ap->a_vap;
 	struct rumpfs_node *rn = vp->v_data;
 	struct vattr *attr = >rn_va;
+	struct timespec now;
 	kauth_cred_t cred = ap->a_cred;
 	int error;
 
@@ -878,14 +905,22 @@ rump_vop_setattr(void *v)
 			return error;
 	}
 
-	SETIFVAL(va_atime.tv_sec, time_t);
-	SETIFVAL(va_ctime.tv_sec, time_t);
-	SETIFVAL(va_mtime.tv_sec, time_t);
+	int flags = 0;
+	if (vap->va_atime.tv_sec != VNOVAL)
+		if (!(vp->v_mount->mnt_flag & MNT_NOATIME))
+			flags |= RUMPFS_ACCESS;
+	if (vap->va_mtime.tv_sec != VNOVAL) {
+		flags |= RUMPFS_CHANGE | RUMPFS_MODIFY;
+		if (vp->v_mount->mnt_flag & MNT_RELATIME)
+			flags |= RUMPFS_ACCESS;
+	}
 	SETIFVAL(va_birthtime.tv_sec, time_t);
-	SETIFVAL(va_atime.tv_nsec, long);
-	SETIFVAL(va_ctime.tv_nsec, long);
-	SETIFVAL(va_mtime.tv_nsec, long);
 	SETIFVAL(va_birthtime.tv_nsec, long);
+	flags |= RUMPFS_CHANGE;
+	getnanotime();
+	error = rumpfs_update(flags, vp, >va_atime, >va_mtime, );
+	if (error)
+		return error;
 
 	if (CHANGED(va_flags, u_long)) {
 		/* XXX Can we handle system flags here...? */
@@ -1345,6 +1380,7 @@ rump_vop_read(void *v)
 	const int advice = IO_ADV_DECODE(ap->a_ioflag);
 	off_t chunk;
 	int error = 0;
+	struct timespec ts;
 
 	if (vp->v_type == VDIR)
 		return EISDIR;
@@ -1353,6 +1389,9 @@ rump_vop_read(void *v)
 	if (rn->rn_flags & RUMPNODE_ET_PHONE_HOST)
 		return etread(rn, uio);
 
+	getnanotime();
+	(void)rumpfs_update(RUMPFS_ACCESS, vp, , , );
+
 	/* otherwise, it's off to ubc with us */
 	while (uio->uio_resid > 0) {
 		chunk = MIN(uio->uio_resid, (off_t)rn->rn_dlen-uio->uio_offset);
@@ -1415,6 +1454,10 @@ rump_vop_write(void *v)
 	off_t chunk;
 	int error = 0;
 	bool allocd = false;
+	struct timespec ts;
+
+	getnanotime();
+	(void)rumpfs_update(RUMPFS_MODIFY, vp, , , );
 
 	if (ap->a_ioflag & IO_APPEND)
 		uio->uio_offset = vp->v_size;



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

2017-11-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Nov  9 12:46:55 UTC 2017

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

Log Message:
added booted_method


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/sys/rump/librump/rumpkern/emul.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.182 src/sys/rump/librump/rumpkern/emul.c:1.183
--- src/sys/rump/librump/rumpkern/emul.c:1.182	Sun Jun  4 04:05:42 2017
+++ src/sys/rump/librump/rumpkern/emul.c	Thu Nov  9 07:46:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.182 2017/06/04 08:05:42 hannken Exp $	*/
+/*	$NetBSD: emul.c,v 1.183 2017/11/09 12:46:55 christos Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.182 2017/06/04 08:05:42 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.183 2017/11/09 12:46:55 christos Exp $");
 
 #include 
 #include 
@@ -84,6 +84,7 @@ int mem_no = 2;
 device_t booted_device;
 device_t booted_wedge;
 int booted_partition;
+const char *booted_method;
 
 /* XXX: unused */
 kmutex_t tty_lock;



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

2017-09-16 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Sun Sep 17 05:47:19 UTC 2017

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

Log Message:
As if rump wasn't constipated enough...

Add some more blockages, hopefully allow the build to find a
path all the way to the other end...


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/rump/librump/rumpkern/locks.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/locks.c
diff -u src/sys/rump/librump/rumpkern/locks.c:1.74 src/sys/rump/librump/rumpkern/locks.c:1.75
--- src/sys/rump/librump/rumpkern/locks.c:1.74	Mon May  1 21:35:26 2017
+++ src/sys/rump/librump/rumpkern/locks.c	Sun Sep 17 05:47:19 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locks.c,v 1.74 2017/05/01 21:35:26 pgoyette Exp $	*/
+/*	$NetBSD: locks.c,v 1.75 2017/09/17 05:47:19 kre Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.74 2017/05/01 21:35:26 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.75 2017/09/17 05:47:19 kre Exp $");
 
 #include 
 #include 
@@ -98,7 +98,7 @@ static lockops_t rw_lockops = {
  * penalty.
  */
 
-#define RUMPMTX(mtx) (*(struct rumpuser_mtx **)(mtx))
+#define RUMPMTX(mtx) (*(struct rumpuser_mtx *const*)(mtx))
 
 void
 mutex_init(kmutex_t *mtx, kmutex_type_t type, int ipl)
@@ -183,7 +183,7 @@ mutex_exit(kmutex_t *mtx)
 __strong_alias(mutex_spin_exit,mutex_exit);
 
 int
-mutex_ownable(kmutex_t *mtx)
+mutex_ownable(const kmutex_t *mtx)
 {
 
 #ifdef LOCKDEBUG
@@ -193,14 +193,14 @@ mutex_ownable(kmutex_t *mtx)
 }
 
 int
-mutex_owned(kmutex_t *mtx)
+mutex_owned(const kmutex_t *mtx)
 {
 
 	return mutex_owner(mtx) == curlwp;
 }
 
-struct lwp *
-mutex_owner(kmutex_t *mtx)
+lwp_t *
+mutex_owner(const kmutex_t *mtx)
 {
 	struct lwp *l;
 



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

2017-07-24 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Tue Jul 25 05:01:25 UTC 2017

Modified Files:
src/sys/rump/librump/rumpkern: Makefile.rumpkern

Log Message:
Add localcount to rump kernels


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/sys/rump/librump/rumpkern/Makefile.rumpkern

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

Modified files:

Index: src/sys/rump/librump/rumpkern/Makefile.rumpkern
diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.169 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.170
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.169	Sat Apr  8 23:46:39 2017
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Tue Jul 25 05:01:25 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.169 2017/04/08 23:46:39 christos Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.170 2017/07/25 05:01:25 ozaki-r Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -109,6 +109,7 @@ SRCS+=	init_sysctl_base.c	\
 	subr_kcpuset.c		\
 	subr_kmem.c		\
 	subr_kobj.c		\
+	subr_localcount.c	\
 	subr_log.c		\
 	subr_lwp_specificdata.c	\
 	subr_once.c		\



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

2017-05-28 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Sun May 28 16:37:16 UTC 2017

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
Suspend file system for vgone().


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/rump/librump/rumpvfs/rumpfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.149 src/sys/rump/librump/rumpvfs/rumpfs.c:1.150
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.149	Fri May 26 14:21:00 2017
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Sun May 28 16:37:16 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.149 2017/05/26 14:21:00 riastradh Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.150 2017/05/28 16:37:16 hannken Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.149 2017/05/26 14:21:00 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.150 2017/05/28 16:37:16 hannken Exp $");
 
 #include 
 #include 
@@ -46,6 +46,7 @@ __KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1
 #include 
 #include 
 #include 
+#include 
 #include 
 
 #include 
@@ -491,8 +492,12 @@ etfsremove(const char *key)
 			mp = NULL;
 		}
 		mutex_exit();
-		if (mp && vcache_get(mp, , sizeof(rn), ) == 0)
+		if (mp && vcache_get(mp, , sizeof(rn), ) == 0) {
+			rv = vfs_suspend(mp, 0);
+			KASSERT(rv == 0);
 			vgone(vp);
+			vfs_resume(mp);
+		}
 	}
 
 	if (et->et_rn->rn_hostpath != NULL)



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

2017-05-14 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sun May 14 13:49:55 UTC 2017

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

Log Message:
Add uvm_map_pageable dummy function.  This means that the audio tests
should run again.

Ok christos@.


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.172 src/sys/rump/librump/rumpkern/vm.c:1.173
--- src/sys/rump/librump/rumpkern/vm.c:1.172	Sun May  7 14:20:50 2017
+++ src/sys/rump/librump/rumpkern/vm.c	Sun May 14 13:49:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.172 2017/05/07 14:20:50 martin Exp $	*/
+/*	$NetBSD: vm.c,v 1.173 2017/05/14 13:49:55 nat Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.172 2017/05/07 14:20:50 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.173 2017/05/14 13:49:55 nat Exp $");
 
 #include 
 #include 
@@ -409,6 +409,13 @@ uvmspace_init(struct vmspace *vm, struct
 	vm->vm_refcnt = 1;
 }
 
+int
+uvm_map_pageable(struct vm_map *map, vaddr_t start, vaddr_t end,
+bool new_pageable, int lockflags)
+{
+	return 0;
+}
+
 void
 uvm_pagewire(struct vm_page *pg)
 {



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

2017-05-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  7 14:20:50 UTC 2017

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

Log Message:
Provide stupid uvm_map() and uvm_unmap1() immplementations - might be enough
to get audio tests in rump going again.
XXX needs a RUMP chef to review/replace by something sane!


To generate a diff of this commit:
cvs rdiff -u -r1.171 -r1.172 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.171 src/sys/rump/librump/rumpkern/vm.c:1.172
--- src/sys/rump/librump/rumpkern/vm.c:1.171	Sun May  7 11:48:39 2017
+++ src/sys/rump/librump/rumpkern/vm.c	Sun May  7 14:20:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.171 2017/05/07 11:48:39 martin Exp $	*/
+/*	$NetBSD: vm.c,v 1.172 2017/05/07 14:20:50 martin Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.171 2017/05/07 11:48:39 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.172 2017/05/07 14:20:50 martin Exp $");
 
 #include 
 #include 
@@ -720,7 +720,15 @@ uvm_map(struct vm_map *map, vaddr_t *sta
 uvm_flag_t flags)
 {
 
-	return EOPNOTSUPP;
+	*startp = (vaddr_t)rump_hypermalloc(size, align, true, "uvm_map");
+	return *startp != 0 ? 0 : ENOMEM;
+}
+
+void
+uvm_unmap1(struct vm_map *map, vaddr_t start, vaddr_t end, int flags)
+{
+
+	rump_hyperfree((void*)start, end-start);
 }
 
 



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

2017-05-07 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun May  7 11:48:40 UTC 2017

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

Log Message:
Add a dummy (non-working) uvm_map().
XXX someone with a clue please fix this for real!


To generate a diff of this commit:
cvs rdiff -u -r1.170 -r1.171 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.170 src/sys/rump/librump/rumpkern/vm.c:1.171
--- src/sys/rump/librump/rumpkern/vm.c:1.170	Wed Jul 20 17:03:50 2016
+++ src/sys/rump/librump/rumpkern/vm.c	Sun May  7 11:48:39 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.170 2016/07/20 17:03:50 christos Exp $	*/
+/*	$NetBSD: vm.c,v 1.171 2017/05/07 11:48:39 martin Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.170 2016/07/20 17:03:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.171 2017/05/07 11:48:39 martin Exp $");
 
 #include 
 #include 
@@ -714,6 +714,16 @@ uvm_map_protect(struct vm_map *map, vadd
 	return EOPNOTSUPP;
 }
 
+int
+uvm_map(struct vm_map *map, vaddr_t *startp, vsize_t size,
+struct uvm_object *uobj, voff_t uoffset, vsize_t align,
+uvm_flag_t flags)
+{
+
+	return EOPNOTSUPP;
+}
+
+
 /*
  * UVM km
  */



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

2017-04-21 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Apr 21 19:16:10 UTC 2017

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

Log Message:
Fix build of rump after change in lwp_create's signature


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/rump/librump/rumpkern/threads.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/threads.c
diff -u src/sys/rump/librump/rumpkern/threads.c:1.25 src/sys/rump/librump/rumpkern/threads.c:1.26
--- src/sys/rump/librump/rumpkern/threads.c:1.25	Fri Apr 21 15:10:35 2017
+++ src/sys/rump/librump/rumpkern/threads.c	Fri Apr 21 19:16:10 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: threads.c,v 1.25 2017/04/21 15:10:35 christos Exp $	*/
+/*	$NetBSD: threads.c,v 1.26 2017/04/21 19:16:10 kamil Exp $	*/
 
 /*
  * Copyright (c) 2007-2009 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: threads.c,v 1.25 2017/04/21 15:10:35 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: threads.c,v 1.26 2017/04/21 19:16:10 kamil Exp $");
 
 #include 
 #include 
@@ -294,7 +294,7 @@ lwpbouncer(void *arg)
 int
 lwp_create(struct lwp *l1, struct proc *p2, vaddr_t uaddr, int flags,
 void *stack, size_t stacksize, void (*func)(void *), void *arg,
-struct lwp **newlwpp, int sclass, const sigmask_t *sigmask,
+struct lwp **newlwpp, int sclass, const sigset_t *sigmask,
 const stack_t *sigstk)
 {
 	struct thrdesc *td;



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

2017-04-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  8 23:46:39 UTC 2017

Modified Files:
src/sys/rump/librump/rumpkern: Makefile.rumpkern

Log Message:
adjust flag.


To generate a diff of this commit:
cvs rdiff -u -r1.168 -r1.169 src/sys/rump/librump/rumpkern/Makefile.rumpkern

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

Modified files:

Index: src/sys/rump/librump/rumpkern/Makefile.rumpkern
diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.168 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.169
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.168	Sat Aug 20 11:50:50 2016
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Sat Apr  8 19:46:39 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.168 2016/08/20 15:50:50 christos Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.169 2017/04/08 23:46:39 christos Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -51,7 +51,7 @@ SRCS+=	locks.c
 vers.c: ${RUMPTOP}/../conf/newvers.sh ${RUMPTOP}/../conf/osrelease.sh \
 		${RUMPTOP}/../sys/param.h ${_NETBSD_VERSION_DEPENDS}
 	${_MKMSG_CREATE} vers.c
-	${HOST_SH} ${RUMPTOP}/../conf/newvers.sh -i RUMP-ROAST -n -r
+	${HOST_SH} ${RUMPTOP}/../conf/newvers.sh -i RUMP-ROAST -n -R
 SRCS+=		vers.c
 CLEANFILES+=	vers.c version
 



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

2017-02-22 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Wed Feb 22 11:20:59 UTC 2017

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

Log Message:
Add weak aliases for _fstrans_start() and fstrans_done().


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/sys/rump/librump/rumpkern/emul.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.180 src/sys/rump/librump/rumpkern/emul.c:1.181
--- src/sys/rump/librump/rumpkern/emul.c:1.180	Thu Dec 22 16:05:15 2016
+++ src/sys/rump/librump/rumpkern/emul.c	Wed Feb 22 11:20:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.180 2016/12/22 16:05:15 cherry Exp $	*/
+/*	$NetBSD: emul.c,v 1.181 2017/02/22 11:20:59 hannken Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,11 +26,12 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.180 2016/12/22 16:05:15 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.181 2017/02/22 11:20:59 hannken Exp $");
 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -240,6 +241,25 @@ void (*delay_func)(unsigned int) = rump_
 __strong_alias(delay,rump_delay);
 __strong_alias(_delay,rump_delay);
 
+/* Weak aliases for fstrans to be used unless librumpvfs is present. */
+
+int rump__fstrans_start(struct mount *, enum fstrans_lock_type, int);
+int
+rump__fstrans_start(struct mount *mp, enum fstrans_lock_type lock, int wait)
+{
+
+	return 0;
+}
+__weak_alias(_fstrans_start,rump__fstrans_start);
+
+void rump_fstrans_done(struct mount *);
+void
+rump_fstrans_done(struct mount *mp)
+{
+
+}
+__weak_alias(fstrans_done,rump_fstrans_done);
+
 /*
  * Provide weak aliases for tty routines used by printf.
  * They will be used unless the rumpkern_tty component is present.



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

2017-01-27 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Fri Jan 27 10:48:51 UTC 2017

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
Run vflush() when going from read/write to read only.
Set link count to zero once a node has been removed.
"Implement" MNT_GETARGS.


To generate a diff of this commit:
cvs rdiff -u -r1.142 -r1.143 src/sys/rump/librump/rumpvfs/rumpfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.142 src/sys/rump/librump/rumpvfs/rumpfs.c:1.143
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.142	Sat Aug 20 12:37:09 2016
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Fri Jan 27 10:48:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.142 2016/08/20 12:37:09 hannken Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.143 2017/01/27 10:48:51 hannken Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.142 2016/08/20 12:37:09 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.143 2017/01/27 10:48:51 hannken Exp $");
 
 #include 
 #include 
@@ -216,6 +216,7 @@ struct rumpfs_node {
 
 struct rumpfs_mount {
 	struct vnode *rfsmp_rvp;
+	bool rfsmp_rdonly;
 };
 
 #define INO_WHITEOUT 1
@@ -1012,6 +1013,7 @@ rump_vop_rmdir(void *v)
 	freedir(rnd, cnp);
 	rn->rn_flags |= RUMPNODE_CANRECLAIM;
 	rn->rn_parent = NULL;
+	rn->rn_va.va_nlink = 0;
 
 out:
 	vput(dvp);
@@ -1040,6 +1042,7 @@ rump_vop_remove(void *v)
 
 	freedir(rnd, cnp);
 	rn->rn_flags |= RUMPNODE_CANRECLAIM;
+	rn->rn_va.va_nlink = 0;
 
 	vput(dvp);
 	vput(vp);
@@ -1803,6 +1806,7 @@ rumpfs_mountfs(struct mount *mp)
 	}
 
 	rfsmp->rfsmp_rvp->v_vflag |= VV_ROOT;
+	rfsmp->rfsmp_rdonly = (mp->mnt_flag & MNT_RDONLY) != 0;
 
 	mp->mnt_data = rfsmp;
 	mp->mnt_stat.f_namemax = RUMPFS_MAXNAMLEN;
@@ -1818,9 +1822,27 @@ rumpfs_mountfs(struct mount *mp)
 int
 rumpfs_mount(struct mount *mp, const char *mntpath, void *arg, size_t *alen)
 {
-	int error;
+	struct rumpfs_mount *rfsmp = mp->mnt_data;
+	int error, flags;
 
+	if (mp->mnt_flag & MNT_GETARGS) {
+		return 0;
+	}
 	if (mp->mnt_flag & MNT_UPDATE) {
+		if (!rfsmp->rfsmp_rdonly && (mp->mnt_flag & MNT_RDONLY)) {
+			/* Changing from read/write to read-only. */
+			flags = WRITECLOSE;
+			if ((mp->mnt_flag & MNT_FORCE))
+flags |= FORCECLOSE;
+			error = vflush(mp, NULL, flags);
+			if (error)
+return error;
+			rfsmp->rfsmp_rdonly = true;
+		}
+		if (rfsmp->rfsmp_rdonly && (mp->mnt_flag & IMNT_WANTRDWR)) {
+			/* Changing from read-only to read/write. */
+			rfsmp->rfsmp_rdonly = false;
+		}
 		return 0;
 	}
 
@@ -1944,6 +1966,7 @@ int
 rumpfs_mountroot()
 {
 	struct mount *mp;
+	struct rumpfs_mount *rfsmp;
 	int error;
 
 	if ((error = vfs_rootmountalloc(MOUNT_RUMPFS, "rootdev", )) != 0) {
@@ -1961,7 +1984,9 @@ rumpfs_mountroot()
 	if (error)
 		panic("set_statvfs_info failed for rootfs: %d", error);
 
+	rfsmp = mp->mnt_data;
 	mp->mnt_flag &= ~MNT_RDONLY;
+	rfsmp->rfsmp_rdonly = false;
 	vfs_unbusy(mp, false, NULL);
 
 	return 0;



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

2017-01-27 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jan 27 09:50:47 UTC 2017

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

Log Message:
Unbreak builds of rump libraries with RUMP_LOCKDEBUG


To generate a diff of this commit:
cvs rdiff -u -r1.72 -r1.73 src/sys/rump/librump/rumpkern/locks.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/locks.c
diff -u src/sys/rump/librump/rumpkern/locks.c:1.72 src/sys/rump/librump/rumpkern/locks.c:1.73
--- src/sys/rump/librump/rumpkern/locks.c:1.72	Tue Jan 26 23:12:17 2016
+++ src/sys/rump/librump/rumpkern/locks.c	Fri Jan 27 09:50:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: locks.c,v 1.72 2016/01/26 23:12:17 pooka Exp $	*/
+/*	$NetBSD: locks.c,v 1.73 2017/01/27 09:50:47 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.72 2016/01/26 23:12:17 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.73 2017/01/27 09:50:47 ozaki-r Exp $");
 
 #include 
 #include 
@@ -61,18 +61,22 @@ static lockops_t rw_lockops = {
 	NULL
 };
 
-#define ALLOCK(lock, ops)		\
-lockdebug_alloc(lock, ops, (uintptr_t)__builtin_return_address(0))
+#define ALLOCK(lock, ops)\
+lockdebug_alloc(__func__, __LINE__, lock, ops,	\
+(uintptr_t)__builtin_return_address(0))
 #define FREELOCK(lock)			\
-lockdebug_free(lock)
-#define WANTLOCK(lock, shar)	\
-lockdebug_wantlock(lock, (uintptr_t)__builtin_return_address(0), shar)
-#define LOCKED(lock, shar)		\
-lockdebug_locked(lock, NULL, (uintptr_t)__builtin_return_address(0), shar)
+lockdebug_free(__func__, __LINE__, lock)
+#define WANTLOCK(lock, shar)\
+lockdebug_wantlock(__func__, __LINE__, lock,	\
+(uintptr_t)__builtin_return_address(0), shar)
+#define LOCKED(lock, shar)\
+lockdebug_locked(__func__, __LINE__, lock, NULL,	\
+(uintptr_t)__builtin_return_address(0), shar)
 #define UNLOCKED(lock, shar)		\
-lockdebug_unlocked(lock, (uintptr_t)__builtin_return_address(0), shar)
+lockdebug_unlocked(__func__, __LINE__, lock,	\
+(uintptr_t)__builtin_return_address(0), shar)
 #define BARRIER(lock, slp)		\
-lockdebug_barrier(lock, slp)
+lockdebug_barrier(__func__, __LINE__, lock, slp)
 #else
 #define ALLOCK(a, b)
 #define FREELOCK(a)



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

2017-01-16 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 17 02:03:09 UTC 2017

Modified Files:
src/sys/rump/librump/rumpnet: rump_net.c

Log Message:
call pfil_init() here.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/rump/librump/rumpnet/rump_net.c

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

Modified files:

Index: src/sys/rump/librump/rumpnet/rump_net.c
diff -u src/sys/rump/librump/rumpnet/rump_net.c:1.19 src/sys/rump/librump/rumpnet/rump_net.c:1.20
--- src/sys/rump/librump/rumpnet/rump_net.c:1.19	Mon Apr 11 04:56:16 2016
+++ src/sys/rump/librump/rumpnet/rump_net.c	Mon Jan 16 21:03:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_net.c,v 1.19 2016/04/11 08:56:16 ozaki-r Exp $	*/
+/*	$NetBSD: rump_net.c,v 1.20 2017/01/17 02:03:09 christos Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_net.c,v 1.19 2016/04/11 08:56:16 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_net.c,v 1.20 2017/01/17 02:03:09 christos Exp $");
 
 #include 
 
@@ -35,6 +35,7 @@ __KERNEL_RCSID(0, "$NetBSD: rump_net.c,v
 #include 
 
 #include 
+#include 
 #include 
 
 #include 
@@ -47,6 +48,7 @@ RUMP_COMPONENT(RUMP__FACTION_NET)
 
 	mbinit();
 	soinit();
+	pfil_init();
 
 	domaininit(false);
 



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

2016-11-17 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Thu Nov 17 23:15:38 UTC 2016

Modified Files:
src/sys/rump/librump/rumpvfs: rump_vfs.c

Log Message:
In addition to initializing the bufq subsystem, we also need to init
the individual strategy modules.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/rump/librump/rumpvfs/rump_vfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rump_vfs.c
diff -u src/sys/rump/librump/rumpvfs/rump_vfs.c:1.85 src/sys/rump/librump/rumpvfs/rump_vfs.c:1.86
--- src/sys/rump/librump/rumpvfs/rump_vfs.c:1.85	Wed Nov 16 23:24:47 2016
+++ src/sys/rump/librump/rumpvfs/rump_vfs.c	Thu Nov 17 23:15:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_vfs.c,v 1.85 2016/11/16 23:24:47 pgoyette Exp $	*/
+/*	$NetBSD: rump_vfs.c,v 1.86 2016/11/17 23:15:38 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_vfs.c,v 1.85 2016/11/16 23:24:47 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_vfs.c,v 1.86 2016/11/17 23:15:38 pgoyette Exp $");
 
 #include 
 #include 
@@ -171,6 +171,7 @@ RUMP_COMPONENT(RUMP__FACTION_VFS)
 		}
 	}
 
+	module_init_class(MODULE_CLASS_BUFQ);
 	module_init_class(MODULE_CLASS_VFS);
 
 	/*



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

2016-11-16 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Wed Nov 16 23:24:47 UTC 2016

Modified Files:
src/sys/rump/librump/rumpvfs: rump_vfs.c

Log Message:
Initialize the bufq stuff for rump, too.

This should fix the large number of tests that recently started to fail.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/rump/librump/rumpvfs/rump_vfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rump_vfs.c
diff -u src/sys/rump/librump/rumpvfs/rump_vfs.c:1.84 src/sys/rump/librump/rumpvfs/rump_vfs.c:1.85
--- src/sys/rump/librump/rumpvfs/rump_vfs.c:1.84	Tue Jan 26 23:12:18 2016
+++ src/sys/rump/librump/rumpvfs/rump_vfs.c	Wed Nov 16 23:24:47 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_vfs.c,v 1.84 2016/01/26 23:12:18 pooka Exp $	*/
+/*	$NetBSD: rump_vfs.c,v 1.85 2016/11/16 23:24:47 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_vfs.c,v 1.84 2016/01/26 23:12:18 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_vfs.c,v 1.85 2016/11/16 23:24:47 pgoyette Exp $");
 
 #include 
 #include 
@@ -47,6 +47,7 @@ __KERNEL_RCSID(0, "$NetBSD: rump_vfs.c,v
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -120,6 +121,7 @@ RUMP_COMPONENT(RUMP__FACTION_VFS)
 		bufpages = rump_physmemlimit / (20 * PAGE_SIZE);
 	}
 
+	bufq_init();
 	vfsinit();
 	bufinit();
 	cwd_sys_init();



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

2016-08-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Aug 20 15:50:50 UTC 2016

Modified Files:
src/sys/rump/librump/rumpkern: Makefile.rumpkern

Log Message:
need kern_ssp.c for a full SSP build.


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/rump/librump/rumpkern/Makefile.rumpkern

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

Modified files:

Index: src/sys/rump/librump/rumpkern/Makefile.rumpkern
diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.167 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.168
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.167	Mon Apr 11 02:49:11 2016
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Sat Aug 20 11:50:50 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.167 2016/04/11 06:49:11 ozaki-r Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.168 2016/08/20 15:50:50 christos Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -87,6 +87,7 @@ SRCS+=	init_sysctl_base.c	\
 	kern_rndsink.c		\
 	kern_rwlock_obj.c	\
 	kern_stub.c		\
+	kern_ssp.c		\
 	kern_syscall.c		\
 	kern_sysctl.c		\
 	kern_tc.c		\



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

2016-07-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Jul 20 17:03:50 UTC 2016

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

Log Message:
add uvm_km_protect()


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.169 src/sys/rump/librump/rumpkern/vm.c:1.170
--- src/sys/rump/librump/rumpkern/vm.c:1.169	Tue Jan 26 18:12:18 2016
+++ src/sys/rump/librump/rumpkern/vm.c	Wed Jul 20 13:03:50 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.169 2016/01/26 23:12:18 pooka Exp $	*/
+/*	$NetBSD: vm.c,v 1.170 2016/07/20 17:03:50 christos Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.169 2016/01/26 23:12:18 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.170 2016/07/20 17:03:50 christos Exp $");
 
 #include 
 #include 
@@ -781,6 +781,12 @@ uvm_km_free(struct vm_map *map, vaddr_t 
 		rumpuser_free((void *)vaddr, size);
 }
 
+int
+uvm_km_protect(struct vm_map *map, vaddr_t vaddr, vsize_t size, vm_prot_t prot)
+{
+	return 0;
+}
+
 struct vm_map *
 uvm_km_suballoc(struct vm_map *map, vaddr_t *minaddr, vaddr_t *maxaddr,
 	vsize_t size, int pageable, bool fixed, struct vm_map *submap)



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

2016-05-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat May 21 14:59:45 UTC 2016

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

Log Message:
Actually get as many bytes as requested from rumpuser_random.

rumpuser_random is limited to 32 bytes at a time -- which would be
reasonable, except that there are too many buffers in the way between
entropy sources and users of the entropy pool.

Partial fix for PR kern/51135.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/rump/librump/rumpkern/hyperentropy.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/hyperentropy.c
diff -u src/sys/rump/librump/rumpkern/hyperentropy.c:1.14 src/sys/rump/librump/rumpkern/hyperentropy.c:1.15
--- src/sys/rump/librump/rumpkern/hyperentropy.c:1.14	Wed Feb 17 01:48:36 2016
+++ src/sys/rump/librump/rumpkern/hyperentropy.c	Sat May 21 14:59:45 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperentropy.c,v 1.14 2016/02/17 01:48:36 riastradh Exp $	*/
+/*	$NetBSD: hyperentropy.c,v 1.15 2016/05/21 14:59:45 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2014 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.14 2016/02/17 01:48:36 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.15 2016/05/21 14:59:45 riastradh Exp $");
 
 #include 
 #include 
@@ -46,13 +46,20 @@ static void
 feedrandom(size_t bytes, void *cookie __unused)
 {
 	uint8_t *rnddata;
-	size_t dsize;
+	size_t n, nread;
 
 	rnddata = kmem_intr_alloc(MAXGET, KM_SLEEP);
-	if (rumpuser_getrandom(rnddata, MIN(MAXGET, bytes),
-	RUMPUSER_RANDOM_HARD|RUMPUSER_RANDOM_NOWAIT, ) == 0) {
+	n = 0;
+	while (n < MIN(MAXGET, bytes)) {
+		if (rumpuser_getrandom(rnddata + n, MIN(MAXGET, bytes) - n,
+			RUMPUSER_RANDOM_HARD|RUMPUSER_RANDOM_NOWAIT, )
+		!= 0)
+			break;
+		n += MIN(nread, MIN(MAXGET, bytes) - n);
+	}
+	if (n) {
 		mutex_enter(_lock);
-		rnd_add_data_sync(, rnddata, dsize, NBBY*dsize);
+		rnd_add_data_sync(, rnddata, n, NBBY*n);
 		mutex_exit(_lock);
 	}
 	kmem_intr_free(rnddata, MAXGET);



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

2016-04-24 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Apr 24 07:45:10 UTC 2016

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

Log Message:
Add lwp_find() - verbatim copy from the hard kernel.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/rump/librump/rumpkern/lwproc.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/lwproc.c
diff -u src/sys/rump/librump/rumpkern/lwproc.c:1.39 src/sys/rump/librump/rumpkern/lwproc.c:1.40
--- src/sys/rump/librump/rumpkern/lwproc.c:1.39	Mon Apr  4 20:47:57 2016
+++ src/sys/rump/librump/rumpkern/lwproc.c	Sun Apr 24 07:45:10 2016
@@ -1,4 +1,4 @@
-/*  $NetBSD: lwproc.c,v 1.39 2016/04/04 20:47:57 christos Exp $	*/
+/*  $NetBSD: lwproc.c,v 1.40 2016/04/24 07:45:10 martin Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #define RUMP__CURLWP_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.39 2016/04/04 20:47:57 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.40 2016/04/24 07:45:10 martin Exp $");
 
 #include 
 #include 
@@ -69,6 +69,33 @@ lwp_unsleep(lwp_t *l, bool cleanup)
 	(*l->l_syncobj->sobj_unsleep)(l, cleanup);
 }
 
+/*
+ * Look up a live LWP within the specified process.
+ * 
+ * Must be called with p->p_lock held.
+ */
+struct lwp *
+lwp_find(struct proc *p, lwpid_t id)
+{
+	struct lwp *l;
+
+	KASSERT(mutex_owned(p->p_lock));
+
+	LIST_FOREACH(l, >p_lwps, l_sibling) {
+		if (l->l_lid == id)
+			break;
+	}
+
+	/*
+	 * No need to lock - all of these conditions will
+	 * be visible with the process level mutex held.
+	 */
+	if (l != NULL && (l->l_stat == LSIDL || l->l_stat == LSZOMB))
+		l = NULL;
+
+	return l;
+}
+
 void
 lwp_update_creds(struct lwp *l)
 {



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

2016-04-11 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Apr 11 06:49:11 UTC 2016

Modified Files:
src/sys/rump/librump/rumpkern: Makefile.rumpkern

Log Message:
Add psref to rump kernel


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 src/sys/rump/librump/rumpkern/Makefile.rumpkern

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

Modified files:

Index: src/sys/rump/librump/rumpkern/Makefile.rumpkern
diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.166 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.167
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.166	Tue Jan 26 23:41:15 2016
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Mon Apr 11 06:49:11 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.166 2016/01/26 23:41:15 pooka Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.167 2016/04/11 06:49:11 ozaki-r Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -116,6 +116,7 @@ SRCS+=	init_sysctl_base.c	\
 	subr_pool.c		\
 	subr_prf.c		\
 	subr_pserialize.c	\
+	subr_psref.c		\
 	subr_specificdata.c	\
 	subr_time.c		\
 	subr_vmem.c		\



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

2016-03-08 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Tue Mar  8 14:30:48 UTC 2016

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

Log Message:
Align the message buffer. The kernel routines normally are used only
with page aligned buffers and they assume at least pointer alignment. Be
defensive here and align to 256 Bytes.


To generate a diff of this commit:
cvs rdiff -u -r1.328 -r1.329 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.328 src/sys/rump/librump/rumpkern/rump.c:1.329
--- src/sys/rump/librump/rumpkern/rump.c:1.328	Mon Feb  8 18:18:19 2016
+++ src/sys/rump/librump/rumpkern/rump.c	Tue Mar  8 14:30:48 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.328 2016/02/08 18:18:19 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.329 2016/03/08 14:30:48 joerg Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.328 2016/02/08 18:18:19 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.329 2016/03/08 14:30:48 joerg Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -106,7 +106,8 @@ int rump_threads = 1;
 static void rump_component_addlocal(void);
 static struct lwp *bootlwp;
 
-static char rump_msgbuf[16*1024]; /* 16k should be enough for std rump needs */
+/* 16k should be enough for std rump needs */
+static  char rump_msgbuf[16*1024] __aligned(256);
 
 bool rump_ttycomponent = false;
 



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

2016-03-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar  7 00:51:32 UTC 2016

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
Avoid void * arithmetic


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/rump/librump/rumpvfs/rumpfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.139 src/sys/rump/librump/rumpvfs/rumpfs.c:1.140
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.139	Sun Mar  6 14:47:41 2016
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Sun Mar  6 19:51:32 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.139 2016/03/06 19:47:41 christos Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.140 2016/03/07 00:51:32 christos Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.139 2016/03/06 19:47:41 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.140 2016/03/07 00:51:32 christos Exp $");
 
 #include 
 #include 
@@ -934,7 +934,7 @@ rump_vop_setattr(void *v)
 
 		copylen = MIN(rn->rn_dlen, newlen);
 		memcpy(newdata, rn->rn_data, copylen);
-		memset(newdata + copylen, 0, newlen - copylen);
+		memset((char *)newdata + copylen, 0, newlen - copylen);
 
 		if ((rn->rn_flags & RUMPNODE_EXTSTORAGE) == 0) {
 			rump_hyperfree(rn->rn_data, rn->rn_dlen);



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

2016-03-06 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  6 19:47:41 UTC 2016

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
PR/50900: David Binderman: optimize memset


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/rump/librump/rumpvfs/rumpfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.138 src/sys/rump/librump/rumpvfs/rumpfs.c:1.139
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.138	Tue Feb  2 08:02:34 2016
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Sun Mar  6 14:47:41 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.138 2016/02/02 13:02:34 pooka Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.139 2016/03/06 19:47:41 christos Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.138 2016/02/02 13:02:34 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.139 2016/03/06 19:47:41 christos Exp $");
 
 #include 
 #include 
@@ -933,8 +933,8 @@ rump_vop_setattr(void *v)
 			return ENOSPC;
 
 		copylen = MIN(rn->rn_dlen, newlen);
-		memset(newdata, 0, newlen);
 		memcpy(newdata, rn->rn_data, copylen);
+		memset(newdata + copylen, 0, newlen - copylen);
 
 		if ((rn->rn_flags & RUMPNODE_EXTSTORAGE) == 0) {
 			rump_hyperfree(rn->rn_data, rn->rn_dlen);



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

2016-02-19 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Feb 19 18:38:37 UTC 2016

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

Log Message:
add cpu_lock

from freqlabs on irc


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/rump/librump/rumpkern/scheduler.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/scheduler.c
diff -u src/sys/rump/librump/rumpkern/scheduler.c:1.43 src/sys/rump/librump/rumpkern/scheduler.c:1.44
--- src/sys/rump/librump/rumpkern/scheduler.c:1.43	Mon Feb  8 18:18:19 2016
+++ src/sys/rump/librump/rumpkern/scheduler.c	Fri Feb 19 18:38:37 2016
@@ -1,4 +1,4 @@
-/*  $NetBSD: scheduler.c,v 1.43 2016/02/08 18:18:19 pooka Exp $	*/
+/*  $NetBSD: scheduler.c,v 1.44 2016/02/19 18:38:37 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.43 2016/02/08 18:18:19 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.44 2016/02/19 18:38:37 pooka Exp $");
 
 #include 
 #include 
@@ -80,6 +80,8 @@ kcpuset_t *kcpuset_attached = NULL;
 kcpuset_t *kcpuset_running = NULL;
 int ncpu, ncpuonline;
 
+kmutex_t cpu_lock;
+
 #define RCPULWP_BUSY	((void *)-1)
 #define RCPULWP_WANTED	((void *)-2)
 
@@ -141,6 +143,8 @@ rump_cpus_bootstrap(int *nump)
 		num = MAXCPUS;
 	}
 
+	mutex_init(_lock, MUTEX_DEFAULT, IPL_NONE);
+
 	kcpuset_create(_attached, true);
 	kcpuset_create(_running, true);
 



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

2016-02-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Feb 17 01:48:36 UTC 2016

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

Log Message:
Need  for mutex(9).


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/rump/librump/rumpkern/hyperentropy.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/hyperentropy.c
diff -u src/sys/rump/librump/rumpkern/hyperentropy.c:1.13 src/sys/rump/librump/rumpkern/hyperentropy.c:1.14
--- src/sys/rump/librump/rumpkern/hyperentropy.c:1.13	Wed Feb 17 01:48:04 2016
+++ src/sys/rump/librump/rumpkern/hyperentropy.c	Wed Feb 17 01:48:36 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperentropy.c,v 1.13 2016/02/17 01:48:04 riastradh Exp $	*/
+/*	$NetBSD: hyperentropy.c,v 1.14 2016/02/17 01:48:36 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2014 Antti Kantee.  All Rights Reserved.
@@ -26,10 +26,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.13 2016/02/17 01:48:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.14 2016/02/17 01:48:36 riastradh Exp $");
 
 #include 
 #include 
+#include 
 #include 
 #include 
 



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

2016-02-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Feb 17 01:48:04 UTC 2016

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

Log Message:
Caller must have exclusive access to rndsource for rnd_add_data(_sync).


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/rump/librump/rumpkern/hyperentropy.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/hyperentropy.c
diff -u src/sys/rump/librump/rumpkern/hyperentropy.c:1.12 src/sys/rump/librump/rumpkern/hyperentropy.c:1.13
--- src/sys/rump/librump/rumpkern/hyperentropy.c:1.12	Wed Feb 17 01:42:25 2016
+++ src/sys/rump/librump/rumpkern/hyperentropy.c	Wed Feb 17 01:48:04 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperentropy.c,v 1.12 2016/02/17 01:42:25 riastradh Exp $	*/
+/*	$NetBSD: hyperentropy.c,v 1.13 2016/02/17 01:48:04 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2014 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.12 2016/02/17 01:42:25 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.13 2016/02/17 01:48:04 riastradh Exp $");
 
 #include 
 #include 
@@ -37,6 +37,7 @@ __KERNEL_RCSID(0, "$NetBSD: hyperentropy
 
 #include 
 
+static kmutex_t rndsrc_lock;
 static krndsource_t rndsrc;
 
 #define MAXGET (RND_POOLBITS/NBBY)
@@ -48,8 +49,11 @@ feedrandom(size_t bytes, void *cookie __
 
 	rnddata = kmem_intr_alloc(MAXGET, KM_SLEEP);
 	if (rumpuser_getrandom(rnddata, MIN(MAXGET, bytes),
-	RUMPUSER_RANDOM_HARD|RUMPUSER_RANDOM_NOWAIT, ) == 0)
+	RUMPUSER_RANDOM_HARD|RUMPUSER_RANDOM_NOWAIT, ) == 0) {
+		mutex_enter(_lock);
 		rnd_add_data_sync(, rnddata, dsize, NBBY*dsize);
+		mutex_exit(_lock);
+	}
 	kmem_intr_free(rnddata, MAXGET);
 }
 
@@ -57,6 +61,8 @@ void
 rump_hyperentropy_init(void)
 {
 
+	mutex_init(_lock, MUTEX_DEFAULT, IPL_VM);
+
 	rndsource_setcb(, , NULL);
 	rnd_attach_source(, "rump_hyperent", RND_TYPE_VM,
 	RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);



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

2016-02-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Feb 17 01:42:25 UTC 2016

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

Log Message:
Make hyperentropy rndsource work synchronously, again.

This time for real!  *crosses fingers*


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/rump/librump/rumpkern/hyperentropy.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/hyperentropy.c
diff -u src/sys/rump/librump/rumpkern/hyperentropy.c:1.11 src/sys/rump/librump/rumpkern/hyperentropy.c:1.12
--- src/sys/rump/librump/rumpkern/hyperentropy.c:1.11	Tue Jan 26 23:12:17 2016
+++ src/sys/rump/librump/rumpkern/hyperentropy.c	Wed Feb 17 01:42:25 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperentropy.c,v 1.11 2016/01/26 23:12:17 pooka Exp $	*/
+/*	$NetBSD: hyperentropy.c,v 1.12 2016/02/17 01:42:25 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2014 Antti Kantee.  All Rights Reserved.
@@ -26,10 +26,9 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.11 2016/01/26 23:12:17 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hyperentropy.c,v 1.12 2016/02/17 01:42:25 riastradh Exp $");
 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -39,12 +38,10 @@ __KERNEL_RCSID(0, "$NetBSD: hyperentropy
 #include 
 
 static krndsource_t rndsrc;
-static volatile unsigned hyperentropy_wanted;
-static void *feedrandom_softint;
 
 #define MAXGET (RND_POOLBITS/NBBY)
 static void
-feedrandom(size_t bytes)
+feedrandom(size_t bytes, void *cookie __unused)
 {
 	uint8_t *rnddata;
 	size_t dsize;
@@ -52,46 +49,16 @@ feedrandom(size_t bytes)
 	rnddata = kmem_intr_alloc(MAXGET, KM_SLEEP);
 	if (rumpuser_getrandom(rnddata, MIN(MAXGET, bytes),
 	RUMPUSER_RANDOM_HARD|RUMPUSER_RANDOM_NOWAIT, ) == 0)
-		rnd_add_data(, rnddata, dsize, NBBY*dsize);
+		rnd_add_data_sync(, rnddata, dsize, NBBY*dsize);
 	kmem_intr_free(rnddata, MAXGET);
 }
 
-static void
-feedrandom_intr(void *cookie __unused)
-{
-
-	feedrandom(atomic_swap_uint(_wanted, 0));
-}
-
-static void
-feedrandom_cb(size_t bytes, void *cookie __unused)
-{
-	unsigned old, new;
-
-	do {
-		old = hyperentropy_wanted;
-		new = ((MAXGET - old) < bytes? MAXGET : (old + bytes));
-	} while (atomic_cas_uint(_wanted, old, new) != old);
-
-	softint_schedule(feedrandom_softint);
-}
-
 void
 rump_hyperentropy_init(void)
 {
 
-	if (rump_threads) {
-		feedrandom_softint =
-		softint_establish(SOFTINT_CLOCK|SOFTINT_MPSAFE,
-			feedrandom_intr, NULL);
-		KASSERT(feedrandom_softint != NULL);
-		rndsource_setcb(, feedrandom_cb, );
-		rnd_attach_source(, "rump_hyperent", RND_TYPE_VM,
-		RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
-	} else {
-		/* without threads, just fill the pool */
-		rnd_attach_source(, "rump_hyperent", RND_TYPE_VM,
-		RND_FLAG_COLLECT_VALUE);
-		feedrandom(MAXGET);
-	}
+	rndsource_setcb(, , NULL);
+	rnd_attach_source(, "rump_hyperent", RND_TYPE_VM,
+	RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
+	feedrandom(MAXGET, NULL);
 }



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

2016-02-02 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Feb  2 13:02:34 UTC 2016

Modified Files:
src/sys/rump/librump/rumpvfs: rumpfs.c

Log Message:
optimize for size a.k.a. operation nuke trailing spaces


To generate a diff of this commit:
cvs rdiff -u -r1.137 -r1.138 src/sys/rump/librump/rumpvfs/rumpfs.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rumpfs.c
diff -u src/sys/rump/librump/rumpvfs/rumpfs.c:1.137 src/sys/rump/librump/rumpvfs/rumpfs.c:1.138
--- src/sys/rump/librump/rumpvfs/rumpfs.c:1.137	Tue Feb  2 12:22:23 2016
+++ src/sys/rump/librump/rumpvfs/rumpfs.c	Tue Feb  2 13:02:34 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpfs.c,v 1.137 2016/02/02 12:22:23 pooka Exp $	*/
+/*	$NetBSD: rumpfs.c,v 1.138 2016/02/02 13:02:34 pooka Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.137 2016/02/02 12:22:23 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpfs.c,v 1.138 2016/02/02 13:02:34 pooka Exp $");
 
 #include 
 #include 
@@ -937,7 +937,7 @@ rump_vop_setattr(void *v)
 		memcpy(newdata, rn->rn_data, copylen);
 
 		if ((rn->rn_flags & RUMPNODE_EXTSTORAGE) == 0) {
-			rump_hyperfree(rn->rn_data, rn->rn_dlen); 
+			rump_hyperfree(rn->rn_data, rn->rn_dlen);
 		} else {
 			rn->rn_flags &= ~RUMPNODE_EXTSTORAGE;
 		}
@@ -1739,7 +1739,7 @@ rump_vop_fcntl(void *v)
 
 	KASSERT(cmd == RUMPFS_FCNTL_EXTSTORAGE_ADD);
 	if (rn->rn_data && (rn->rn_flags & RUMPNODE_EXTSTORAGE) == 0) {
-		rump_hyperfree(rn->rn_data, rn->rn_dlen); 
+		rump_hyperfree(rn->rn_data, rn->rn_dlen);
 	}
 
 	rn->rn_data = rfse->rfse_data;



CVS commit: src/sys/rump/librump

2016-01-26 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Jan 26 23:21:19 UTC 2016

Modified Files:
src/sys/rump/librump: makerumpif.sh

Log Message:
include rumpif private headers from 


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/rump/librump/makerumpif.sh

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

Modified files:

Index: src/sys/rump/librump/makerumpif.sh
diff -u src/sys/rump/librump/makerumpif.sh:1.9 src/sys/rump/librump/makerumpif.sh:1.10
--- src/sys/rump/librump/makerumpif.sh:1.9	Thu Apr 23 10:50:00 2015
+++ src/sys/rump/librump/makerumpif.sh	Tue Jan 26 23:21:18 2016
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-#	$NetBSD: makerumpif.sh,v 1.9 2015/04/23 10:50:00 pooka Exp $
+#	$NetBSD: makerumpif.sh,v 1.10 2016/01/26 23:21:18 pooka Exp $
 #
 # Copyright (c) 2009, 2015 Antti Kantee.  All rights reserved.
 #
@@ -78,9 +78,9 @@ sed -e '
 ' ${1} | awk -F\| -v topdir=${TOPDIR} '
 function fileheaders(file, srcstr)
 {
-	printf("/*\t$NetBSD: makerumpif.sh,v 1.9 2015/04/23 10:50:00 pooka Exp $\t*/\n\n") > file
+	printf("/*\t$NetBSD: makerumpif.sh,v 1.10 2016/01/26 23:21:18 pooka Exp $\t*/\n\n") > file
 	printf("/*\n * Automatically generated.  DO NOT EDIT.\n") > file
-	genstr = "$NetBSD: makerumpif.sh,v 1.9 2015/04/23 10:50:00 pooka Exp $"
+	genstr = "$NetBSD: makerumpif.sh,v 1.10 2016/01/26 23:21:18 pooka Exp $"
 	gsub("\\$", "", genstr)
 	printf(" * from: %s\n", srcstr) > file
 	printf(" * by:   %s\n", genstr) > file
@@ -154,11 +154,11 @@ $1 == "WRAPPERS"{gencalls = topdir "/" $
 		printf("\n") > privhdr
 
 		printf("\n#include \n") > gencalls
-		printf("#include \n") > gencalls
-		printf("\n#include \n") > gencalls
+		printf("#include \n\n") > gencalls
+		printf("#include \n", privfile) > gencalls
+		printf("#include \n\n", privfile) > gencalls
+		printf("#include \n") > gencalls
 		printf("#include \n\n", pubfile) > gencalls
-		printf("#include \"rump_private.h\"\n", privfile) > gencalls
-		printf("#include \"%s\"\n\n", privfile) > gencalls
 		printf("void __dead rump_%s_unavailable(void);\n",	\
 		myname) > gencalls
 		printf("void __dead\nrump_%s_unavailable(void)\n{\n",	\



CVS commit: src/sys/rump/librump

2016-01-26 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Jan 26 23:22:22 UTC 2016

Modified Files:
src/sys/rump/librump/rumpkern: rumpkern.ifspec
src/sys/rump/librump/rumpnet: rumpnet.ifspec
src/sys/rump/librump/rumpvfs: rumpvfs.ifspec

Log Message:
generate privhdrs to new location


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/rump/librump/rumpkern/rumpkern.ifspec
cvs rdiff -u -r1.3 -r1.4 src/sys/rump/librump/rumpnet/rumpnet.ifspec
cvs rdiff -u -r1.10 -r1.11 src/sys/rump/librump/rumpvfs/rumpvfs.ifspec

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rumpkern.ifspec
diff -u src/sys/rump/librump/rumpkern/rumpkern.ifspec:1.13 src/sys/rump/librump/rumpkern/rumpkern.ifspec:1.14
--- src/sys/rump/librump/rumpkern/rumpkern.ifspec:1.13	Fri Apr 25 13:10:42 2014
+++ src/sys/rump/librump/rumpkern/rumpkern.ifspec	Tue Jan 26 23:22:22 2016
@@ -1,8 +1,8 @@
-;	$NetBSD: rumpkern.ifspec,v 1.13 2014/04/25 13:10:42 pooka Exp $
+;	$NetBSD: rumpkern.ifspec,v 1.14 2016/01/26 23:22:22 pooka Exp $
 
 NAME|kern
 PUBHDR|include/rump/rumpkern_if_pub.h
-PRIVHDR|librump/rumpkern/rumpkern_if_priv.h
+PRIVHDR|include/rump-sys/kern_if.h
 WRAPPERS|librump/rumpkern/rumpkern_if_wrappers.c
 
 ; type		| name		| args

Index: src/sys/rump/librump/rumpnet/rumpnet.ifspec
diff -u src/sys/rump/librump/rumpnet/rumpnet.ifspec:1.3 src/sys/rump/librump/rumpnet/rumpnet.ifspec:1.4
--- src/sys/rump/librump/rumpnet/rumpnet.ifspec:1.3	Wed Jul  3 19:21:11 2013
+++ src/sys/rump/librump/rumpnet/rumpnet.ifspec	Tue Jan 26 23:22:22 2016
@@ -1,8 +1,8 @@
-;   $NetBSD: rumpnet.ifspec,v 1.3 2013/07/03 19:21:11 pooka Exp $
+;   $NetBSD: rumpnet.ifspec,v 1.4 2016/01/26 23:22:22 pooka Exp $
 
 NAME|net
 PUBHDR|include/rump/rumpnet_if_pub.h
-PRIVHDR|librump/rumpnet/rumpnet_if_priv.h
+PRIVHDR|include/rump-sys/net_if.h
 WRAPPERS|librump/rumpnet/rumpnet_if_wrappers.c
 
 ; type  | name  | args			| attrs

Index: src/sys/rump/librump/rumpvfs/rumpvfs.ifspec
diff -u src/sys/rump/librump/rumpvfs/rumpvfs.ifspec:1.10 src/sys/rump/librump/rumpvfs/rumpvfs.ifspec:1.11
--- src/sys/rump/librump/rumpvfs/rumpvfs.ifspec:1.10	Thu Apr 23 10:50:29 2015
+++ src/sys/rump/librump/rumpvfs/rumpvfs.ifspec	Tue Jan 26 23:22:22 2016
@@ -1,8 +1,8 @@
-;   $NetBSD: rumpvfs.ifspec,v 1.10 2015/04/23 10:50:29 pooka Exp $
+;   $NetBSD: rumpvfs.ifspec,v 1.11 2016/01/26 23:22:22 pooka Exp $
 
 NAME|vfs
 PUBHDR|include/rump/rumpvfs_if_pub.h
-PRIVHDR|librump/rumpvfs/rumpvfs_if_priv.h
+PRIVHDR|include/rump-sys/vfs_if.h
 WRAPPERS|librump/rumpvfs/rumpvfs_if_wrappers.c
 
 ; type  | name  | args		| attrs



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

2016-01-21 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Fri Jan 22 04:26:01 UTC 2016

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

Log Message:
Fix build with RUMP_LOCKDEBUG=yes


To generate a diff of this commit:
cvs rdiff -u -r1.177 -r1.178 src/sys/rump/librump/rumpkern/emul.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.177 src/sys/rump/librump/rumpkern/emul.c:1.178
--- src/sys/rump/librump/rumpkern/emul.c:1.177	Mon Jan 18 23:27:20 2016
+++ src/sys/rump/librump/rumpkern/emul.c	Fri Jan 22 04:26:01 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.177 2016/01/18 23:27:20 pooka Exp $	*/
+/*	$NetBSD: emul.c,v 1.178 2016/01/22 04:26:01 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.177 2016/01/18 23:27:20 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.178 2016/01/22 04:26:01 ozaki-r Exp $");
 
 #include 
 #include 
@@ -35,6 +35,9 @@ __KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.1
 #include 
 #include 
 #include 
+#ifdef LOCKDEBUG
+#include 
+#endif
 
 #include 
 



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

2016-01-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jan 18 15:53:38 UTC 2016

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

Log Message:
boottime is a timespec, not timeval


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/sys/rump/librump/rumpkern/emul.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.174 src/sys/rump/librump/rumpkern/emul.c:1.175
--- src/sys/rump/librump/rumpkern/emul.c:1.174	Tue Dec 29 10:22:05 2015
+++ src/sys/rump/librump/rumpkern/emul.c	Mon Jan 18 15:53:38 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.174 2015/12/29 10:22:05 pgoyette Exp $	*/
+/*	$NetBSD: emul.c,v 1.175 2016/01/18 15:53:38 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.174 2015/12/29 10:22:05 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.175 2016/01/18 15:53:38 pooka Exp $");
 
 #include 
 #include 
@@ -36,6 +36,7 @@ __KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.1
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -86,7 +87,7 @@ dev_t rootdev = NODEV;
 
 const int schedppq = 1;
 bool mp_online = false;
-struct timeval boottime;
+struct timespec boottime;
 int cold = 1;
 int boothowto = AB_SILENT;
 struct tty *constty;



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

2016-01-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jan 18 23:27:20 UTC 2016

Modified Files:
src/sys/rump/librump/rumpkern: emul.c lwproc.c

Log Message:
put lwp/proc stuff into the same source module (emul.c -> lwproc.c)


To generate a diff of this commit:
cvs rdiff -u -r1.176 -r1.177 src/sys/rump/librump/rumpkern/emul.c
cvs rdiff -u -r1.35 -r1.36 src/sys/rump/librump/rumpkern/lwproc.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.176 src/sys/rump/librump/rumpkern/emul.c:1.177
--- src/sys/rump/librump/rumpkern/emul.c:1.176	Mon Jan 18 23:21:28 2016
+++ src/sys/rump/librump/rumpkern/emul.c	Mon Jan 18 23:27:20 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.176 2016/01/18 23:21:28 pooka Exp $	*/
+/*	$NetBSD: emul.c,v 1.177 2016/01/18 23:27:20 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.176 2016/01/18 23:21:28 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.177 2016/01/18 23:27:20 pooka Exp $");
 
 #include 
 #include 
@@ -55,11 +55,6 @@ int physmem = PHYSMEM;
 int nkmempages = PHYSMEM/2; /* from le chapeau */
 #undef PHYSMEM
 
-struct lwp lwp0 = {
-	.l_lid = 1,
-	.l_proc = ,
-	.l_fd = ,
-};
 struct vnode *rootvp;
 dev_t rootdev = NODEV;
 
@@ -90,8 +85,6 @@ int booted_partition;
 kmutex_t tty_lock;
 krwlock_t exec_lock;
 
-struct lwplist alllwp = LIST_HEAD_INITIALIZER(alllwp);
-
 /* sparc doesn't sport constant page size, pretend we have 4k pages */
 #ifdef __sparc__
 int nbpg = 4096;
@@ -130,8 +123,6 @@ struct emul emul_netbsd = {
 	.e_sc_autoload = netbsd_syscalls_autoload,
 };
 
-u_int nprocs = 1;
-
 cprng_strong_t *kern_cprng;
 
 /* not used, but need the symbols for pointer comparisons */
@@ -158,34 +149,6 @@ kpause(const char *wmesg, bool intr, int
 	return 0;
 }
 
-void
-lwp_unsleep(lwp_t *l, bool cleanup)
-{
-
-	KASSERT(mutex_owned(l->l_mutex));
-
-	(*l->l_syncobj->sobj_unsleep)(l, cleanup);
-}
-
-void
-lwp_update_creds(struct lwp *l)
-{
-	struct proc *p;
-	kauth_cred_t oldcred;
-
-	p = l->l_proc;
-	oldcred = l->l_cred;
-	l->l_prflag &= ~LPR_CRMOD;
-
-	mutex_enter(p->p_lock);
-	kauth_cred_hold(p->p_cred);
-	l->l_cred = p->p_cred;
-	mutex_exit(p->p_lock);
-
-	if (oldcred != NULL)
-		kauth_cred_free(oldcred);
-}
-
 vaddr_t
 calc_cache_size(vsize_t vasz, int pct, int va_pct)
 {

Index: src/sys/rump/librump/rumpkern/lwproc.c
diff -u src/sys/rump/librump/rumpkern/lwproc.c:1.35 src/sys/rump/librump/rumpkern/lwproc.c:1.36
--- src/sys/rump/librump/rumpkern/lwproc.c:1.35	Sat Apr 18 15:49:18 2015
+++ src/sys/rump/librump/rumpkern/lwproc.c	Mon Jan 18 23:27:20 2016
@@ -1,4 +1,4 @@
-/*  $NetBSD: lwproc.c,v 1.35 2015/04/18 15:49:18 pooka Exp $	*/
+/*  $NetBSD: lwproc.c,v 1.36 2016/01/18 23:27:20 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #define RUMP__CURLWP_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.35 2015/04/18 15:49:18 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.36 2016/01/18 23:27:20 pooka Exp $");
 
 #include 
 #include 
@@ -47,9 +47,46 @@ __KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1
 #include "rump_private.h"
 #include "rump_curlwp.h"
 
+struct lwp lwp0 = {
+	.l_lid = 1,
+	.l_proc = ,
+	.l_fd = ,
+};
+struct lwplist alllwp = LIST_HEAD_INITIALIZER(alllwp);
+
+u_int nprocs = 1;
+
 struct emul *emul_default = _netbsd;
 
 void
+lwp_unsleep(lwp_t *l, bool cleanup)
+{
+
+	KASSERT(mutex_owned(l->l_mutex));
+
+	(*l->l_syncobj->sobj_unsleep)(l, cleanup);
+}
+
+void
+lwp_update_creds(struct lwp *l)
+{
+	struct proc *p;
+	kauth_cred_t oldcred;
+
+	p = l->l_proc;
+	oldcred = l->l_cred;
+	l->l_prflag &= ~LPR_CRMOD;
+
+	mutex_enter(p->p_lock);
+	kauth_cred_hold(p->p_cred);
+	l->l_cred = p->p_cred;
+	mutex_exit(p->p_lock);
+
+	if (oldcred != NULL)
+		kauth_cred_free(oldcred);
+}
+
+void
 rump_lwproc_init(void)
 {
 



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

2016-01-18 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Jan 18 23:21:28 UTC 2016

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

Log Message:
massively reduce header pollution from times prehistoric


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/sys/rump/librump/rumpkern/emul.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.175 src/sys/rump/librump/rumpkern/emul.c:1.176
--- src/sys/rump/librump/rumpkern/emul.c:1.175	Mon Jan 18 15:53:38 2016
+++ src/sys/rump/librump/rumpkern/emul.c	Mon Jan 18 23:21:28 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.175 2016/01/18 15:53:38 pooka Exp $	*/
+/*	$NetBSD: emul.c,v 1.176 2016/01/18 23:21:28 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,42 +26,20 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.175 2016/01/18 15:53:38 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.176 2016/01/18 23:21:28 pooka Exp $");
 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
 #include 
-#include 
 #include 
 #include 
-#include 
-#include 
-#include 
-#include 
 
 #include 
 
 #include 
 
-#include 
-
 #include "rump_private.h"
 
 void (*rump_vfs_fini)(void) = (void *)nullop;



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

2015-12-29 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Tue Dec 29 10:22:06 UTC 2015

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

Log Message:
Now that the table of auto-loadable syscalls is per-emulation, make sure
that the rump-kernel has its own list.  Otherwise, missing syscalls won't
trigger a module auto-load.

This commit finishes the work to get tests/lib/librumphijack/t_tcpip
nfs_autoload test case working again after 16 months of failures!  (see
PR bin/49153).


To generate a diff of this commit:
cvs rdiff -u -r1.173 -r1.174 src/sys/rump/librump/rumpkern/emul.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.173 src/sys/rump/librump/rumpkern/emul.c:1.174
--- src/sys/rump/librump/rumpkern/emul.c:1.173	Tue Aug 25 14:47:26 2015
+++ src/sys/rump/librump/rumpkern/emul.c	Tue Dec 29 10:22:05 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.173 2015/08/25 14:47:26 pooka Exp $	*/
+/*	$NetBSD: emul.c,v 1.174 2015/12/29 10:22:05 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.173 2015/08/25 14:47:26 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.174 2015/12/29 10:22:05 pgoyette Exp $");
 
 #include 
 #include 
@@ -133,6 +133,11 @@ struct loadavg averunnable = {
 	FSCALE,
 };
 
+/*
+ * Include the autogenerated list of auto-loadable syscalls
+ */
+#include 
+
 struct emul emul_netbsd = {
 	.e_name = "netbsd-rump",
 	.e_sysent = rump_sysent,
@@ -143,6 +148,7 @@ struct emul emul_netbsd = {
 #ifdef __HAVE_SYSCALL_INTERN
 	.e_syscall_intern = syscall_intern,
 #endif
+	.e_sc_autoload = netbsd_syscalls_autoload,
 };
 
 u_int nprocs = 1;



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

2015-12-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Dec  8 22:16:01 UTC 2015

Modified Files:
src/sys/rump/librump/rumpvfs: rumpblk.c

Log Message:
fix struct name


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/rump/librump/rumpvfs/rumpblk.c

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

Modified files:

Index: src/sys/rump/librump/rumpvfs/rumpblk.c
diff -u src/sys/rump/librump/rumpvfs/rumpblk.c:1.61 src/sys/rump/librump/rumpvfs/rumpblk.c:1.62
--- src/sys/rump/librump/rumpvfs/rumpblk.c:1.61	Tue Dec  8 15:36:15 2015
+++ src/sys/rump/librump/rumpvfs/rumpblk.c	Tue Dec  8 17:16:01 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: rumpblk.c,v 1.61 2015/12/08 20:36:15 christos Exp $	*/
+/*	$NetBSD: rumpblk.c,v 1.62 2015/12/08 22:16:01 christos Exp $	*/
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rumpblk.c,v 1.61 2015/12/08 20:36:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpblk.c,v 1.62 2015/12/08 22:16:01 christos Exp $");
 
 #include 
 #include 
@@ -421,7 +421,7 @@ rumpblk_ioctl(dev_t dev, u_long xfer, vo
 	devminor_t dmin = minor(dev);
 	struct rblkdev *rblk = [dmin];
 	struct partinfo *pi;
-	struct diskpart *dp;
+	struct partition *dp;
 	int error = 0;
 
 	/* well, me should support a few more, but we don't for now */



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

2015-11-26 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Thu Nov 26 15:13:43 UTC 2015

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

Log Message:
Adapt to e_default_mapaddr signature changes


To generate a diff of this commit:
cvs rdiff -u -r1.167 -r1.168 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.167 src/sys/rump/librump/rumpkern/vm.c:1.168
--- src/sys/rump/librump/rumpkern/vm.c:1.167	Tue Jun  2 14:07:48 2015
+++ src/sys/rump/librump/rumpkern/vm.c	Thu Nov 26 15:13:43 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.167 2015/06/02 14:07:48 pooka Exp $	*/
+/*	$NetBSD: vm.c,v 1.168 2015/11/26 15:13:43 martin Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.167 2015/06/02 14:07:48 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.168 2015/11/26 15:13:43 martin Exp $");
 
 #include 
 #include 
@@ -700,7 +700,7 @@ ubc_purge(struct uvm_object *uobj)
 }
 
 vaddr_t
-uvm_default_mapaddr(struct proc *p, vaddr_t base, vsize_t sz)
+uvm_default_mapaddr(struct proc *p, vaddr_t base, vsize_t sz, int topdown)
 {
 
 	return 0;



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

2015-10-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct 14 01:33:32 UTC 2015

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

Log Message:
CID 1327233: Expicitly ignore return values of syscalls that don't fail.


To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 src/sys/rump/librump/rumpkern/rump_syscalls.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump_syscalls.c
diff -u src/sys/rump/librump/rumpkern/rump_syscalls.c:1.116 src/sys/rump/librump/rumpkern/rump_syscalls.c:1.117
--- src/sys/rump/librump/rumpkern/rump_syscalls.c:1.116	Fri Oct  9 23:30:17 2015
+++ src/sys/rump/librump/rumpkern/rump_syscalls.c	Tue Oct 13 21:33:32 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_syscalls.c,v 1.116 2015/10/10 03:30:17 pgoyette Exp $ */
+/* $NetBSD: rump_syscalls.c,v 1.117 2015/10/14 01:33:32 christos Exp $ */
 
 /*
  * System call vector and marshalling for rump.
@@ -15,7 +15,7 @@
 
 #ifdef __NetBSD__
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_syscalls.c,v 1.116 2015/10/10 03:30:17 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_syscalls.c,v 1.117 2015/10/14 01:33:32 christos Exp $");
 
 #include 
 #include 
@@ -392,7 +392,7 @@ rump___sysimpl_getpid(void )
 	register_t retval[2];
 	pid_t rv = -1;
 
-	rsys_syscall(SYS_getpid, NULL, 0, retval);
+	(void)rsys_syscall(SYS_getpid, NULL, 0, retval);
 	if (sizeof(pid_t) > sizeof(register_t))
 		rv = *(pid_t *)retval;
 	else
@@ -469,7 +469,7 @@ rump___sysimpl_getuid(void )
 	register_t retval[2];
 	uid_t rv = -1;
 
-	rsys_syscall(SYS_getuid, NULL, 0, retval);
+	(void)rsys_syscall(SYS_getuid, NULL, 0, retval);
 	if (sizeof(uid_t) > sizeof(register_t))
 		rv = *(uid_t *)retval;
 	else
@@ -489,7 +489,7 @@ rump___sysimpl_geteuid(void )
 	register_t retval[2];
 	uid_t rv = -1;
 
-	rsys_syscall(SYS_geteuid, NULL, 0, retval);
+	(void)rsys_syscall(SYS_geteuid, NULL, 0, retval);
 	if (sizeof(uid_t) > sizeof(register_t))
 		rv = *(uid_t *)retval;
 	else
@@ -778,7 +778,7 @@ rump___sysimpl_sync(void )
 {
 	register_t retval[2];
 
-	rsys_syscall(SYS_sync, NULL, 0, retval);
+	(void)rsys_syscall(SYS_sync, NULL, 0, retval);
 }
 #ifdef RUMP_KERNEL_IS_LIBC
 __weak_alias(sync,rump___sysimpl_sync);
@@ -793,7 +793,7 @@ rump___sysimpl_getppid(void )
 	register_t retval[2];
 	pid_t rv = -1;
 
-	rsys_syscall(SYS_getppid, NULL, 0, retval);
+	(void)rsys_syscall(SYS_getppid, NULL, 0, retval);
 	if (sizeof(pid_t) > sizeof(register_t))
 		rv = *(pid_t *)retval;
 	else
@@ -841,7 +841,7 @@ rump___sysimpl_getegid(void )
 	register_t retval[2];
 	gid_t rv = -1;
 
-	rsys_syscall(SYS_getegid, NULL, 0, retval);
+	(void)rsys_syscall(SYS_getegid, NULL, 0, retval);
 	if (sizeof(gid_t) > sizeof(register_t))
 		rv = *(gid_t *)retval;
 	else
@@ -892,7 +892,7 @@ rump___sysimpl_getgid(void )
 	register_t retval[2];
 	gid_t rv = -1;
 
-	rsys_syscall(SYS_getgid, NULL, 0, retval);
+	(void)rsys_syscall(SYS_getgid, NULL, 0, retval);
 	if (sizeof(gid_t) > sizeof(register_t))
 		rv = *(gid_t *)retval;
 	else
@@ -3379,7 +3379,7 @@ rump___sysimpl_issetugid(void )
 	register_t retval[2];
 	int rv = -1;
 
-	rsys_syscall(SYS_issetugid, NULL, 0, retval);
+	(void)rsys_syscall(SYS_issetugid, NULL, 0, retval);
 	if (sizeof(int) > sizeof(register_t))
 		rv = *(int *)retval;
 	else
@@ -4977,7 +4977,7 @@ rump___sysimpl_posix_fadvise50(int fd, o
 	SPARG(, len) = len;
 	SPARG(, advice) = advice;
 
-	rsys_syscall(SYS___posix_fadvise50, , sizeof(callarg), retval);
+	(void)rsys_syscall(SYS___posix_fadvise50, , sizeof(callarg), retval);
 	if (sizeof(int) > sizeof(register_t))
 		rv = *(int *)retval;
 	else
@@ -6417,7 +6417,8 @@ rump___sysimpl_clock_nanosleep(clockid_t
 	SPARG(, rqtp) = rqtp;
 	SPARG(, rmtp) = rmtp;
 
-	rsys_syscall(SYS_clock_nanosleep, , sizeof(callarg), retval);
+	(void)rsys_syscall(SYS_clock_nanosleep, , sizeof(callarg),
+	retval);
 	if (sizeof(int) > sizeof(register_t))
 		rv = *(int *)retval;
 	else
@@ -6444,7 +6445,7 @@ rump___sysimpl_posix_fallocate(int fd, o
 	SPARG(, pos) = pos;
 	SPARG(, len) = len;
 
-	rsys_syscall(SYS_posix_fallocate, , sizeof(callarg), retval);
+	(void)rsys_syscall(SYS_posix_fallocate, , sizeof(callarg), retval);
 	if (sizeof(int) > sizeof(register_t))
 		rv = *(int *)retval;
 	else



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

2015-09-29 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Sep 30 01:31:56 UTC 2015

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

Log Message:
Remove redundant UNLOCKED and LOCKED

UNLOCKED and LOCKED are done inside mutex_exit and mutex_enter respectively
so we don't need to do them outside mutex_exit and mutex_enter.

Reviewed by pooka@


To generate a diff of this commit:
cvs rdiff -u -r1.69 -r1.70 src/sys/rump/librump/rumpkern/locks.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/locks.c
diff -u src/sys/rump/librump/rumpkern/locks.c:1.69 src/sys/rump/librump/rumpkern/locks.c:1.70
--- src/sys/rump/librump/rumpkern/locks.c:1.69	Fri Apr 25 18:13:59 2014
+++ src/sys/rump/librump/rumpkern/locks.c	Wed Sep 30 01:31:56 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: locks.c,v 1.69 2014/04/25 18:13:59 pooka Exp $	*/
+/*	$NetBSD: locks.c,v 1.70 2015/09/30 01:31:56 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.69 2014/04/25 18:13:59 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.70 2015/09/30 01:31:56 ozaki-r Exp $");
 
 #include 
 #include 
@@ -368,7 +368,6 @@ docvwait(kcondvar_t *cv, kmutex_t *mtx, 
 	if (__predict_false(l->l_flag & LW_RUMP_QEXIT)) {
 		struct proc *p = l->l_proc;
 
-		UNLOCKED(mtx, false);
 		mutex_exit(mtx); /* drop and retake later */
 
 		mutex_enter(p->p_lock);
@@ -383,7 +382,6 @@ docvwait(kcondvar_t *cv, kmutex_t *mtx, 
 		/* ok, we can exit and remove "reference" to l->private */
 
 		mutex_enter(mtx);
-		LOCKED(mtx, false);
 		rv = EINTR;
 	}
 	l->l_private = NULL;



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

2015-09-29 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Sep 30 02:45:33 UTC 2015

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

Log Message:
Add lockdebug_barrier

ok pooka@


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/rump/librump/rumpkern/locks.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/locks.c
diff -u src/sys/rump/librump/rumpkern/locks.c:1.70 src/sys/rump/librump/rumpkern/locks.c:1.71
--- src/sys/rump/librump/rumpkern/locks.c:1.70	Wed Sep 30 01:31:56 2015
+++ src/sys/rump/librump/rumpkern/locks.c	Wed Sep 30 02:45:33 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: locks.c,v 1.70 2015/09/30 01:31:56 ozaki-r Exp $	*/
+/*	$NetBSD: locks.c,v 1.71 2015/09/30 02:45:33 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.70 2015/09/30 01:31:56 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.71 2015/09/30 02:45:33 ozaki-r Exp $");
 
 #include 
 #include 
@@ -71,12 +71,15 @@ static lockops_t rw_lockops = {
 lockdebug_locked(lock, NULL, (uintptr_t)__builtin_return_address(0), shar)
 #define UNLOCKED(lock, shar)		\
 lockdebug_unlocked(lock, (uintptr_t)__builtin_return_address(0), shar)
+#define BARRIER(lock, slp)		\
+lockdebug_barrier(lock, slp)
 #else
 #define ALLOCK(a, b)
 #define FREELOCK(a)
 #define WANTLOCK(a, b)
 #define LOCKED(a, b)
 #define UNLOCKED(a, b)
+#define BARRIER(a, b)
 #endif
 
 /*
@@ -138,6 +141,7 @@ mutex_enter(kmutex_t *mtx)
 {
 
 	WANTLOCK(mtx, 0);
+	BARRIER(mtx, 1);
 	rumpuser_mutex_enter(RUMPMTX(mtx));
 	LOCKED(mtx, false);
 }
@@ -147,6 +151,7 @@ mutex_spin_enter(kmutex_t *mtx)
 {
 
 	WANTLOCK(mtx, 0);
+	BARRIER(mtx, 1);
 	rumpuser_mutex_enter_nowrap(RUMPMTX(mtx));
 	LOCKED(mtx, false);
 }
@@ -229,8 +234,8 @@ void
 rw_enter(krwlock_t *rw, const krw_t op)
 {
 
-
 	WANTLOCK(rw, op == RW_READER);
+	BARRIER(rw, 1);
 	rumpuser_rw_enter(krw2rumprw(op), RUMPRW(rw));
 	LOCKED(rw, op == RW_READER);
 }



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

2015-09-15 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Sep 15 15:09:11 UTC 2015

Modified Files:
src/sys/rump/librump/rumpkern: Makefile.rumpkern

Log Message:
Use the more widely accepted version of alphabetical order.


To generate a diff of this commit:
cvs rdiff -u -r1.163 -r1.164 src/sys/rump/librump/rumpkern/Makefile.rumpkern

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

Modified files:

Index: src/sys/rump/librump/rumpkern/Makefile.rumpkern
diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.163 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.164
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.163	Mon Aug 31 07:38:48 2015
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Tue Sep 15 15:09:10 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.163 2015/08/31 07:38:48 ozaki-r Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.164 2015/09/15 15:09:10 pooka Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -83,6 +83,7 @@ SRCS+=	init_sysctl_base.c	\
 	kern_rndpool.c		\
 	kern_rndq.c		\
 	kern_rndsink.c		\
+	kern_rwlock_obj.c	\
 	kern_stub.c		\
 	kern_syscall.c		\
 	kern_sysctl.c		\
@@ -92,11 +93,11 @@ SRCS+=	init_sysctl_base.c	\
 	kern_uidinfo.c		\
 	kern_xxx.c		\
 	param.c			\
-	subr_devsw.c		\
 	subr_callback.c		\
 	subr_copy.c		\
 	subr_cprng.c		\
 	subr_device.c		\
+	subr_devsw.c		\
 	subr_evcnt.c		\
 	subr_extent.c		\
 	subr_hash.c		\
@@ -113,7 +114,6 @@ SRCS+=	init_sysctl_base.c	\
 	subr_pool.c		\
 	subr_prf.c		\
 	subr_pserialize.c	\
-	kern_rwlock_obj.c	\
 	subr_specificdata.c	\
 	subr_time.c		\
 	subr_vmem.c		\



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

2015-08-31 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Aug 31 07:38:48 UTC 2015

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

Log Message:
Allow rumpkernel to use rw_obj_*


To generate a diff of this commit:
cvs rdiff -u -r1.162 -r1.163 src/sys/rump/librump/rumpkern/Makefile.rumpkern
cvs rdiff -u -r1.324 -r1.325 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/Makefile.rumpkern
diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.162 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.163
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.162	Fri Aug 21 06:56:12 2015
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Mon Aug 31 07:38:48 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.162 2015/08/21 06:56:12 christos Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.163 2015/08/31 07:38:48 ozaki-r Exp $
 #
 
 .include "${RUMPTOP}/Makefile.rump"
@@ -113,6 +113,7 @@ SRCS+=	init_sysctl_base.c	\
 	subr_pool.c		\
 	subr_prf.c		\
 	subr_pserialize.c	\
+	kern_rwlock_obj.c	\
 	subr_specificdata.c	\
 	subr_time.c		\
 	subr_vmem.c		\

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.324 src/sys/rump/librump/rumpkern/rump.c:1.325
--- src/sys/rump/librump/rumpkern/rump.c:1.324	Tue Aug 25 14:53:25 2015
+++ src/sys/rump/librump/rumpkern/rump.c	Mon Aug 31 07:38:48 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.324 2015/08/25 14:53:25 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.325 2015/08/31 07:38:48 ozaki-r Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.324 2015/08/25 14:53:25 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.325 2015/08/31 07:38:48 ozaki-r Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -296,6 +296,7 @@ rump_init(void)
 	uao_init();
 
 	mutex_obj_init();
+	rw_obj_init();
 	callout_startup();
 
 	kprintf_init();



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

2015-08-25 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Aug 25 14:53:25 UTC 2015

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

Log Message:
initialize ncpuonline


To generate a diff of this commit:
cvs rdiff -u -r1.323 -r1.324 src/sys/rump/librump/rumpkern/rump.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump.c
diff -u src/sys/rump/librump/rumpkern/rump.c:1.323 src/sys/rump/librump/rumpkern/rump.c:1.324
--- src/sys/rump/librump/rumpkern/rump.c:1.323	Tue Aug 25 14:52:59 2015
+++ src/sys/rump/librump/rumpkern/rump.c	Tue Aug 25 14:53:25 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.323 2015/08/25 14:52:59 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.324 2015/08/25 14:53:25 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.323 2015/08/25 14:52:59 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.324 2015/08/25 14:53:25 pooka Exp $);
 
 #include sys/systm.h
 #define ELFSIZE ARCH_ELFSIZE
@@ -384,6 +384,7 @@ rump_init(void)
 
 		aprint_verbose(cpu%d at thinair0: rump virtual cpu\n, i);
 	}
+	ncpuonline = ncpu;
 
 	/* Once all CPUs are detected, initialize the per-CPU cprng_fast.  */
 	cprng_fast_init();



  1   2   3   4   5   6   7   8   9   >