From: "Daniel P. Berrangé" <berrange@redhat.com>
To: tugy@chinatelecom.cn
Cc: eblake@redhat.com, armbru@redhat.com, kwolf@redhat.com,
hreitz@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [PATCH 2/2] qapi/crypto: support enable encryption/decryption in parallel
Date: Fri, 17 Jan 2025 13:04:37 +0000 [thread overview]
Message-ID: <Z4pVZa0qjPQ67Nr1@redhat.com> (raw)
In-Reply-To: <608e6ae38d080acdcd1f28d0700b9e0b919ee2db.1732789721.git.tugy@chinatelecom.cn>
On Thu, Nov 28, 2024 at 06:51:22PM +0800, tugy@chinatelecom.cn wrote:
> From: Guoyi Tu <tugy@chinatelecom.cn>
>
> add encrypt-in-parallel option to enable encryption/decryption
> in parallel
>
> Signed-off-by: Guoyi Tu <tugy@chinatelecom.cn>
> ---
> block/crypto.c | 8 ++++++++
> block/crypto.h | 9 +++++++++
> qapi/block-core.json | 6 +++++-
> qapi/crypto.json | 6 +++++-
> 4 files changed, 27 insertions(+), 2 deletions(-)
>
> diff --git a/block/crypto.c b/block/crypto.c
> index c085f331ce..b02400fb26 100644
> --- a/block/crypto.c
> +++ b/block/crypto.c
> @@ -212,6 +212,7 @@ static QemuOptsList block_crypto_runtime_opts_luks = {
> .head = QTAILQ_HEAD_INITIALIZER(block_crypto_runtime_opts_luks.head),
> .desc = {
> BLOCK_CRYPTO_OPT_DEF_LUKS_KEY_SECRET(""),
> + BLOCK_CRYPTO_OPT_DEF_LUKS_ENCRYPT_IN_PARALLEL(""),
> { /* end of list */ }
> },
> };
> @@ -347,6 +348,13 @@ static int block_crypto_open_generic(QCryptoBlockFormat format,
> }
>
> cryptoopts = qemu_opts_to_qdict(opts, NULL);
> +
> + if (!g_strcmp0(qdict_get_try_str(cryptoopts,
> + BLOCK_CRYPTO_OPT_LUKS_ENCRYPT_IN_PARALLEL), "on") ||
> + qdict_get_try_bool(cryptoopts,
> + BLOCK_CRYPTO_OPT_LUKS_ENCRYPT_IN_PARALLEL, false)) {
> + crypto->encrypt_in_parallel = true;
> + }
> qdict_put_str(cryptoopts, "format", QCryptoBlockFormat_str(format));
>
> open_opts = block_crypto_open_opts_init(cryptoopts, errp);
> diff --git a/block/crypto.h b/block/crypto.h
> index dc3d2d5ed9..6729420941 100644
> --- a/block/crypto.h
> +++ b/block/crypto.h
> @@ -46,6 +46,7 @@
> #define BLOCK_CRYPTO_OPT_LUKS_STATE "state"
> #define BLOCK_CRYPTO_OPT_LUKS_OLD_SECRET "old-secret"
> #define BLOCK_CRYPTO_OPT_LUKS_NEW_SECRET "new-secret"
> +#define BLOCK_CRYPTO_OPT_LUKS_ENCRYPT_IN_PARALLEL "encrypt-in-parallel"
>
>
> #define BLOCK_CRYPTO_OPT_DEF_LUKS_KEY_SECRET(prefix) \
> @@ -130,6 +131,14 @@
> "Empty string to erase", \
> }
>
> +#define BLOCK_CRYPTO_OPT_DEF_LUKS_ENCRYPT_IN_PARALLEL(prefix) \
> + { \
> + .name = prefix BLOCK_CRYPTO_OPT_LUKS_ENCRYPT_IN_PARALLEL, \
> + .type = QEMU_OPT_BOOL, \
> + .help = "perform encryption and decryption through " \
> + "thread pool", \
> + }
> +
> QCryptoBlockCreateOptions *
> block_crypto_create_opts_init(QDict *opts, Error **errp);
>
> diff --git a/qapi/block-core.json b/qapi/block-core.json
> index fd3bcc1c17..1e47b6ea80 100644
> --- a/qapi/block-core.json
> +++ b/qapi/block-core.json
> @@ -3365,12 +3365,16 @@
> #
> # @header: block device holding a detached LUKS header. (since 9.0)
> #
> +# @encrypt-in-parallel: perform encryption and decryption through
> +# thread pool
> +#
> # Since: 2.9
> ##
> { 'struct': 'BlockdevOptionsLUKS',
> 'base': 'BlockdevOptionsGenericFormat',
> 'data': { '*key-secret': 'str',
> - '*header': 'BlockdevRef'} }
> + '*header': 'BlockdevRef',
> + '*encrypt-in-parallel': 'bool'} }
>
> ##
> # @BlockdevOptionsGenericCOWFormat:
> diff --git a/qapi/crypto.json b/qapi/crypto.json
> index c9d967d782..91963c693f 100644
> --- a/qapi/crypto.json
> +++ b/qapi/crypto.json
> @@ -192,10 +192,14 @@
> # decryption key. Mandatory except when probing image for
> # metadata only.
> #
> +# @encrypt-in-parallel: perform encryption and decryption through
> +# thread pool
> +#
> # Since: 2.6
> ##
> { 'struct': 'QCryptoBlockOptionsLUKS',
> - 'data': { '*key-secret': 'str' }}
> + 'data': { '*key-secret': 'str',
> + '*encrypt-in-parallel': 'bool' }}
Perhaps better named as 'use-thread-pool': 'bool', not least because
this applies to decrypt too, not just encrypt .
NB, both the qapi changes need a "(since 10.0.0)" annotation too
With 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:[~2025-01-17 13:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-28 10:51 [PATCH 0/2] support block encryption/decryption in parallel tugy
2024-11-28 10:51 ` [PATCH 1/2] crpyto: support encryt and decrypt parallelly using thread pool tugy
2024-11-28 10:51 ` [PATCH 2/2] qapi/crypto: support enable encryption/decryption in parallel tugy
2025-01-17 13:04 ` Daniel P. Berrangé [this message]
2024-12-13 8:26 ` [PATCH 0/2] support block " Guoyi Tu
2024-12-13 15:56 ` Daniel P. Berrangé
2025-01-16 12:37 ` Kevin Wolf
2025-01-17 12:55 ` Daniel P. Berrangé
2025-01-18 14:39 ` Guoyi Tu
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=Z4pVZa0qjPQ67Nr1@redhat.com \
--to=berrange@redhat.com \
--cc=armbru@redhat.com \
--cc=eblake@redhat.com \
--cc=hreitz@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=tugy@chinatelecom.cn \
/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.