From patchwork Sat Mar 10 15:22:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10273687 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 86F7C602BD for ; Sat, 10 Mar 2018 15:36:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 763A928EAB for ; Sat, 10 Mar 2018 15:36:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 69A2829A6C; Sat, 10 Mar 2018 15:36:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D282A28EAB for ; Sat, 10 Mar 2018 15:36:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Cu7H7DtCXXD3HKU02VSdLjdijUEH2ASsXGg7j3onFjE=; b=GvQZ5duqzjfVvZEcu3XPAaDLyw rTw80295uz03xnSMO54zx232KQhfEjQJWl4rvEIXLOF+0lO6te4EShYYqtWOLr9kK7E182gGBdQXj lzebhStmlDJG/KOGp9c3g3rmfSUpq8k7ovq72X0bTzR7Uh54xudtRID7BM39hFlP/Fgk/GtzyxnBD uS2i665VaHwv3Plv9qdEWVWFh3dNXwzyqO4T37ISkDc1i+MA+U9vUr2AOeOV7w+aZqY4n++BHUIJo QIbprW7jnrKdyhQHOVItDKvsY59R0+HjqrYl81/hKkNb0nkvD38qtVETk3Fw/jRVYyF2ao/Hihu1S 5I5Mup/Q==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eugXF-0002Cr-8H; Sat, 10 Mar 2018 15:35:49 +0000 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eugLL-0008Qn-PP for linux-arm-kernel@lists.infradead.org; Sat, 10 Mar 2018 15:23:58 +0000 Received: by mail-wm0-x241.google.com with SMTP id t3so8872739wmc.2 for ; Sat, 10 Mar 2018 07:23:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=apZ9QsQuaZ0gT1OVIfDzjvRv8DsDf/pTY8gsd2Y7Oiw=; b=ADy9E1gcBwO+tYFBIPdbEqonckWhwCTH9638nxOgpLPvKJFFRI3dNPLIpXMZSAfs6T uOHqZnoMRsKzh2XScaBoYIVmOTiPijXsUHm1v7NmsWrLsqRVW+r3C+FliEknLYzbfoxW HpDUab2hwO8N1+ZRCQXS8BEPMu4VDfEfZtnnI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=apZ9QsQuaZ0gT1OVIfDzjvRv8DsDf/pTY8gsd2Y7Oiw=; b=Mf5tPqAubZfnlCEZzjZkvUbBsaf/lfM2hJBo/w0dCs3fxtfg30ewVQVnc/jyaeWfL6 wrJWwYWzeXVGH6siO1XzFKU0FzS1MeCLd2clY+QE2X0J1B+qQwUbaSygNGogPmvDGkL4 ndAiYnf1sJ70rvNfy8AbOkCgkeYEMgYObRkSDI/MNBrbcHe0+BPDva3F+s6xYXbGfjvB Cvv5RLKHguANRj05K3eVoqtJUbSCio1JWPQQzbzLLObZ8iV30ojUpDcHsp95xK34QE58 AxNk/ethwdamDnViEo9lLhymZXdQ/9mVxDQFRLOazo0XZ1xIQ7WyDW8wMxPIdX1R8Mgx XGQQ== X-Gm-Message-State: AElRT7FR2MJfUdlYtX1Ua09hGCISPaRTGMLWxOTuE+iFtUNoBR2ROpAZ RN7pXW+W/dF7cIlspJbcNqus1A== X-Google-Smtp-Source: AG47ELta9v8wtm9Of2svyJiDOrOChxSaXUeDyZFgI/L9xYrBZJLsoJ3BT2bemF6cf4ohpuQG4KbRcw== X-Received: by 10.28.85.7 with SMTP id j7mr1259212wmb.38.1520695407432; Sat, 10 Mar 2018 07:23:27 -0800 (PST) Received: from localhost.localdomain ([105.148.128.186]) by smtp.gmail.com with ESMTPSA id m9sm7027531wrf.13.2018.03.10.07.23.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 10 Mar 2018 07:23:26 -0800 (PST) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Subject: [PATCH v5 19/23] crypto: arm64/crct10dif-ce - yield NEON after every block of input Date: Sat, 10 Mar 2018 15:22:04 +0000 Message-Id: <20180310152208.10369-20-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.15.1 In-Reply-To: <20180310152208.10369-1-ard.biesheuvel@linaro.org> References: <20180310152208.10369-1-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180310_072332_461510_F7EEFC59 X-CRM114-Status: GOOD ( 13.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , herbert@gondor.apana.org.au, Ard Biesheuvel , Peter Zijlstra , Catalin Marinas , Sebastian Andrzej Siewior , Will Deacon , Russell King - ARM Linux , Steven Rostedt , Thomas Gleixner , Dave Martin , linux-arm-kernel@lists.infradead.org, linux-rt-users@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Avoid excessive scheduling delays under a preemptible kernel by conditionally yielding the NEON after every block of input. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/crct10dif-ce-core.S | 32 +++++++++++++++++--- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/arch/arm64/crypto/crct10dif-ce-core.S b/arch/arm64/crypto/crct10dif-ce-core.S index f179c01bd55c..663ea71cdb38 100644 --- a/arch/arm64/crypto/crct10dif-ce-core.S +++ b/arch/arm64/crypto/crct10dif-ce-core.S @@ -74,13 +74,19 @@ .text .cpu generic+crypto - arg1_low32 .req w0 - arg2 .req x1 - arg3 .req x2 + arg1_low32 .req w19 + arg2 .req x20 + arg3 .req x21 vzr .req v13 ENTRY(crc_t10dif_pmull) + frame_push 3, 128 + + mov arg1_low32, w0 + mov arg2, x1 + mov arg3, x2 + movi vzr.16b, #0 // init zero register // adjust the 16-bit initial_crc value, scale it to 32 bits @@ -175,8 +181,25 @@ CPU_LE( ext v12.16b, v12.16b, v12.16b, #8 ) subs arg3, arg3, #128 // check if there is another 64B in the buffer to be able to fold - b.ge _fold_64_B_loop + b.lt _fold_64_B_end + + if_will_cond_yield_neon + stp q0, q1, [sp, #.Lframe_local_offset] + stp q2, q3, [sp, #.Lframe_local_offset + 32] + stp q4, q5, [sp, #.Lframe_local_offset + 64] + stp q6, q7, [sp, #.Lframe_local_offset + 96] + do_cond_yield_neon + ldp q0, q1, [sp, #.Lframe_local_offset] + ldp q2, q3, [sp, #.Lframe_local_offset + 32] + ldp q4, q5, [sp, #.Lframe_local_offset + 64] + ldp q6, q7, [sp, #.Lframe_local_offset + 96] + ldr_l q10, rk3, x8 + movi vzr.16b, #0 // init zero register + endif_yield_neon + + b _fold_64_B_loop +_fold_64_B_end: // at this point, the buffer pointer is pointing at the last y Bytes // of the buffer the 64B of folded data is in 4 of the vector // registers: v0, v1, v2, v3 @@ -304,6 +327,7 @@ _barrett: _cleanup: // scale the result back to 16 bits lsr x0, x0, #16 + frame_pop ret _less_than_128: