From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:48434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1fWj-0005Cm-K1 for qemu-devel@nongnu.org; Sun, 26 Feb 2012 09:56:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S1fWb-00086Z-95 for qemu-devel@nongnu.org; Sun, 26 Feb 2012 09:56:41 -0500 Received: from e06smtp13.uk.ibm.com ([195.75.94.109]:51927) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1fWb-00086R-15 for qemu-devel@nongnu.org; Sun, 26 Feb 2012 09:56:33 -0500 Received: from /spool/local by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sun, 26 Feb 2012 14:56:29 -0000 Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by d06nrmr1806.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q1QEtvld1786066 for ; Sun, 26 Feb 2012 14:55:57 GMT Received: from d06av01.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q1QEtvuc001290 for ; Sun, 26 Feb 2012 07:55:57 -0700 From: Stefan Hajnoczi Date: Sun, 26 Feb 2012 14:55:24 +0000 Message-Id: <1330268124-10725-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH] qed: replace vm_clock with rt_clock for qemu-tool compatibility List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Kevin Wolf , Stefan Hajnoczi , Zhi Yong Wu 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 --- 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 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