From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z9UrQ-0007fs-Ch for qemu-devel@nongnu.org; Mon, 29 Jun 2015 04:56:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z9UrO-0004iP-VG for qemu-devel@nongnu.org; Mon, 29 Jun 2015 04:56:16 -0400 Date: Mon, 29 Jun 2015 10:56:07 +0200 (CEST) From: Alexandre DERUMIER Message-ID: <1581452714.3249899.1435568167292.JavaMail.zimbra@oxygem.tv> In-Reply-To: <20150616040625.GA31232@localhost.localdomain> References: <1431486673-19280-1-git-send-email-famz@redhat.com> <20150616040625.GA31232@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH] block/mirror: Sleep periodically during bitmap scanning List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: Kevin Wolf , pbonzini , Jeff Cody , qemu-devel , qemu-block@nongnu.org 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, 100000= 000); And now it's working fine for me, no more qemu hang ----- Mail original ----- De: "Jeff Cody" =C3=80: "Fam Zheng" Cc: "Kevin Wolf" , "pbonzini" , "qem= u-devel" , qemu-block@nongnu.org Envoy=C3=A9: Mardi 16 Juin 2015 06:06:25 Objet: Re: [Qemu-devel] [PATCH] block/mirror: Sleep periodically during=09b= itmap scanning On Wed, May 13, 2015 at 11:11:13AM +0800, Fam Zheng wrote:=20 > Before, we only yield after initializing dirty bitmap, where the QMP=20 > command would return. That may take very long, and guest IO will be=20 > blocked.=20 >=20 > Add sleep points like the later mirror iterations.=20 >=20 > Signed-off-by: Fam Zheng =20 > ---=20 > block/mirror.c | 13 ++++++++++++-=20 > 1 file changed, 12 insertions(+), 1 deletion(-)=20 >=20 > diff --git a/block/mirror.c b/block/mirror.c=20 > index 1a1d997..baed225 100644=20 > --- a/block/mirror.c=20 > +++ b/block/mirror.c=20 > @@ -467,11 +467,23 @@ static void coroutine_fn mirror_run(void *opaque)= =20 > sectors_per_chunk =3D s->granularity >> BDRV_SECTOR_BITS;=20 > mirror_free_init(s);=20 >=20 > + last_pause_ns =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME);=20 > if (!s->is_none_mode) {=20 > /* First part, loop on the sectors and initialize the dirty bitmap. */=20 > BlockDriverState *base =3D s->base;=20 > for (sector_num =3D 0; sector_num < end; ) {=20 > int64_t next =3D (sector_num | (sectors_per_chunk - 1)) + 1;=20 > + int64_t now =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME);=20 > +=20 > + if (now - last_pause_ns > SLICE_TIME) {=20 > + last_pause_ns =3D now;=20 > + block_job_sleep_ns(&s->common, QEMU_CLOCK_REALTIME, 0);=20 > + }=20 > +=20 > + if (block_job_is_cancelled(&s->common)) {=20 > + goto immediate_exit;=20 > + }=20 > +=20 > ret =3D bdrv_is_allocated_above(bs, base,=20 > sector_num, next - sector_num, &n);=20 >=20 > @@ -490,7 +502,6 @@ static void coroutine_fn mirror_run(void *opaque)=20 > }=20 >=20 > bdrv_dirty_iter_init(s->dirty_bitmap, &s->hbi);=20 > - last_pause_ns =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME);=20 > for (;;) {=20 > uint64_t delay_ns =3D 0;=20 > int64_t cnt;=20 > --=20 > 2.4.0=20 >=20 Thanks, applied to my block tree:=20 https://github.com/codyprime/qemu-kvm-jtc/commits/block=20 Jeff=20