Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3688545pxb; Mon, 24 Jan 2022 15:24:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJyK8IC+87Z5YHS6miIzW4pv6G5r9H8OlfLg2Z+T+BV9tNndC7LTbN4+eVjZsACmKFg9lJ6o X-Received: by 2002:aa7:97b7:0:b0:4c7:4bb9:5bb8 with SMTP id d23-20020aa797b7000000b004c74bb95bb8mr14870789pfq.39.1643066689411; Mon, 24 Jan 2022 15:24:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643066689; cv=none; d=google.com; s=arc-20160816; b=IV2TzOPFrbdB5+FojznZHh43LSMwO4+c9McYURcDDIYZzYBrYGHozeZdx29SkGjaCy Tg0nwVLtRZXaZAgrrw0AFpghzgEUDnqV2buy756jZmrXNsmVuOIBdAa8/noymx3MdH6H di3/pCWuYvuxkSBhJua9zQOPfove7Qr6dRKjrCG12A07bIogV+JT+1t7zkKaQlL/rO0J cQaTTkRNktSSr+WAUoBdoCrwmgJwa46aBOAzlWsiftQ5VdrEQlLM/E8R+V4JEHtSSyql zteCSmNkROlbi0WHRPyaoYHwvT/zhsHiKaT+7P43UITzfCFuwTQjTww3XS+L6Lmuq/Sy 45dg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=D5B7o+AUBvjOLgDi2nrxxhdGaLAg1pKaRvimBRh3Mco=; b=maVnyqMpjQTwWFr7bnpEyQt1VgYdRLFf/6D0O7l7zIcD4clRAbiRq3yy6DBAkEy0ym 9qhhsRsGEjLlF/Tzs+z36cyEvsiXHTsHsX8P3/MbjMYr1y5F6LzBpO2Oa8h3qIcYPD+4 GP6ucZHE+8yzek8COU/RjXQuzgv8cN353YxclnZSACcbQE7RNmMZkkzLNln+AEvVUx5J yqZ9zK65yLUpQjAcUU550I/wuEuK5SrrfkOHCJSBUk0wCBIStkBAobqhSNlP3B3+C+rB dEF2pSgIwQJkd4tS2aDa9AF3plW+l8lF7tRDwGf2kAXJKuICqSym/wRdtH4FdmqbyB8s 6fAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="Cnkm7/wW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k10si585813pjs.56.2022.01.24.15.24.37; Mon, 24 Jan 2022 15:24:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-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=@linuxfoundation.org header.s=korg header.b="Cnkm7/wW"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385146AbiAXXSD (ORCPT + 99 others); Mon, 24 Jan 2022 18:18:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1585943AbiAXWZZ (ORCPT ); Mon, 24 Jan 2022 17:25:25 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D9FEC0418B2; Mon, 24 Jan 2022 12:53:59 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 42C12B81057; Mon, 24 Jan 2022 20:53:59 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 631F5C340E5; Mon, 24 Jan 2022 20:53:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643057638; bh=CJ40P4ApaPT+yCkIt+R5SbXdg418MmTbXEyQxB9sxMU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cnkm7/wWz8tC0WrcihwoVoXAKxAyUzwOF50zoyR5L2rkF9zD7dvcAmPB0ZE5d5Rko dikfBbKWH03W/UBZ4FYHGxbF4lLyXju4zCA2gOp49mE99Xh/NrN7zhtEnkS7cAy5G9 IChh3uIG/ga0aVHFdrDgW6p6q8o1QNNMPFn6qyhQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jakub Kicinski , Ard Biesheuvel , Herbert Xu Subject: [PATCH 5.16 0031/1039] crypto: x86/aesni - dont require alignment of data Date: Mon, 24 Jan 2022 19:30:20 +0100 Message-Id: <20220124184126.181559588@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jakub Kicinski commit d480a26bdf872529919e7c30e17f79d0d7b8c4da upstream. x86 AES-NI routines can deal with unaligned data. Crypto context (key, iv etc.) have to be aligned but we take care of that separately by copying it onto the stack. We were feeding unaligned data into crypto routines up until commit 83c83e658863 ("crypto: aesni - refactor scatterlist processing") switched to use the full skcipher API which uses cra_alignmask to decide data alignment. This fixes 21% performance regression in kTLS. Tested by booting with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y (and running thru various kTLS packets). CC: stable@vger.kernel.org # 5.15+ Fixes: 83c83e658863 ("crypto: aesni - refactor scatterlist processing") Signed-off-by: Jakub Kicinski Acked-by: Ard Biesheuvel Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- arch/x86/crypto/aesni-intel_glue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/x86/crypto/aesni-intel_glue.c +++ b/arch/x86/crypto/aesni-intel_glue.c @@ -1107,7 +1107,7 @@ static struct aead_alg aesni_aeads[] = { .cra_flags = CRYPTO_ALG_INTERNAL, .cra_blocksize = 1, .cra_ctxsize = sizeof(struct aesni_rfc4106_gcm_ctx), - .cra_alignmask = AESNI_ALIGN - 1, + .cra_alignmask = 0, .cra_module = THIS_MODULE, }, }, { @@ -1124,7 +1124,7 @@ static struct aead_alg aesni_aeads[] = { .cra_flags = CRYPTO_ALG_INTERNAL, .cra_blocksize = 1, .cra_ctxsize = sizeof(struct generic_gcmaes_ctx), - .cra_alignmask = AESNI_ALIGN - 1, + .cra_alignmask = 0, .cra_module = THIS_MODULE, }, } };