From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53177) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7S7q-0001og-39 for qemu-devel@nongnu.org; Wed, 16 Jul 2014 12:32:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X7S7j-0001AR-0d for qemu-devel@nongnu.org; Wed, 16 Jul 2014 12:32:13 -0400 Received: from mail-pa0-f51.google.com ([209.85.220.51]:60779) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X7S7i-000198-QY for qemu-devel@nongnu.org; Wed, 16 Jul 2014 12:32:06 -0400 Received: by mail-pa0-f51.google.com with SMTP id ey11so1599543pad.38 for ; Wed, 16 Jul 2014 09:32:06 -0700 (PDT) From: Ming Lei Date: Thu, 17 Jul 2014 00:31:12 +0800 Message-Id: <1405528281-23744-6-git-send-email-ming.lei@canonical.com> In-Reply-To: <1405528281-23744-1-git-send-email-ming.lei@canonical.com> References: <1405528281-23744-1-git-send-email-ming.lei@canonical.com> Subject: [Qemu-devel] [PATCH RFC 05/14] dataplane: enable selective bypassing coroutine List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Paolo Bonzini , Stefan Hajnoczi Cc: Kevin Wolf , Ming Lei , Fam Zheng , "Michael S. Tsirkin" This patch enables selective bypassing for the coroutine in bdrv_co_aio_rw_vector() if the image format is raw. With this patch, ~16% thoughput improvement can be observed in my laptop based VM test, and ~7% improvement is observed in the VM based on server. Signed-off-by: Ming Lei --- hw/block/dataplane/virtio-blk.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/block/dataplane/virtio-blk.c b/hw/block/dataplane/virtio-blk.c index d6ba65c..2093e4a 100644 --- a/hw/block/dataplane/virtio-blk.c +++ b/hw/block/dataplane/virtio-blk.c @@ -28,6 +28,7 @@ struct VirtIOBlockDataPlane { bool started; bool starting; bool stopping; + bool raw_format; VirtIOBlkConf *blk; @@ -193,6 +194,8 @@ void virtio_blk_data_plane_create(VirtIODevice *vdev, VirtIOBlkConf *blk, error_setg(&s->blocker, "block device is in use by data plane"); bdrv_op_block_all(blk->conf.bs, s->blocker); + s->raw_format = (raw_get_aio_fd(blk->conf.bs) >= 0); + *dataplane = s; } @@ -262,6 +265,10 @@ void virtio_blk_data_plane_start(VirtIOBlockDataPlane *s) /* Kick right away to begin processing requests already in vring */ event_notifier_set(virtio_queue_get_host_notifier(vq)); + if (s->raw_format) { + qemu_aio_set_bypass_co(s->ctx, true); + } + /* Get this show started by hooking up our callbacks */ aio_context_acquire(s->ctx); aio_set_event_notifier(s->ctx, &s->host_notifier, handle_notify); @@ -291,6 +298,9 @@ void virtio_blk_data_plane_stop(VirtIOBlockDataPlane *s) aio_context_release(s->ctx); + if (s->raw_format) { + qemu_aio_set_bypass_co(s->ctx, false); + } /* Sync vring state back to virtqueue so that non-dataplane request * processing can continue when we disable the host notifier below. */ -- 1.7.9.5