public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Cc: herbert@gondor.apana.org.au, linux-crypto@vger.kernel.org,
	qat-linux@intel.com, stable@vger.kernel.org
Subject: Re: [PATCH] crypto: qat - lower priority for skcipher and aead algorithms
Date: Fri, 13 Jun 2025 12:28:06 -0700	[thread overview]
Message-ID: <20250613192806.GE1284@sol> (raw)
In-Reply-To: <20250613190150.GD1284@sol>

On Fri, Jun 13, 2025 at 12:01:50PM -0700, Eric Biggers wrote:
> On Fri, Jun 13, 2025 at 11:32:27AM +0100, Giovanni Cabiddu wrote:
> > Most kernel applications utilizing the crypto API operate synchronously
> > and on small buffer sizes, therefore do not benefit from QAT acceleration.
> > 
> > Reduce the priority of QAT implementations for both skcipher and aead
> > algorithms, allowing more suitable alternatives to be selected by default.
> > 
> > Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
> > Link: https://lore.kernel.org/all/20250613012357.GA3603104@google.com/
> > Cc: stable@vger.kernel.org
> > ---
> >  drivers/crypto/intel/qat/qat_common/qat_algs.c | 12 ++++++------
> >  1 file changed, 6 insertions(+), 6 deletions(-)
> > 
> > diff --git a/drivers/crypto/intel/qat/qat_common/qat_algs.c b/drivers/crypto/intel/qat/qat_common/qat_algs.c
> > index 3c4bba4a8779..d69cc1e5e023 100644
> > --- a/drivers/crypto/intel/qat/qat_common/qat_algs.c
> > +++ b/drivers/crypto/intel/qat/qat_common/qat_algs.c
> > @@ -1277,7 +1277,7 @@ static struct aead_alg qat_aeads[] = { {
> >  	.base = {
> >  		.cra_name = "authenc(hmac(sha1),cbc(aes))",
> >  		.cra_driver_name = "qat_aes_cbc_hmac_sha1",
> > -		.cra_priority = 4001,
> > +		.cra_priority = 100,
> >  		.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_ALLOCATES_MEMORY,
> >  		.cra_blocksize = AES_BLOCK_SIZE,
> >  		.cra_ctxsize = sizeof(struct qat_alg_aead_ctx),
> > @@ -1294,7 +1294,7 @@ static struct aead_alg qat_aeads[] = { {
> >  	.base = {
> >  		.cra_name = "authenc(hmac(sha256),cbc(aes))",
> >  		.cra_driver_name = "qat_aes_cbc_hmac_sha256",
> > -		.cra_priority = 4001,
> > +		.cra_priority = 100,
> >  		.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_ALLOCATES_MEMORY,
> >  		.cra_blocksize = AES_BLOCK_SIZE,
> >  		.cra_ctxsize = sizeof(struct qat_alg_aead_ctx),
> > @@ -1311,7 +1311,7 @@ static struct aead_alg qat_aeads[] = { {
> >  	.base = {
> >  		.cra_name = "authenc(hmac(sha512),cbc(aes))",
> >  		.cra_driver_name = "qat_aes_cbc_hmac_sha512",
> > -		.cra_priority = 4001,
> > +		.cra_priority = 100,
> >  		.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_ALLOCATES_MEMORY,
> >  		.cra_blocksize = AES_BLOCK_SIZE,
> >  		.cra_ctxsize = sizeof(struct qat_alg_aead_ctx),
> > @@ -1329,7 +1329,7 @@ static struct aead_alg qat_aeads[] = { {
> >  static struct skcipher_alg qat_skciphers[] = { {
> >  	.base.cra_name = "cbc(aes)",
> >  	.base.cra_driver_name = "qat_aes_cbc",
> > -	.base.cra_priority = 4001,
> > +	.base.cra_priority = 100,
> >  	.base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_ALLOCATES_MEMORY,
> >  	.base.cra_blocksize = AES_BLOCK_SIZE,
> >  	.base.cra_ctxsize = sizeof(struct qat_alg_skcipher_ctx),
> > @@ -1347,7 +1347,7 @@ static struct skcipher_alg qat_skciphers[] = { {
> >  }, {
> >  	.base.cra_name = "ctr(aes)",
> >  	.base.cra_driver_name = "qat_aes_ctr",
> > -	.base.cra_priority = 4001,
> > +	.base.cra_priority = 100,
> >  	.base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_ALLOCATES_MEMORY,
> >  	.base.cra_blocksize = 1,
> >  	.base.cra_ctxsize = sizeof(struct qat_alg_skcipher_ctx),
> > @@ -1365,7 +1365,7 @@ static struct skcipher_alg qat_skciphers[] = { {
> >  }, {
> >  	.base.cra_name = "xts(aes)",
> >  	.base.cra_driver_name = "qat_aes_xts",
> > -	.base.cra_priority = 4001,
> > +	.base.cra_priority = 100,
> >  	.base.cra_flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK |
> >  			  CRYPTO_ALG_ALLOCATES_MEMORY,
> >  	.base.cra_blocksize = AES_BLOCK_SIZE,
> > -- 
> > 2.49.0
> > 
> 
> Acked-by: Eric Biggers <ebiggers@kernel.org>
> 
> But, I think your commit message may be misleading:
> 
> > Most kernel applications utilizing the crypto API operate synchronously
> > and on small buffer sizes, therefore do not benefit from QAT acceleration.
> 
> That implies that QAT acceleration *would* be beneficial for kernel applications
> using asynchronous processing, large buffer sizes, or both.
> 
> But as far as I know, that hasn't been shown to be true either.  Those things
> would likely make the performance characteristics of the QAT driver less bad,
> but that doesn't necessarily mean it would become better than VAES.  VAES is
> already incredibly fast, and far easier to use.

Also, it seems that you're considering 4096 bytes to be a "small" buffer size,
which is kind of misleading too.  In dm-crypt for example 4096-byte sectors (the
recommended setting these days) are considered "large sectors", differentiating
them from the traditional 512-byte sectors.

- Eric

  reply	other threads:[~2025-06-13 19:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-13 10:32 [PATCH] crypto: qat - lower priority for skcipher and aead algorithms Giovanni Cabiddu
2025-06-13 19:01 ` Eric Biggers
2025-06-13 19:28   ` Eric Biggers [this message]
2025-06-16  4:18 ` Herbert Xu
2025-06-16 15:02   ` Giovanni Cabiddu
2025-06-16 16:47     ` Eric Biggers
2025-06-16 16:54       ` Eric Biggers
2025-06-16 21:25       ` Eric Biggers
2025-06-17  4:57     ` Herbert Xu
2025-06-19 20:21       ` Giovanni Cabiddu
2025-06-23  9:20 ` Herbert Xu

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=20250613192806.GE1284@sol \
    --to=ebiggers@kernel.org \
    --cc=giovanni.cabiddu@intel.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=qat-linux@intel.com \
    --cc=stable@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox