From 74a093eb9803f0f2fb802d1574583a49ed22d5d9 Mon Sep 17 00:00:00 2001 From: Konstantin Belousov Date: Sat, 21 Nov 2020 10:32:40 +0000 Subject: [PATCH] Stop using eventhandler to invoke umtx_exec hook. There is no point in dynamic registration, umtx hook is there always. Reviewed by: mjg Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27303 --- sys/kern/kern_exec.c | 3 ++- sys/kern/kern_umtx.c | 11 ++++------- sys/sys/umtx.h | 1 + 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 6b33a5b63181..366831c3f096 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -67,6 +67,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #ifdef KTRACE @@ -1047,8 +1048,8 @@ exec_new_vmspace(struct image_params *imgp, struct sysentvec *sv) imgp->sysent = sv; sigfastblock_clear(td); + umtx_exec(p); - /* May be called with Giant held */ EVENTHANDLER_DIRECT_INVOKE(process_exec, p, imgp); /* diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index acff69474302..466328dc9840 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -446,8 +446,6 @@ umtxq_sysinit(void *arg __unused) umtx_init_profiling(); #endif mtx_init(&umtx_lock, "umtx lock", NULL, MTX_DEF); - EVENTHANDLER_REGISTER(process_exec, umtx_exec_hook, NULL, - EVENTHANDLER_PRI_ANY); umtx_shm_init(); } @@ -4356,12 +4354,11 @@ umtx_thread_alloc(struct thread *td) * exec() hook. * * Clear robust lists for all process' threads, not delaying the - * cleanup to thread_exit hook, since the relevant address space is + * cleanup to thread exit, since the relevant address space is * destroyed right now. */ -static void -umtx_exec_hook(void *arg __unused, struct proc *p, - struct image_params *imgp __unused) +void +umtx_exec(struct proc *p) { struct thread *td; @@ -4383,7 +4380,7 @@ umtx_exec_hook(void *arg __unused, struct proc *p, } /* - * thread_exit() hook. + * thread exit hook. */ void umtx_thread_exit(struct thread *td) diff --git a/sys/sys/umtx.h b/sys/sys/umtx.h index da93d03f9329..2955c2ad9901 100644 --- a/sys/sys/umtx.h +++ b/sys/sys/umtx.h @@ -188,6 +188,7 @@ umtx_key_match(const struct umtx_key *k1, const struct umtx_key *k2) } int umtx_copyin_timeout(const void *, struct timespec *); +void umtx_exec(struct proc *p); int umtx_key_get(const void *, int, int, struct umtx_key *); void umtx_key_release(struct umtx_key *); struct umtx_q *umtxq_alloc(void);