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

2023-10-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Oct 15 11:11:38 UTC 2023

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

Log Message:
rump: Sprinkle sys/syncobj.h here too.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/rump/librump/rumpkern/emul.c
cvs rdiff -u -r1.57 -r1.58 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.200 src/sys/rump/librump/rumpkern/emul.c:1.201
--- src/sys/rump/librump/rumpkern/emul.c:1.200	Thu Sep 28 15:50:24 2023
+++ src/sys/rump/librump/rumpkern/emul.c	Sun Oct 15 11:11:37 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.200 2023/09/28 15:50:24 manu Exp $	*/
+/*	$NetBSD: emul.c,v 1.201 2023/10/15 11:11:37 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.200 2023/09/28 15:50:24 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.201 2023/10/15 11:11:37 riastradh Exp $");
 
 #include 
 #include 
@@ -40,6 +40,7 @@ __KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.2
 #ifdef LOCKDEBUG
 #include 
 #endif
+#include 
 
 #include 
 

Index: src/sys/rump/librump/rumpkern/lwproc.c
diff -u src/sys/rump/librump/rumpkern/lwproc.c:1.57 src/sys/rump/librump/rumpkern/lwproc.c:1.58
--- src/sys/rump/librump/rumpkern/lwproc.c:1.57	Thu Oct  5 19:41:07 2023
+++ src/sys/rump/librump/rumpkern/lwproc.c	Sun Oct 15 11:11:37 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: lwproc.c,v 1.57 2023/10/05 19:41:07 ad Exp $	*/
+/*  $NetBSD: lwproc.c,v 1.58 2023/10/15 11:11:37 riastradh 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.57 2023/10/05 19:41:07 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.58 2023/10/15 11:11:37 riastradh Exp $");
 
 #include 
 #include 
@@ -44,6 +44,7 @@ __KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1
 #include 
 #include 
 #include 
+#include 
 
 #include 
 



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

2023-10-15 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Oct 15 11:11:38 UTC 2023

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

Log Message:
rump: Sprinkle sys/syncobj.h here too.


To generate a diff of this commit:
cvs rdiff -u -r1.200 -r1.201 src/sys/rump/librump/rumpkern/emul.c
cvs rdiff -u -r1.57 -r1.58 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.



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

2023-10-13 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri Oct 13 18:23:54 UTC 2023

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

Log Message:
Rump: sleepq_remove(): don't unlock the sleepq.  Spotted by hannken@.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 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.27 src/sys/rump/librump/rumpkern/sleepq.c:1.28
--- src/sys/rump/librump/rumpkern/sleepq.c:1.27	Sun Oct  8 13:23:05 2023
+++ src/sys/rump/librump/rumpkern/sleepq.c	Fri Oct 13 18:23:54 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: sleepq.c,v 1.27 2023/10/08 13:23:05 ad Exp $	*/
+/*	$NetBSD: sleepq.c,v 1.28 2023/10/13 18:23:54 ad Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.27 2023/10/08 13:23:05 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.28 2023/10/13 18:23:54 ad Exp $");
 
 #include 
 #include 
@@ -150,7 +150,7 @@ void
 sleepq_remove(sleepq_t *sq, struct lwp *l, bool wakeup)
 {
 
-	sleepq_unsleep(l, true);
+	sleepq_unsleep(l, false);
 }
 
 /*



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

2023-10-13 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Fri Oct 13 18:23:54 UTC 2023

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

Log Message:
Rump: sleepq_remove(): don't unlock the sleepq.  Spotted by hannken@.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 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.



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

2023-10-04 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Oct  4 21:56:16 UTC 2023

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

Log Message:
rump now needs lwp_need_userret()


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 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.27 src/sys/rump/librump/rumpkern/threads.c:1.28
--- src/sys/rump/librump/rumpkern/threads.c:1.27	Sat Aug  1 22:30:57 2020
+++ src/sys/rump/librump/rumpkern/threads.c	Wed Oct  4 21:56:15 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: threads.c,v 1.27 2020/08/01 22:30:57 riastradh Exp $	*/
+/*	$NetBSD: threads.c,v 1.28 2023/10/04 21:56:15 ad Exp $	*/
 
 /*
  * Copyright (c) 2007-2009 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: threads.c,v 1.27 2020/08/01 22:30:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: threads.c,v 1.28 2023/10/04 21:56:15 ad Exp $");
 
 #include 
 #include 
@@ -377,3 +377,10 @@ lwp_userret(struct lwp *l)
 	rump_unschedule();
 	rumpuser_thread_exit();
 }
+
+void
+lwp_need_userret(struct lwp *l)
+{
+
+	/* do what? */
+}



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

2023-10-04 Thread Andrew Doran
Module Name:src
Committed By:   ad
Date:   Wed Oct  4 21:56:16 UTC 2023

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

Log Message:
rump now needs lwp_need_userret()


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 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.



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

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 11:51:48 UTC 2023

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

Log Message:
Revert "rump: Set mp_online = true and start threads _after_ cold = 0."

This breaks some tests, e.g. dev/scsipi/t_cd:noisyeject, which relies
on config_finalize to wait for driver threads.  Trouble is, the
actual setting of cold=0 happens near the call to config_finalize in
RUMP__FACTION_DEV.  Need to think harder about this.


To generate a diff of this commit:
cvs rdiff -u -r1.356 -r1.357 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.356 src/sys/rump/librump/rumpkern/rump.c:1.357
--- src/sys/rump/librump/rumpkern/rump.c:1.356	Sat Aug  5 08:05:57 2023
+++ src/sys/rump/librump/rumpkern/rump.c	Sat Aug  5 11:51:47 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.356 2023/08/05 08:05:57 riastradh Exp $	*/
+/*	$NetBSD: rump.c,v 1.357 2023/08/05 11:51:47 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.356 2023/08/05 08:05:57 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.357 2023/08/05 11:51:47 riastradh Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -391,9 +391,14 @@ rump_init_callback(void (*cpuinit_callba
 	cprng_init();
 	cprng_fast_init();
 
+	mp_online = true;
+
 	if (cpuinit_callback)
 		(*cpuinit_callback)();
 
+	/* CPUs are up.  allow kernel threads to run */
+	rump_thread_allow(NULL);
+
 	rnd_init_softint();
 
 	kqueue_init();
@@ -447,11 +452,6 @@ rump_init_callback(void (*cpuinit_callba
 
 	cold = 0;
 
-	mp_online = true;
-
-	/* CPUs are up.  allow kernel threads to run */
-	rump_thread_allow(NULL);
-
 	sysctl_finalize();
 
 	module_init_class(MODULE_CLASS_ANY);



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

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 11:51:48 UTC 2023

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

Log Message:
Revert "rump: Set mp_online = true and start threads _after_ cold = 0."

This breaks some tests, e.g. dev/scsipi/t_cd:noisyeject, which relies
on config_finalize to wait for driver threads.  Trouble is, the
actual setting of cold=0 happens near the call to config_finalize in
RUMP__FACTION_DEV.  Need to think harder about this.


To generate a diff of this commit:
cvs rdiff -u -r1.356 -r1.357 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.



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

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 08:05:58 UTC 2023

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

Log Message:
rump: Set mp_online = true and start threads _after_ cold = 0.

Otherwise we may have threads running while cold, which is a
contradiction in terms.

Deferring mp_online = true is necessary because things like xcall(9)
use rely on it to decide whether to wait for threads on other CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.355 -r1.356 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.355 src/sys/rump/librump/rumpkern/rump.c:1.356
--- src/sys/rump/librump/rumpkern/rump.c:1.355	Mon Mar 28 20:49:32 2022
+++ src/sys/rump/librump/rumpkern/rump.c	Sat Aug  5 08:05:57 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.355 2022/03/28 20:49:32 christos Exp $	*/
+/*	$NetBSD: rump.c,v 1.356 2023/08/05 08:05:57 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.355 2022/03/28 20:49:32 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.356 2023/08/05 08:05:57 riastradh Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -391,14 +391,9 @@ rump_init_callback(void (*cpuinit_callba
 	cprng_init();
 	cprng_fast_init();
 
-	mp_online = true;
-
 	if (cpuinit_callback)
 		(*cpuinit_callback)();
 
-	/* CPUs are up.  allow kernel threads to run */
-	rump_thread_allow(NULL);
-
 	rnd_init_softint();
 
 	kqueue_init();
@@ -452,6 +447,11 @@ rump_init_callback(void (*cpuinit_callba
 
 	cold = 0;
 
+	mp_online = true;
+
+	/* CPUs are up.  allow kernel threads to run */
+	rump_thread_allow(NULL);
+
 	sysctl_finalize();
 
 	module_init_class(MODULE_CLASS_ANY);



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

2023-08-05 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Aug  5 08:05:58 UTC 2023

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

Log Message:
rump: Set mp_online = true and start threads _after_ cold = 0.

Otherwise we may have threads running while cold, which is a
contradiction in terms.

Deferring mp_online = true is necessary because things like xcall(9)
use rely on it to decide whether to wait for threads on other CPUs.


To generate a diff of this commit:
cvs rdiff -u -r1.355 -r1.356 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.



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

2023-07-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 16 23:12:17 UTC 2023

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

Log Message:
rump: Fix comment to reflect l_private -> l_sched.info.

Comment was misspelled `l->private', hence didn't come up in grep.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 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.85 src/sys/rump/librump/rumpkern/locks.c:1.86
--- src/sys/rump/librump/rumpkern/locks.c:1.85	Sun Jul 16 23:05:53 2023
+++ src/sys/rump/librump/rumpkern/locks.c	Sun Jul 16 23:12:17 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: locks.c,v 1.85 2023/07/16 23:05:53 riastradh Exp $	*/
+/*	$NetBSD: locks.c,v 1.86 2023/07/16 23:12:17 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.85 2023/07/16 23:05:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.86 2023/07/16 23:12:17 riastradh Exp $");
 
 #include 
 #include 
@@ -425,7 +425,7 @@ docvwait(kcondvar_t *cv, kmutex_t *mtx, 
 		KASSERT(p->p_sflag & PS_RUMP_LWPEXIT);
 		mutex_exit(p->p_lock);
 
-		/* ok, we can exit and remove "reference" to l->private */
+		/* ok, we can exit and remove "reference" to l->l_sched.info */
 
 		mutex_enter(mtx);
 		rv = EINTR;



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

2023-07-16 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Jul 16 23:12:17 UTC 2023

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

Log Message:
rump: Fix comment to reflect l_private -> l_sched.info.

Comment was misspelled `l->private', hence didn't come up in grep.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 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.



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

2023-06-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jun 23 21:09:45 UTC 2023

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

Log Message:
rump: KASSERT(x && y) -> KASSERT(x); KASSERT(y)

Add some KASSERTMSG while here.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/rump/librump/rumpkern/klock.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/klock.c
diff -u src/sys/rump/librump/rumpkern/klock.c:1.10 src/sys/rump/librump/rumpkern/klock.c:1.11
--- src/sys/rump/librump/rumpkern/klock.c:1.10	Thu Jul  7 06:55:44 2016
+++ src/sys/rump/librump/rumpkern/klock.c	Fri Jun 23 21:09:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: klock.c,v 1.10 2016/07/07 06:55:44 msaitoh Exp $	*/
+/*	$NetBSD: klock.c,v 1.11 2023/06/23 21:09:44 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: klock.c,v 1.10 2016/07/07 06:55:44 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: klock.c,v 1.11 2023/06/23 21:09:44 riastradh Exp $");
 
 #include 
 #include 
@@ -67,7 +67,9 @@ void
 rump_kernel_bigwrap(int *nlocks)
 {
 
-	KASSERT(giantcnt > 0 && curlwp == giantowner);
+	KASSERTMSG(giantcnt > 0, "giantcnt=%d", giantcnt);
+	KASSERTMSG(curlwp == giantowner, "curlwp=%p giantowner=%p",
+	curlwp, giantowner);
 	giantowner = NULL;
 	*nlocks = giantcnt;
 	giantcnt = 0;



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

2023-06-23 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Fri Jun 23 21:09:45 UTC 2023

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

Log Message:
rump: KASSERT(x && y) -> KASSERT(x); KASSERT(y)

Add some KASSERTMSG while here.


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

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



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

2023-04-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr 22 13:53:44 UTC 2023

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

Log Message:
rumpkern: Provide stub pnbuf_cache weak alias.

Needed only by sys_module.c handle_modctl_load, which won't work if
there's no rumpvfs linked in anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 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.



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

2023-04-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr 22 13:53:44 UTC 2023

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

Log Message:
rumpkern: Provide stub pnbuf_cache weak alias.

Needed only by sys_module.c handle_modctl_load, which won't work if
there's no rumpvfs linked in anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 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.198 src/sys/rump/librump/rumpkern/emul.c:1.199
--- src/sys/rump/librump/rumpkern/emul.c:1.198	Sat Apr 22 13:53:29 2023
+++ src/sys/rump/librump/rumpkern/emul.c	Sat Apr 22 13:53:44 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.198 2023/04/22 13:53:29 riastradh Exp $	*/
+/*	$NetBSD: emul.c,v 1.199 2023/04/22 13:53:44 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.198 2023/04/22 13:53:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.199 2023/04/22 13:53:44 riastradh Exp $");
 
 #include 
 #include 
@@ -337,6 +337,9 @@ struct filterops rump_fs_filtops = {
 };
 __weak_alias(fs_filtops,rump_fs_filtops);
 
+struct pool_cache *rump_pnbuf_cache;
+__weak_alias(pnbuf_cache,rump_pnbuf_cache);
+
 /*
  * 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

2023-04-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr 22 13:53:37 UTC 2023

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

Log Message:
rumpkern: Provide stub uvm_vnodeops weak alias.

Needed for UVM_OBJ_IS_VNODE, but not for anything else in rumpkern
without rumpvfs.


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 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.194 src/sys/rump/librump/rumpkern/vm.c:1.195
--- src/sys/rump/librump/rumpkern/vm.c:1.194	Wed Oct 26 23:22:07 2022
+++ src/sys/rump/librump/rumpkern/vm.c	Sat Apr 22 13:53:37 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.194 2022/10/26 23:22:07 riastradh Exp $	*/
+/*	$NetBSD: vm.c,v 1.195 2023/04/22 13:53:37 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.194 2022/10/26 23:22:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.195 2023/04/22 13:53:37 riastradh Exp $");
 
 #include 
 #include 
@@ -163,6 +163,10 @@ pgdtor(void *arg, void *obj)
 
 static struct pool_cache pagecache;
 
+/* stub for UVM_OBJ_IS_VNODE */
+struct uvm_pagerops rump_uvm_vnodeops;
+__weak_alias(uvm_vnodeops,rump_uvm_vnodeops);
+
 /*
  * Called with the object locked.  We don't support anons.
  */



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

2023-04-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr 22 13:53:37 UTC 2023

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

Log Message:
rumpkern: Provide stub uvm_vnodeops weak alias.

Needed for UVM_OBJ_IS_VNODE, but not for anything else in rumpkern
without rumpvfs.


To generate a diff of this commit:
cvs rdiff -u -r1.194 -r1.195 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.



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

2023-04-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr 22 13:53:30 UTC 2023

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

Log Message:
rumpkern: Provide fs_filtops weak alias.

We should introduce a link set for sys_kfilters, but this works
around the problem for now -- librump's dependency on librumpvfs
symbols.


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 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.



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

2023-04-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr 22 13:53:30 UTC 2023

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

Log Message:
rumpkern: Provide fs_filtops weak alias.

We should introduce a link set for sys_kfilters, but this works
around the problem for now -- librump's dependency on librumpvfs
symbols.


To generate a diff of this commit:
cvs rdiff -u -r1.197 -r1.198 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.197 src/sys/rump/librump/rumpkern/emul.c:1.198
--- src/sys/rump/librump/rumpkern/emul.c:1.197	Sun Feb 26 07:27:14 2023
+++ src/sys/rump/librump/rumpkern/emul.c	Sat Apr 22 13:53:29 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: emul.c,v 1.197 2023/02/26 07:27:14 skrll Exp $	*/
+/*	$NetBSD: emul.c,v 1.198 2023/04/22 13:53:29 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.197 2023/02/26 07:27:14 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.198 2023/04/22 13:53:29 riastradh Exp $");
 
 #include 
 #include 
@@ -325,6 +325,18 @@ rump_fstrans_lwp_dtor(struct lwp *l)
 }
 __weak_alias(fstrans_lwp_dtor,rump_fstrans_lwp_dtor);
 
+static int
+rump_filt_fsattach(struct knote *kn)
+{
+
+	return EOPNOTSUPP;
+}
+
+struct filterops rump_fs_filtops = {
+	.f_attach = rump_filt_fsattach,
+};
+__weak_alias(fs_filtops,rump_fs_filtops);
+
 /*
  * 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

2023-02-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Feb 22 21:44:45 UTC 2023

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

Log Message:
rump: Nix membar_enter/exit after/before RUMPUSER_LWP_CREATE/DESTROY.

These make no sense and are obviously not needed for any of the
rumpuser implementations in-tree.  (For single-threaded fiber and
pth_dummy, no barriers needed; for pth, RUMPUSER_LWP_CREATE/DESTROY
use pthread_mutex so don't need any barriers.)

It _might_ make sense to do membar_release/acquire around just
RUMPUSER_LWP_DESTROY, perhaps if there's some reference-counting
business involved.  But if a rumpuser implementation really needs
that it can do it itself.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 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.53 src/sys/rump/librump/rumpkern/lwproc.c:1.54
--- src/sys/rump/librump/rumpkern/lwproc.c:1.53	Wed Feb 22 21:44:33 2023
+++ src/sys/rump/librump/rumpkern/lwproc.c	Wed Feb 22 21:44:45 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: lwproc.c,v 1.53 2023/02/22 21:44:33 riastradh Exp $	*/
+/*  $NetBSD: lwproc.c,v 1.54 2023/02/22 21:44:45 riastradh 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.53 2023/02/22 21:44:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.54 2023/02/22 21:44:45 riastradh Exp $");
 
 #include 
 #include 
@@ -334,7 +334,6 @@ lwproc_freelwp(struct lwp *l)
 	lwp_finispecific(l);
 
 	lwproc_curlwpop(RUMPUSER_LWP_DESTROY, l);
-	membar_exit();
 	kmem_free(l, sizeof(*l));
 
 	if (p->p_stat == SDEAD)
@@ -379,7 +378,6 @@ lwproc_makelwp(struct proc *p, bool dosw
 	lwp_initspecific(l);
 	PSREF_DEBUG_INIT_LWP(l);
 
-	membar_enter();
 	lwproc_curlwpop(RUMPUSER_LWP_CREATE, l);
 	if (doswitch) {
 		rump_lwproc_switch(l);



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

2023-02-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Feb 22 21:44:45 UTC 2023

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

Log Message:
rump: Nix membar_enter/exit after/before RUMPUSER_LWP_CREATE/DESTROY.

These make no sense and are obviously not needed for any of the
rumpuser implementations in-tree.  (For single-threaded fiber and
pth_dummy, no barriers needed; for pth, RUMPUSER_LWP_CREATE/DESTROY
use pthread_mutex so don't need any barriers.)

It _might_ make sense to do membar_release/acquire around just
RUMPUSER_LWP_DESTROY, perhaps if there's some reference-counting
business involved.  But if a rumpuser implementation really needs
that it can do it itself.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 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.



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

2023-02-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Feb 22 21:44:34 UTC 2023

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

Log Message:
rumpkern/lwproc.c: Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 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.52 src/sys/rump/librump/rumpkern/lwproc.c:1.53
--- src/sys/rump/librump/rumpkern/lwproc.c:1.52	Wed Nov  2 09:01:42 2022
+++ src/sys/rump/librump/rumpkern/lwproc.c	Wed Feb 22 21:44:33 2023
@@ -1,4 +1,4 @@
-/*  $NetBSD: lwproc.c,v 1.52 2022/11/02 09:01:42 ozaki-r Exp $	*/
+/*  $NetBSD: lwproc.c,v 1.53 2023/02/22 21:44:33 riastradh 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.52 2022/11/02 09:01:42 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.53 2023/02/22 21:44:33 riastradh Exp $");
 
 #include 
 #include 
@@ -73,7 +73,7 @@ lwp_unsleep(lwp_t *l, bool cleanup)
 
 /*
  * Look up a live LWP within the specified process.
- * 
+ *
  * Must be called with p->p_lock held.
  */
 struct lwp *
@@ -338,7 +338,7 @@ lwproc_freelwp(struct lwp *l)
 	kmem_free(l, sizeof(*l));
 
 	if (p->p_stat == SDEAD)
-		lwproc_proc_free(p);	
+		lwproc_proc_free(p);
 }
 
 extern kmutex_t unruntime_lock;



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

2023-02-22 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Wed Feb 22 21:44:34 UTC 2023

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

Log Message:
rumpkern/lwproc.c: Nix trailing whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 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.



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

2022-11-02 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Nov  2 09:01:42 UTC 2022

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

Log Message:
rump: don't touch p_nlwps without holding p_lock

There was a race condition on p_nlwps.  Heavy thread switching could
cause a kernel panic like:
  panic: kernel diagnostic assertion "LIST_EMPTY(>p_lwps)" failed:
  file "(hidden)/src/lib/librump/../../sys/rump/librump/rumpkern/lwproc.c", 
line 177


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 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.



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

2022-11-02 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Wed Nov  2 09:01:42 UTC 2022

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

Log Message:
rump: don't touch p_nlwps without holding p_lock

There was a race condition on p_nlwps.  Heavy thread switching could
cause a kernel panic like:
  panic: kernel diagnostic assertion "LIST_EMPTY(>p_lwps)" failed:
  file "(hidden)/src/lib/librump/../../sys/rump/librump/rumpkern/lwproc.c", 
line 177


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 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.51 src/sys/rump/librump/rumpkern/lwproc.c:1.52
--- src/sys/rump/librump/rumpkern/lwproc.c:1.51	Sat May 30 19:16:53 2020
+++ src/sys/rump/librump/rumpkern/lwproc.c	Wed Nov  2 09:01:42 2022
@@ -1,4 +1,4 @@
-/*  $NetBSD: lwproc.c,v 1.51 2020/05/30 19:16:53 ad Exp $	*/
+/*  $NetBSD: lwproc.c,v 1.52 2022/11/02 09:01:42 ozaki-r 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.51 2020/05/30 19:16:53 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.52 2022/11/02 09:01:42 ozaki-r Exp $");
 
 #include 
 #include 
@@ -348,6 +348,14 @@ lwproc_makelwp(struct proc *p, bool dosw
 {
 	struct lwp *l = kmem_zalloc(sizeof(*l), KM_SLEEP);
 
+	l->l_refcnt = 1;
+	l->l_proc = p;
+	l->l_stat = LSIDL;
+	l->l_mutex = _lock;
+
+	proc_alloc_lwpid(p, l);
+
+	mutex_enter(p->p_lock);
 	/*
 	 * Account the new lwp to the owner of the process.
 	 * For some reason, NetBSD doesn't count the first lwp
@@ -357,14 +365,6 @@ lwproc_makelwp(struct proc *p, bool dosw
 		chglwpcnt(kauth_cred_getuid(p->p_cred), 1);
 	}
 
-	l->l_refcnt = 1;
-	l->l_proc = p;
-	l->l_stat = LSIDL;
-	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);
 



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

2022-08-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 21 22:28:26 UTC 2022

Modified Files:
src/sys/rump/librump/rumpkern/arch/generic: rump_generic_pmap.c

Log Message:
rump: Define pmap_resident_count, pmap_wired_count conditionally.

These definitions will not be used by anything yet because on every
architecture except x86 as of yeterday, pmap_resident_count and
pmap_wired_count are defined as macros anyway.  But if more struct
pmaps are made private these definitions will get used.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/sys/rump/librump/rumpkern/arch/generic/rump_generic_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/arch/generic/rump_generic_pmap.c
diff -u src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c:1.6 src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c:1.7
--- src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c:1.6	Sun Aug 21 16:55:14 2022
+++ src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c	Sun Aug 21 22:28:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_generic_pmap.c,v 1.6 2022/08/21 16:55:14 mlelstv Exp $	*/
+/*	$NetBSD: rump_generic_pmap.c,v 1.7 2022/08/21 22:28:26 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_generic_pmap.c,v 1.6 2022/08/21 16:55:14 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_generic_pmap.c,v 1.7 2022/08/21 22:28:26 riastradh Exp $");
 
 #include 
 
@@ -89,16 +89,20 @@ pmap_clear_modify(struct vm_page *pg)
 	return false;
 }
 
+#ifndef pmap_resident_count
 long
 pmap_resident_count(struct pmap *pmap)
 
 {
 	return 0;
 }
+#endif
 
+#ifndef pmap_wired_count
 long
 pmap_wired_count(struct pmap *pmap)
 {
 
 	return 0;
 }
+#endif



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

2022-08-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 21 22:28:26 UTC 2022

Modified Files:
src/sys/rump/librump/rumpkern/arch/generic: rump_generic_pmap.c

Log Message:
rump: Define pmap_resident_count, pmap_wired_count conditionally.

These definitions will not be used by anything yet because on every
architecture except x86 as of yeterday, pmap_resident_count and
pmap_wired_count are defined as macros anyway.  But if more struct
pmaps are made private these definitions will get used.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 \
src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c

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



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

2022-08-21 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 21 16:55:14 UTC 2022

Modified Files:
src/sys/rump/librump/rumpkern/arch/generic: rump_generic_pmap.c

Log Message:
Add stubs for pmap_resident_count, pmap_wired_count.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/rump/librump/rumpkern/arch/generic/rump_generic_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/arch/generic/rump_generic_pmap.c
diff -u src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c:1.5 src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c:1.6
--- src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c:1.5	Tue Jan 26 23:12:18 2016
+++ src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c	Sun Aug 21 16:55:14 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_generic_pmap.c,v 1.5 2016/01/26 23:12:18 pooka Exp $	*/
+/*	$NetBSD: rump_generic_pmap.c,v 1.6 2022/08/21 16:55:14 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_generic_pmap.c,v 1.5 2016/01/26 23:12:18 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_generic_pmap.c,v 1.6 2022/08/21 16:55:14 mlelstv Exp $");
 
 #include 
 
@@ -88,3 +88,17 @@ pmap_clear_modify(struct vm_page *pg)
 
 	return false;
 }
+
+long
+pmap_resident_count(struct pmap *pmap)
+
+{
+	return 0;
+}
+
+long
+pmap_wired_count(struct pmap *pmap)
+{
+
+	return 0;
+}



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

2022-08-21 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Aug 21 16:55:14 UTC 2022

Modified Files:
src/sys/rump/librump/rumpkern/arch/generic: rump_generic_pmap.c

Log Message:
Add stubs for pmap_resident_count, pmap_wired_count.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 \
src/sys/rump/librump/rumpkern/arch/generic/rump_generic_pmap.c

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



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

2022-08-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 21 12:08:12 UTC 2022

Modified Files:
src/sys/rump/librump/rumpkern/arch/x86: rump_x86_pmap.c

Log Message:
rump/x86: Add stubs for pmap_resident_count, pmap_wired_count.

These are no longer static inlines, now that struct pmap is private.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
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/arch/x86/rump_x86_pmap.c
diff -u src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c:1.4 src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c:1.5
--- src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c:1.4	Tue Jan 26 23:12:18 2016
+++ src/sys/rump/librump/rumpkern/arch/x86/rump_x86_pmap.c	Sun Aug 21 12:08:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_x86_pmap.c,v 1.4 2016/01/26 23:12:18 pooka Exp $	*/
+/*	$NetBSD: rump_x86_pmap.c,v 1.5 2022/08/21 12:08:12 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2010 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_x86_pmap.c,v 1.4 2016/01/26 23:12:18 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_x86_pmap.c,v 1.5 2022/08/21 12:08:12 riastradh Exp $");
 
 #include 
 
@@ -107,3 +107,17 @@ void
 pmap_write_protect(pmap_t pmap, vaddr_t sva, vaddr_t eva, vm_prot_t prot)
 {
 }
+
+long
+pmap_resident_count(struct pmap *pmap)
+
+{
+	return 0;
+}
+
+long
+pmap_wired_count(struct pmap *pmap)
+{
+
+	return 0;
+}



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

2022-08-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 21 12:08:12 UTC 2022

Modified Files:
src/sys/rump/librump/rumpkern/arch/x86: rump_x86_pmap.c

Log Message:
rump/x86: Add stubs for pmap_resident_count, pmap_wired_count.

These are no longer static inlines, now that struct pmap is private.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
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.



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

2022-08-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 21 10:18:20 UTC 2022

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

Log Message:
rumpkern: Abusing struct pmap internals now requires extra effort.

(as it should)


To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 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.192 src/sys/rump/librump/rumpkern/vm.c:1.193
--- src/sys/rump/librump/rumpkern/vm.c:1.192	Thu Sep 16 21:29:42 2021
+++ src/sys/rump/librump/rumpkern/vm.c	Sun Aug 21 10:18:20 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.192 2021/09/16 21:29:42 andvar Exp $	*/
+/*	$NetBSD: vm.c,v 1.193 2022/08/21 10:18:20 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.192 2021/09/16 21:29:42 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.193 2022/08/21 10:18:20 riastradh Exp $");
 
 #include 
 #include 
@@ -56,6 +56,19 @@ __KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.192
 
 #include 
 
+#if defined(__i386__) || defined(__x86_64__)
+/*
+ * This file abuses the pmap abstraction to create its own statically
+ * allocated struct pmap object, even though it can't do anything
+ * useful with such a thing from userland.  On x86 the struct pmap
+ * definition is private, so we have to go to extra effort to abuse it
+ * there.  This should be fixed -- all of the struct pmap definitions
+ * should be private, and then rump can furnish its own fake struct
+ * pmap without clashing with anything.
+ */
+#include 
+#endif
+
 #include 
 #include 
 #include 



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

2022-08-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 21 10:18:20 UTC 2022

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

Log Message:
rumpkern: Abusing struct pmap internals now requires extra effort.

(as it should)


To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 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.



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

2022-08-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 21 10:18:11 UTC 2022

Modified Files:
src/sys/rump/librump/rumpkern/arch/x86: rump_x86_cpu.c

Log Message:
rump/x86: Need x86/cpufunc.h for declaration of wbinvd.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/rump/librump/rumpkern/arch/x86/rump_x86_cpu.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/arch/x86/rump_x86_cpu.c
diff -u src/sys/rump/librump/rumpkern/arch/x86/rump_x86_cpu.c:1.4 src/sys/rump/librump/rumpkern/arch/x86/rump_x86_cpu.c:1.5
--- src/sys/rump/librump/rumpkern/arch/x86/rump_x86_cpu.c:1.4	Tue Jan 26 23:12:18 2016
+++ src/sys/rump/librump/rumpkern/arch/x86/rump_x86_cpu.c	Sun Aug 21 10:18:11 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump_x86_cpu.c,v 1.4 2016/01/26 23:12:18 pooka Exp $	*/
+/*	$NetBSD: rump_x86_cpu.c,v 1.5 2022/08/21 10:18:11 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -29,13 +29,15 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump_x86_cpu.c,v 1.4 2016/01/26 23:12:18 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump_x86_cpu.c,v 1.5 2022/08/21 10:18:11 riastradh Exp $");
 
 #include 
 #include 
 
 #include 
 
+#include 
+
 #include 
 
 #include "rump_curlwp.h"



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

2022-08-21 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sun Aug 21 10:18:11 UTC 2022

Modified Files:
src/sys/rump/librump/rumpkern/arch/x86: rump_x86_cpu.c

Log Message:
rump/x86: Need x86/cpufunc.h for declaration of wbinvd.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
src/sys/rump/librump/rumpkern/arch/x86/rump_x86_cpu.c

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



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

2022-06-30 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Jun 30 07:47:07 UTC 2022

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

Log Message:
Fix rump build failure after sleepq.h:r1.35.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 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.



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

2022-06-30 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Thu Jun 30 07:47:07 UTC 2022

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

Log Message:
Fix rump build failure after sleepq.h:r1.35.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 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.22 src/sys/rump/librump/rumpkern/sleepq.c:1.23
--- src/sys/rump/librump/rumpkern/sleepq.c:1.22	Sat Apr  9 23:45:23 2022
+++ src/sys/rump/librump/rumpkern/sleepq.c	Thu Jun 30 07:47:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sleepq.c,v 1.22 2022/04/09 23:45:23 riastradh Exp $	*/
+/*	$NetBSD: sleepq.c,v 1.23 2022/06/30 07:47:07 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.22 2022/04/09 23:45:23 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.23 2022/06/30 07:47:07 knakahara Exp $");
 
 #include 
 #include 
@@ -69,7 +69,7 @@ sleepq_enqueue(sleepq_t *sq, wchan_t wc,
 }
 
 int
-sleepq_block(int timo, bool catch)
+sleepq_block(int timo, bool catch, struct syncobj *syncobj __unused)
 {
 	struct lwp *l = curlwp;
 	int error = 0;



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

2022-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  9 23:45:23 UTC 2022

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

Log Message:
rumpkern/sleepq: Convert membar_exit/store to atomic_store_release.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 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.21 src/sys/rump/librump/rumpkern/sleepq.c:1.22
--- src/sys/rump/librump/rumpkern/sleepq.c:1.21	Sun Nov  1 20:58:38 2020
+++ src/sys/rump/librump/rumpkern/sleepq.c	Sat Apr  9 23:45:23 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: sleepq.c,v 1.21 2020/11/01 20:58:38 christos Exp $	*/
+/*	$NetBSD: sleepq.c,v 1.22 2022/04/09 23:45:23 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.21 2020/11/01 20:58:38 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sleepq.c,v 1.22 2022/04/09 23:45:23 riastradh Exp $");
 
 #include 
 #include 
@@ -163,7 +163,6 @@ lwp_unlock_to(struct lwp *l, kmutex_t *n
 	KASSERT(mutex_owned(l->l_mutex));
 
 	old = l->l_mutex;
-	membar_exit();
-	l->l_mutex = new;
+	atomic_store_release(>l_mutex, new);
 	mutex_spin_exit(old);
 }



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

2022-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  9 23:45:23 UTC 2022

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

Log Message:
rumpkern/sleepq: Convert membar_exit/store to atomic_store_release.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 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.



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

2022-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  9 23:45:14 UTC 2022

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

Log Message:
rumpkern/scheduler: Use membar_release.

...but add an XXX comment asking for clarity on what it pairs with.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 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.52 src/sys/rump/librump/rumpkern/scheduler.c:1.53
--- src/sys/rump/librump/rumpkern/scheduler.c:1.52	Sun Nov  1 20:58:38 2020
+++ src/sys/rump/librump/rumpkern/scheduler.c	Sat Apr  9 23:45:14 2022
@@ -1,4 +1,4 @@
-/*  $NetBSD: scheduler.c,v 1.52 2020/11/01 20:58:38 christos Exp $	*/
+/*  $NetBSD: scheduler.c,v 1.53 2022/04/09 23:45:14 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.52 2020/11/01 20:58:38 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scheduler.c,v 1.53 2022/04/09 23:45:14 riastradh Exp $");
 
 #include 
 #include 
@@ -473,7 +473,7 @@ rump_unschedule_cpu1(struct lwp *l, void
 	if (interlock == rcpu->rcpu_mtx)
 		rumpuser_mutex_enter_nowrap(rcpu->rcpu_mtx);
 	else
-		membar_exit();
+		membar_release(); /* XXX what does this pair with? */
 
 	/* Release the CPU. */
 	old = atomic_swap_ptr(>rcpu_prevlwp, l);



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

2022-04-09 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  9 23:45:14 UTC 2022

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

Log Message:
rumpkern/scheduler: Use membar_release.

...but add an XXX comment asking for clarity on what it pairs with.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 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.



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

2022-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 28 20:49:52 UTC 2022

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

Log Message:
include the extensions secmodel


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 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.



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

2022-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 28 20:49:52 UTC 2022

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

Log Message:
include the extensions secmodel


To generate a diff of this commit:
cvs rdiff -u -r1.187 -r1.188 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.187 src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.188
--- src/sys/rump/librump/rumpkern/Makefile.rumpkern:1.187	Thu Aug 27 10:11:57 2020
+++ src/sys/rump/librump/rumpkern/Makefile.rumpkern	Mon Mar 28 16:49:52 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.rumpkern,v 1.187 2020/08/27 14:11:57 riastradh Exp $
+#	$NetBSD: Makefile.rumpkern,v 1.188 2022/03/28 20:49:52 christos Exp $
 #
 
 IOCONFDIR:=	${.PARSEDIR}
@@ -20,6 +20,7 @@ MAN=		rump.3 rump_lwproc.3
 	${RUMPTOP}/../crypto/cprng_fast\
 	${RUMPTOP}/../crypto/nist_hash_drbg			\
 	${RUMPTOP}/../secmodel	\
+	${RUMPTOP}/../secmodel/extensions			\
 	${RUMPTOP}/../secmodel/suser\
 	${RUMPTOP}/../compat/common
 
@@ -145,6 +146,7 @@ SRCS+=	uvm_page_array.c uvm_page_status.
 # 4.4BSD secmodel.  selection is hardcoded for now
 SRCS+=	secmodel.c
 SRCS+=	secmodel_suser.c
+SRCS+=	secmodel_extensions.c
 
 # the funny bit.  this doesn't really belong here, but helps with the
 # needs of kern_descrip.c.  And since it's a fully dynamic interface,



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

2022-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 28 20:49:32 UTC 2022

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

Log Message:
no need to include suser; it gets autoloaded as a module.


To generate a diff of this commit:
cvs rdiff -u -r1.354 -r1.355 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.



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

2022-03-28 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 28 20:49:32 UTC 2022

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

Log Message:
no need to include suser; it gets autoloaded as a module.


To generate a diff of this commit:
cvs rdiff -u -r1.354 -r1.355 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.354 src/sys/rump/librump/rumpkern/rump.c:1.355
--- src/sys/rump/librump/rumpkern/rump.c:1.354	Mon Mar 28 08:38:59 2022
+++ src/sys/rump/librump/rumpkern/rump.c	Mon Mar 28 16:49:32 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: rump.c,v 1.354 2022/03/28 12:38:59 riastradh Exp $	*/
+/*	$NetBSD: rump.c,v 1.355 2022/03/28 20:49:32 christos Exp $	*/
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.354 2022/03/28 12:38:59 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.355 2022/03/28 20:49:32 christos Exp $");
 
 #include 
 #define ELFSIZE ARCH_ELFSIZE
@@ -85,8 +85,6 @@ __KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.3
 
 #include 
 
-#include 
-
 #include 
 
 #include 



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/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.



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.



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-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.



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.



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-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.



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-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.



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-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.



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-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.



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-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.



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-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.



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.



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.



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.



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.



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-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.



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.



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.



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.



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.



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.



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-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.



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.



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.



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-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.



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 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.



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.



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.



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;



  1   2   3   4   5   6   7   8   9   10   >