• Paolo Bonzini's avatar
    rcu: do not create thread in pthread_atfork callback · a59629fc
    Paolo Bonzini authored
    
    
    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: default avatarPaolo Bonzini <pbonzini@redhat.com>
    a59629fc