aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2015-03-03 11:36:09 +0100
committerPeter Maydell <peter.maydell@linaro.org>2015-03-03 13:21:53 +0000
commit576a94d8bcaa1bb07a81d9ffd2cf76095a66ad9a (patch)
tree879706ba4e400072ae763c7c520292a85d9fe4d7
parent3180aadb1f00fa0f0b47bccbcae5b1d47dc5ff74 (diff)
vl: take iothread lock very early
If the iothread lock isn't taken by the main thread, the RCU callbacks might run concurrently with the main thread. QEMU's not ready for that. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Christian Borntraeger <borntraeger@de.ibm.com> Tested-by: Gonglei <arei.gonglei@huawei.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r--vl.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/vl.c b/vl.c
index 5d13d2fd5e..801d48709c 100644
--- a/vl.c
+++ b/vl.c
@@ -2767,6 +2767,9 @@ int main(int argc, char **argv, char **envp)
FILE *vmstate_dump_file = NULL;
Error *main_loop_err = NULL;
+ qemu_init_cpu_loop();
+ qemu_mutex_lock_iothread();
+
atexit(qemu_run_exit_notifiers);
error_set_progname(argv[0]);
qemu_init_exec_dir(argv[0]);
@@ -4102,9 +4105,6 @@ int main(int argc, char **argv, char **envp)
os_set_line_buffering();
- qemu_init_cpu_loop();
- qemu_mutex_lock_iothread();
-
#ifdef CONFIG_SPICE
/* spice needs the timers to be initialized by this point */
qemu_spice_init();