Paolo Bonzini 73c6e4013b rcu: completely disable pthread_atfork callbacks as soon as possible
Because of -daemonize, system mode QEMU sometimes needs to fork() and
keep RCU enabled in the child.  However, there is a possible deadlock
with synchronize_rcu:

- the CPU thread is inside a RCU critical section and wants to take
  the BQL in order to do MMIO

- the monitor thread, which is owning the BQL, calls rcu_init_lock
  which tries to take the rcu_sync_lock

- the call_rcu thread has taken rcu_sync_lock in synchronize_rcu, but
  synchronize_rcu needs the CPU thread to end the critical section
  before returning.

This cannot happen for user-mode emulation, because it does not have
a BQL.

To fix it, assume that system mode QEMU only forks in preparation for
exec (except when daemonizing) and disable pthread_atfork as soon as
the double fork has happened.

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>
2017-08-08 10:40:09 +02:00
..
2017-07-24 12:42:55 +01:00
2016-06-07 18:19:23 +03:00
2016-10-26 08:29:01 -07:00
2016-11-01 10:29:03 -06:00
2016-02-23 12:43:05 +00:00
2017-03-07 16:07:46 +01:00
2016-06-16 18:39:03 +02:00
2017-01-24 23:26:52 +03:00
2017-01-24 17:54:47 +00:00
2017-06-16 07:55:00 +08:00
2016-02-23 12:43:05 +00:00
2017-06-13 14:56:59 +01:00
2016-09-15 15:32:22 +03:00
2016-09-23 11:42:52 +08:00
2017-01-24 23:26:52 +03:00