linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: linux-crypto@vger.kernel.org
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	Ben Greear <greearb@candelatech.com>,
	Ard Biesheuvel <ardb@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Eric Biggers <ebiggers@google.com>
Subject: [RFC PATCH 0/3] crypto: ARM - run kernel mode NEON with softirqs disabled
Date: Thu, 10 Dec 2020 19:11:55 +0100	[thread overview]
Message-ID: <20201210181158.28960-1-ardb@kernel.org> (raw)

This series is presented in response to the discussion [0] that has been going
on on the linux-crypto list regarding the use of SIMD in synchronous skciphers
and AEADs, which is problematic if such transforms may be used in softirq
context while the SIMD unit is already being used by the kernel in process
context as well.

This series proposes a way to work around this restriction. It is mainly
intended to elicit discussion, so it is based on ARM not x86, which is
probably more instructive, given that ARM does not permit SIMD use in
softirq context at all (which is changed by patch #1), and also already
carries some of these fallbacks that we should be able to remove if these
changes work as intended (patches #2 and #3)

The primary assumption here is that use of skciphers and AEADs is currently
only supported in process or softirq context. If this is true, we can avoid
the need for dealing with nested use of the SIMD unit (when softirq uses
the SIMD unit while it is already being used in process context), by
disabling softirq processing entirely when the NEON unit is enabled for
kernel mode use.

If this approach works and turns out to be suitable for x86 as well (which
will require a separate discussion involving the x86 maintainers), we will
probably need to reduce the scope of the kernel_fpu_begin/end blocks to
ensure that softirq processing latency is not affected. Given that x86 has
recently been updated to drastically reduce the overhead of preserving/
restoring the FPU state, this should not adversely affect performance.

[0] https://lore.kernel.org/linux-crypto/20201201194556.5220-1-ardb@kernel.org/

Cc: Eric Biggers <ebiggers@google.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Ben Greear <greearb@candelatech.com>

Ard Biesheuvel (3):
  ARM: vfp: allow kernel mode NEON in softirq context
  crypto: arm/aes-ce - drop non-SIMD fallbacks and SIMD helper
  crypto: arm/aes-neonbs - drop non-SIMD fallbacks and SIMD helper

 arch/arm/crypto/aes-ce-glue.c     |  84 +-------------
 arch/arm/crypto/aes-neonbs-glue.c | 119 ++------------------
 arch/arm/include/asm/simd.h       |  12 ++
 arch/arm/vfp/vfpmodule.c          |  11 +-
 4 files changed, 31 insertions(+), 195 deletions(-)
 create mode 100644 arch/arm/include/asm/simd.h

-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2020-12-10 18:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10 18:11 Ard Biesheuvel [this message]
2020-12-10 18:11 ` [RFC PATCH 1/3] ARM: vfp: allow kernel mode NEON in softirq context Ard Biesheuvel
2020-12-10 18:11 ` [RFC PATCH 2/3] crypto: arm/aes-ce - drop non-SIMD fallbacks and SIMD helper Ard Biesheuvel
2020-12-10 18:11 ` [RFC PATCH 3/3] crypto: arm/aes-neonbs " Ard Biesheuvel

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=20201210181158.28960-1-ardb@kernel.org \
    --to=ardb@kernel.org \
    --cc=ebiggers@google.com \
    --cc=greearb@candelatech.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-crypto@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;
as well as URLs for NNTP newsgroup(s).