From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44833) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2tqP-0004Sd-CG for qemu-devel@nongnu.org; Thu, 03 Jul 2014 23:07:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X2tqJ-00036Q-Az for qemu-devel@nongnu.org; Thu, 03 Jul 2014 23:07:25 -0400 Received: from mail-pd0-f170.google.com ([209.85.192.170]:58981) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X2tqI-00036J-Ti for qemu-devel@nongnu.org; Thu, 03 Jul 2014 23:07:19 -0400 Received: by mail-pd0-f170.google.com with SMTP id z10so1212813pdj.15 for ; Thu, 03 Jul 2014 20:07:18 -0700 (PDT) From: Ming Lei Date: Fri, 4 Jul 2014 11:06:42 +0800 Message-Id: <1404443202-14174-4-git-send-email-ming.lei@canonical.com> In-Reply-To: <1404443202-14174-1-git-send-email-ming.lei@canonical.com> References: <1404443202-14174-1-git-send-email-ming.lei@canonical.com> Subject: [Qemu-devel] [PATCH v5 3/3] dataplane: submit I/O as a batch List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell , qemu-devel@nongnu.org, Paolo Bonzini , Stefan Hajnoczi Cc: Kevin Wolf , Ming Lei , Fam Zheng , "Michael S. Tsirkin" Before commit 580b6b2aa2(dataplane: use the QEMU block layer for I/O), dataplane for virtio-blk submits block I/O as a batch. This commit 580b6b2aa2 replaces the custom linux AIO implementation(including submit I/O as a batch) with QEMU block layer, but this commit causes ~40% throughput regression on virtio-blk performance, and removing submitting I/O as a batch is one of the causes. This patch applies the newly introduced bdrv_io_plug() and bdrv_io_unplug() interfaces to support submitting I/O at batch for Qemu block layer, and in my test, the change can improve throughput by ~30% with 'aio=native'. Following my fio test script: [global] direct=1 size=4G bsrange=4k-4k timeout=40 numjobs=4 ioengine=libaio iodepth=64 filename=/dev/vdc group_reporting=1 [f] rw=randread Result on one of my small machine(host: x86_64, 2cores, 4thread, guest: 4cores): - qemu master: 65K IOPS - qemu master with these patches: 92K IOPS - 2.0.0 release(dataplane using custom linux aio): 104K IOPS Reviewed-by: Paolo Bonzini Signed-off-by: Ming Lei --- hw/block/dataplane/virtio-blk.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index 6cd75f6..bed9f13 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -83,6 +83,7 @@ static void handle_notify(EventNotifier *e) }; 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); @@ -116,6 +117,7 @@ static void handle_notify(EventNotifier *e) break; } } + bdrv_io_unplug(s->blk->conf.bs); } /* Context: QEMU global mutex held */ -- 1.7.9.5