diff options
-rw-r--r-- | include/qemu/rcu.h | 1 | ||||
-rw-r--r-- | linux-user/syscall.c | 1 | ||||
-rw-r--r-- | os-posix.c | 2 | ||||
-rw-r--r-- | util/rcu.c | 7 |
4 files changed, 7 insertions, 4 deletions
diff --git a/include/qemu/rcu.h b/include/qemu/rcu.h index 506ab58..7df1e86 100644 --- a/include/qemu/rcu.h +++ b/include/qemu/rcu.h @@ -117,6 +117,7 @@ extern void synchronize_rcu(void); */ extern void rcu_register_thread(void); extern void rcu_unregister_thread(void); +extern void rcu_after_fork(void); struct rcu_head; typedef void RCUCBFunc(struct rcu_head *head); diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 4bd9543..1622ad6 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -4572,6 +4572,7 @@ static int do_fork(CPUArchState *env, unsigned int flags, abi_ulong newsp, ret = fork(); if (ret == 0) { /* Child Process. */ + rcu_after_fork(); cpu_clone_regs(env, newsp); fork_end(1); /* There is a race condition here. The parent process could @@ -39,6 +39,7 @@ #include "sysemu/sysemu.h" #include "net/slirp.h" #include "qemu-options.h" +#include "qemu/rcu.h" #ifdef CONFIG_LINUX #include <sys/prctl.h> @@ -247,6 +248,7 @@ void os_daemonize(void) signal(SIGTSTP, SIG_IGN); signal(SIGTTOU, SIG_IGN); signal(SIGTTIN, SIG_IGN); + rcu_after_fork(); } } @@ -311,19 +311,18 @@ static void rcu_init_unlock(void) { qemu_mutex_unlock(&rcu_gp_lock); } +#endif -static void rcu_init_child(void) +void rcu_after_fork(void) { - qemu_mutex_unlock(&rcu_gp_lock); memset(®istry, 0, sizeof(registry)); rcu_init_complete(); } -#endif static void __attribute__((__constructor__)) rcu_init(void) { #ifdef CONFIG_POSIX - pthread_atfork(rcu_init_lock, rcu_init_unlock, rcu_init_child); + pthread_atfork(rcu_init_lock, rcu_init_unlock, rcu_init_unlock); #endif rcu_init_complete(); } |