[{"id":1776342,"web_url":"http://patchwork.ozlabs.org/comment/1776342/","msgid":"<a4fbc91e-8d9e-bb6c-758f-672b0a943bcd@redhat.com>","list_archive_url":null,"date":"2017-09-27T13:27:56","subject":"Re: [Qemu-devel] [PATCH v4 1/6] block: use 1 MB bounce buffers for\n\tcrypto instead of 16KB","submitter":{"id":6591,"url":"http://patchwork.ozlabs.org/api/people/6591/","name":"Eric Blake","email":"eblake@redhat.com"},"content":"On 09/27/2017 07:53 AM, Daniel P. Berrange wrote:\n> Using 16KB bounce buffers creates a significant performance\n> penalty for I/O to encrypted volumes on storage which high\n> I/O latency (rotating rust & network drives), because it\n> triggers lots of fairly small I/O operations.\n> \n> On tests with rotating rust, and cache=none|directsync,\n> write speed increased from 2MiB/s to 32MiB/s, on a par\n> with that achieved by the in-kernel luks driver. With\n> other cache modes the in-kernel driver is still notably\n> faster because it is able to report completion of the\n> I/O request before any encryption is done, while the\n> in-QEMU driver must encrypt the data before completion.\n> \n> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>\n> ---\n>  block/crypto.c | 28 +++++++++++++++-------------\n>  1 file changed, 15 insertions(+), 13 deletions(-)\n\nReviewed-by: Eric Blake <eblake@redhat.com>\n\n\n> @@ -464,12 +467,11 @@ block_crypto_co_writev(BlockDriverState *bs, int64_t sector_num,\n>  \n>      qemu_iovec_init(&hd_qiov, qiov->niov);\n>  \n> -    /* Bounce buffer so we have a linear mem region for\n> -     * entire sector. XXX optimize so we avoid bounce\n> -     * buffer in case that qiov->niov == 1\n> +    /* Bounce buffer because we're not permitted to touch\n> +     * contents of qiov - it points to guest memory.\n>       */\n>      cipher_data =\n> -        qemu_try_blockalign(bs->file->bs, MIN(BLOCK_CRYPTO_MAX_SECTORS * 512,\n> +        qemu_try_blockalign(bs->file->bs, MIN(BLOCK_CRYPTO_MAX_IO_SIZE,\n>                                                qiov->size));\n\nWe allocate and free a bounce buffer for every write - is there anything\nwe can do to reduce malloc() calls by reusing a bounce buffer associated\nwith a coroutine (we have to be careful that parallel coroutines don't\nshare bounce buffers, of course).  But that's independent of this patch.\n\nReviewed-by: Eric Blake <eblake@redhat.com>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx06.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=eblake@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y2JYR5t39z9tXw\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 27 Sep 2017 23:28:27 +1000 (AEST)","from localhost ([::1]:54841 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dxCO1-0003iL-Vw\n\tfor incoming@patchwork.ozlabs.org; Wed, 27 Sep 2017 09:28:26 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:58939)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dxCNh-0003gn-HU\n\tfor qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:28:06 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <eblake@redhat.com>) id 1dxCNg-000343-IP\n\tfor qemu-devel@nongnu.org; Wed, 27 Sep 2017 09:28:05 -0400","from mx1.redhat.com ([209.132.183.28]:53220)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <eblake@redhat.com>)\n\tid 1dxCNb-00031p-R1; Wed, 27 Sep 2017 09:28:00 -0400","from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id CC5E8C6544;\n\tWed, 27 Sep 2017 13:27:58 +0000 (UTC)","from [10.10.124.97] (ovpn-124-97.rdu2.redhat.com [10.10.124.97])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id BD8CE7F652;\n\tWed, 27 Sep 2017 13:27:57 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com CC5E8C6544","To":"\"Daniel P. Berrange\" <berrange@redhat.com>, qemu-devel@nongnu.org","References":"<20170927125340.12360-1-berrange@redhat.com>\n\t<20170927125340.12360-2-berrange@redhat.com>","From":"Eric Blake <eblake@redhat.com>","Openpgp":"url=http://people.redhat.com/eblake/eblake.gpg","Organization":"Red Hat, Inc.","Message-ID":"<a4fbc91e-8d9e-bb6c-758f-672b0a943bcd@redhat.com>","Date":"Wed, 27 Sep 2017 08:27:56 -0500","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170927125340.12360-2-berrange@redhat.com>","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"EHjpgKl9grtNcdNgTTGlOd3iKG1oQjQLt\"","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.16","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.30]);\n\tWed, 27 Sep 2017 13:27:58 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [PATCH v4 1/6] block: use 1 MB bounce buffers for\n\tcrypto instead of 16KB","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@gmail.com>,\n\tqemu-block@nongnu.org, Max Reitz <mreitz@redhat.com>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}},{"id":1776602,"web_url":"http://patchwork.ozlabs.org/comment/1776602/","msgid":"<80c29ed7-ca42-d5aa-3af0-ee6461277dcb@redhat.com>","list_archive_url":null,"date":"2017-09-27T20:39:36","subject":"Re: [Qemu-devel] [PATCH v4 1/6] block: use 1 MB bounce buffers for\n\tcrypto instead of 16KB","submitter":{"id":36836,"url":"http://patchwork.ozlabs.org/api/people/36836/","name":"Max Reitz","email":"mreitz@redhat.com"},"content":"On 2017-09-27 14:53, Daniel P. Berrange wrote:\n> Using 16KB bounce buffers creates a significant performance\n> penalty for I/O to encrypted volumes on storage which high\n> I/O latency (rotating rust & network drives), because it\n> triggers lots of fairly small I/O operations.\n> \n> On tests with rotating rust, and cache=none|directsync,\n> write speed increased from 2MiB/s to 32MiB/s, on a par\n> with that achieved by the in-kernel luks driver. With\n> other cache modes the in-kernel driver is still notably\n> faster because it is able to report completion of the\n> I/O request before any encryption is done, while the\n> in-QEMU driver must encrypt the data before completion.\n> \n> Signed-off-by: Daniel P. Berrange <berrange@redhat.com>\n> ---\n>  block/crypto.c | 28 +++++++++++++++-------------\n>  1 file changed, 15 insertions(+), 13 deletions(-)\n\nReviewed-by: Max Reitz <mreitz@redhat.com>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@bilbo.ozlabs.org","Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx02.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=mreitz@redhat.com"],"Received":["from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y2V7j2W3pz9t66\n\tfor <incoming@patchwork.ozlabs.org>;\n\tThu, 28 Sep 2017 06:40:17 +1000 (AEST)","from localhost ([::1]:56263 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dxJ7v-0008Pn-GC\n\tfor incoming@patchwork.ozlabs.org; Wed, 27 Sep 2017 16:40:15 -0400","from eggs.gnu.org ([2001:4830:134:3::10]:59270)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <mreitz@redhat.com>) id 1dxJ7W-0008Mx-4a\n\tfor qemu-devel@nongnu.org; Wed, 27 Sep 2017 16:39:51 -0400","from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <mreitz@redhat.com>) id 1dxJ7V-0002e0-EK\n\tfor qemu-devel@nongnu.org; Wed, 27 Sep 2017 16:39:50 -0400","from mx1.redhat.com ([209.132.183.28]:33660)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <mreitz@redhat.com>)\n\tid 1dxJ7Q-0002Wr-7p; Wed, 27 Sep 2017 16:39:44 -0400","from smtp.corp.redhat.com\n\t(int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 0830D1CCC37;\n\tWed, 27 Sep 2017 20:39:40 +0000 (UTC)","from dresden.str.redhat.com (unknown [10.40.205.58])\n\tby smtp.corp.redhat.com (Postfix) with ESMTPS id 72DFA89F14;\n\tWed, 27 Sep 2017 20:39:38 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 0830D1CCC37","To":"\"Daniel P. Berrange\" <berrange@redhat.com>, qemu-devel@nongnu.org","References":"<20170927125340.12360-1-berrange@redhat.com>\n\t<20170927125340.12360-2-berrange@redhat.com>","From":"Max Reitz <mreitz@redhat.com>","Message-ID":"<80c29ed7-ca42-d5aa-3af0-ee6461277dcb@redhat.com>","Date":"Wed, 27 Sep 2017 22:39:36 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170927125340.12360-2-berrange@redhat.com>","Content-Type":"multipart/signed; micalg=pgp-sha256;\n\tprotocol=\"application/pgp-signature\";\n\tboundary=\"hpHAsQbqQFReutAs1EeBd9JM9ISW0H0Xd\"","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.11","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.26]);\n\tWed, 27 Sep 2017 20:39:40 +0000 (UTC)","X-detected-operating-system":"by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]","X-Received-From":"209.132.183.28","X-Content-Filtered-By":"Mailman/MimeDel 2.1.21","Subject":"Re: [Qemu-devel] [PATCH v4 1/6] block: use 1 MB bounce buffers for\n\tcrypto instead of 16KB","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.21","Precedence":"list","List-Id":"<qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<http://lists.nongnu.org/archive/html/qemu-devel/>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Cc":"Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@gmail.com>,\n\tqemu-block@nongnu.org","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>"}}]