From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Cc: qemu-devel@nongnu.org, qemu-block@nongnu.org, mreitz@redhat.com,
kwolf@redhat.com, berto@igalia.com, den@openvz.org
Subject: Re: [Qemu-devel] [PATCH 07/11] qcow2-threads: add encryption
Date: Tue, 27 Nov 2018 16:21:37 +0000 [thread overview]
Message-ID: <20181127162137.GL18381@redhat.com> (raw)
In-Reply-To: <20181123165511.416480-8-vsementsov@virtuozzo.com>
On Fri, Nov 23, 2018 at 07:55:07PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> Add thread-based encrypt/decrypt. QCrypto don't support parallel
> operations with one block, so we need QCryptoBlock for each thread.
> +static int qcow2_crypto_blocks_open(BDRVQcow2State *s,
> + const char *optprefix,
> + QCryptoBlockReadFunc readfunc,
> + void *opaque,
> + unsigned int flags,
> + Error **errp)
> +{
> + int i;
> +
> + s->crypto = qcrypto_block_open(s->crypto_opts, optprefix,
> + readfunc, opaque, flags, errp);
> + if (!s->crypto) {
> + qcrypto_block_free(s->crypto);
> + return -EINVAL;
> + }
> +
> + for (i = 0; i < QCOW2_MAX_THREADS; i++) {
> + s->threads.per_thread[i].crypto =
> + qcrypto_block_open(s->crypto_opts, optprefix,
> + readfunc, opaque, flags, errp);
We really don't want to be doing this. LUKS has an intentional time
penalty for opening devices. Each time you open a disk, we expect to
burn 1-2 seconds in CPU time. So this is multiplying that burn by
QCOW2_MAX_THREADS.
What we need todo is modify QCryptoBlock so that it can (optionally)
create many QCryptoCipher instances, allowing each thread to have its
own instance. We'll also need locking around the iv generator calls.
> + if (!s->threads.per_thread[i].crypto) {
> + qcow2_crypto_blocks_free(s);
> + return -EINVAL;
> + }
> + }
> +
> + return 0;
> +}
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
next prev parent reply other threads:[~2018-11-27 16:21 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-23 16:55 [Qemu-devel] [PATCH 00/11] qcow2: encryption threads Vladimir Sementsov-Ogievskiy
2018-11-23 16:55 ` [Qemu-devel] [PATCH 01/11] qcow2.h: add missing include Vladimir Sementsov-Ogievskiy
2018-11-23 16:55 ` [Qemu-devel] [PATCH 02/11] qcow2: add separate file for threaded data processing functions Vladimir Sementsov-Ogievskiy
2018-11-23 16:55 ` [Qemu-devel] [PATCH 03/11] qcow2-threads: use thread_pool_submit_co Vladimir Sementsov-Ogievskiy
2018-11-23 16:55 ` [Qemu-devel] [PATCH 04/11] qcow2: split out data processing threads state from BDRVQcow2State Vladimir Sementsov-Ogievskiy
2018-11-23 16:55 ` [Qemu-devel] [PATCH 05/11] qcow2-threads: split out generic path Vladimir Sementsov-Ogievskiy
2018-11-23 16:55 ` [Qemu-devel] [PATCH 06/11] qcow2-threads: add per-thread data Vladimir Sementsov-Ogievskiy
2018-11-23 16:55 ` [Qemu-devel] [PATCH 07/11] qcow2-threads: add encryption Vladimir Sementsov-Ogievskiy
2018-11-27 16:21 ` Daniel P. Berrangé [this message]
2018-11-23 16:55 ` [Qemu-devel] [PATCH 08/11] qcow2: bdrv_co_preadv: improve locking Vladimir Sementsov-Ogievskiy
2018-11-23 16:55 ` [Qemu-devel] [PATCH 09/11] qcow2: qcow2_co_preadv: skip using hd_qiov when possible Vladimir Sementsov-Ogievskiy
2018-11-23 16:55 ` [Qemu-devel] [PATCH 10/11] qcow2: bdrv_co_pwritev: move encryption code out of the lock Vladimir Sementsov-Ogievskiy
2018-11-23 16:55 ` [Qemu-devel] [PATCH 11/11] qcow2: do encryption in threads Vladimir Sementsov-Ogievskiy
2018-11-27 16:23 ` [Qemu-devel] [PATCH 00/11] qcow2: encryption threads Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181127162137.GL18381@redhat.com \
--to=berrange@redhat.com \
--cc=berto@igalia.com \
--cc=den@openvz.org \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.