Source-Changes-HG archive

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

[src/trunk]: src/sys/rump Give remote clients struct pmap storage. Although ...



details:   https://anonhg.NetBSD.org/src/rev/23fbf56c088b
branches:  trunk
changeset: 807678:23fbf56c088b
user:      pooka <pooka%NetBSD.org@localhost>
date:      Sat Apr 18 15:49:18 2015 +0000

description:
Give remote clients struct pmap storage.  Although the pmap is unused,
that way we can sure that the pmap macro framework doesn't access all
the wrong places.

diffstat:

 sys/rump/kern/lib/libsysproxy/sysproxy.c |  15 ++++++++++-----
 sys/rump/librump/rumpkern/emul.c         |   6 +++---
 sys/rump/librump/rumpkern/lwproc.c       |   7 ++++---
 sys/rump/librump/rumpkern/rump_private.h |   9 ++++++++-
 sys/rump/librump/rumpkern/rumpcopy.c     |  18 +++++++++---------
 sys/rump/librump/rumpkern/signals.c      |   6 +++---
 sys/rump/librump/rumpkern/vm.c           |   6 +++---
 7 files changed, 40 insertions(+), 27 deletions(-)

diffs (257 lines):

diff -r 01c9b507e6a6 -r 23fbf56c088b sys/rump/kern/lib/libsysproxy/sysproxy.c
--- a/sys/rump/kern/lib/libsysproxy/sysproxy.c  Sat Apr 18 14:44:44 2015 +0000
+++ b/sys/rump/kern/lib/libsysproxy/sysproxy.c  Sat Apr 18 15:49:18 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sysproxy.c,v 1.2 2015/04/03 16:40:55 pooka Exp $       */
+/*     $NetBSD: sysproxy.c,v 1.3 2015/04/18 15:49:18 pooka Exp $       */
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sysproxy.c,v 1.2 2015/04/03 16:40:55 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysproxy.c,v 1.3 2015/04/18 15:49:18 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/filedesc.h>
@@ -76,9 +76,12 @@
        return rv;
 }
 
+static struct pmap remotepmap;
+
 static int
 hyp_rfork(void *priv, int flags, const char *comm)
 {
+       struct rump_spctl *spctl;
        struct vmspace *vm;
        struct proc *p;
        struct lwp *l;
@@ -97,10 +100,12 @@
        }
 
        /*
-        * Since it's a proxy proc, we need create a vmspace for it.
+        * Since it's a proxy proc, we create a vmspace for it.
         */
-       vm = kmem_zalloc(sizeof(*vm), KM_SLEEP);
-       uvmspace_init(vm, priv, 0, 0, false);
+       spctl = kmem_zalloc(sizeof(*spctl), KM_SLEEP);
+       vm = &spctl->spctl_vm;
+       uvmspace_init(vm, &remotepmap, 0, 0, false);
+       spctl->spctl = priv;
 
        if ((error = rump_lwproc_rfork_vmspace(vm, flags)) != 0) {
                kmem_free(vm, sizeof(*vm));
diff -r 01c9b507e6a6 -r 23fbf56c088b sys/rump/librump/rumpkern/emul.c
--- a/sys/rump/librump/rumpkern/emul.c  Sat Apr 18 14:44:44 2015 +0000
+++ b/sys/rump/librump/rumpkern/emul.c  Sat Apr 18 15:49:18 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: emul.c,v 1.169 2015/01/03 17:23:51 pooka Exp $ */
+/*     $NetBSD: emul.c,v 1.170 2015/04/18 15:49:18 pooka Exp $ */
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.169 2015/01/03 17:23:51 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: emul.c,v 1.170 2015/04/18 15:49:18 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/null.h>
@@ -362,7 +362,7 @@
        printf("rump kernel halting...\n");
 
        if (!RUMP_LOCALPROC_P(curproc))
-               finiarg = curproc->p_vmspace->vm_map.pmap;
+               finiarg = RUMP_SPVM2CTL(curproc->p_vmspace);
        else
                finiarg = NULL;
 
diff -r 01c9b507e6a6 -r 23fbf56c088b sys/rump/librump/rumpkern/lwproc.c
--- a/sys/rump/librump/rumpkern/lwproc.c        Sat Apr 18 14:44:44 2015 +0000
+++ b/sys/rump/librump/rumpkern/lwproc.c        Sat Apr 18 15:49:18 2015 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: lwproc.c,v 1.34 2015/04/17 13:03:38 pooka Exp $       */
+/*      $NetBSD: lwproc.c,v 1.35 2015/04/18 15:49:18 pooka Exp $       */
 
 /*
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #define RUMP__CURLWP_PRIVATE
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.34 2015/04/17 13:03:38 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lwproc.c,v 1.35 2015/04/18 15:49:18 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -132,8 +132,9 @@
 
        /* non-local vmspaces are not shared */
        if (!RUMP_LOCALPROC_P(p)) {
+               struct rump_spctl *ctl = (struct rump_spctl *)p->p_vmspace;
                KASSERT(p->p_vmspace->vm_refcnt == 1);
-               kmem_free(p->p_vmspace, sizeof(*p->p_vmspace));
+               kmem_free(ctl, sizeof(*ctl));
        }
 
        proc_free_mem(p);
diff -r 01c9b507e6a6 -r 23fbf56c088b sys/rump/librump/rumpkern/rump_private.h
--- a/sys/rump/librump/rumpkern/rump_private.h  Sat Apr 18 14:44:44 2015 +0000
+++ b/sys/rump/librump/rumpkern/rump_private.h  Sat Apr 18 15:49:18 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump_private.h,v 1.90 2015/04/17 12:43:16 pooka Exp $  */
+/*     $NetBSD: rump_private.h,v 1.91 2015/04/18 15:49:18 pooka Exp $  */
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -122,6 +122,13 @@
 #define RUMP_LOCALPROC_P(p) \
     (p->p_vmspace == vmspace_kernel() || p->p_vmspace == rump_vmspace_local)
 
+/* vm bundle for remote clients.  the last member is the hypercall cookie */
+struct rump_spctl {
+       struct vmspace spctl_vm;
+       void *spctl;
+};
+#define RUMP_SPVM2CTL(vm) (((struct rump_spctl *)vm)->spctl)
+
 void           rump_component_load(const struct rump_component *);
 void           rump_component_init(enum rump_component_type);
 int            rump_component_count(enum rump_component_type);
diff -r 01c9b507e6a6 -r 23fbf56c088b sys/rump/librump/rumpkern/rumpcopy.c
--- a/sys/rump/librump/rumpkern/rumpcopy.c      Sat Apr 18 14:44:44 2015 +0000
+++ b/sys/rump/librump/rumpkern/rumpcopy.c      Sat Apr 18 15:49:18 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpcopy.c,v 1.19 2015/01/03 17:23:51 pooka Exp $      */
+/*     $NetBSD: rumpcopy.c,v 1.20 2015/04/18 15:49:18 pooka Exp $      */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rumpcopy.c,v 1.19 2015/01/03 17:23:51 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rumpcopy.c,v 1.20 2015/04/18 15:49:18 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/lwp.h>
@@ -49,7 +49,7 @@
        if (RUMP_LOCALPROC_P(curproc)) {
                memcpy(kaddr, uaddr, len);
        } else if (len) {
-               error = rump_sysproxy_copyin(curproc->p_vmspace->vm_map.pmap,
+               error = rump_sysproxy_copyin(RUMP_SPVM2CTL(curproc->p_vmspace),
                    uaddr, kaddr, len);
        }
 
@@ -68,7 +68,7 @@
        if (RUMP_LOCALPROC_P(curproc)) {
                memcpy(uaddr, kaddr, len);
        } else if (len) {
-               error = rump_sysproxy_copyout(curproc->p_vmspace->vm_map.pmap,
+               error = rump_sysproxy_copyout(RUMP_SPVM2CTL(curproc->p_vmspace),
                    kaddr, uaddr, len);
        }
        return error;
@@ -82,7 +82,7 @@
        if (RUMP_LOCALPROC_P(curproc))
                *(char *)uaddr = byte;
        else
-               error = rump_sysproxy_copyout(curproc->p_vmspace->vm_map.pmap,
+               error = rump_sysproxy_copyout(RUMP_SPVM2CTL(curproc->p_vmspace),
                    &byte, uaddr, 1);
 
        return error;
@@ -122,7 +122,7 @@
        if (RUMP_LOCALPROC_P(curproc))
                return copystr(uaddr, kaddr, len, done);
 
-       if ((rv = rump_sysproxy_copyinstr(curproc->p_vmspace->vm_map.pmap,
+       if ((rv = rump_sysproxy_copyinstr(RUMP_SPVM2CTL(curproc->p_vmspace),
            uaddr, kaddr, &len)) != 0)
                return rv;
 
@@ -159,7 +159,7 @@
        if (slen > len)
                return ENAMETOOLONG;
 
-       error = rump_sysproxy_copyoutstr(curproc->p_vmspace->vm_map.pmap,
+       error = rump_sysproxy_copyoutstr(RUMP_SPVM2CTL(curproc->p_vmspace),
            kaddr, uaddr, &slen);
        if (done)
                *done = slen;
@@ -194,11 +194,11 @@
                        continue;
 
                if (uio->uio_rw == UIO_READ) {
-                       error = rump_sysproxy_copyin(vm->pmap,
+                       error = rump_sysproxy_copyin(RUMP_SPVM2CTL(vm),
                            (void *)(vaddr_t)uio->uio_offset, iov->iov_base,
                            curlen);
                } else {
-                       error = rump_sysproxy_copyout(vm->pmap,
+                       error = rump_sysproxy_copyout(RUMP_SPVM2CTL(vm),
                            iov->iov_base, (void *)(vaddr_t)uio->uio_offset,
                            curlen);
                }
diff -r 01c9b507e6a6 -r 23fbf56c088b sys/rump/librump/rumpkern/signals.c
--- a/sys/rump/librump/rumpkern/signals.c       Sat Apr 18 14:44:44 2015 +0000
+++ b/sys/rump/librump/rumpkern/signals.c       Sat Apr 18 15:49:18 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: signals.c,v 1.14 2015/01/03 17:23:51 pooka Exp $       */
+/*     $NetBSD: signals.c,v 1.15 2015/04/18 15:49:18 pooka Exp $       */
 
 /*-
  * Copyright (c) 2010, 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: signals.c,v 1.14 2015/01/03 17:23:51 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: signals.c,v 1.15 2015/04/18 15:49:18 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -93,7 +93,7 @@
        if (RUMP_LOCALPROC_P(p)) {
                rumpuser_kill(p->p_pid, signo);
        } else {
-               rump_sysproxy_raise(p->p_vmspace->vm_map.pmap, signo);
+               rump_sysproxy_raise(RUMP_SPVM2CTL(p->p_vmspace), signo);
        }
 }
 
diff -r 01c9b507e6a6 -r 23fbf56c088b sys/rump/librump/rumpkern/vm.c
--- a/sys/rump/librump/rumpkern/vm.c    Sat Apr 18 14:44:44 2015 +0000
+++ b/sys/rump/librump/rumpkern/vm.c    Sat Apr 18 15:49:18 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vm.c,v 1.165 2015/04/17 12:46:33 pooka Exp $   */
+/*     $NetBSD: vm.c,v 1.166 2015/04/18 15:49:18 pooka Exp $   */
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.165 2015/04/17 12:46:33 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vm.c,v 1.166 2015/04/18 15:49:18 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/atomic.h>
@@ -457,7 +457,7 @@
        if (RUMP_LOCALPROC_P(curproc)) {
                error = rumpuser_anonmmap(NULL, size, 0, 0, addrp);
        } else {
-               error = rump_sysproxy_anonmmap(p->p_vmspace->vm_map.pmap,
+               error = rump_sysproxy_anonmmap(RUMP_SPVM2CTL(p->p_vmspace),
                    size, addrp);
        }
        return error;



Home | Main Index | Thread Index | Old Index