On Fri, 04/03 13:10, Paolo Bonzini wrote: > > > 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?
Yeah. It would. Will need a bit more code, but still be a neat solution. Fam