Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1072217pxb; Fri, 27 Aug 2021 00:05:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzr+QlWpmsyJBN93saP/2/uDugo+6UUkb24STg2LjDddE8oWW2iYOLdE39WB0QrtDjyBPHX X-Received: by 2002:a6b:8f94:: with SMTP id r142mr6149178iod.183.1630047916690; Fri, 27 Aug 2021 00:05:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630047916; cv=none; d=google.com; s=arc-20160816; b=aOHqLSCk/dRt7Ex8AtWJ7PWw+eKorjpbXDfWE6mryPv/oerkK4UfKchizxfSIK5LIm 8sFqUJvTUV+X6bxswe9fUEoLQYHuCFR8bfYTC3kTriSYtvvP0SePyAy9xnPJSIWpWD0Q J7rJb8UIyLHmcqOytVTurGhf9bmCLRycL9R/0adLP95KkL0HbYNutOQmK3a/HZ0gKLNU 3yV8+fY/HreavEJxHc21szYTpSogItJou1hijLOWO+fEzqYWCwS8S9cKapSVjQZW+NsJ 9Ft2347pzvS3XGztjtLAriF0/IOvZtWw6urShUE1eXfbjAVgMx0pJpFtj5mcUCP3gUOn 20aQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LsNN+gHvQsAA08Hr9zJJlTevAsLp4IH7orHA57jkunQ=; b=csnyUHp1E+8FDorlfvAt4iQmzXv4VkEP6ILbQXb9V2Jflr5vnceA8N2tK3Ny0aKylU YGIMkRL/BdBHU66K8sgS+sLKep/PdTMuGxc+mDCkH95q11voIocyq8rmovjvxiBRI6RX UuC+fdqmgMxOPoQEYN/djhgnZiS/0SZncUp9Z1TNLAnRRsnD1Z7NOlvil73b0fj7ySbQ dxmYGht+/FmMDvn0sDUsHHXk/7BPBYEPNMHa2FuZtRyUxC99qXK4ndDP9UcMlw/CO4wm x12wSnp8WTeqlreRQZ0HhSy/oCvKLqLfJer7EvliGOXBDoUQcx6iocsPIFmf5tXu2Ub6 hJeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ZCgk/ESI"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b97si5425867jai.49.2021.08.27.00.05.04; Fri, 27 Aug 2021 00:05:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="ZCgk/ESI"; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244235AbhH0HEm (ORCPT + 99 others); Fri, 27 Aug 2021 03:04:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:55660 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244378AbhH0HEm (ORCPT ); Fri, 27 Aug 2021 03:04:42 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9251A60FDA; Fri, 27 Aug 2021 07:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1630047833; bh=sLIzRDneiqENH/YHWMThBLYK3jPTozGBrqboWLXHwzw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZCgk/ESIk3S0OG+95k8UNYZ4RuXiTZ4bHL+YPTNuxYynlgt2SHuYqRSC175BokYTL yENCAiz5VdFwH+HWznhE8NBDTqcg9ydFm9HJk4mBcfLrgg/97ok66RqPGId9r96BN8 T8kJDHdzt6e2wXeFwKIQwzlZNttmXHl0Nn0w/qUyBXuh+qBmbTuFgk5oweWDzqCyMx d1bKZ5wcbRTNJGolN9JqFdGqWsCubcNNjDKt6ke1A5B6sIml0iVpwgBusc4X1Xk42s B3PlyxrMsOron+n4iTocG/z25gpdRSpHEjcT2Wxybw7iu+++kR18xkVMqojnTTseYv aGn+JNeUHluXw== From: Ard Biesheuvel To: linux-crypto@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, herbert@gondor.apana.org.au, ebiggers@kernel.org, Ard Biesheuvel Subject: [PATCH v7 4/7] crypto: arm64/aes-ccm - yield NEON when processing auth-only data Date: Fri, 27 Aug 2021 09:03:39 +0200 Message-Id: <20210827070342.218276-5-ardb@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210827070342.218276-1-ardb@kernel.org> References: <20210827070342.218276-1-ardb@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org In SIMD accelerated crypto drivers, we typically yield the SIMD unit after processing 4 KiB of input, to avoid scheduling blackouts caused by the fact that claiming the SIMD unit disables preemption as well as softirq processing. The arm64 CCM driver does this implicitly for the ciphertext, due to the fact that the skcipher API never processes more than a single page at a time. However, the scatterwalk performed by this driver when processing the authenticate-only data will keep the SIMD unit occupied until it completes. So cap the scatterwalk steps to 4 KiB. Signed-off-by: Ard Biesheuvel --- arch/arm64/crypto/aes-ce-ccm-glue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm64/crypto/aes-ce-ccm-glue.c b/arch/arm64/crypto/aes-ce-ccm-glue.c index f6d19b0dc893..fe9c837ac4b9 100644 --- a/arch/arm64/crypto/aes-ce-ccm-glue.c +++ b/arch/arm64/crypto/aes-ce-ccm-glue.c @@ -161,6 +161,7 @@ static void ccm_calculate_auth_mac(struct aead_request *req, u8 mac[]) scatterwalk_start(&walk, sg_next(walk.sg)); n = scatterwalk_clamp(&walk, len); } + n = min_t(u32, n, SZ_4K); /* yield NEON at least every 4k */ p = scatterwalk_map(&walk); ccm_update_mac(ctx, mac, p, n, &macp); len -= n; -- 2.30.2