From patchwork Tue Jul 24 17:12:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 142820 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp7516491ljj; Tue, 24 Jul 2018 10:12:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdXB2GQnoeRbOOKR57CTDsdQpVWTDtBL2qPyX0hVQwTfQyw+mjelKf7rsfnJd4oAXWIcMQg X-Received: by 2002:a17:902:7587:: with SMTP id j7-v6mr867393pll.256.1532452356095; Tue, 24 Jul 2018 10:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532452356; cv=none; d=google.com; s=arc-20160816; b=cW3U+0tu9K8mExcAZdjTS1oxkNLD2TuqIEFFQlpSrC2vvaNMsSxi+hnhBT2bn9NhaU PCowNTXD9Uo5HTEedN9I6qDv+3RkqPSxXFDZrsfyMjUIbABTV8z/CBqr5xi5FGUJw2yy iNfRDZFUZCPczq6TXlhDrXpGIzpY8+z05+yKZJNkBOPw0BmS2eX6lR17RdYFYy0o0Oao paNqc+l/RLJsaLkQeg+rpuwD/IOlROSVAHujXhJn3egapV1d5Wr250lCDObQBMC4qSoQ 2VGHX7dsmTLB+u4WNj7z0PU+nIeormpBWznqhBCHIlAcpCDWbNMB0nU8Kq7xVer7rlKN /S4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=GVbSC95/yEEbAynfAN2phGeEVzpKjdkr/hhdhpjQFqU=; b=PvncMHknJiMbnxU2dSAHZ8b2VE97uvB2KtkIQRE8I9IsZXihpomnzDYTBsNek9Bmzw SvPYt1ucBrhImt2GhmWVrOJmBIA1d9yckcouYI4r/TDsJKU4WXAfkXZIiVcfbX+g2/37 fwKNiQ0Uy3ou404+QT74/HscZKE3zyL8+a/61M1EaQCLl43FeQPTLT9sVThhAt0xc2z2 6akRBXuWwxEWtHdDt9+VRtZGj14BvJlzVJazRN2mOvf9Hdw7ySNTqxy8yWyc3+fj1nvX bi3Hwv9tGkDRaO+dKpFdf8uP9BzGSxWlwqnemmg8uADRVFDYz/J+9jG9WwLEWgVwD2kF wujA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dvmqOphd; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x1-v6si10764942plb.8.2018.07.24.10.12.35; Tue, 24 Jul 2018 10:12:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dvmqOphd; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388431AbeGXSUC (ORCPT + 1 other); Tue, 24 Jul 2018 14:20:02 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:35609 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388422AbeGXSUB (ORCPT ); Tue, 24 Jul 2018 14:20:01 -0400 Received: by mail-ed1-f65.google.com with SMTP id e6-v6so4760710edr.2 for ; Tue, 24 Jul 2018 10:12:34 -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=GVbSC95/yEEbAynfAN2phGeEVzpKjdkr/hhdhpjQFqU=; b=dvmqOphdJaDe8yPZYpg+gmLNzy+5ESZJcjvwTnZ5/mzQDXAkAnko15du5jWjSrHiF6 K5vcnsNPhPQWcQJLJ5EprvNgKK0Fe+Lt1fLZ4B6n0TeJvd3cAKg4veACZfUTAWHGIg87 w/oiG9Y/RFA9jelKfSO4+atx6GwmLJ+FOJay4= 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=GVbSC95/yEEbAynfAN2phGeEVzpKjdkr/hhdhpjQFqU=; b=pPiriIQ8k74eL3XWld5gDr5xDqGk+6g48QBEKfZjA/WWnjcYBGlpxrxrEp9Gd3UjzS yUkGfHoGgEbE4e0UOD4aoksqhFhMqVNiNTZOU7AxTG3NZI+NbdAIBZbm/CRw3AE+MmtB VTFHMTV/95e4k8sc2QKkEcQp4/+GlkFbs56EUaAISaZpeiDcCA5RYUjbK0i7cmViTr4V bLNNKRwHfOlPvdJQugAkiogK+7GVwT1IbqxzYiCMyqGWyb4jOQYUiuJv0zFnN3JebakY 6prj2UzpTJFEYV/jRpJsbVsyreTd/2EJOFPSRu7FkB6zquXKJDUW07RDi3EiglneLnaT aADA== X-Gm-Message-State: AOUpUlGf6OTTCu2fDkR9coblmB4v0ECwwnMao4TGKAwcGcAhXITE6zSc LkFFgJdhpeYcki6hRrt/pGnouymdtX8= X-Received: by 2002:a50:b410:: with SMTP id b16-v6mr4055409edh.190.1532452353254; Tue, 24 Jul 2018 10:12:33 -0700 (PDT) Received: from rev02.home (b80182.upc-b.chello.nl. [212.83.80.182]) by smtp.gmail.com with ESMTPSA id j50-v6sm11267948ede.0.2018.07.24.10.12.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 24 Jul 2018 10:12:32 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: herbert@gondor.apana.org.au, will.deacon@arm.com, dave.martin@arm.com, vakul.garg@nxp.com, bigeasy@linutronix.de, Ard Biesheuvel Subject: [PATCH 3/4] crypto/arm64: sha1 - reduce performance impact of NEON yield checks Date: Tue, 24 Jul 2018 19:12:23 +0200 Message-Id: <20180724171224.17363-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180724171224.17363-1-ard.biesheuvel@linaro.org> References: <20180724171224.17363-1-ard.biesheuvel@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Only perform the NEON yield check for every 4 blocks of input, to prevent taking a considerable performance hit on cores with very fast crypto instructions and comparatively slow memory accesses, such as the Cortex-A53. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/sha1-ce-core.S | 3 +++ 1 file changed, 3 insertions(+) -- 2.11.0 diff --git a/arch/arm64/crypto/sha1-ce-core.S b/arch/arm64/crypto/sha1-ce-core.S index 78eb35fb5056..f592c55218d0 100644 --- a/arch/arm64/crypto/sha1-ce-core.S +++ b/arch/arm64/crypto/sha1-ce-core.S @@ -129,6 +129,9 @@ CPU_LE( rev32 v11.16b, v11.16b ) add dgbv.2s, dgbv.2s, dg1v.2s add dgav.4s, dgav.4s, dg0v.4s + tst w21, #0x3 // yield only every 4 blocks + b.ne 1b + cbz w21, 3f if_will_cond_yield_neon