From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdzVr-0003Sh-N9 for qemu-devel@nongnu.org; Fri, 03 Apr 2015 07:11:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YdzVq-00066w-MR for qemu-devel@nongnu.org; Fri, 03 Apr 2015 07:11:47 -0400 Message-ID: <551E753D.6060900@redhat.com> Date: Fri, 03 Apr 2015 13:10:53 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1428057542-24310-1-git-send-email-famz@redhat.com> In-Reply-To: <1428057542-24310-1-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 0/3] Fix "stop" draining block jobs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: Kevin Wolf , Jeff Cody , berto@igalia.com, qemu-block@nongnu.org, Stefan Hajnoczi On 03/04/2015 12:38, Fam Zheng wrote: > Stopping the vm will drive the block job all the way to the end, because the > sleep duration is too short, which means the block_job_sleep_ns in the block > jobs are unhelpful. That is because the timer will fire too soon, even before > the aio_poll in bdrv_drain_all returns. > > Lengthen the sleep and add a test case to catch this issue in the future. > > It's not perfect, because the aio_poll returning point could still be far > enough that we wake up the job earlier, but this patch is already making it > better in common cases - setting up a timer with timeout=0 was definitely too > short anyway. > > A complete solution would be adding a "sleep until next iteration" timer/BH > API, but I'm not sure that is worth the complexity. Would it work if vm_stop pauses block jobs before drain, and restarts the paused ones afterwards? Paolo