mbox series

[0/2] crypto: aesni - fix more FPU handling and indirect call issues

Message ID 20210116164810.21192-1-ardb@kernel.org
Headers show
Series crypto: aesni - fix more FPU handling and indirect call issues | expand

Message

Ard Biesheuvel Jan. 16, 2021, 4:48 p.m. UTC
My recent patches to the AES-NI driver addressed all the instances of
indirect calls occurring in the XTS and GCM drivers, and while at it,
limited the scope of FPU enabled/preemption disabled regions not to
cover the work that goes on inside the skcipher walk API. This gets rid
of scheduling latency spikes for large skcipher/aead inputs, which are
more common these days after the introduction of s/w kTLS.

Let's address the other modes in this driver as well: ECB, CBC and CTR,
all of which currently keep the FPU enabled (and thus preemption disabled)
for the entire skcipher request, which is unnecessary, and potentially
problematic for workloads that are sensitive to scheduling latency.

Let's also switch to a static call for the CTR mode asm helper, which
gets chosen once at driver init time.

Cc: Megha Dey <megha.dey@intel.com>
Cc: Eric Biggers <ebiggers@google.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>

Ard Biesheuvel (2):
  crypto: aesni - replace CTR function pointer with static call
  crypto: aesni - release FPU during skcipher walk API calls

 arch/x86/crypto/aesni-intel_glue.c | 78 +++++++++-----------
 1 file changed, 35 insertions(+), 43 deletions(-)

Comments

Herbert Xu Jan. 22, 2021, 6:21 a.m. UTC | #1
On Sat, Jan 16, 2021 at 05:48:08PM +0100, Ard Biesheuvel wrote:
> My recent patches to the AES-NI driver addressed all the instances of

> indirect calls occurring in the XTS and GCM drivers, and while at it,

> limited the scope of FPU enabled/preemption disabled regions not to

> cover the work that goes on inside the skcipher walk API. This gets rid

> of scheduling latency spikes for large skcipher/aead inputs, which are

> more common these days after the introduction of s/w kTLS.

> 

> Let's address the other modes in this driver as well: ECB, CBC and CTR,

> all of which currently keep the FPU enabled (and thus preemption disabled)

> for the entire skcipher request, which is unnecessary, and potentially

> problematic for workloads that are sensitive to scheduling latency.

> 

> Let's also switch to a static call for the CTR mode asm helper, which

> gets chosen once at driver init time.

> 

> Cc: Megha Dey <megha.dey@intel.com>

> Cc: Eric Biggers <ebiggers@google.com>

> Cc: Herbert Xu <herbert@gondor.apana.org.au>

> 

> Ard Biesheuvel (2):

>   crypto: aesni - replace CTR function pointer with static call

>   crypto: aesni - release FPU during skcipher walk API calls

> 

>  arch/x86/crypto/aesni-intel_glue.c | 78 +++++++++-----------

>  1 file changed, 35 insertions(+), 43 deletions(-)


All applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt