From patchwork Mon Apr 30 16:18:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 10372097 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 A5AF06032A for ; Mon, 30 Apr 2018 16:28:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7B39928C72 for ; Mon, 30 Apr 2018 16:28:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78CB3286BE; Mon, 30 Apr 2018 16:28:20 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI 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 31AD228C98 for ; Mon, 30 Apr 2018 16:27:47 +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=2YlpZlr3SpnnAko4jUBADWmTPZHwQB72IEHcSTjbF5s=; b=naFnV8/TRyxnj8PGp8Nf2YnTSh jAVfDL1IXIzCeVLBEic8Q+3qtV7Lem0BF6jkmxTjlCflczcl0PmRDrJNDW+xPv9uLP5cREe7OsJWw JG+PHhoy5kvB53gks2y9IRPYz8C31bRYn9K+JlSelpuN4sCqNm/L9kYEuLdGLIPHYW4ptEhn52Fgm vvjjIas7xaXzqsqxdocY818K6NEUJ3R48kCIlqZAqbBYRsdRVObj+NbOB4ac4xv50+nqLF8/RYf0S 4YpuwUBAC+quEolGhnjmWRIqZZNT36KHP00yBBktD2WJTyT9jOTLx6vzY1cl7EXmdXsXdPg5IN0Pr L6vnH3JA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fDBeL-0000x5-G6; Mon, 30 Apr 2018 16:27:37 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fDBWF-0003RH-0I for linux-arm-kernel@lists.infradead.org; Mon, 30 Apr 2018 16:19:17 +0000 Received: by mail-wr0-x244.google.com with SMTP id p5-v6so8569265wre.12 for ; Mon, 30 Apr 2018 09:19:04 -0700 (PDT) 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=mwG0WG0+HI1ga14AdY6J5/Dk0o23fBmL75xEvbxHT5g=; b=CvIWwP0PEVVhdyqomj0HzfDrVHbGRDdBm0ORNmdI8+UO5PQH/hIPQ8BGd8/ukoj93X GOFK5FWPE5BVGGxtcdKm+bMbqm52U0aCjagoooO6yS3CNAPiIZf1V66gwNkfnKHX9oXA DZo1p7+6fy4+947WOcP193waFK98zejrAK0wE= 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=mwG0WG0+HI1ga14AdY6J5/Dk0o23fBmL75xEvbxHT5g=; b=s6A5O7tbpZLVQlin7Sy6wtcyyuiCxFlqD6uxPpenTfieT/KMVSQcgE/Zne55GwKRBO 1BCryOpJUM+6l+74RmVi3R4uX46pnATID2Iazly5juFozl5JPXVwHLGMVb7PY1HERNbY yeW/tvPvMHg8EXsXG0SWacBwvaCrsg/kWRBSm+7/+WtDPRb+jgOwKAIoYCett99Qki2K bQoNULml2J7hOMMm0sNbi+6T1r4ua4Y/qyd9+8eVS86/+nPzlcCYXRkAfHT592Op8sTb q91OFUIH0aIrRpitA8NdwP4Qo7uxDJbJ16fTNTla0bYXJ+prksRM6kuccq7Lg9AX73Qt vSfw== X-Gm-Message-State: ALQs6tCEFbcRVsS4xitbxRmas8pF9mXHY8lJSPDIjFZk9npKhLw050Mg 5e/Nx7YbtcoTwzt0374kHhXSpQ== X-Google-Smtp-Source: AB8JxZpBVk0ka5pvSF5rhadXrREP0FPPTX71StCtMlhXg1GjiPeIWYzixKA9PXlAY6Jy75byrGwgvg== X-Received: by 2002:adf:db85:: with SMTP id u5-v6mr8828662wri.278.1525105143500; Mon, 30 Apr 2018 09:19:03 -0700 (PDT) Received: from localhost.localdomain ([2a01:e35:3995:5470:200:1aff:fe1b:b328]) by smtp.gmail.com with ESMTPSA id l1-v6sm5753845wre.54.2018.04.30.09.19.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Apr 2018 09:19:02 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au 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 Message-Id: <20180430161830.14892-11-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430161830.14892-1-ard.biesheuvel@linaro.org> References: <20180430161830.14892-1-ard.biesheuvel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180430_091915_097571_F30EDDD4 X-CRM114-Status: GOOD ( 10.74 ) 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: will.deacon@arm.com, dave.martin@arm.com, linux-arm-kernel@lists.infradead.org, Ard Biesheuvel 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/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)