From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, Paolo Bonzini <pbonzini@redhat.com>,
Kevin Wolf <kwolf@redhat.com>, Fam Zheng <famz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH 1/3] block: count bdrv_co_rw_vmstate() requests
Date: Wed, 17 May 2017 18:09:39 +0100 [thread overview]
Message-ID: <20170517170941.25850-2-stefanha@redhat.com> (raw)
In-Reply-To: <20170517170941.25850-1-stefanha@redhat.com>
Call bdrv_inc/dec_in_flight() for vmstate reads/writes. This seems
unnecessary at first glance because vmstate reads/writes are done
synchronously while the guest is stopped. But we need the bdrv_wakeup()
in bdrv_dec_in_flight() so the main loop sees request completion.
Besides, it's cleaner to count vmstate reads/writes like ordinary
read/write requests.
The bdrv_wakeup() partially fixes a 'savevm' hang with -object iothread.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/io.c | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/block/io.c b/block/io.c
index fdd7485..cc56e90 100644
--- a/block/io.c
+++ b/block/io.c
@@ -1988,17 +1988,24 @@ bdrv_co_rw_vmstate(BlockDriverState *bs, QEMUIOVector *qiov, int64_t pos,
bool is_read)
{
BlockDriver *drv = bs->drv;
+ int ret = -ENOTSUP;
+
+ bdrv_inc_in_flight(bs);
if (!drv) {
- return -ENOMEDIUM;
+ ret = -ENOMEDIUM;
} else if (drv->bdrv_load_vmstate) {
- return is_read ? drv->bdrv_load_vmstate(bs, qiov, pos)
- : drv->bdrv_save_vmstate(bs, qiov, pos);
+ if (is_read) {
+ ret = drv->bdrv_load_vmstate(bs, qiov, pos);
+ } else {
+ ret = drv->bdrv_save_vmstate(bs, qiov, pos);
+ }
} else if (bs->file) {
- return bdrv_co_rw_vmstate(bs->file->bs, qiov, pos, is_read);
+ ret = bdrv_co_rw_vmstate(bs->file->bs, qiov, pos, is_read);
}
- return -ENOTSUP;
+ bdrv_dec_in_flight(bs);
+ return ret;
}
static void coroutine_fn bdrv_co_rw_vmstate_entry(void *opaque)
--
2.9.3
next prev parent reply other threads:[~2017-05-17 17:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-17 17:09 [Qemu-devel] [PATCH 0/3] block: fix 'savevm' hang with -object iothread Stefan Hajnoczi
2017-05-17 17:09 ` Stefan Hajnoczi [this message]
2017-05-17 20:09 ` [Qemu-devel] [PATCH 1/3] block: count bdrv_co_rw_vmstate() requests Eric Blake
2017-05-17 17:09 ` [Qemu-devel] [PATCH 2/3] block: use BDRV_POLL_WHILE() in bdrv_rw_vmstate() Stefan Hajnoczi
2017-05-17 20:16 ` Eric Blake
2017-05-17 20:47 ` Paolo Bonzini
2017-05-18 7:57 ` Kevin Wolf
2017-05-18 8:06 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-05-18 8:22 ` Kevin Wolf
2017-05-18 8:05 ` Stefan Hajnoczi
2017-05-17 17:09 ` [Qemu-devel] [PATCH 3/3] migration: avoid recursive AioContext locking in save_vmstate() Stefan Hajnoczi
2017-05-17 20:24 ` Eric Blake
2017-05-18 8:18 ` Kevin Wolf
2017-05-19 9:07 ` [Qemu-devel] [Qemu-block] " Stefan Hajnoczi
2017-05-17 20:49 ` [Qemu-devel] [PATCH 0/3] block: fix 'savevm' hang with -object iothread Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170517170941.25850-2-stefanha@redhat.com \
--to=stefanha@redhat.com \
--cc=famz@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).