On Thu, Jul 3, 2014 at 8:37 PM, Stefan Hajnoczi <stefa...@gmail.com> wrote: > On Wed, Jul 02, 2014 at 08:18:48PM +0800, Ming Lei wrote: >> diff --git a/hw/block/dataplane/virtio-blk.c >> b/hw/block/dataplane/virtio-blk.c >> index c10b7b7..82bb276 100644 >> --- a/hw/block/dataplane/virtio-blk.c >> +++ b/hw/block/dataplane/virtio-blk.c >> @@ -201,6 +201,9 @@ static void do_flush_cmd(VirtIOBlockDataPlane *s, >> VirtQueueElement *elem, >> req->elem = elem; >> req->inhdr = inhdr; >> >> + /* flush IOs queued first */ >> + bdrv_flush_io_queue(s->blk->conf.bs); >> + >> bdrv_aio_flush(s->blk->conf.bs, complete_flush, req); >> } >> >> @@ -289,6 +292,7 @@ static void handle_notify(EventNotifier *e) >> int ret; >> >> event_notifier_test_and_clear(&s->host_notifier); >> + bdrv_io_plug(s->blk->conf.bs); >> for (;;) { >> /* Disable guest->host notifies to avoid unnecessary vmexits */ >> vring_disable_notification(s->vdev, &s->vring); >> @@ -322,6 +326,7 @@ static void handle_notify(EventNotifier *e) >> break; >> } >> } >> + bdrv_io_unplug(s->blk->conf.bs); >> } > > Might as well do the same for non-dataplane in hw/block/virtio-blk.c?
It may need further optimization for non-dataplane, and I saw the message of 'main-loop: WARNING: I/O thread spun for 1000 iterations' when I enabled for non-dataplane. The queue depth should be decreased for non-dataplane. Thanks,