From: Zhi Yong Wu <zwu.kernel@gmail.com>
To: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Kevin Wolf <kwolf@redhat.com>,
qemu-devel@nongnu.org, Zhi Yong Wu <wuzhy@cn.ibm.com>
Subject: Re: [Qemu-devel] [PATCH] qed: replace vm_clock with rt_clock for qemu-tool compatibility
Date: Mon, 27 Feb 2012 15:35:33 +0800 [thread overview]
Message-ID: <CAEH94LiRXAXN6_cqaKN1sFafMHbsSg3u6HR9TUz+VJqS3XEtzg@mail.gmail.com> (raw)
In-Reply-To: <1330268124-10725-1-git-send-email-stefanha@linux.vnet.ibm.com>
On Sun, Feb 26, 2012 at 10:55 PM, Stefan Hajnoczi
<stefanha@linux.vnet.ibm.com> wrote:
> The QED dirty bit timer marks the file clean after allocating writes
> have drained. This is cheaper than clearing/setting the dirty bit on
> each allocating write because the timer introduces a grace period which
> can be extended if more allocating writes arrive.
>
> The vm_clock was used in an attempt to prevent modifying the image file
> when live migration has stopped the VM. Unfortunately vm_clock is
> unavailable in the qemu-tool environment and will abort(3)!
>
> Since QED currently does not support live migration, just replace
> vm_clock with rt_clock and add comments explaining the migration
> blocker.
>
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> ---
> Zhi Yong: This patch is needed in addition to the qemu_init_main_loop() patches
> you sent recently. Without this patch QED may read the vm_clock, which calls
> abort(3) in qemu-tool.c. Together, our patches make QED work again in qemu-img
Since vm_clock is created via qemu_init_main_loop(), when QED read
vm_clock, why will this call abort()?
Can you elaborate this? what is its call path?
> and qemu-io.
>
> block/qed.c | 16 +++++++++++-----
> 1 files changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/block/qed.c b/block/qed.c
> index a041d31..fdb90e3 100644
> --- a/block/qed.c
> +++ b/block/qed.c
> @@ -353,10 +353,7 @@ static void qed_start_need_check_timer(BDRVQEDState *s)
> {
> trace_qed_start_need_check_timer(s);
>
> - /* Use vm_clock so we don't alter the image file while suspended for
> - * migration.
> - */
> - qemu_mod_timer(s->need_check_timer, qemu_get_clock_ns(vm_clock) +
> + qemu_mod_timer(s->need_check_timer, qemu_get_clock_ns(rt_clock) +
> get_ticks_per_sec() * QED_NEED_CHECK_TIMEOUT);
> }
>
> @@ -494,9 +491,18 @@ static int bdrv_qed_open(BlockDriverState *bs, int flags)
> }
> }
>
> - s->need_check_timer = qemu_new_timer_ns(vm_clock,
> + s->need_check_timer = qemu_new_timer_ns(rt_clock,
> qed_need_check_timer_cb, s);
>
> + /* There are two issues with live migration:
> + *
> + * 1. The destination will open the image file and see the dirty bit is
> + * set, causing it to "repair" the image while the source still has it
> + * open for writing.
> + *
> + * 2. The timer used for clearing the dirty bit uses rt_clock and can in
> + * theory fire when the VM is not running during migration.
> + */
> error_set(&s->migration_blocker,
> QERR_BLOCK_FORMAT_FEATURE_NOT_SUPPORTED,
> "qed", bs->device_name, "live migration");
> --
> 1.7.9
>
>
--
Regards,
Zhi Yong Wu
next prev parent reply other threads:[~2012-02-27 7:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-26 14:55 [Qemu-devel] [PATCH] qed: replace vm_clock with rt_clock for qemu-tool compatibility Stefan Hajnoczi
2012-02-27 7:35 ` Zhi Yong Wu [this message]
2012-02-27 8:42 ` Paolo Bonzini
2012-02-27 8:48 ` Zhi Yong Wu
2012-02-27 9:31 ` Kevin Wolf
2012-02-27 11:14 ` Stefan Hajnoczi
2012-02-27 14:20 ` Zhi Yong Wu
2012-02-27 14:41 ` Stefan Hajnoczi
2012-02-27 15:17 ` Zhi Yong Wu
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=CAEH94LiRXAXN6_cqaKN1sFafMHbsSg3u6HR9TUz+VJqS3XEtzg@mail.gmail.com \
--to=zwu.kernel@gmail.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
--cc=wuzhy@cn.ibm.com \
/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).