Source-Changes-HG archive

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

[src/trunk]: src Teach rump to process __link_set_evcnts entries. (Second pa...



details:   https://anonhg.NetBSD.org/src/rev/355225871179
branches:  trunk
changeset: 746114:355225871179
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Mar 22 13:30:10 2020 +0000

description:
Teach rump to process __link_set_evcnts entries.  (Second part of
fix for PR kern/55088)

diffstat:

 lib/librumpuser/rumpuser_dl.c    |  24 ++++++++++--------------
 sys/rump/include/rump/rumpuser.h |   7 +++++--
 sys/rump/librump/rumpkern/rump.c |  19 ++++++++++++++++---
 3 files changed, 31 insertions(+), 19 deletions(-)

diffs (171 lines):

diff -r 9d247adc67fe -r 355225871179 lib/librumpuser/rumpuser_dl.c
--- a/lib/librumpuser/rumpuser_dl.c     Sun Mar 22 11:20:59 2020 +0000
+++ b/lib/librumpuser/rumpuser_dl.c     Sun Mar 22 13:30:10 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: rumpuser_dl.c,v 1.32 2020/03/21 04:48:37 pgoyette Exp $       */
+/*      $NetBSD: rumpuser_dl.c,v 1.33 2020/03/22 13:30:10 pgoyette Exp $       */
 
 /*
  * Copyright (c) 2009 Antti Kantee.  All Rights Reserved.
@@ -40,15 +40,12 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser_dl.c,v 1.32 2020/03/21 04:48:37 pgoyette Exp $");
+__RCSID("$NetBSD: rumpuser_dl.c,v 1.33 2020/03/22 13:30:10 pgoyette Exp $");
 #endif /* !lint */
 
 #include <sys/types.h>
 #include <sys/time.h>
-
-#ifdef NOTYET
 #include <sys/evcnt.h>
-#endif
 
 #include <assert.h>
 
@@ -353,7 +350,8 @@
 
 static void
 process_object(void *handle,
-       rump_modinit_fn domodinit, rump_compload_fn docompload)
+       rump_modinit_fn domodinit, rump_compload_fn docompload,
+       rump_evcntattach_fn doevcntattach)
 {
        const struct modinfo *const *mi_start, *const *mi_end;
        struct rump_component *const *rc, *const *rc_end;
@@ -362,9 +360,7 @@
        typedef void sysctl_setup_func(struct sysctllog **);
        sysctl_setup_func *const *sfp, *const *sfp_end;
 
-#ifdef NOTYET  /* We don't yet handle link_set_evcnts */
        struct evcnt *const *evp, *const *evp_end;
-#endif
 
        mi_start = dlsym(handle, "__start_link_set_modules");
        mi_end = dlsym(handle, "__stop_link_set_modules");
@@ -388,16 +384,14 @@
                assert(sfp == sfp_end);
        }
 
-#ifdef NOTYET
        /* handle link_set_evcnts */
        evp = dlsym(handle, "__start_link_set_evcnts");
        evp_end = dlsym(handle, "__stop_link_set_evcnts");
        if (evp && evp_end) {
                for (; evp < evp_end; evp++)
-                       evcnt_attach_static(*evp);
+                       doevcntattach(*evp);
                assert(evp == evp_end);
        }
-#endif
 }
 
 /*
@@ -406,7 +400,8 @@
  */
 void
 rumpuser_dl_bootstrap(rump_modinit_fn domodinit,
-       rump_symload_fn symload, rump_compload_fn compload)
+       rump_symload_fn symload, rump_compload_fn compload,
+       rump_evcntattach_fn doevcntattach)
 {
        struct link_map *map, *origmap, *mainmap;
        void *mainhandle;
@@ -501,7 +496,7 @@
                        if (handle == NULL)
                                continue;
                }
-               process_object(handle, domodinit, compload);
+               process_object(handle, domodinit, compload, doevcntattach);
                if (map != mainmap)
                        dlclose(handle);
        }
@@ -512,7 +507,8 @@
  */
 void
 rumpuser_dl_bootstrap(rump_modinit_fn domodinit,
-       rump_symload_fn symload, rump_compload_fn compload)
+       rump_symload_fn symload, rump_compload_fn compload,
+       rump_evcntattach_fn doevcntattach)
 {
 
        return;
diff -r 9d247adc67fe -r 355225871179 sys/rump/include/rump/rumpuser.h
--- a/sys/rump/include/rump/rumpuser.h  Sun Mar 22 11:20:59 2020 +0000
+++ b/sys/rump/include/rump/rumpuser.h  Sun Mar 22 13:30:10 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser.h,v 1.115 2017/12/27 09:01:53 ozaki-r Exp $   */
+/*     $NetBSD: rumpuser.h,v 1.116 2020/03/22 13:30:10 pgoyette Exp $  */
 
 /*
  * Copyright (c) 2007-2013 Antti Kantee.  All Rights Reserved.
@@ -224,10 +224,13 @@
 
 struct modinfo;
 struct rump_component;
+struct evcnt;
 typedef void (*rump_modinit_fn)(const struct modinfo *const *, size_t);
 typedef int (*rump_symload_fn)(void *, uint64_t, char *, uint64_t);
 typedef void (*rump_compload_fn)(const struct rump_component *);
-void rumpuser_dl_bootstrap(rump_modinit_fn, rump_symload_fn, rump_compload_fn);
+typedef void (*rump_evcntattach_fn)(struct evcnt *);
+void rumpuser_dl_bootstrap(rump_modinit_fn, rump_symload_fn, rump_compload_fn,
+    rump_evcntattach_fn);
 
 /*
  * misc management
diff -r 9d247adc67fe -r 355225871179 sys/rump/librump/rumpkern/rump.c
--- a/sys/rump/librump/rumpkern/rump.c  Sun Mar 22 11:20:59 2020 +0000
+++ b/sys/rump/librump/rumpkern/rump.c  Sun Mar 22 13:30:10 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rump.c,v 1.342 2020/02/22 21:45:34 ad Exp $    */
+/*     $NetBSD: rump.c,v 1.343 2020/03/22 13:30:10 pgoyette Exp $      */
 
 /*
  * Copyright (c) 2007-2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.342 2020/02/22 21:45:34 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rump.c,v 1.343 2020/03/22 13:30:10 pgoyette Exp $");
 
 #include <sys/systm.h>
 #define ELFSIZE ARCH_ELFSIZE
@@ -129,6 +129,7 @@
 rump_proc_vfs_release_fn rump_proc_vfs_release = (void *)nullop;
 
 static void add_linkedin_modules(const struct modinfo *const *, size_t);
+static void add_static_evcnt(struct evcnt *);
 
 static pid_t rspo_wrap_getpid(void) {
        return rump_sysproxy_hyp_getpid();
@@ -423,7 +424,7 @@
 
        /* process dso's */
        rumpuser_dl_bootstrap(add_linkedin_modules,
-           rump_kernelfsym_load, rump_component_load);
+           rump_kernelfsym_load, rump_component_load, add_static_evcnt);
 
        rump_component_addlocal();
        rump_component_init(RUMP_COMPONENT_KERN);
@@ -645,6 +646,18 @@
        module_builtin_add(mip, nmodinfo, false);
 }
 
+/*
+ * Add an evcnt.  Just in case it might already have been added, remove
+ * it first.
+ */
+static void
+add_static_evcnt(struct evcnt *ev)
+{
+
+       evcnt_detach(ev);
+       evcnt_attach_static(ev);
+}
+
 int
 rump_kernelfsym_load(void *symtab, uint64_t symsize,
        char *strtab, uint64_t strsize)



Home | Main Index | Thread Index | Old Index