From a59629fcc6f603e19b516dc08f75334e5c480bd0 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 31 Mar 2015 13:01:05 +0200 Subject: rcu: do not create thread in pthread_atfork callback If QEMU forks after the CPU threads have been created, qemu_mutex_lock_iothread will not be able to do qemu_cpu_kick_thread. There is no solution other than assuming that forks after the CPU threads have been created will end up in an exec. Forks before the CPU threads have been created (such as -daemonize) have to call rcu_after_fork manually. Notably, the oxygen theme for GTK+ forks and shows a "No such process" error without this patch. This patch can be reverted once the iothread loses the "kick the TCG thread" magic. User-mode emulation does not use the iothread, so it can also call rcu_after_fork. Reported by: Dr. David Alan Gilbert Tested by: Dr. David Alan Gilbert Signed-off-by: Paolo Bonzini --- os-posix.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'os-posix.c') diff --git a/os-posix.c b/os-posix.c index ba091f1530..e4da406f38 100644 --- a/os-posix.c +++ b/os-posix.c @@ -39,6 +39,7 @@ #include "sysemu/sysemu.h" #include "net/slirp.h" #include "qemu-options.h" +#include "qemu/rcu.h" #ifdef CONFIG_LINUX #include @@ -247,6 +248,7 @@ void os_daemonize(void) signal(SIGTSTP, SIG_IGN); signal(SIGTTOU, SIG_IGN); signal(SIGTTIN, SIG_IGN); + rcu_after_fork(); } } -- cgit v1.2.1