aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2018-02-15 15:45:33 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-02-15 15:45:33 +0000
commitf003d07337a6d4d02c43429b26a4270459afb51a (patch)
tree6caf67e3cd097fabea32e1a66c635d9df2040e11 /vl.c
parent8c5e7bddc22dac9d4dc3526996babce4c7242d9d (diff)
parentd2f668b74907cbd96d9df0774971768ed06de2f0 (diff)
Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging
Pull request v2: * Dropped Fam's git-publish series because there is still ongoing discussion # gpg: Signature made Thu 15 Feb 2018 09:42:03 GMT # gpg: using RSA key 9CA4ABB381AB73C8 # gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" # gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" # Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8 * remotes/stefanha/tags/block-pull-request: misc: fix spelling ratelimit: don't align wait time with slices vl: pause vcpus before stopping iothreads Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/vl.c b/vl.c
index 21878496ec..7a5554bc41 100644
--- a/vl.c
+++ b/vl.c
@@ -4767,10 +4767,18 @@ int main(int argc, char **argv, char **envp)
main_loop();
replay_disable_events();
- iothread_stop_all();
+ /* The ordering of the following is delicate. Stop vcpus to prevent new
+ * I/O requests being queued by the guest. Then stop IOThreads (this
+ * includes a drain operation and completes all request processing). At
+ * this point emulated devices are still associated with their IOThreads
+ * (if any) but no longer have any work to do. Only then can we close
+ * block devices safely because we know there is no more I/O coming.
+ */
pause_all_vcpus();
+ iothread_stop_all();
bdrv_close_all();
+
res_free();
/* vhost-user must be cleaned up before chardevs. */