]> git.proxmox.com Git - mirror_qemu.git/commit
rcu: do not create thread in pthread_atfork callback
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 31 Mar 2015 11:01:05 +0000 (13:01 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 1 Apr 2015 08:06:38 +0000 (10:06 +0200)
commita59629fcc6f603e19b516dc08f75334e5c480bd0
tree4c663417db01a79eedc121f83e176dfb7c503b93
parente65bef6954415b24ee17184b959333d9456bece8
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 <dgilbert@redhat.com>
Tested by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
include/qemu/rcu.h
linux-user/syscall.c
os-posix.c
util/rcu.c