[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] block/mirror: Sleep periodically during bitmap
From: |
Alexandre DERUMIER |
Subject: |
Re: [Qemu-devel] [PATCH] block/mirror: Sleep periodically during bitmap scanning |
Date: |
Mon, 29 Jun 2015 10:56:07 +0200 (CEST) |
Hi,
I'm currently testing this patch,
and it still hanging for me (mirroring a raw file from nfs)
I just wonder why block_job_sleep_ns is set to 0 ?
+ block_job_sleep_ns(&s->common, QEMU_CLOCK_REALTIME, 0);
I have tried to increasing it to a bigger value
+ block_job_sleep_ns(&s->common, QEMU_CLOCK_REALTIME, 100000000);
And now it's working fine for me, no more qemu hang
----- Mail original -----
De: "Jeff Cody" <address@hidden>
À: "Fam Zheng" <address@hidden>
Cc: "Kevin Wolf" <address@hidden>, "pbonzini" <address@hidden>, "qemu-devel"
<address@hidden>, address@hidden
Envoyé: Mardi 16 Juin 2015 06:06:25
Objet: Re: [Qemu-devel] [PATCH] block/mirror: Sleep periodically during bitmap
scanning
On Wed, May 13, 2015 at 11:11:13AM +0800, Fam Zheng wrote:
> Before, we only yield after initializing dirty bitmap, where the QMP
> command would return. That may take very long, and guest IO will be
> blocked.
>
> Add sleep points like the later mirror iterations.
>
> Signed-off-by: Fam Zheng <address@hidden>
> ---
> block/mirror.c | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/block/mirror.c b/block/mirror.c
> index 1a1d997..baed225 100644
> --- a/block/mirror.c
> +++ b/block/mirror.c
> @@ -467,11 +467,23 @@ static void coroutine_fn mirror_run(void *opaque)
> sectors_per_chunk = s->granularity >> BDRV_SECTOR_BITS;
> mirror_free_init(s);
>
> + last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
> if (!s->is_none_mode) {
> /* First part, loop on the sectors and initialize the dirty bitmap. */
> BlockDriverState *base = s->base;
> for (sector_num = 0; sector_num < end; ) {
> int64_t next = (sector_num | (sectors_per_chunk - 1)) + 1;
> + int64_t now = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
> +
> + if (now - last_pause_ns > SLICE_TIME) {
> + last_pause_ns = now;
> + block_job_sleep_ns(&s->common, QEMU_CLOCK_REALTIME, 0);
> + }
> +
> + if (block_job_is_cancelled(&s->common)) {
> + goto immediate_exit;
> + }
> +
> ret = bdrv_is_allocated_above(bs, base,
> sector_num, next - sector_num, &n);
>
> @@ -490,7 +502,6 @@ static void coroutine_fn mirror_run(void *opaque)
> }
>
> bdrv_dirty_iter_init(s->dirty_bitmap, &s->hbi);
> - last_pause_ns = qemu_clock_get_ns(QEMU_CLOCK_REALTIME);
> for (;;) {
> uint64_t delay_ns = 0;
> int64_t cnt;
> --
> 2.4.0
>
Thanks, applied to my block tree:
https://github.com/codyprime/qemu-kvm-jtc/commits/block
Jeff