linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: ebiggers@kernel.org (Eric Biggers)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 06/14] crypto: arm/chacha20 - limit the preemption-disabled section
Date: Fri, 16 Nov 2018 17:26:23 -0800	[thread overview]
Message-ID: <20181117012631.23528-7-ebiggers@kernel.org> (raw)
In-Reply-To: <20181117012631.23528-1-ebiggers@kernel.org>

From: Eric Biggers <ebiggers@google.com>

To improve responsivesess, disable preemption for each step of the walk
(which is at most PAGE_SIZE) rather than for the entire
encryption/decryption operation.

Suggested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 arch/arm/crypto/chacha20-neon-glue.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/crypto/chacha20-neon-glue.c b/arch/arm/crypto/chacha20-neon-glue.c
index 7386eb1c1889..2bc035cb8f23 100644
--- a/arch/arm/crypto/chacha20-neon-glue.c
+++ b/arch/arm/crypto/chacha20-neon-glue.c
@@ -68,22 +68,22 @@ static int chacha20_neon(struct skcipher_request *req)
 	if (req->cryptlen <= CHACHA_BLOCK_SIZE || !may_use_simd())
 		return crypto_chacha_crypt(req);
 
-	err = skcipher_walk_virt(&walk, req, true);
+	err = skcipher_walk_virt(&walk, req, false);
 
 	crypto_chacha_init(state, ctx, walk.iv);
 
-	kernel_neon_begin();
 	while (walk.nbytes > 0) {
 		unsigned int nbytes = walk.nbytes;
 
 		if (nbytes < walk.total)
 			nbytes = round_down(nbytes, walk.stride);
 
+		kernel_neon_begin();
 		chacha20_doneon(state, walk.dst.virt.addr, walk.src.virt.addr,
 				nbytes);
+		kernel_neon_end();
 		err = skcipher_walk_done(&walk, walk.nbytes - nbytes);
 	}
-	kernel_neon_end();
 
 	return err;
 }
-- 
2.19.1.1215.g8438c0b245-goog

  parent reply	other threads:[~2018-11-17  1:26 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-17  1:26 [PATCH v4 00/14] crypto: Adiantum support Eric Biggers
2018-11-17  1:26 ` [PATCH v4 01/14] crypto: chacha20-generic - add HChaCha20 library function Eric Biggers
2018-11-17  1:26 ` [PATCH v4 02/14] crypto: chacha20-generic - don't unnecessarily use atomic walk Eric Biggers
2018-11-17  1:26 ` [PATCH v4 03/14] crypto: chacha20-generic - add XChaCha20 support Eric Biggers
2018-11-17  1:26 ` [PATCH v4 04/14] crypto: chacha20-generic - refactor to allow varying number of rounds Eric Biggers
2018-11-17  1:26 ` [PATCH v4 05/14] crypto: chacha - add XChaCha12 support Eric Biggers
2018-11-17  1:26 ` Eric Biggers [this message]
2018-11-17  1:26 ` [PATCH v4 07/14] crypto: arm/chacha20 - add XChaCha20 support Eric Biggers
2018-11-17  1:26 ` [PATCH v4 08/14] crypto: arm/chacha20 - refactor to allow varying number of rounds Eric Biggers
2018-11-17  1:26 ` [PATCH v4 09/14] crypto: arm/chacha - add XChaCha12 support Eric Biggers
2018-11-17  1:26 ` [PATCH v4 10/14] crypto: poly1305 - use structures for key and accumulator Eric Biggers
2018-11-17  1:43   ` Ard Biesheuvel
2018-11-17  1:26 ` [PATCH v4 11/14] crypto: poly1305 - add Poly1305 core API Eric Biggers
2018-11-17  1:50   ` Ard Biesheuvel
2018-11-17  1:26 ` [PATCH v4 12/14] crypto: nhpoly1305 - add NHPoly1305 support Eric Biggers
2018-11-17  1:52   ` Ard Biesheuvel
2018-11-17  1:26 ` [PATCH v4 13/14] crypto: arm/nhpoly1305 - add NEON-accelerated NHPoly1305 Eric Biggers
2018-11-17  2:00   ` Ard Biesheuvel
2018-11-17  1:26 ` [PATCH v4 14/14] crypto: adiantum - add Adiantum support Eric Biggers
2018-11-17  2:03   ` Ard Biesheuvel
2018-11-20  6:33 ` [PATCH v4 00/14] crypto: " Herbert Xu
2018-11-30 17:58 ` Eric Biggers

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=20181117012631.23528-7-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.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).