Don't quit IO thread before all vcpus are stopped
commit5c27553c85b2a49a54b9dcd4b6511d0129f1ce34
authorDor Laor <dor.laor@qumranet.com>
Wed, 23 Apr 2008 21:51:19 +0000 (24 00:51 +0300)
committerAvi Kivity <avi@qumranet.com>
Thu, 24 Apr 2008 12:42:30 +0000 (24 15:42 +0300)
treefb1a5c1e7f9d80f588dc1772eb97b1dfa11531d7
parent58d6ca86d8c4bdb94b444a1f07264f568b545cb6
Don't quit IO thread before all vcpus are stopped

Call pause_all_threads() before exiting the i/o thread
main loop.

This scenario happened on system_powerdown request:
The vcpu eventually makes pm_ioport_writew (soft power off)
access that calls qemu_system_shutdown_request.
It causes the i/o thread to exit although the vcpu did not
exit yet.

One of the symptoms is that vcpu may trigger timers thus
causing a segfault since the i/o thread stopped the timer.

Signed-off-by: Dor Laor <dor.laor@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
qemu-kvm.c