[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [PATCH 07/11] qcow2-threads: add encryption
From: |
Daniel P . Berrangé |
Subject: |
Re: [Qemu-block] [PATCH 07/11] qcow2-threads: add encryption |
Date: |
Tue, 27 Nov 2018 16:21:37 +0000 |
User-agent: |
Mutt/1.10.1 (2018-07-13) |
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 :|
- [Qemu-block] [PATCH 00/11] qcow2: encryption threads, Vladimir Sementsov-Ogievskiy, 2018/11/23
- [Qemu-block] [PATCH 07/11] qcow2-threads: add encryption, Vladimir Sementsov-Ogievskiy, 2018/11/23
- Re: [Qemu-block] [PATCH 07/11] qcow2-threads: add encryption,
Daniel P . Berrangé <=
- [Qemu-block] [PATCH 01/11] qcow2.h: add missing include, Vladimir Sementsov-Ogievskiy, 2018/11/23
- [Qemu-block] [PATCH 05/11] qcow2-threads: split out generic path, Vladimir Sementsov-Ogievskiy, 2018/11/23
- [Qemu-block] [PATCH 08/11] qcow2: bdrv_co_preadv: improve locking, Vladimir Sementsov-Ogievskiy, 2018/11/23
- [Qemu-block] [PATCH 03/11] qcow2-threads: use thread_pool_submit_co, Vladimir Sementsov-Ogievskiy, 2018/11/23
- [Qemu-block] [PATCH 06/11] qcow2-threads: add per-thread data, Vladimir Sementsov-Ogievskiy, 2018/11/23
- [Qemu-block] [PATCH 11/11] qcow2: do encryption in threads, Vladimir Sementsov-Ogievskiy, 2018/11/23
- [Qemu-block] [PATCH 04/11] qcow2: split out data processing threads state from BDRVQcow2State, Vladimir Sementsov-Ogievskiy, 2018/11/23
- [Qemu-block] [PATCH 02/11] qcow2: add separate file for threaded data processing functions, Vladimir Sementsov-Ogievskiy, 2018/11/23
- [Qemu-block] [PATCH 09/11] qcow2: qcow2_co_preadv: skip using hd_qiov when possible, Vladimir Sementsov-Ogievskiy, 2018/11/23
- [Qemu-block] [PATCH 10/11] qcow2: bdrv_co_pwritev: move encryption code out of the lock, Vladimir Sementsov-Ogievskiy, 2018/11/23