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/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/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/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/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/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/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/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/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/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/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/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/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/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();



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

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

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

Log Message:
add cpu_getmodel()


To generate a diff of this commit:
cvs rdiff -u -r1.172 -r1.173 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.172 src/sys/rump/librump/rumpkern/emul.c:1.173
--- src/sys/rump/librump/rumpkern/emul.c:1.172	Fri Jul 24 14:11:11 2015
+++ src/sys/rump/librump/rumpkern/emul.c	Tue Aug 25 14:47:26 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.172 2015/07/24 14:11:11 pooka Exp $	*/
+/*	$NetBSD: emul.c,v 1.173 2015/08/25 14:47:26 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: emul.c,v 1.172 2015/07/24 14:11:11 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: emul.c,v 1.173 2015/08/25 14:47:26 pooka Exp $);
 
 #include sys/param.h
 #include sys/null.h
@@ -392,3 +392,10 @@ cpu_reboot(int howto, char *bootstr)
 	rump_sysproxy_fini(finiarg);
 	rumpuser_exit(ruhow);
 }
+
+const char *
+cpu_getmodel(void)
+{
+
+	return rumpcore (virtual);
+}



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

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

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

Log Message:
remove mksysctls(), now provided by init_sysctl_base


To generate a diff of this commit:
cvs rdiff -u -r1.322 -r1.323 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.322 src/sys/rump/librump/rumpkern/rump.c:1.323
--- src/sys/rump/librump/rumpkern/rump.c:1.322	Tue Jul  7 12:38:02 2015
+++ src/sys/rump/librump/rumpkern/rump.c	Tue Aug 25 14:52:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.322 2015/07/07 12:38:02 justin Exp $	*/
+/*	$NetBSD: rump.c,v 1.323 2015/08/25 14:52:59 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.322 2015/07/07 12:38:02 justin Exp $);
+__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.323 2015/08/25 14:52:59 pooka Exp $);
 
 #include sys/systm.h
 #define ELFSIZE ARCH_ELFSIZE
@@ -133,25 +133,6 @@ rump_proc_vfs_release_fn rump_proc_vfs_r
 
 static void add_linkedin_modules(const struct modinfo *const *, size_t);
 
-/*
- * Create some sysctl nodes.  why only this you ask.  well, init_sysctl
- * is a kitchen sink in need of some gardening.  but i want to use
- * others today.  Furthermore, creating a whole kitchen sink full of
- * sysctl nodes is a waste of cycles for rump kernel bootstrap.
- */
-static void
-mksysctls(void)
-{
-
-	/* hw.pagesize */
-	sysctl_createv(NULL, 0, NULL, NULL,
-	CTLFLAG_PERMANENT|CTLFLAG_IMMEDIATE,
-	CTLTYPE_INT, pagesize,
-	SYSCTL_DESCR(Software page size),
-	NULL, PAGE_SIZE, NULL, 0,
-	CTL_HW, HW_PAGESIZE, CTL_EOL);
-}
-
 static pid_t rspo_wrap_getpid(void) {
 	return rump_sysproxy_hyp_getpid();
 }
@@ -412,7 +393,6 @@ rump_init(void)
 
 	rnd_init_softint();
 
-	mksysctls();
 	kqueue_init();
 	iostat_init();
 	fd_sys_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:47:40 UTC 2015

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

Log Message:
add ncpuonline


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 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.40 src/sys/rump/librump/rumpkern/scheduler.c:1.41
--- src/sys/rump/librump/rumpkern/scheduler.c:1.40	Wed Apr 22 16:01:07 2015
+++ src/sys/rump/librump/rumpkern/scheduler.c	Tue Aug 25 14:47:39 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: scheduler.c,v 1.40 2015/04/22 16:01:07 pooka Exp $	*/
+/*  $NetBSD: scheduler.c,v 1.41 2015/08/25 14:47:39 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: scheduler.c,v 1.40 2015/04/22 16:01:07 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: scheduler.c,v 1.41 2015/08/25 14:47:39 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -72,7 +72,7 @@ static struct rumpcpu {
 struct cpu_info *rump_cpu = rump_cpus[0];
 kcpuset_t *kcpuset_attached = NULL;
 kcpuset_t *kcpuset_running = NULL;
-int ncpu;
+int ncpu, ncpuonline;
 
 #define RCPULWP_BUSY	((void *)-1)
 #define RCPULWP_WANTED	((void *)-2)



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

2015-08-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Aug 21 06:56:12 UTC 2015

Modified Files:
src/sys/rump/librump/rumpkern: Makefile.rumpkern
src/sys/rump/librump/rumpkern/opt: ksyms.h
Removed Files:
src/sys/rump/librump/rumpkern: KERN.ioconf

Log Message:
Remove KERN.ioconf, ksyms does not really need it.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 src/sys/rump/librump/rumpkern/KERN.ioconf
cvs rdiff -u -r1.161 -r1.162 src/sys/rump/librump/rumpkern/Makefile.rumpkern
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/librump/rumpkern/opt/ksyms.h

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

Modified files:

Index: src/sys/rump/librump/rumpkern/Makefile.rumpkern
diff -u src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.161 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.162
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.161	Thu Aug 20 08:04:30 2015
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Fri Aug 21 02:56:12 2015
@@ -1,7 +1,6 @@
-#	$NetBSD: Makefile.rumpkern,v 1.161 2015/08/20 12:04:30 christos Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.162 2015/08/21 06:56:12 christos Exp $
 #
 
-IOCONF=KERN.ioconf
 .include ${RUMPTOP}/Makefile.rump
 
 .include bsd.own.mk

Index: src/sys/rump/librump/rumpkern/opt/ksyms.h
diff -u src/sys/rump/librump/rumpkern/opt/ksyms.h:1.2 src/sys/rump/librump/rumpkern/opt/ksyms.h:1.3
--- src/sys/rump/librump/rumpkern/opt/ksyms.h:1.2	Sat Apr 17 09:10:02 2010
+++ src/sys/rump/librump/rumpkern/opt/ksyms.h	Fri Aug 21 02:56:12 2015
@@ -1,3 +1,3 @@
-/*	$NetBSD: ksyms.h,v 1.2 2010/04/17 13:10:02 pooka Exp $	*/
+/*	$NetBSD: ksyms.h,v 1.3 2015/08/21 06:56:12 christos Exp $	*/
 
-#define NKSYMS 1
+#define NKSYMS 0



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

2015-08-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Aug 20 12:04:30 UTC 2015

Modified Files:
src/sys/rump/librump/rumpkern: Makefile.rumpkern
Added Files:
src/sys/rump/librump/rumpkern: KERN.ioconf

Log Message:
generate ioconf.h for pseudo-device attach prototype


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/rump/librump/rumpkern/KERN.ioconf
cvs rdiff -u -r1.160 -r1.161 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.160 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.161
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.160	Wed Jun 17 07:46:34 2015
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Thu Aug 20 08:04:30 2015
@@ -1,12 +1,12 @@
-#	$NetBSD: Makefile.rumpkern,v 1.160 2015/06/17 11:46:34 pooka Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.161 2015/08/20 12:04:30 christos Exp $
 #
 
+IOCONF=KERN.ioconf
 .include ${RUMPTOP}/Makefile.rump
 
 .include bsd.own.mk
 
 LIB=		rump
-
 MAN=		rump.3 rump_lwproc.3
 
 .PATH:	${RUMPTOP}/librump/rumpkern\

Added files:

Index: src/sys/rump/librump/rumpkern/KERN.ioconf
diff -u /dev/null src/sys/rump/librump/rumpkern/KERN.ioconf:1.1
--- /dev/null	Thu Aug 20 08:04:30 2015
+++ src/sys/rump/librump/rumpkern/KERN.ioconf	Thu Aug 20 08:04:30 2015
@@ -0,0 +1,7 @@
+#	$NetBSD: KERN.ioconf,v 1.1 2015/08/20 12:04:30 christos Exp $
+
+ioconf		kern
+
+include		conf/files
+
+pseudo-device   ksyms



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

2015-08-16 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Sun Aug 16 11:06:54 UTC 2015

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

Log Message:
Don't use KASSERT() to test for external return values, use panic()

from Robert Millan r...@freebsd.org


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/rump/librump/rumpkern/intr.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/intr.c
diff -u src/sys/rump/librump/rumpkern/intr.c:1.52 src/sys/rump/librump/rumpkern/intr.c:1.53
--- src/sys/rump/librump/rumpkern/intr.c:1.52	Wed Apr 22 17:38:33 2015
+++ src/sys/rump/librump/rumpkern/intr.c	Sun Aug 16 11:06:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.52 2015/04/22 17:38:33 pooka Exp $	*/
+/*	$NetBSD: intr.c,v 1.53 2015/08/16 11:06:54 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008-2010, 2015 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.52 2015/04/22 17:38:33 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.53 2015/08/16 11:06:54 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -127,7 +127,10 @@ doclock(void *noarg)
 
 		error = rumpuser_clock_sleep(RUMPUSER_CLOCK_ABSMONO,
 		curclock.tv_sec, curclock.tv_nsec);
-		KASSERT(!error);
+		if (error) {
+			panic(rumpuser_clock_sleep failed with error %d,
+			error);
+		}
 		timespecadd(curclock, thetick, curclock);
 	}
 }



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

2015-06-02 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Jun  2 14:07:48 UTC 2015

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

Log Message:
In case pagedaemon can't release any more memory, use kpause() instead
of cv_timedwait() on the pagedaemon condvar -- it's no use constantly
waking the pagedaemon up for new memory allocation attempts, as will
happen e.g. if new network connections are constantly pouring in.


To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.167 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.166 src/sys/rump/librump/rumpkern/vm.c:1.167
--- src/sys/rump/librump/rumpkern/vm.c:1.166	Sat Apr 18 15:49:18 2015
+++ src/sys/rump/librump/rumpkern/vm.c	Tue Jun  2 14:07:48 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.166 2015/04/18 15:49:18 pooka Exp $	*/
+/*	$NetBSD: vm.c,v 1.167 2015/06/02 14:07:48 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.166 2015/04/18 15:49:18 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.167 2015/06/02 14:07:48 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -1176,7 +1176,7 @@ uvm_pageout(void *arg)
 		uvmexp.paging == 0) {
 			rumpuser_dprintf(pagedaemoness: failed to reclaim 
 			memory ... sleeping (deadlock?)\n);
-			cv_timedwait(pdaemoncv, pdaemonmtx, hz);
+			kpause(pddlk, false, hz, pdaemonmtx);
 		}
 	}
 



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

2015-05-26 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue May 26 15:29:39 UTC 2015

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

Log Message:
Implement fo_poll so that rump_sys_poll(stdout) works
more or less as expected.

from Martin Lucina mar...@lucina.net via rumpkernel-users


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/rump/librump/rumpkern/cons.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/cons.c
diff -u src/sys/rump/librump/rumpkern/cons.c:1.4 src/sys/rump/librump/rumpkern/cons.c:1.5
--- src/sys/rump/librump/rumpkern/cons.c:1.4	Mon Aug 25 14:58:48 2014
+++ src/sys/rump/librump/rumpkern/cons.c	Tue May 26 15:29:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: cons.c,v 1.4 2014/08/25 14:58:48 pooka Exp $	*/
+/*	$NetBSD: cons.c,v 1.5 2015/05/26 15:29:39 pooka Exp $	*/
 
 /*
  * Copyright (c) 2013 Antti Kantee.  All Rights Reserved.
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: cons.c,v 1.4 2014/08/25 14:58:48 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: cons.c,v 1.5 2015/05/26 15:29:39 pooka Exp $);
 
 #include sys/param.h
 #include sys/file.h
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, $NetBSD: cons.c,v 1.4
 #include sys/ioctl.h
 #include sys/kernel.h
 #include sys/kmem.h
+#include sys/poll.h
 #include sys/proc.h
 #include sys/stat.h
 #include sys/termios.h
@@ -56,13 +57,14 @@ static int rumpcons_write(struct file *,
 			  kauth_cred_t, int);
 static int rumpcons_ioctl(struct file *, u_long, void *);
 static int rumpcons_stat(struct file *, struct stat *);
+static int rumpcons_poll(struct file *, int events);
 
 static const struct fileops rumpcons_fileops = {
 	.fo_read = (void *)nullop,
 	.fo_write = rumpcons_write,
 	.fo_ioctl = rumpcons_ioctl,
 	.fo_fcntl = fnullop_fcntl,
-	.fo_poll = fnullop_poll,
+	.fo_poll = rumpcons_poll,
 	.fo_stat = rumpcons_stat,
 	.fo_close = (void *)nullop,
 	.fo_kqfilter = fnullop_kqfilter,
@@ -142,3 +144,14 @@ rumpcons_stat(struct file *fp, struct st
 
 	return 0;
 }
+
+static int
+rumpcons_poll(struct file *fp, int events)
+{
+	int revents = 0;
+
+	if (events  (POLLOUT | POLLWRNORM))
+		revents |= events  (POLLOUT | POLLWRNORM);
+
+	return revents;
+}



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

2015-05-20 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed May 20 11:02:54 UTC 2015

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

Log Message:
call loginit() later, a lot later


To generate a diff of this commit:
cvs rdiff -u -r1.319 -r1.320 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.319 src/sys/rump/librump/rumpkern/rump.c:1.320
--- src/sys/rump/librump/rumpkern/rump.c:1.319	Wed Apr 22 18:12:39 2015
+++ src/sys/rump/librump/rumpkern/rump.c	Wed May 20 11:02:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.319 2015/04/22 18:12:39 pooka Exp $	*/
+/*	$NetBSD: rump.c,v 1.320 2015/05/20 11:02:54 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.319 2015/04/22 18:12:39 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.320 2015/05/20 11:02:54 pooka Exp $);
 
 #include sys/systm.h
 #define ELFSIZE ARCH_ELFSIZE
@@ -317,7 +317,6 @@ rump_init(void)
 
 	kprintf_init();
 	pserialize_init();
-	loginit();
 
 	kauth_init();
 
@@ -355,6 +354,8 @@ rump_init(void)
 	lwpinit_specificdata();
 	lwp_initspecific(lwp0);
 
+	loginit();
+
 	rump_biglock_init();
 
 	rump_scheduler_init(numcpu);



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

2015-04-23 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Apr 23 06:39:19 UTC 2015

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

Log Message:
g/c the never-used and never-useful hyperstubs.c


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/sys/rump/librump/rumpkern/Makefile.rumpkern
cvs rdiff -u -r1.2 -r0 src/sys/rump/librump/rumpkern/hyperstubs.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.157 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.158
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.157	Wed Apr 22 17:57:49 2015
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Thu Apr 23 06:39:19 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.157 2015/04/22 17:57:49 pooka Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.158 2015/04/23 06:39:19 pooka Exp $
 #
 
 .include ${RUMPTOP}/Makefile.rump
@@ -39,9 +39,6 @@ RUMPOBJ_NORENAME= rump_syscalls.o rump_s
 CPPFLAGS+= -DRUMP_KERNEL_IS_LIBC
 .endif
 
-# optional hypervisor interfaces
-#SRCS+=	hyperstubs.c
-
 # Multiprocessor or uniprocessor locking.  TODO: select right
 # locking at runtime.
 .if ${RUMP_LOCKS_UP:Uno} == yes



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

2015-04-22 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Apr 22 16:49:42 UTC 2015

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

Log Message:
Include kern_clock.c in rump kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.155 -r1.156 src/sys/rump/librump/rumpkern/Makefile.rumpkern
cvs rdiff -u -r1.170 -r1.171 src/sys/rump/librump/rumpkern/emul.c
cvs rdiff -u -r1.50 -r1.51 src/sys/rump/librump/rumpkern/intr.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.155 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.156
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.155	Tue Apr 14 13:32:34 2015
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Wed Apr 22 16:49:42 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.155 2015/04/14 13:32:34 riastradh Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.156 2015/04/22 16:49:42 pooka Exp $
 #
 
 .include ${RUMPTOP}/Makefile.rump
@@ -71,6 +71,7 @@ SRCS+=	devsw.c
 SRCS+=	init_sysctl_base.c	\
 	kern_auth.c		\
 	kern_cfglock.c		\
+	kern_clock.c		\
 	kern_descrip.c		\
 	kern_event.c		\
 	kern_hook.c		\

Index: src/sys/rump/librump/rumpkern/emul.c
diff -u src/sys/rump/librump/rumpkern/emul.c:1.170 src/sys/rump/librump/rumpkern/emul.c:1.171
--- src/sys/rump/librump/rumpkern/emul.c:1.170	Sat Apr 18 15:49:18 2015
+++ src/sys/rump/librump/rumpkern/emul.c	Wed Apr 22 16:49:42 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.170 2015/04/18 15:49:18 pooka Exp $	*/
+/*	$NetBSD: emul.c,v 1.171 2015/04/22 16:49:42 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: emul.c,v 1.170 2015/04/18 15:49:18 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: emul.c,v 1.171 2015/04/22 16:49:42 pooka Exp $);
 
 #include sys/param.h
 #include sys/null.h
@@ -85,7 +85,6 @@ struct vnode *rootvp;
 dev_t rootdev = NODEV;
 
 const int schedppq = 1;
-int hardclock_ticks;
 bool mp_online = false;
 struct timeval boottime;
 int cold = 1;

Index: src/sys/rump/librump/rumpkern/intr.c
diff -u src/sys/rump/librump/rumpkern/intr.c:1.50 src/sys/rump/librump/rumpkern/intr.c:1.51
--- src/sys/rump/librump/rumpkern/intr.c:1.50	Tue Apr 21 16:18:50 2015
+++ src/sys/rump/librump/rumpkern/intr.c	Wed Apr 22 16:49:42 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.50 2015/04/21 16:18:50 pooka Exp $	*/
+/*	$NetBSD: intr.c,v 1.51 2015/04/22 16:49:42 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008-2010, 2015 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.50 2015/04/21 16:18:50 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.51 2015/04/22 16:49:42 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -82,22 +82,12 @@ kcondvar_t lbolt; /* Oh Kath Ra */
 
 static int ncpu_final;
 
-static u_int
-rumptc_get(struct timecounter *tc)
-{
-
-	KASSERT(rump_threads);
-	return (u_int)hardclock_ticks;
-}
-
-static struct timecounter rumptc = {
-	.tc_get_timecount	= rumptc_get,
-	.tc_poll_pps 		= NULL,
-	.tc_counter_mask	= ~0,
-	.tc_frequency		= 0,
-	.tc_name		= rumpclk,
-	.tc_quality		= 0,
-};
+void noclock(void); void noclock(void) {return;}
+__strong_alias(sched_schedclock,noclock);
+__strong_alias(cpu_initclocks,noclock);
+__strong_alias(addupc_intr,noclock);
+__strong_alias(sched_tick,noclock);
+__strong_alias(setstatclockrate,noclock);
 
 /*
  * clock interrupt
@@ -106,10 +96,11 @@ static void
 doclock(void *noarg)
 {
 	struct timespec thetick, curclock;
+	struct clockframe frame;
 	int64_t sec;
 	long nsec;
 	int error;
-	int cpuindx = curcpu()-ci_index;
+	struct cpu_info *ci = curcpu();
 
 	error = rumpuser_clock_gettime(RUMPUSER_CLOCK_ABSMONO, sec, nsec);
 	if (error)
@@ -120,21 +111,24 @@ doclock(void *noarg)
 	thetick.tv_sec = 0;
 	thetick.tv_nsec = 10/hz;
 
+	/* not used, so doesn't matter what we pass in */
+	memset(frame, 0, sizeof(frame));
+
 	for (;;) {
-		callout_hardclock();
+		int lbolt_ticks = 0;
+
+		hardclock(frame);
+		if (CPU_IS_PRIMARY(ci)) {
+			if (++lbolt_ticks = hz) {
+lbolt_ticks = 0;
+cv_broadcast(lbolt);
+			}
+		}
 
 		error = rumpuser_clock_sleep(RUMPUSER_CLOCK_ABSMONO,
 		curclock.tv_sec, curclock.tv_nsec);
 		KASSERT(!error);
 		timespecadd(curclock, thetick, curclock);
-
-		if (cpuindx != 0)
-			continue;
-
-		if ((++hardclock_ticks % hz) == 0) {
-			cv_broadcast(lbolt);
-		}
-		tc_ticktock();
 	}
 }
 
@@ -304,8 +298,12 @@ softint_init(struct cpu_info *ci)
 	if (ci-ci_index == 0) {
 		int sithr_swap;
 
-		rumptc.tc_frequency = hz;
-		tc_init(rumptc);
+		/* pretend that we have our own for these */
+		stathz = 1;
+		schedhz = 1;
+		profhz = 1;
+
+		initclocks();
 
 		/* create deferred softint threads */
 		mutex_enter(sithr_emtx);



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

2015-04-22 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Apr 22 16:01:07 UTC 2015

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

Log Message:
track cpu_onproc


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 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.39 src/sys/rump/librump/rumpkern/scheduler.c:1.40
--- src/sys/rump/librump/rumpkern/scheduler.c:1.39	Sat Jun  7 11:08:09 2014
+++ src/sys/rump/librump/rumpkern/scheduler.c	Wed Apr 22 16:01:07 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: scheduler.c,v 1.39 2014/06/07 11:08:09 rmind Exp $	*/
+/*  $NetBSD: scheduler.c,v 1.40 2015/04/22 16:01:07 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: scheduler.c,v 1.39 2014/06/07 11:08:09 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: scheduler.c,v 1.40 2015/04/22 16:01:07 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -280,6 +280,7 @@ void
 rump_schedule_cpu_interlock(struct lwp *l, void *interlock)
 {
 	struct rumpcpu *rcpu;
+	struct cpu_info *ci;
 	void *old;
 	bool domigrate;
 	bool bound = l-l_pflag  LP_BOUND;
@@ -354,12 +355,19 @@ rump_schedule_cpu_interlock(struct lwp *
 	rumpuser_mutex_exit(rcpu-rcpu_mtx);
 
  fastlane:
-	l-l_cpu = l-l_target_cpu = rcpu-rcpu_ci;
+	ci = rcpu-rcpu_ci;
+	l-l_cpu = l-l_target_cpu = ci;
 	l-l_mutex = rcpu-rcpu_ci-ci_schedstate.spc_mutex;
 	l-l_ncsw++;
 	l-l_stat = LSONPROC;
 
-	rcpu-rcpu_ci-ci_curlwp = l;
+	/*
+	 * No interrupts, so ci_curlwp === cpu_onproc.
+	 * Okay, we could make an attempt to not set cpu_onproc
+	 * 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;
 }
 
 void
@@ -431,7 +439,7 @@ rump_unschedule_cpu1(struct lwp *l, void
 	void *old;
 
 	ci = l-l_cpu;
-	ci-ci_curlwp = NULL;
+	ci-ci_curlwp = ci-ci_data.cpu_onproc = NULL;
 	rcpu = rcpu_storage[ci-rump_cpus[0]];
 
 	KASSERT(rcpu-rcpu_ci == ci);



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

2015-04-22 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Apr 22 20:10:56 UTC 2015

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

Log Message:
Apparently new source files need to be added to each Makefile.inc
individually.  Who comes up with this kind of crappy build infra?


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 \
src/sys/rump/librump/rumpkern/arch/alpha/Makefile.inc
cvs rdiff -u -r1.4 -r1.5 src/sys/rump/librump/rumpkern/arch/arm/Makefile.inc
cvs rdiff -u -r1.2 -r1.3 src/sys/rump/librump/rumpkern/arch/mips/Makefile.inc
cvs rdiff -u -r1.5 -r1.6 \
src/sys/rump/librump/rumpkern/arch/powerpc/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/alpha/Makefile.inc
diff -u src/sys/rump/librump/rumpkern/arch/alpha/Makefile.inc:1.3 src/sys/rump/librump/rumpkern/arch/alpha/Makefile.inc:1.4
--- src/sys/rump/librump/rumpkern/arch/alpha/Makefile.inc:1.3	Wed Feb 12 22:28:43 2014
+++ src/sys/rump/librump/rumpkern/arch/alpha/Makefile.inc	Wed Apr 22 20:10:56 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.3 2014/02/12 22:28:43 pooka Exp $
+#	$NetBSD: Makefile.inc,v 1.4 2015/04/22 20:10:56 pooka Exp $
 #
 
 # some stubs
@@ -8,4 +8,4 @@ SRCS+=	rumpcrud.c
 SRCS+=  kobj_machdep.c
 
 .PATH:	${RUMPTOP}/librump/rumpkern/arch/generic
-SRCS+=	rump_generic_cpu.c rump_generic_pmap.c
+SRCS+=	rump_generic_abi.c rump_generic_cpu.c rump_generic_pmap.c

Index: src/sys/rump/librump/rumpkern/arch/arm/Makefile.inc
diff -u src/sys/rump/librump/rumpkern/arch/arm/Makefile.inc:1.4 src/sys/rump/librump/rumpkern/arch/arm/Makefile.inc:1.5
--- src/sys/rump/librump/rumpkern/arch/arm/Makefile.inc:1.4	Tue Jun 17 08:50:48 2014
+++ src/sys/rump/librump/rumpkern/arch/arm/Makefile.inc	Wed Apr 22 20:10:56 2015
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.4 2014/06/17 08:50:48 alnsn Exp $
+# $NetBSD: Makefile.inc,v 1.5 2015/04/22 20:10:56 pooka Exp $
 
 CPPFLAGS+=	-DARCH_ELFSIZE=32
 
@@ -6,4 +6,4 @@ CPPFLAGS+=	-DARCH_ELFSIZE=32
 SRCS+=  	kobj_machdep.c
 
 .PATH:	${RUMPTOP}/librump/rumpkern/arch/generic
-SRCS+=  	rump_generic_cpu.c rump_generic_pmap.c
+SRCS+=  	rump_generic_abi.c rump_generic_cpu.c rump_generic_pmap.c

Index: src/sys/rump/librump/rumpkern/arch/mips/Makefile.inc
diff -u src/sys/rump/librump/rumpkern/arch/mips/Makefile.inc:1.2 src/sys/rump/librump/rumpkern/arch/mips/Makefile.inc:1.3
--- src/sys/rump/librump/rumpkern/arch/mips/Makefile.inc:1.2	Wed Feb 12 22:28:43 2014
+++ src/sys/rump/librump/rumpkern/arch/mips/Makefile.inc	Wed Apr 22 20:10:56 2015
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile.inc,v 1.2 2014/02/12 22:28:43 pooka Exp $
+# $NetBSD: Makefile.inc,v 1.3 2015/04/22 20:10:56 pooka Exp $
 
 CPPFLAGS+=	-DARCH_ELFSIZE=32
 
 .PATH:	${RUMPTOP}/librump/rumpkern/arch/generic
+SRCS+=	rump_generic_abi.c
 SRCS+= 	rump_generic_cpu.c rump_generic_kobj.c rump_generic_pmap.c

Index: src/sys/rump/librump/rumpkern/arch/powerpc/Makefile.inc
diff -u src/sys/rump/librump/rumpkern/arch/powerpc/Makefile.inc:1.5 src/sys/rump/librump/rumpkern/arch/powerpc/Makefile.inc:1.6
--- src/sys/rump/librump/rumpkern/arch/powerpc/Makefile.inc:1.5	Fri Mar  7 05:49:05 2014
+++ src/sys/rump/librump/rumpkern/arch/powerpc/Makefile.inc	Wed Apr 22 20:10:56 2015
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.5 2014/03/07 05:49:05 matt Exp $
+# $NetBSD: Makefile.inc,v 1.6 2015/04/22 20:10:56 pooka Exp $
 
 .if ${MACHINE_ARCH} == powerpc \
 || (defined(MLIBDIR)  ${MLIBDIR} == powerpc)
@@ -8,4 +8,5 @@ CPPFLAGS+=	-DARCH_ELFSIZE=64
 .endif
 
 .PATH:	${RUMPTOP}/librump/rumpkern/arch/generic
+SRCS+=	rump_generic_abi.c
 SRCS+=	rump_generic_cpu.c rump_generic_kobj.c rump_generic_pmap.c



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

2015-04-21 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Apr 21 16:18:50 UTC 2015

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

Log Message:
Use hardclock_ticks instead of a homegrown variable.

... not that I understand how various kernel algorithms can work
after enough uptime with hardclock_ticks being a signed int.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/rump/librump/rumpkern/intr.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/intr.c
diff -u src/sys/rump/librump/rumpkern/intr.c:1.49 src/sys/rump/librump/rumpkern/intr.c:1.50
--- src/sys/rump/librump/rumpkern/intr.c:1.49	Thu Apr 16 10:08:59 2015
+++ src/sys/rump/librump/rumpkern/intr.c	Tue Apr 21 16:18:50 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.49 2015/04/16 10:08:59 pooka Exp $	*/
+/*	$NetBSD: intr.c,v 1.50 2015/04/21 16:18:50 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008-2010, 2015 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.49 2015/04/16 10:08:59 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.50 2015/04/21 16:18:50 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -80,7 +80,6 @@ static struct rumpuser_cv *sicpucv;
 
 kcondvar_t lbolt; /* Oh Kath Ra */
 
-static u_int ticks;
 static int ncpu_final;
 
 static u_int
@@ -88,7 +87,7 @@ rumptc_get(struct timecounter *tc)
 {
 
 	KASSERT(rump_threads);
-	return ticks;
+	return (u_int)hardclock_ticks;
 }
 
 static struct timecounter rumptc = {
@@ -132,7 +131,7 @@ doclock(void *noarg)
 		if (cpuindx != 0)
 			continue;
 
-		if ((++ticks % hz) == 0) {
+		if ((++hardclock_ticks % hz) == 0) {
 			cv_broadcast(lbolt);
 		}
 		tc_ticktock();



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

2015-04-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 21 03:53:51 UTC 2015

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

Log Message:
Restore simplicity of rump hyperentropy `hardware RNG'.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 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.8 src/sys/rump/librump/rumpkern/hyperentropy.c:1.9
--- src/sys/rump/librump/rumpkern/hyperentropy.c:1.8	Mon Apr 13 16:46:33 2015
+++ src/sys/rump/librump/rumpkern/hyperentropy.c	Tue Apr 21 03:53:50 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperentropy.c,v 1.8 2015/04/13 16:46:33 riastradh Exp $	*/
+/*	$NetBSD: hyperentropy.c,v 1.9 2015/04/21 03:53:50 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2014 Antti Kantee.  All Rights Reserved.
@@ -26,10 +26,9 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hyperentropy.c,v 1.8 2015/04/13 16:46:33 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: hyperentropy.c,v 1.9 2015/04/21 03:53:50 riastradh Exp $);
 
 #include sys/param.h
-#include sys/atomic.h
 #include sys/kmem.h
 #include sys/rndpool.h
 #include sys/rndsource.h
@@ -39,12 +38,10 @@ __KERNEL_RCSID(0, $NetBSD: hyperentropy
 #include rump_private.h
 
 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_cb(size_t bytes, void *cookie __unused)
 {
 	uint8_t *rnddata;
 	size_t dsize;
@@ -56,42 +53,11 @@ feedrandom(size_t bytes)
 	kmem_intr_free(rnddata, MAXGET);
 }
 
-static void
-feedrandom_intr(void *cookie __unused)
-{
-
-	feedrandom(atomic_swap_uint(hyperentropy_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(hyperentropy_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(rndsrc, feedrandom_cb, rndsrc);
-		rnd_attach_source(rndsrc, rump_hyperent, RND_TYPE_VM,
-		RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
-	} else {
-		/* without threads, just fill the pool */
-		rnd_attach_source(rndsrc, rump_hyperent, RND_TYPE_VM,
-		RND_FLAG_COLLECT_VALUE);
-		feedrandom(MAXGET);
-	}
+	rndsource_setcb(rndsrc, feedrandom_cb, rndsrc);
+	rnd_attach_source(rndsrc, rump_hyperent, RND_TYPE_VM,
+	RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
 }



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

2015-04-20 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Apr 21 04:05:57 UTC 2015

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

Log Message:
Revert previous -- a little too quick on the commit trigger.

Ran some tests but not enough.  There is a deadlock against myself:

rndsink_request acquires rndsinks_lock
- rnd_getmore
- hyperentropy feedrandom (or any other rndsource callback)
- rnd_add_data
- rndsinks_distribute acquires rndsinks_lock

Need to break this cycle before rndsource callbacks can invoke
rnd_add_data.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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.9 src/sys/rump/librump/rumpkern/hyperentropy.c:1.10
--- src/sys/rump/librump/rumpkern/hyperentropy.c:1.9	Tue Apr 21 03:53:50 2015
+++ src/sys/rump/librump/rumpkern/hyperentropy.c	Tue Apr 21 04:05:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: hyperentropy.c,v 1.9 2015/04/21 03:53:50 riastradh Exp $	*/
+/*	$NetBSD: hyperentropy.c,v 1.10 2015/04/21 04:05:57 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2014 Antti Kantee.  All Rights Reserved.
@@ -26,9 +26,10 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hyperentropy.c,v 1.9 2015/04/21 03:53:50 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: hyperentropy.c,v 1.10 2015/04/21 04:05:57 riastradh Exp $);
 
 #include sys/param.h
+#include sys/atomic.h
 #include sys/kmem.h
 #include sys/rndpool.h
 #include sys/rndsource.h
@@ -38,10 +39,12 @@ __KERNEL_RCSID(0, $NetBSD: hyperentropy
 #include rump_private.h
 
 static krndsource_t rndsrc;
+static volatile unsigned hyperentropy_wanted;
+static void *feedrandom_softint;
 
 #define MAXGET (RND_POOLBITS/NBBY)
 static void
-feedrandom_cb(size_t bytes, void *cookie __unused)
+feedrandom(size_t bytes)
 {
 	uint8_t *rnddata;
 	size_t dsize;
@@ -53,11 +56,42 @@ feedrandom_cb(size_t bytes, void *cookie
 	kmem_intr_free(rnddata, MAXGET);
 }
 
+static void
+feedrandom_intr(void *cookie __unused)
+{
+
+	feedrandom(atomic_swap_uint(hyperentropy_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(hyperentropy_wanted, old, new) != old);
+
+	softint_schedule(feedrandom_softint);
+}
+
 void
 rump_hyperentropy_init(void)
 {
 
-	rndsource_setcb(rndsrc, feedrandom_cb, rndsrc);
-	rnd_attach_source(rndsrc, rump_hyperent, RND_TYPE_VM,
-	RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
+	if (rump_threads) {
+		feedrandom_softint =
+		softint_establish(SOFTINT_CLOCK|SOFTINT_MPSAFE,
+			feedrandom_intr, NULL);
+		KASSERT(feedrandom_softint != NULL);
+		rndsource_setcb(rndsrc, feedrandom_cb, rndsrc);
+		rnd_attach_source(rndsrc, rump_hyperent, RND_TYPE_VM,
+		RND_FLAG_COLLECT_VALUE|RND_FLAG_HASCB);
+	} else {
+		/* without threads, just fill the pool */
+		rnd_attach_source(rndsrc, rump_hyperent, RND_TYPE_VM,
+		RND_FLAG_COLLECT_VALUE);
+		feedrandom(MAXGET);
+	}
 }



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

2015-04-17 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Apr 17 12:46:33 UTC 2015

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

Log Message:
g/c rump_vmmap

No recollection what it was used for; didn't seem to be used even when
it was originally added 5th August 2007.


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 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.164 src/sys/rump/librump/rumpkern/vm.c:1.165
--- src/sys/rump/librump/rumpkern/vm.c:1.164	Fri Apr 17 12:43:16 2015
+++ src/sys/rump/librump/rumpkern/vm.c	Fri Apr 17 12:46:33 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.164 2015/04/17 12:43:16 pooka Exp $	*/
+/*	$NetBSD: vm.c,v 1.165 2015/04/17 12:46:33 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.164 2015/04/17 12:43:16 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.165 2015/04/17 12:46:33 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -80,8 +80,6 @@ const int * const uvmexp_pagemask = uvm
 const int * const uvmexp_pageshift = uvmexp.pageshift;
 #endif
 
-struct vm_map rump_vmmap;
-
 static struct vm_map kernel_map_store;
 struct vm_map *kernel_map = kernel_map_store;
 



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

2015-04-17 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Apr 17 13:02:54 UTC 2015

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

Log Message:
set the local clients' comm to rumplocal instead of system


To generate a diff of this commit:
cvs rdiff -u -r1.317 -r1.318 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.317 src/sys/rump/librump/rumpkern/rump.c:1.318
--- src/sys/rump/librump/rumpkern/rump.c:1.317	Mon Apr 13 16:46:33 2015
+++ src/sys/rump/librump/rumpkern/rump.c	Fri Apr 17 13:02:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.317 2015/04/13 16:46:33 riastradh Exp $	*/
+/*	$NetBSD: rump.c,v 1.318 2015/04/17 13:02:54 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.317 2015/04/13 16:46:33 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: rump.c,v 1.318 2015/04/17 13:02:54 pooka Exp $);
 
 #include sys/systm.h
 #define ELFSIZE ARCH_ELFSIZE
@@ -492,6 +492,7 @@ rump_init(void)
 	mutex_exit(proc_lock);
 	if (initproc == NULL)
 		panic(where in the world is initproc?);
+	strlcpy(initproc-p_comm, rumplocal, sizeof(initproc-p_comm));
 
 	rump_component_init(RUMP_COMPONENT_POSTINIT);
 



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

2015-04-17 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Apr 17 13:03:38 UTC 2015

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

Log Message:
Don't share file descriptors between proc0 and local clients.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 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.33 src/sys/rump/librump/rumpkern/lwproc.c:1.34
--- src/sys/rump/librump/rumpkern/lwproc.c:1.33	Fri Apr  3 16:40:55 2015
+++ src/sys/rump/librump/rumpkern/lwproc.c	Fri Apr 17 13:03:38 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: lwproc.c,v 1.33 2015/04/03 16:40:55 pooka Exp $	*/
+/*  $NetBSD: lwproc.c,v 1.34 2015/04/17 13:03:38 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #define RUMP__CURLWP_PRIVATE
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lwproc.c,v 1.33 2015/04/03 16:40:55 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: lwproc.c,v 1.34 2015/04/17 13:03:38 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -327,7 +327,7 @@ rump__lwproc_alloclwp(struct proc *p)
 	bool newproc = false;
 
 	if (p == NULL) {
-		p = lwproc_newproc(proc0, rump_vmspace_local, 0);
+		p = lwproc_newproc(proc0, rump_vmspace_local, RUMP_RFCFDG);
 		newproc = true;
 	}
 



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

2015-04-16 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Thu Apr 16 10:08:59 UTC 2015

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

Log Message:
extern int hz was written in a very aesthetically pleasing way in this
file, but let's just be happy with the sys/kernel.h style of writing it.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/rump/librump/rumpkern/intr.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/intr.c
diff -u src/sys/rump/librump/rumpkern/intr.c:1.48 src/sys/rump/librump/rumpkern/intr.c:1.49
--- src/sys/rump/librump/rumpkern/intr.c:1.48	Wed Jan 14 18:51:56 2015
+++ src/sys/rump/librump/rumpkern/intr.c	Thu Apr 16 10:08:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.48 2015/01/14 18:51:56 pooka Exp $	*/
+/*	$NetBSD: intr.c,v 1.49 2015/04/16 10:08:59 pooka Exp $	*/
 
 /*
  * Copyright (c) 2008-2010, 2015 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.48 2015/01/14 18:51:56 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.49 2015/04/16 10:08:59 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -111,7 +111,6 @@ doclock(void *noarg)
 	long nsec;
 	int error;
 	int cpuindx = curcpu()-ci_index;
-	extern int hz;
 
 	error = rumpuser_clock_gettime(RUMPUSER_CLOCK_ABSMONO, sec, nsec);
 	if (error)



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

2015-04-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Apr  3 16:37:02 UTC 2015

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

Log Message:
Use vmspace of calling [rump kernel] process instead of sysspace.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/librump/rumpkern/accessors.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/accessors.c
diff -u src/sys/rump/librump/rumpkern/accessors.c:1.1 src/sys/rump/librump/rumpkern/accessors.c:1.2
--- src/sys/rump/librump/rumpkern/accessors.c:1.1	Fri Apr 25 18:25:38 2014
+++ src/sys/rump/librump/rumpkern/accessors.c	Fri Apr  3 16:37:02 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: accessors.c,v 1.1 2014/04/25 18:25:38 pooka Exp $	*/
+/*	$NetBSD: accessors.c,v 1.2 2015/04/03 16:37:02 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: accessors.c,v 1.1 2014/04/25 18:25:38 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: accessors.c,v 1.2 2015/04/03 16:37:02 pooka Exp $);
 
 #include sys/param.h
 #include sys/kauth.h
@@ -68,7 +68,7 @@ rump_uio_setup(void *buf, size_t bufsize
 	uio-uio_offset = offset;
 	uio-uio_resid = bufsize;
 	uio-uio_rw = uiorw;
-	UIO_SETUP_SYSSPACE(uio);
+	uio-uio_vmspace = curproc-p_vmspace;
 
 	return uio;
 }



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

2015-04-03 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Fri Apr  3 16:46:39 UTC 2015

Modified Files:
src/sys/rump/librump/rumpkern: rump_private.h vm.c
src/sys/rump/librump/rumpkern/arch/generic: rump_generic_pmap.c
src/sys/rump/librump/rumpkern/arch/x86: rump_x86_pmap.c

Log Message:
Use RUMP_PMAP_KERNEL and RUMP_PMAP_LOCAL to denote
kernel and local client pmaps, respectively.


To generate a diff of this commit:
cvs rdiff -u -r1.88 -r1.89 src/sys/rump/librump/rumpkern/rump_private.h
cvs rdiff -u -r1.162 -r1.163 src/sys/rump/librump/rumpkern/vm.c
cvs rdiff -u -r1.2 -r1.3 \
src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c
cvs rdiff -u -r1.1 -r1.2 \
src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/rump_private.h
diff -u src/sys/rump/librump/rumpkern/rump_private.h:1.88 src/sys/rump/librump/rumpkern/rump_private.h:1.89
--- src/sys/rump/librump/rumpkern/rump_private.h:1.88	Fri Apr  3 16:40:55 2015
+++ src/sys/rump/librump/rumpkern/rump_private.h	Fri Apr  3 16:46:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_private.h,v 1.88 2015/04/03 16:40:55 pooka Exp $	*/
+/*	$NetBSD: rump_private.h,v 1.89 2015/04/03 16:46:39 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -120,6 +120,8 @@ extern unsigned long rump_physmemlimit;
 extern struct vmspace *rump_vmspace_local;
 #define RUMP_LOCALPROC_P(p) \
 (p-p_vmspace == vmspace_kernel() || p-p_vmspace == rump_vmspace_local)
+#define RUMP_PMAP_KERNEL ((struct pmap *const)-1)
+#define RUMP_PMAP_LOCAL ((struct pmap *)-2)
 
 void		rump_component_load(const struct rump_component *);
 void		rump_component_init(enum rump_component_type);

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.162 src/sys/rump/librump/rumpkern/vm.c:1.163
--- src/sys/rump/librump/rumpkern/vm.c:1.162	Fri Apr  3 16:40:55 2015
+++ src/sys/rump/librump/rumpkern/vm.c	Fri Apr  3 16:46:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.162 2015/04/03 16:40:55 pooka Exp $	*/
+/*	$NetBSD: vm.c,v 1.163 2015/04/03 16:46:39 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.162 2015/04/03 16:40:55 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.163 2015/04/03 16:46:39 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -395,7 +395,7 @@ uvm_init(void)
 
 	/* create vmspace used by local clients */
 	rump_vmspace_local = kmem_zalloc(sizeof(*rump_vmspace_local), KM_SLEEP);
-	uvmspace_init(rump_vmspace_local, (struct pmap *)-2, 0, 0, false);
+	uvmspace_init(rump_vmspace_local, RUMP_PMAP_LOCAL, 0, 0, false);
 }
 
 void

Index: src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c
diff -u src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c:1.2 src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c:1.3
--- src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c:1.2	Wed Feb 12 22:30:45 2014
+++ src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c	Fri Apr  3 16:46:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_generic_pmap.c,v 1.2 2014/02/12 22:30:45 pooka Exp $	*/
+/*	$NetBSD: rump_generic_pmap.c,v 1.3 2015/04/03 16:46:39 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -26,18 +26,20 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rump_generic_pmap.c,v 1.2 2014/02/12 22:30:45 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: rump_generic_pmap.c,v 1.3 2015/04/03 16:46:39 pooka Exp $);
 
 #include sys/param.h
 
 #include uvm/uvm_extern.h
 
+#include rump_private.h
+
 /*
  * This is the MI pmap implementation for rump kernels.  It's used only by
  * architectures which do not conform to the kernel ABI.
  */
 
-struct pmap *const kernel_pmap_ptr = (struct pmap *const)-1;
+struct pmap *const kernel_pmap_ptr = RUMP_PMAP_KERNEL;
 
 void
 pmap_kenter_pa(vaddr_t va, paddr_t pa, vm_prot_t prot, u_int fl)

Index: src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c
diff -u src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c:1.1 src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c:1.2
--- src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c:1.1	Wed Feb 12 22:28:43 2014
+++ src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c	Fri Apr  3 16:46:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_x86_pmap.c,v 1.1 2014/02/12 22:28:43 pooka Exp $	*/
+/*	$NetBSD: rump_x86_pmap.c,v 1.2 2015/04/03 16:46:39 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -26,14 +26,15 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rump_x86_pmap.c,v 1.1 2014/02/12 22:28:43 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: rump_x86_pmap.c,v 1.2 2015/04/03 16:46:39 pooka Exp $);
 
 #include sys/param.h
 
 #include 

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

2015-03-23 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Mon Mar 23 15:42:29 UTC 2015

Modified Files:
src/sys/rump/librump/rumpkern: rump_lwproc.3

Log Message:
fix typo

set curlwp to context - set curlwp to implicit context
from Martin Lucina mar...@lucina.net


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

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_lwproc.3
diff -u src/sys/rump/librump/rumpkern/rump_lwproc.3:1.1 src/sys/rump/librump/rumpkern/rump_lwproc.3:1.2
--- src/sys/rump/librump/rumpkern/rump_lwproc.3:1.1	Sun Nov  9 17:39:38 2014
+++ src/sys/rump/librump/rumpkern/rump_lwproc.3	Mon Mar 23 15:42:29 2015
@@ -1,4 +1,4 @@
-.\ $NetBSD: rump_lwproc.3,v 1.1 2014/11/09 17:39:38 pooka Exp $
+.\ $NetBSD: rump_lwproc.3,v 1.2 2015/03/23 15:42:29 pooka Exp $
 .\
 .\ Copyright (c) 2010 Antti Kantee.  All rights reserved.
 .\
@@ -118,7 +118,7 @@ sets curlwp to implicit context.
 Switching to an already running lwp, i.e. attempting to use the
 same curlwp in two host threads simultaneously causes a fatal error.
 .It Fn rump_pub_lwproc_releaselwp
-Release curlwp and set curlwp to context.
+Release curlwp and set curlwp to implicit context.
 In case curlwp was the last thread inside the current process, the
 process container is also released.
 Calling this routine without a dedicated curlwp is a fatal error.



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

2015-03-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Mar  8 20:32:21 UTC 2015

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

Log Message:
regen


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 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.106 src/sys/rump/librump/rumpkern/rump_syscalls.c:1.107
--- src/sys/rump/librump/rumpkern/rump_syscalls.c:1.106	Sat Mar  7 11:40:05 2015
+++ src/sys/rump/librump/rumpkern/rump_syscalls.c	Sun Mar  8 16:32:21 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: rump_syscalls.c,v 1.106 2015/03/07 16:40:05 christos Exp $ */
+/* $NetBSD: rump_syscalls.c,v 1.107 2015/03/08 20:32:21 christos Exp $ */
 
 /*
  * System call vector and marshalling for rump.
@@ -15,7 +15,7 @@
 
 #ifdef __NetBSD__
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rump_syscalls.c,v 1.106 2015/03/07 16:40:05 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: rump_syscalls.c,v 1.107 2015/03/08 20:32:21 christos Exp $);
 
 #include sys/fstypes.h
 #include sys/proc.h
@@ -6402,1118 +6402,2075 @@ int rumpns_enosys(void);
 #define	ns(type)	n(type), s(type)
 
 struct sysent rump_sysent[] = {
-	{ 0, 0, SYCALL_NOSYS,
-	(sy_call_t *)rumpns_enosys, 0, 0 }, 	/* 0 = syscall */
-	{ 0, 0, SYCALL_NOSYS,
-	(sy_call_t *)rumpns_enosys, 0, 0 }, 	/* 1 = exit */
-	{ 0, 0, SYCALL_NOSYS,
-	(sy_call_t *)rumpns_enosys, 0, 0 }, 	/* 2 = fork */
-	{ ns(struct sys_read_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 3 = read */
-	{ ns(struct sys_write_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 4 = write */
-	{ ns(struct sys_open_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 5 = open */
-	{ ns(struct sys_close_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 6 = close */
-	{ 0, 0, 0,
-	(sy_call_t *)rumpns_sys_nomodule, 0, 0 }, 	/* 7 = wait4 */
-	{ 0, 0, 0,
-	(sy_call_t *)rumpns_sys_nomodule, 0, 0 }, 	/* 8 = ocreat */
-	{ ns(struct sys_link_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 9 = link */
-	{ ns(struct sys_unlink_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 10 = unlink */
-	{ 0, 0, SYCALL_NOSYS,
-	(sy_call_t *)rumpns_enosys, 0, 0 },		/* 11 = obsolete execv */
-	{ ns(struct sys_chdir_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 12 = chdir */
-	{ ns(struct sys_fchdir_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 13 = fchdir */
-	{ ns(struct compat_50_sys_mknod_args), 0,
-	   (sy_call_t *)rumpns_sys_nomodule, 0, 0 },	/* 14 = compat_50_mknod */
-	{ ns(struct sys_chmod_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 15 = chmod */
-	{ ns(struct sys_chown_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 16 = chown */
-	{ 0, 0, SYCALL_NOSYS,
-	(sy_call_t *)rumpns_enosys, 0, 0 }, 	/* 17 = break */
-	{ 0, 0, 0,
-	(sy_call_t *)rumpns_sys_nomodule, 0, 0 }, 	/* 18 = getfsstat */
-	{ 0, 0, 0,
-	(sy_call_t *)rumpns_sys_nomodule, 0, 0 }, 	/* 19 = olseek */
-	{ 0, 0, 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 20 = getpid */
-	{ 0, 0, 0,
-	(sy_call_t *)rumpns_sys_nomodule, 0, 0 }, 	/* 21 = mount */
-	{ ns(struct sys_unmount_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 22 = unmount */
-	{ ns(struct sys_setuid_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 23 = setuid */
-	{ 0, 0, 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 24 = getuid */
-	{ 0, 0, 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 25 = geteuid */
-	{ 0, 0, SYCALL_NOSYS,
-	(sy_call_t *)rumpns_enosys, 0, 0 }, 	/* 26 = ptrace */
-	{ ns(struct sys_recvmsg_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 27 = recvmsg */
-	{ ns(struct sys_sendmsg_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 28 = sendmsg */
-	{ ns(struct sys_recvfrom_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 29 = recvfrom */
-	{ ns(struct sys_accept_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 30 = accept */
-	{ ns(struct sys_getpeername_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 31 = getpeername */
-	{ ns(struct sys_getsockname_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 32 = getsockname */
-	{ ns(struct sys_access_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 33 = access */
-	{ ns(struct sys_chflags_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 34 = chflags */
-	{ ns(struct sys_fchflags_args), 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 35 = fchflags */
-	{ 0, 0, 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 36 = sync */
-	{ 0, 0, SYCALL_NOSYS,
-	(sy_call_t *)rumpns_enosys, 0, 0 }, 	/* 37 = kill */
-	{ 0, 0, 0,
-	(sy_call_t *)rumpns_sys_nomodule, 0, 0 }, 	/* 38 = stat43 */
-	{ 0, 0, 0,
-	   (sy_call_t *)rumpns_enosys, 0, 0 },	/* 39 = getppid */
-	{ 0, 0, 0,
-	(sy_call_t *)rumpns_sys_nomodule, 0, 0 }, 	/* 40 = lstat43 */
-	{ 

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

2015-02-25 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb 25 13:20:05 UTC 2015

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

Log Message:
belated regen (posix_fallocate, readlinkat)


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 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.104 src/sys/rump/librump/rumpkern/rump_syscalls.c:1.105
--- src/sys/rump/librump/rumpkern/rump_syscalls.c:1.104	Fri Jul 25 04:27:36 2014
+++ src/sys/rump/librump/rumpkern/rump_syscalls.c	Wed Feb 25 08:20:05 2015
@@ -1,10 +1,10 @@
-/* $NetBSD: rump_syscalls.c,v 1.104 2014/07/25 08:27:36 dholland Exp $ */
+/* $NetBSD: rump_syscalls.c,v 1.105 2015/02/25 13:20:05 christos Exp $ */
 
 /*
  * System call vector and marshalling for rump.
  *
  * DO NOT EDIT-- this file is automatically generated.
- * created from	NetBSD: syscalls.master,v 1.270 2014/07/25 08:25:47 dholland Exp
+ * created from	NetBSD: syscalls.master,v 1.272 2015/02/22 00:50:30 christos Exp
  */
 
 #ifdef RUMP_CLIENT
@@ -15,7 +15,7 @@
 
 #ifdef __NetBSD__
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rump_syscalls.c,v 1.104 2014/07/25 08:27:36 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: rump_syscalls.c,v 1.105 2015/02/25 13:20:05 christos Exp $);
 
 #include sys/fstypes.h
 #include sys/proc.h
@@ -6072,13 +6072,13 @@ __weak_alias(_openat,rump___sysimpl_open
 __strong_alias(_sys_openat,rump___sysimpl_openat);
 #endif /* RUMP_KERNEL_IS_LIBC */
 
-int rump___sysimpl_readlinkat(int, const char *, char *, size_t);
-int
+ssize_t rump___sysimpl_readlinkat(int, const char *, char *, size_t);
+ssize_t
 rump___sysimpl_readlinkat(int fd, const char * path, char * buf, size_t bufsize)
 {
 	register_t retval[2];
 	int error = 0;
-	int rv = -1;
+	ssize_t rv = -1;
 	struct sys_readlinkat_args callarg;
 
 	memset(callarg, 0, sizeof(callarg));
@@ -6090,8 +6090,8 @@ rump___sysimpl_readlinkat(int fd, const 
 	error = rsys_syscall(SYS_readlinkat, callarg, sizeof(callarg), retval);
 	rsys_seterrno(error);
 	if (error == 0) {
-		if (sizeof(int)  sizeof(register_t))
-			rv = *(int *)retval;
+		if (sizeof(ssize_t)  sizeof(register_t))
+			rv = *(ssize_t *)retval;
 		else
 			rv = *retval;
 	}
@@ -6320,7 +6320,6 @@ int
 rump___sysimpl_posix_fallocate(int fd, off_t pos, off_t len)
 {
 	register_t retval[2];
-	int error = 0;
 	int rv = -1;
 	struct sys_posix_fallocate_args callarg;
 
@@ -6330,14 +6329,11 @@ rump___sysimpl_posix_fallocate(int fd, o
 	SPARG(callarg, pos) = pos;
 	SPARG(callarg, len) = len;
 
-	error = rsys_syscall(SYS_posix_fallocate, callarg, sizeof(callarg), retval);
-	rsys_seterrno(error);
-	if (error == 0) {
-		if (sizeof(int)  sizeof(register_t))
-			rv = *(int *)retval;
-		else
-			rv = *retval;
-	}
+	rsys_syscall(SYS_posix_fallocate, callarg, sizeof(callarg), retval);
+	if (sizeof(int)  sizeof(register_t))
+		rv = *(int *)retval;
+	else
+		rv = *retval;
 	return rv;
 }
 #ifdef RUMP_KERNEL_IS_LIBC



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

2015-02-04 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Feb  4 12:48:05 UTC 2015

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

Log Message:
default newvers.sh parameters to reproducible build


To generate a diff of this commit:
cvs rdiff -u -r1.153 -r1.154 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.153 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.154
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.153	Wed Jan  7 22:24:04 2015
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Wed Feb  4 12:48:05 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.153 2015/01/07 22:24:04 pooka Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.154 2015/02/04 12:48:05 pooka Exp $
 #
 
 .include ${RUMPTOP}/Makefile.rump
@@ -50,18 +50,10 @@ SRCS+=	locks_up.c
 SRCS+=	locks.c
 .endif
 
-MKREPRO?=no
-
-.if ${MKREPRO} == yes
-_NVFLAGS=-r
-.else
-_NVFLAGS=
-.endif
-
 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 ${_NVFLAGS}
+	${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

2015-01-21 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Jan 21 14:39:37 UTC 2015

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

Log Message:
Account for lwps so that rump_sys_setuid() doesn't hit a KASSERT when
it tries to reaccount a switching procs lwps.

from Mato Lucina


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 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.31 src/sys/rump/librump/rumpkern/lwproc.c:1.32
--- src/sys/rump/librump/rumpkern/lwproc.c:1.31	Fri Apr 25 13:20:45 2014
+++ src/sys/rump/librump/rumpkern/lwproc.c	Wed Jan 21 14:39:37 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: lwproc.c,v 1.31 2014/04/25 13:20:45 pooka Exp $	*/
+/*  $NetBSD: lwproc.c,v 1.32 2015/01/21 14:39:37 pooka Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #define RUMP__CURLWP_PRIVATE
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: lwproc.c,v 1.31 2014/04/25 13:20:45 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: lwproc.c,v 1.32 2015/01/21 14:39:37 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -246,6 +246,8 @@ lwproc_freelwp(struct lwp *l)
 	if (--p-p_nlwps == 0) {
 		KASSERT(p != proc0);
 		p-p_stat = SDEAD;
+	} else {
+		chglwpcnt(kauth_cred_getuid(p-p_cred), -1);
 	}
 	cv_broadcast(p-p_lwpcv); /* nobody sleeps on this in a rump kernel? */
 	kauth_cred_free(l-l_cred);
@@ -276,7 +278,15 @@ static void
 lwproc_makelwp(struct proc *p, struct lwp *l, bool doswitch, bool procmake)
 {
 
-	p-p_nlwps++;
+	/*
+	 * Account the new lwp to the owner of the process.
+	 * For some reason, NetBSD doesn't count the first lwp
+	 * in a process as a lwp, so skip that.
+	 */
+	if (p-p_nlwps++) {
+		chglwpcnt(kauth_cred_getuid(p-p_cred), 1);
+	}
+
 	l-l_refcnt = 1;
 	l-l_proc = p;
 



  1   2   3   4   5   >