From patchwork Thu Aug 6 16:35:49 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 39649 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n76Ga0DB021230 for ; Thu, 6 Aug 2009 16:36:01 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753275AbZHFQf5 (ORCPT ); Thu, 6 Aug 2009 12:35:57 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753217AbZHFQf5 (ORCPT ); Thu, 6 Aug 2009 12:35:57 -0400 Received: from verein.lst.de ([213.95.11.210]:53533 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752833AbZHFQf5 (ORCPT ); Thu, 6 Aug 2009 12:35:57 -0400 Received: from verein.lst.de (localhost [127.0.0.1]) by verein.lst.de (8.12.3/8.12.3/Debian-7.1) with ESMTP id n76GZnVL026118 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO); Thu, 6 Aug 2009 18:35:49 +0200 Received: (from hch@localhost) by verein.lst.de (8.12.3/8.12.3/Debian-7.2) id n76GZnuv026117; Thu, 6 Aug 2009 18:35:49 +0200 Date: Thu, 6 Aug 2009 18:35:49 +0200 From: Christoph Hellwig To: kvm@vger.kernel.org Cc: qemu-devel@nongnu.org Subject: virtio-blk performance and MSI Message-ID: <20090806163549.GA25594@lst.de> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.3.28i X-Spam-Score: 0 () X-Scanned-By: MIMEDefang 2.39 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Michael suggested to me a while ago to try MSI with virtio-blk and I played with this small patch: which gave about 5% speedups on 4k sized reads and writes, see the full iozone output I attached. Now getting the information about using multiple MSI vectors from the command line to virtio-blk similar to how virtio-net does seems extremly messy right now. Waiting for Gerd's additional qdev patches to make it easier as a qdev property. File size set to 131072 KB Record Size 4 KB O_DIRECT feature enabled Command line used: iozone -s 128m -r 4k -I -f /dev/sdb Output is in Kbytes/sec Time Resolution = 0.000001 seconds. Processor cache size set to 1024 Kbytes. Processor cache line size set to 32 bytes. File stride size set to 17 * record size. random random bkwd record stride KB reclen write rewrite read reread read write read rewrite read fwrite frewrite fread freread native 131072 4 11428 11847 25110 25302 24415 10904 25051 12146 24859 978572 1224433 1974096 2086567 131072 4 11812 11784 24941 25209 24325 10776 24814 12271 24907 959819 1208770 1977191 2103138 131072 4 11834 11892 25270 25347 24427 10839 24571 12161 24558 958934 1213707 1959754 2100647 131072 4 11688 11914 25102 25100 24514 10855 24787 12237 24738 987739 1218774 1985245 2085435 131072 4 11768 11910 24986 25087 24342 10819 24687 12304 24711 974889 1221511 2027124 2102430 qemu 131072 4 8752 9137 14020 14181 13924 8491 14158 8215 13816 378448 1498838 2117166 2341281 131072 4 9113 9097 14019 14187 14024 8536 14153 8243 14132 1194485 1506540 2053520 2333202 131072 4 9082 9128 14001 14232 13971 8541 14113 8216 14103 1260659 1464543 2101490 2335442 131072 4 9103 9163 14373 14149 13983 8523 14171 8242 14026 1278104 1503047 2127449 2334738 131072 4 9084 9128 14103 14212 13980 8519 14064 8260 13810 1204696 1497434 2053129 2334362 qemu+msi 131072 4 9466 9726 15339 15225 14845 8884 15159 8631 14460 375140 1488522 2066115 2337399 131072 4 9541 9590 15025 15059 15010 8852 15007 8677 14736 1142718 1491640 2111847 2332153 131072 4 9492 9621 14831 15093 14792 8895 14849 8452 14976 1163760 1461825 2118741 2337985 131072 4 9519 9615 14954 14950 14713 8915 15229 8547 14854 1212529 1490471 2091894 2343676 131072 4 9527 9576 14872 14828 14741 8880 14891 8769 14502 1253559 1436703 2127827 2344256 Index: qemu-kvm/hw/virtio-blk.c =================================================================== --- qemu-kvm.orig/hw/virtio-blk.c +++ qemu-kvm/hw/virtio-blk.c @@ -416,6 +416,7 @@ VirtIODevice *virtio_blk_init(DeviceStat s->vdev.get_config = virtio_blk_update_config; s->vdev.get_features = virtio_blk_get_features; s->vdev.reset = virtio_blk_reset; + s->vdev.nvectors = 2; s->bs = bs; s->rq = NULL; if (strlen(ps = (char *)drive_get_serial(bs)))