From: ard.biesheuvel@linaro.org (Ard Biesheuvel)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH resend 10/10] crypto: arm64/sha512-ce - yield NEON after every block of input
Date: Mon, 30 Apr 2018 18:18:30 +0200 [thread overview]
Message-ID: <20180430161830.14892-11-ard.biesheuvel@linaro.org> (raw)
In-Reply-To: <20180430161830.14892-1-ard.biesheuvel@linaro.org>
Avoid excessive scheduling delays under a preemptible kernel by
conditionally yielding the NEON after every block of input.
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
---
arch/arm64/crypto/sha512-ce-core.S | 27 +++++++++++++++-----
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/arch/arm64/crypto/sha512-ce-core.S b/arch/arm64/crypto/sha512-ce-core.S
index 7f3bca5c59a2..ce65e3abe4f2 100644
--- a/arch/arm64/crypto/sha512-ce-core.S
+++ b/arch/arm64/crypto/sha512-ce-core.S
@@ -107,17 +107,23 @@
*/
.text
ENTRY(sha512_ce_transform)
+ frame_push 3
+
+ mov x19, x0
+ mov x20, x1
+ mov x21, x2
+
/* load state */
- ld1 {v8.2d-v11.2d}, [x0]
+0: ld1 {v8.2d-v11.2d}, [x19]
/* load first 4 round constants */
adr_l x3, .Lsha512_rcon
ld1 {v20.2d-v23.2d}, [x3], #64
/* load input */
-0: ld1 {v12.2d-v15.2d}, [x1], #64
- ld1 {v16.2d-v19.2d}, [x1], #64
- sub w2, w2, #1
+1: ld1 {v12.2d-v15.2d}, [x20], #64
+ ld1 {v16.2d-v19.2d}, [x20], #64
+ sub w21, w21, #1
CPU_LE( rev64 v12.16b, v12.16b )
CPU_LE( rev64 v13.16b, v13.16b )
@@ -196,9 +202,18 @@ CPU_LE( rev64 v19.16b, v19.16b )
add v11.2d, v11.2d, v3.2d
/* handled all input blocks? */
- cbnz w2, 0b
+ cbz w21, 3f
+
+ if_will_cond_yield_neon
+ st1 {v8.2d-v11.2d}, [x19]
+ do_cond_yield_neon
+ b 0b
+ endif_yield_neon
+
+ b 1b
/* store new state */
-3: st1 {v8.2d-v11.2d}, [x0]
+3: st1 {v8.2d-v11.2d}, [x19]
+ frame_pop
ret
ENDPROC(sha512_ce_transform)
--
2.17.0
next prev parent reply other threads:[~2018-04-30 16:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-30 16:18 [PATCH resend 00/10] crypto: arm64 - play nice with CONFIG_PREEMPT Ard Biesheuvel
2018-04-30 16:18 ` [PATCH resend 01/10] crypto: arm64/sha1-ce - yield NEON after every block of input Ard Biesheuvel
2018-04-30 16:18 ` [PATCH resend 02/10] crypto: arm64/sha2-ce " Ard Biesheuvel
2018-04-30 16:18 ` [PATCH resend 03/10] crypto: arm64/aes-ccm " Ard Biesheuvel
2018-04-30 16:18 ` [PATCH resend 04/10] crypto: arm64/aes-blk " Ard Biesheuvel
2018-04-30 16:18 ` [PATCH resend 05/10] crypto: arm64/aes-bs " Ard Biesheuvel
2018-04-30 16:18 ` [PATCH resend 06/10] crypto: arm64/aes-ghash " Ard Biesheuvel
2018-04-30 16:18 ` [PATCH resend 07/10] crypto: arm64/crc32-ce " Ard Biesheuvel
2018-04-30 16:18 ` [PATCH resend 08/10] crypto: arm64/crct10dif-ce " Ard Biesheuvel
2018-04-30 16:18 ` [PATCH resend 09/10] crypto: arm64/sha3-ce " Ard Biesheuvel
2018-04-30 16:18 ` Ard Biesheuvel [this message]
2018-05-11 16:18 ` [PATCH resend 00/10] crypto: arm64 - play nice with CONFIG_PREEMPT 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=20180430161830.14892-11-ard.biesheuvel@linaro.org \
--to=ard.biesheuvel@linaro.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).