summaryrefslogtreecommitdiffstats
path: root/ui/input-keymap.c
diff options
context:
space:
mode:
authorIgor Mammedov2018-06-05 16:00:42 +0200
committerEduardo Habkost2018-06-11 19:25:49 +0200
commit0f5319ea25fb0a05827d512859b7c7d23371ac5d (patch)
tree896bed615e35ac6a98ba8dbdd6816265a45725a0 /ui/input-keymap.c
parentMerge remote-tracking branch 'remotes/vivier/tags/m68k-for-3.0-pull-request' ... (diff)
downloadqemu-0f5319ea25fb0a05827d512859b7c7d23371ac5d.tar.gz
qemu-0f5319ea25fb0a05827d512859b7c7d23371ac5d.tar.xz
qemu-0f5319ea25fb0a05827d512859b7c7d23371ac5d.zip
cli: Don't run early event loop if no --preconfig was specified
After 047f7038f586d215 it is possible for event loop to run two times. First time whilst parsing command line options (the idea is to bring up monitor early so that management applications can tweak config before machine is initialized). And the second time is after everything is set up (this is the usual place). In both cases the event loop is called as main_loop_wait(nonblocking = false) which causes the event loop to block until at least one event occurred. Now, consider that somebody (i.e. libvirt) calls us with -daemonize. This operation is split in two steps. The main() calls os_daemonize() which fork()-s and then waits in read() until child notifies it via write(): /qemu.git $ ./x86_64-softmmu/qemu-system-x86_64 -S -daemonize \ -no-user-config -nodefaults -nographic main(): child: os_daemonize(): read(pipe[0]) main_loop(): main_loop_wait(false) os_setup_post(): write(pipe[1]) main_loop(): main_loop_wait(false) Here it can be clearly seen that main() does not exit until an event occurs, but at the same time nobody will touch the monitor socket until their exec("qemu-system-*") finishes. So the whole thing deadlocks. The solution is to not call main_loop_wait() unless --preconfig was specified (in which case caller knows they must connect to the socket before exec() finishes). Patch also fixes hang when -nodefaults option is used, which were causing QEMU hang in the early main_loop_wait() indefinitely by the same means (not calling main_loop_wait() unless --preconfig is present on CLI) Based on From: Michal Privoznik <mprivozn@redhat.com> Subject: [PATCH] cli: Don't run early event loop if no --preconfig was specified Message-Id: <ad910973c593c5ac2fed3a10ea958f7e9c12f82c.1527935663.git.mprivozn@redhat.com> Fixes: 047f7038f586d215 Signed-off-by: Igor Mammedov <imammedo@redhat.com> Message-Id: <1528207243-268226-2-git-send-email-imammedo@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Diffstat (limited to 'ui/input-keymap.c')
0 files changed, 0 insertions, 0 deletions