All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"open list:BPF JIT for MIPS (32-BIT AND 64-BIT)" 
	<netdev@vger.kernel.org>, "# 3.4.x" <stable@vger.kernel.org>,
	X86 ML <x86@kernel.org>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>
Subject: Re: [PATCH crypto] x86/aesni: don't require alignment of data
Date: Tue, 21 Dec 2021 17:14:27 +0100	[thread overview]
Message-ID: <CAMj1kXHvLyUQdM9U4hkHdBoLHFJJn19-iESRXV6XZv87=F1x8g@mail.gmail.com> (raw)
In-Reply-To: <20211221150611.3692437-1-kuba@kernel.org>

On Tue, 21 Dec 2021 at 16:06, Jakub Kicinski <kuba@kernel.org> wrote:
>
> x86 AES-NI routines can deal with unaligned data. Crypto context
> (key, iv etc.) have to be aligned but we take care of that separately
> by copying it onto the stack. We were feeding unaligned data into
> crypto routines up until commit 83c83e658863 ("crypto: aesni -
> refactor scatterlist processing") switched to use the full
> skcipher API which uses cra_alignmask to decide data alignment.
>
> This fixes 21% performance regression in kTLS.
>
> Tested by booting with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y
> (and running thru various kTLS packets).
>
> CC: stable@vger.kernel.org # 5.15+
> Fixes: 83c83e658863 ("crypto: aesni - refactor scatterlist processing")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Acked-by: Ard Biesheuvel <ardb@kernel.org>

> ---
> CC: herbert@gondor.apana.org.au
> CC: x86@kernel.org
> CC: ardb@kernel.org
> CC: linux-crypto@vger.kernel.org
> ---
>  arch/x86/crypto/aesni-intel_glue.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
> index e09f4672dd38..41901ba9d3a2 100644
> --- a/arch/x86/crypto/aesni-intel_glue.c
> +++ b/arch/x86/crypto/aesni-intel_glue.c
> @@ -1107,7 +1107,7 @@ static struct aead_alg aesni_aeads[] = { {
>                 .cra_flags              = CRYPTO_ALG_INTERNAL,
>                 .cra_blocksize          = 1,
>                 .cra_ctxsize            = sizeof(struct aesni_rfc4106_gcm_ctx),
> -               .cra_alignmask          = AESNI_ALIGN - 1,
> +               .cra_alignmask          = 0,
>                 .cra_module             = THIS_MODULE,
>         },
>  }, {
> @@ -1124,7 +1124,7 @@ static struct aead_alg aesni_aeads[] = { {
>                 .cra_flags              = CRYPTO_ALG_INTERNAL,
>                 .cra_blocksize          = 1,
>                 .cra_ctxsize            = sizeof(struct generic_gcmaes_ctx),
> -               .cra_alignmask          = AESNI_ALIGN - 1,
> +               .cra_alignmask          = 0,
>                 .cra_module             = THIS_MODULE,
>         },
>  } };
> --
> 2.31.1
>

  reply	other threads:[~2021-12-21 16:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21 15:06 [PATCH crypto] x86/aesni: don't require alignment of data Jakub Kicinski
2021-12-21 16:14 ` Ard Biesheuvel [this message]
2021-12-31 11:34 ` 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='CAMj1kXHvLyUQdM9U4hkHdBoLHFJJn19-iESRXV6XZv87=F1x8g@mail.gmail.com' \
    --to=ardb@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=kuba@kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=x86@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 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.