From patchwork Wed Dec 6 19:43:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10096975 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 9944560327 for ; Wed, 6 Dec 2017 19:50:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8945D297C2 for ; Wed, 6 Dec 2017 19:50:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C94629930; Wed, 6 Dec 2017 19:50:07 +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=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.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 17CC9297C2 for ; Wed, 6 Dec 2017 19:50:07 +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=sO+ZawwkfpAoh+6r9urb7jqa27rSM2V3NR9uSaWYiKs=; b=TW5U5vbdS/ybJrG9iLTdJYdDbR x3MDz4ZplBwWxZG/PiL9TSsxWYTpeffY2U2hwaji0I4HAyFSD7T2lMIgC+GsowXY2D1I+lVu+y3Fw 3PpPLHhsQUJ420JNufhrqVYJlpWHcB6ZEpBtLmxTJvrNn4PyotjQVBcqUgjid5udUwA0QDPaSRLSQ 5N6zfNVm9O6c08yY2nKtZDNO/OF1zug+/o3dNFJ1OVweQn3bL0U8vmcHlkfsiBPgNKeXJYpklANGp 1HB7R9gCNId4rJaDuqcGaVBWgzYsk++1s2fpLUbzimTYzPijQBDsnXvY/q6cu3VwC2t9fKFWyVSYQ 6V7nBP+A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eMfhl-0004aM-R9; Wed, 06 Dec 2017 19:50:05 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eMfd1-00075M-E2 for linux-arm-kernel@lists.infradead.org; Wed, 06 Dec 2017 19:45:22 +0000 Received: by mail-wm0-x244.google.com with SMTP id 9so9204114wme.4 for ; Wed, 06 Dec 2017 11:44:54 -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=DEQY0/LoXnU9pE4NqHBI/5S5x1EkKDsFAJsw6tFA+2s=; b=JjbszcL1QLYfb9KIS8xhZQOQn2eIBxu0r6aj47MK99HUcf03NTf7obEUcPOmqNcyVt oB6igxGd/aX/rpzZqECbXOGi4RSATmwFJ1jylkBq7MZA6Mfv2sS6sz0jEQMtQy5Fys5T l6C+uoUNcfXE3UGQzP4kEzaKvkznd23ZRG2PE= 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=DEQY0/LoXnU9pE4NqHBI/5S5x1EkKDsFAJsw6tFA+2s=; b=ATY32pgu4UPSiIooICxgtrPE0E9P2ZwWe/aF90evHLohCsKGZHaXZ/1RePehWK3H54 sTGkIb7EZjxkyTZ9FHUjrKbkodMZYV491PeqM/5nYc1Ib6qZPZc9OMoW6dfJD7U3Emwp xW5TAnC9qreLoCegZ1QGknljxU9hXACZh3lTI9JTqM/Cok+wd87Nk5u6uS1wZkzLPBov VG1C/fMzrlfOSYL/oC7Hf/fz1RLTr8TKaMvNjJxsHb7AdiJQXCuYN0pWo6RvoYc0Bgvx AW8WNxwPk+mxlhfbOw4WLJcE/BiR63cRPi7TJ88cy5NgtEUiLiH+o1LaOS6SbWN1KuK0 RSXQ== X-Gm-Message-State: AKGB3mK+R1zTRTEDrzWkiPaiqw+zKEmZzacITsF+9eb4G9o7gOX8JxTu OPX1dYChwn229c2+2hJ39Q+POw== X-Google-Smtp-Source: AGs4zMYLptysyOnkk1bxlwtHi6wcmgtcSiWIyrjClSE6mGzzjztwMlzMYool3JVabFzScyIiHZ+2dQ== X-Received: by 10.28.24.210 with SMTP id 201mr8391378wmy.120.1512589493581; Wed, 06 Dec 2017 11:44:53 -0800 (PST) Received: from localhost.localdomain ([105.150.171.234]) by smtp.gmail.com with ESMTPSA id b66sm3596594wmh.32.2017.12.06.11.44.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Dec 2017 11:44:52 -0800 (PST) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Subject: [PATCH v3 19/20] crypto: arm64/crct10dif-ce - yield NEON after every block of input Date: Wed, 6 Dec 2017 19:43:45 +0000 Message-Id: <20171206194346.24393-20-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171206194346.24393-1-ard.biesheuvel@linaro.org> References: <20171206194346.24393-1-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171206_114511_910113_ABE0C486 X-CRM114-Status: GOOD ( 11.77 ) 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 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 d5b5a8c038c8..111675f7bad5 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, #48] + stp q2, q3, [sp, #80] + stp q4, q5, [sp, #112] + stp q6, q7, [sp, #144] + do_cond_yield_neon + ldp q0, q1, [sp, #48] + ldp q2, q3, [sp, #80] + ldp q4, q5, [sp, #112] + ldp q6, q7, [sp, #144] + ldr q10, rk3 + 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 3, 128 ret _less_than_128: