Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Make the rump kernel upcalls which were previous available o...



details:   https://anonhg.NetBSD.org/src/rev/35b4fefce8b9
branches:  trunk
changeset: 786477:35b4fefce8b9
user:      pooka <pooka%NetBSD.org@localhost>
date:      Mon Apr 29 14:51:39 2013 +0000

description:
Make the rump kernel upcalls which were previous available only to
the sysproxy module available for the entire hypervisor.

diffstat:

 lib/librumpuser/rumpuser.c           |  18 +++-----
 lib/librumpuser/rumpuser_bio.c       |  10 ++--
 lib/librumpuser/rumpuser_component.c |   8 +-
 lib/librumpuser/rumpuser_int.h       |  29 +++++++++---
 lib/librumpuser/rumpuser_pth.c       |  12 ++--
 lib/librumpuser/rumpuser_sp.c        |  79 +++++++++++++++++------------------
 sys/rump/include/rump/rumpuser.h     |  44 ++++++++++---------
 sys/rump/librump/rumpkern/klock.c    |  15 +++++-
 sys/rump/librump/rumpkern/rump.c     |  51 +++++++++++-----------
 9 files changed, 143 insertions(+), 123 deletions(-)

diffs (truncated from 691 to 300 lines):

diff -r a23099a33cc1 -r 35b4fefce8b9 lib/librumpuser/rumpuser.c
--- a/lib/librumpuser/rumpuser.c        Mon Apr 29 14:42:11 2013 +0000
+++ b/lib/librumpuser/rumpuser.c        Mon Apr 29 14:51:39 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser.c,v 1.40 2013/04/29 13:21:03 pooka Exp $      */
+/*     $NetBSD: rumpuser.c,v 1.41 2013/04/29 14:51:39 pooka Exp $      */
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser.c,v 1.40 2013/04/29 13:21:03 pooka Exp $");
+__RCSID("$NetBSD: rumpuser.c,v 1.41 2013/04/29 14:51:39 pooka Exp $");
 #endif /* !lint */
 
 #include <sys/ioctl.h>
@@ -64,12 +64,10 @@
 
 #include "rumpuser_int.h"
 
-rump_unschedulefn      rumpuser__unschedule;
-rump_reschedulefn      rumpuser__reschedule;
+struct rumpuser_hyperup rumpuser__hyp;
 
 int
-rumpuser_init(int version,
-       rump_reschedulefn rumpkern_resched, rump_unschedulefn rumpkern_unsched)
+rumpuser_init(int version, const struct rumpuser_hyperup *hyp)
 {
 
        if (version != RUMPUSER_VERSION) {
@@ -94,9 +92,7 @@
 #endif
 
        rumpuser__thrinit();
-
-       rumpuser__unschedule = rumpkern_unsched;
-       rumpuser__reschedule = rumpkern_resched;
+       rumpuser__hyp = *hyp;
 
        return 0;
 }
@@ -465,7 +461,7 @@
        int nlocks;
        int rv;
 
-       rumpuser__unschedule(0, &nlocks, NULL);
+       rumpkern_unsched(&nlocks, NULL);
 
        /*LINTED*/
        rqt.tv_sec = sec;
@@ -513,7 +509,7 @@
                abort();
        }
 
-       rumpuser__reschedule(nlocks, NULL);
+       rumpkern_sched(nlocks, NULL);
        return rv;
 }
 
diff -r a23099a33cc1 -r 35b4fefce8b9 lib/librumpuser/rumpuser_bio.c
--- a/lib/librumpuser/rumpuser_bio.c    Mon Apr 29 14:42:11 2013 +0000
+++ b/lib/librumpuser/rumpuser_bio.c    Mon Apr 29 14:51:39 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser_bio.c,v 1.3 2013/04/29 13:57:46 pooka Exp $   */
+/*     $NetBSD: rumpuser_bio.c,v 1.4 2013/04/29 14:51:39 pooka Exp $   */
 
 /*-
  * Copyright (c) 2013 Antti Kantee.  All Rights Reserved.
@@ -88,9 +88,9 @@
 #endif
                }
        }
-       rumpuser__reschedule(0, NULL);
+       rumpkern_sched(0, NULL);
        biop->bio_done(biop->bio_donearg, (size_t)rv, error);
-       rumpuser__unschedule(0, &dummy, NULL);
+       rumpkern_unsched(&dummy, NULL);
 
        /* paranoia */
        biop->bio_donearg = NULL;
@@ -129,7 +129,7 @@
        static int usethread = 1;
        int nlocks;
 
-       rumpuser__unschedule(0, &nlocks, NULL);
+       rumpkern_unsched(&nlocks, NULL);
 
        if (!inited) {
                pthread_mutex_lock(&biomtx);
@@ -175,5 +175,5 @@
                pthread_mutex_unlock(&biomtx);
        }
 
-       rumpuser__reschedule(nlocks, NULL);
+       rumpkern_sched(nlocks, NULL);
 }
diff -r a23099a33cc1 -r 35b4fefce8b9 lib/librumpuser/rumpuser_component.c
--- a/lib/librumpuser/rumpuser_component.c      Mon Apr 29 14:42:11 2013 +0000
+++ b/lib/librumpuser/rumpuser_component.c      Mon Apr 29 14:51:39 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser_component.c,v 1.2 2013/04/27 14:59:08 pooka Exp $     */
+/*     $NetBSD: rumpuser_component.c,v 1.3 2013/04/29 14:51:39 pooka Exp $     */
 
 /*
  * Copyright (c) 2013 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser_component.c,v 1.2 2013/04/27 14:59:08 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_component.c,v 1.3 2013/04/29 14:51:39 pooka Exp $");
 #endif /* !lint */
 
 /*
@@ -47,7 +47,7 @@
 {
        int nlocks;
 
-       rumpuser__unschedule(0, &nlocks, NULL);
+       rumpkern_unsched(&nlocks, NULL);
        return (void *)(intptr_t)nlocks;
 }
 
@@ -56,5 +56,5 @@
 {
        int nlocks = (int)(intptr_t)cookie;
 
-       rumpuser__reschedule(nlocks, NULL);
+       rumpkern_sched(nlocks, NULL);
 }
diff -r a23099a33cc1 -r 35b4fefce8b9 lib/librumpuser/rumpuser_int.h
--- a/lib/librumpuser/rumpuser_int.h    Mon Apr 29 14:42:11 2013 +0000
+++ b/lib/librumpuser/rumpuser_int.h    Mon Apr 29 14:51:39 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser_int.h,v 1.6 2013/04/29 12:56:04 pooka Exp $   */
+/*     $NetBSD: rumpuser_int.h,v 1.7 2013/04/29 14:51:39 pooka Exp $   */
 
 /*
  * Copyright (c) 2008 Antti Kantee.  All Rights Reserved.
@@ -29,17 +29,30 @@
 
 #include <rump/rumpuser.h>
 
-extern rump_unschedulefn rumpuser__unschedule;
-extern rump_reschedulefn rumpuser__reschedule;
+#define seterror(value) do { if (error) *error = value;} while (/*CONSTCOND*/0)
+
+extern struct rumpuser_hyperup rumpuser__hyp;
+
+static inline void
+rumpkern_unsched(int *nlocks, void *interlock)
+{
 
-#define seterror(value) do { if (error) *error = value;} while (/*CONSTCOND*/0)
+       rumpuser__hyp.hyp_backend_unschedule(0, nlocks, interlock);
+}
+
+static inline void
+rumpkern_sched(int nlocks, void *interlock)
+{
+
+       rumpuser__hyp.hyp_backend_schedule(nlocks, interlock);
+}
 
 #define KLOCK_WRAP(a)                                                  \
 do {                                                                   \
        int nlocks;                                                     \
-       rumpuser__unschedule(0, &nlocks, NULL);                         \
+       rumpkern_unsched(&nlocks, NULL);                                \
        a;                                                              \
-       rumpuser__reschedule(nlocks, NULL);                             \
+       rumpkern_sched(nlocks, NULL);                                   \
 } while (/*CONSTCOND*/0)
 
 #define DOCALL(rvtype, call)                                           \
@@ -57,9 +70,9 @@
 {                                                                      \
        rvtype rv;                                                      \
        int nlocks;                                                     \
-       rumpuser__unschedule(0, &nlocks, NULL);                         \
+       rumpkern_unsched(&nlocks, NULL);                                \
        rv = call;                                                      \
-       rumpuser__reschedule(nlocks, NULL);                             \
+       rumpkern_sched(nlocks, NULL);                                   \
        if (rv == -1)                                                   \
                seterror(errno);                                        \
        else                                                            \
diff -r a23099a33cc1 -r 35b4fefce8b9 lib/librumpuser/rumpuser_pth.c
--- a/lib/librumpuser/rumpuser_pth.c    Mon Apr 29 14:42:11 2013 +0000
+++ b/lib/librumpuser/rumpuser_pth.c    Mon Apr 29 14:51:39 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser_pth.c,v 1.17 2013/04/29 12:56:04 pooka Exp $  */
+/*     $NetBSD: rumpuser_pth.c,v 1.18 2013/04/29 14:51:40 pooka Exp $  */
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser_pth.c,v 1.17 2013/04/29 12:56:04 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_pth.c,v 1.18 2013/04/29 14:51:40 pooka Exp $");
 #endif /* !lint */
 
 #include <assert.h>
@@ -381,11 +381,11 @@
        int nlocks;
 
        cv->nwaiters++;
-       rumpuser__unschedule(0, &nlocks, mtx);
+       rumpkern_unsched(&nlocks, mtx);
        mtxexit(mtx);
        NOFAIL_ERRNO(pthread_cond_wait(&cv->pthcv, &mtx->pthmtx));
        mtxenter(mtx);
-       rumpuser__reschedule(nlocks, mtx);
+       rumpkern_sched(nlocks, mtx);
        cv->nwaiters--;
 }
 
@@ -417,7 +417,7 @@
        clock_gettime(CLOCK_REALTIME, &ts);
 
        cv->nwaiters++;
-       rumpuser__unschedule(0, &nlocks, mtx);
+       rumpkern_unsched(&nlocks, mtx);
        mtxexit(mtx);
 
        ts.tv_sec += sec;
@@ -428,7 +428,7 @@
        }
        rv = pthread_cond_timedwait(&cv->pthcv, &mtx->pthmtx, &ts);
        mtxenter(mtx);
-       rumpuser__reschedule(nlocks, mtx);
+       rumpkern_sched(nlocks, mtx);
        cv->nwaiters--;
        if (rv != 0 && rv != ETIMEDOUT)
                abort();
diff -r a23099a33cc1 -r 35b4fefce8b9 lib/librumpuser/rumpuser_sp.c
--- a/lib/librumpuser/rumpuser_sp.c     Mon Apr 29 14:42:11 2013 +0000
+++ b/lib/librumpuser/rumpuser_sp.c     Mon Apr 29 14:51:39 2013 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rumpuser_sp.c,v 1.55 2013/04/27 17:35:10 pooka Exp $  */
+/*      $NetBSD: rumpuser_sp.c,v 1.56 2013/04/29 14:51:40 pooka Exp $  */
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -37,7 +37,7 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser_sp.c,v 1.55 2013/04/27 17:35:10 pooka Exp $");
+__RCSID("$NetBSD: rumpuser_sp.c,v 1.56 2013/04/29 14:51:40 pooka Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
@@ -83,8 +83,6 @@
 static unsigned int disco;
 static volatile int spfini;
 
-static struct rumpuser_sp_ops spops;
-
 static char banner[MAXBANNER];
 
 #define PROTOMAJOR 0
@@ -179,18 +177,18 @@
 lwproc_switch(struct lwp *l)
 {
 
-       spops.spop_schedule();
-       spops.spop_lwproc_switch(l);
-       spops.spop_unschedule();
+       rumpuser__hyp.hyp_schedule();
+       rumpuser__hyp.hyp_lwproc_switch(l);
+       rumpuser__hyp.hyp_unschedule();
 }
 
 static void
 lwproc_release(void)
 {
 
-       spops.spop_schedule();
-       spops.spop_lwproc_release();
-       spops.spop_unschedule();
+       rumpuser__hyp.hyp_schedule();
+       rumpuser__hyp.hyp_lwproc_release();
+       rumpuser__hyp.hyp_unschedule();
 }
 
 static int
@@ -198,9 +196,9 @@
 {
        int rv;
 
-       spops.spop_schedule();
-       rv = spops.spop_lwproc_rfork(spc, flags, comm);
-       spops.spop_unschedule();
+       rumpuser__hyp.hyp_schedule();



Home | Main Index | Thread Index | Old Index