* [PATCH] dm crypt: log the encryption algorithm implementation
@ 2018-12-06 4:53 Eric Biggers
2018-12-06 7:28 ` Ard Biesheuvel
0 siblings, 1 reply; 3+ messages in thread
From: Eric Biggers @ 2018-12-06 4:53 UTC (permalink / raw)
To: dm-devel, Alasdair Kergon, Mike Snitzer; +Cc: linux-crypto
From: Eric Biggers <ebiggers@google.com>
Log the encryption algorithm's driver name when a dm-crypt target is
created. This will help people determine whether the expected
implementation is being used. In some cases we've seen people do
benchmarks and reject using encryption for performance reasons, when in
fact they used a much slower implementation than was possible on the
hardware. It can make an enormous difference; e.g., AES-XTS on ARM can
be over 10x faster with the crypto extensions than without. It can also
be useful to know if an implementation using an external crypto
accelerator is being used instead of a software implementation.
Example message:
[ 29.307629] device-mapper: crypt: xts(aes) using implementation "xts-aes-ce"
We've already found the similar message in fs/crypto/keyinfo.c to be
very useful.
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
drivers/md/dm-crypt.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
index b8eec515a003..7646135487be 100644
--- a/drivers/md/dm-crypt.c
+++ b/drivers/md/dm-crypt.c
@@ -1885,6 +1885,13 @@ static int crypt_alloc_tfms_skcipher(struct crypt_config *cc, char *ciphermode)
}
}
+ /*
+ * dm-crypt performance can vary greatly depending on which crypto
+ * algorithm implementation is used. Help people debug performance
+ * problems by logging the ->cra_driver_name.
+ */
+ DMINFO("%s using implementation \"%s\"", ciphermode,
+ crypto_skcipher_alg(any_tfm(cc))->base.cra_driver_name);
return 0;
}
@@ -1903,6 +1910,8 @@ static int crypt_alloc_tfms_aead(struct crypt_config *cc, char *ciphermode)
return err;
}
+ DMINFO("%s using implementation \"%s\"", ciphermode,
+ crypto_aead_alg(any_tfm_aead(cc))->base.cra_driver_name);
return 0;
}
--
2.19.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] dm crypt: log the encryption algorithm implementation
2018-12-06 4:53 [PATCH] dm crypt: log the encryption algorithm implementation Eric Biggers
@ 2018-12-06 7:28 ` Ard Biesheuvel
0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2018-12-06 7:28 UTC (permalink / raw)
To: Eric Biggers
Cc: device-mapper development, Mike Snitzer, Alasdair G. Kergon,
open list:HARDWARE RANDOM NUMBER GENERATOR CORE
On Thu, 6 Dec 2018 at 05:54, Eric Biggers <ebiggers@kernel.org> wrote:
>
> From: Eric Biggers <ebiggers@google.com>
>
> Log the encryption algorithm's driver name when a dm-crypt target is
> created. This will help people determine whether the expected
> implementation is being used. In some cases we've seen people do
> benchmarks and reject using encryption for performance reasons, when in
> fact they used a much slower implementation than was possible on the
> hardware. It can make an enormous difference; e.g., AES-XTS on ARM can
> be over 10x faster with the crypto extensions than without. It can also
> be useful to know if an implementation using an external crypto
> accelerator is being used instead of a software implementation.
>
> Example message:
>
> [ 29.307629] device-mapper: crypt: xts(aes) using implementation "xts-aes-ce"
>
> We've already found the similar message in fs/crypto/keyinfo.c to be
> very useful.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> drivers/md/dm-crypt.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
> index b8eec515a003..7646135487be 100644
> --- a/drivers/md/dm-crypt.c
> +++ b/drivers/md/dm-crypt.c
> @@ -1885,6 +1885,13 @@ static int crypt_alloc_tfms_skcipher(struct crypt_config *cc, char *ciphermode)
> }
> }
>
> + /*
> + * dm-crypt performance can vary greatly depending on which crypto
> + * algorithm implementation is used. Help people debug performance
> + * problems by logging the ->cra_driver_name.
> + */
> + DMINFO("%s using implementation \"%s\"", ciphermode,
> + crypto_skcipher_alg(any_tfm(cc))->base.cra_driver_name);
> return 0;
> }
>
> @@ -1903,6 +1910,8 @@ static int crypt_alloc_tfms_aead(struct crypt_config *cc, char *ciphermode)
> return err;
> }
>
> + DMINFO("%s using implementation \"%s\"", ciphermode,
> + crypto_aead_alg(any_tfm_aead(cc))->base.cra_driver_name);
> return 0;
> }
>
> --
> 2.19.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dm crypt: log the encryption algorithm implementation
@ 2018-12-06 7:28 ` Ard Biesheuvel
0 siblings, 0 replies; 3+ messages in thread
From: Ard Biesheuvel @ 2018-12-06 7:28 UTC (permalink / raw)
To: Eric Biggers
Cc: device-mapper development, Alasdair G. Kergon, Mike Snitzer,
open list:HARDWARE RANDOM NUMBER GENERATOR CORE
On Thu, 6 Dec 2018 at 05:54, Eric Biggers <ebiggers@kernel.org> wrote:
>
> From: Eric Biggers <ebiggers@google.com>
>
> Log the encryption algorithm's driver name when a dm-crypt target is
> created. This will help people determine whether the expected
> implementation is being used. In some cases we've seen people do
> benchmarks and reject using encryption for performance reasons, when in
> fact they used a much slower implementation than was possible on the
> hardware. It can make an enormous difference; e.g., AES-XTS on ARM can
> be over 10x faster with the crypto extensions than without. It can also
> be useful to know if an implementation using an external crypto
> accelerator is being used instead of a software implementation.
>
> Example message:
>
> [ 29.307629] device-mapper: crypt: xts(aes) using implementation "xts-aes-ce"
>
> We've already found the similar message in fs/crypto/keyinfo.c to be
> very useful.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> ---
> drivers/md/dm-crypt.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/md/dm-crypt.c b/drivers/md/dm-crypt.c
> index b8eec515a003..7646135487be 100644
> --- a/drivers/md/dm-crypt.c
> +++ b/drivers/md/dm-crypt.c
> @@ -1885,6 +1885,13 @@ static int crypt_alloc_tfms_skcipher(struct crypt_config *cc, char *ciphermode)
> }
> }
>
> + /*
> + * dm-crypt performance can vary greatly depending on which crypto
> + * algorithm implementation is used. Help people debug performance
> + * problems by logging the ->cra_driver_name.
> + */
> + DMINFO("%s using implementation \"%s\"", ciphermode,
> + crypto_skcipher_alg(any_tfm(cc))->base.cra_driver_name);
> return 0;
> }
>
> @@ -1903,6 +1910,8 @@ static int crypt_alloc_tfms_aead(struct crypt_config *cc, char *ciphermode)
> return err;
> }
>
> + DMINFO("%s using implementation \"%s\"", ciphermode,
> + crypto_aead_alg(any_tfm_aead(cc))->base.cra_driver_name);
> return 0;
> }
>
> --
> 2.19.2
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-06 7:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-06 4:53 [PATCH] dm crypt: log the encryption algorithm implementation Eric Biggers
2018-12-06 7:28 ` Ard Biesheuvel
2018-12-06 7:28 ` Ard Biesheuvel
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.