From patchwork Mon Apr 30 16:18:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 134718 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp3948309lji; Mon, 30 Apr 2018 09:19:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZobqTXjz6xrkoTpTdBI1QaNy3KAiGtyjLtM3J5Q4T4uEuqA567cLgUIzFKjeFSB7nkJuY4N X-Received: by 2002:a63:3389:: with SMTP id z131-v6mr10533204pgz.386.1525105142254; Mon, 30 Apr 2018 09:19:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525105142; cv=none; d=google.com; s=arc-20160816; b=R4T3Kbo1+UiQzTBcYSuX8FEcGAX9kTuLM4dOYM3Pp07t2OcjhXJ5x6lozAsjswgc1f djYIXL4equyYWn0268Pqj2oAGcuxbL8dIbSahokK4EEW8CrkUcNilFzM/XTaTY/j58sx fE+zzJ4FIB1iCfLNdK0Kl2+xU0GV8bsfzYSDDvIRna6ETn5Rf9Gopew3zpZ9lTEbzo0Q RL5wd0a0n+SoU8InnpHr9GS/iNlZ8mGZpxg+KV04qC9vH18vmOlAKuxZPSIxYa7CIim5 9VesrOXfEd73JaM6Kbe4vcU4SMiGSUAN9rQ6Xen3WomNETs3xM6ECRBXmguYy699EcYt AXWw== 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=Gthgd64Km1iH1bKOjg6MqzV/Ss4xdEPwnIkWfLymZ/g=; b=tc+tAQDP9WWZtxkhSSF0ajiI5ey0GumnKCdbg5AUsLe634h0F9izJntZ+W+SgoUESN 05Yb13rb2/1YAh6odl7nWkRT0ar/7/poOh6XRtve+1FhLFn2gIoSV3SNz/fW12x+hndz 5l+KXu2IIXdgALaxl2aEzwmIh1HyiWC9KfYlFY9pQa1KCFI76+/cRIl3f0hk4jEPo/U9 lRqoWVkkum/2/MNZAZ88EJbroNxzDfXBS8acYkqsjmphuos8oLXr5RWym+ou4c9fWclQ 0BoSIvJaKYXxQVtiiqctyqgW6rXe76H4jTTkSICOhFKDIwdVv8jXrJWWInIc2J9gXEOD M+uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZHA/QYsp; 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 f66-v6si5264259pgc.391.2018.04.30.09.19.02; Mon, 30 Apr 2018 09:19:02 -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=ZHA/QYsp; 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 S1754631AbeD3QTB (ORCPT + 1 other); Mon, 30 Apr 2018 12:19:01 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:34488 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753334AbeD3QTA (ORCPT ); Mon, 30 Apr 2018 12:19:00 -0400 Received: by mail-wm0-f65.google.com with SMTP id a137so10639828wme.1 for ; Mon, 30 Apr 2018 09:19:00 -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=Gthgd64Km1iH1bKOjg6MqzV/Ss4xdEPwnIkWfLymZ/g=; b=ZHA/QYspwri/y8m1Kw1dhwEIfX1P+tFGWd9MEcVbzVEGufJep0ngvCUQN5S7ECVRhR v4T/0mXYbPmEhvkPtt2UXcambT6+OU1Rq2Mo+IkhkAxS9bInIX3GfP/Jj1g7an5JXTXN gcHz7Qt4pFUYXN9ZEL9QADFpmV65t8T5X54fA= 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=Gthgd64Km1iH1bKOjg6MqzV/Ss4xdEPwnIkWfLymZ/g=; b=hqQZuXCsQZ663a+RUkuuduXTXxk4B4CeFV8tnf4Z7bApwmMk2Pq82xnYYIQAUQGSzk FtuqW+4hi7ozHmSVL4rx7SkSdvocDYoReeyoG/Gf5MmRSHVh1mWqsDOBepZXz0Vqm4eI K5SVwKbeiBL5lWbUgs7afCMru8fc2HWeINIAbx30Y0auK4QlsX+66LdP0WrsDjaDiPUS SUBvyj1y9thS6hqzVv5rowaTgxclaSie+Q4ZtMfzobM8xCUPGVhG0YDp0sUaBh0Hm5Fb jmDJzJZB0cLbcqUiV2xcED58utcNSl0X7F4UtDKMQHGjQpPs3+Pi93/GR9V5hsiCWgoa 8ihA== X-Gm-Message-State: ALQs6tA9K1eR9ObvbF+xBHLBi7/Ih3iZz2wH7DiXftdFvw6Uc3E8b7aV HaC9m4yffTWcdlEExAgW8NEJ1LYWM2k= X-Received: by 10.28.113.196 with SMTP id d65mr7484273wmi.157.1525105139232; Mon, 30 Apr 2018 09:18:59 -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.18.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 Apr 2018 09:18:58 -0700 (PDT) From: Ard Biesheuvel To: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au Cc: linux-arm-kernel@lists.infradead.org, dave.martin@arm.com, will.deacon@arm.com, Ard Biesheuvel Subject: [PATCH resend 08/10] crypto: arm64/crct10dif-ce - yield NEON after every block of input Date: Mon, 30 Apr 2018 18:18:28 +0200 Message-Id: <20180430161830.14892-9-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> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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(-) -- 2.17.0 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: