From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C938AC433F5 for ; Tue, 12 Apr 2022 09:41:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5A6096B007D; Tue, 12 Apr 2022 05:41:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 556106B007E; Tue, 12 Apr 2022 05:41:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 445D06B0080; Tue, 12 Apr 2022 05:41:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.27]) by kanga.kvack.org (Postfix) with ESMTP id 3221E6B007D for ; Tue, 12 Apr 2022 05:41:21 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0AD7A21F7C for ; Tue, 12 Apr 2022 09:41:21 +0000 (UTC) X-FDA: 79347733962.07.6FE0B76 Received: from fornost.hmeau.com (helcar.hmeau.com [216.24.177.18]) by imf30.hostedemail.com (Postfix) with ESMTP id F167180004 for ; Tue, 12 Apr 2022 09:41:18 +0000 (UTC) Received: from gwarestrin.arnor.me.apana.org.au ([192.168.103.7]) by fornost.hmeau.com with smtp (Exim 4.94.2 #2 (Debian)) id 1neD17-001sqd-Uh; Tue, 12 Apr 2022 19:40:59 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Tue, 12 Apr 2022 17:40:58 +0800 Date: Tue, 12 Apr 2022 17:40:58 +0800 From: Herbert Xu To: Catalin Marinas Cc: Ard Biesheuvel , Will Deacon , Marc Zyngier , Arnd Bergmann , Greg Kroah-Hartman , Andrew Morton , Linus Torvalds , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, "David S. Miller" Subject: Re: [PATCH 07/10] crypto: Use ARCH_DMA_MINALIGN instead of ARCH_KMALLOC_MINALIGN Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: F167180004 X-Rspam-User: Authentication-Results: imf30.hostedemail.com; dkim=none; dmarc=none; spf=pass (imf30.hostedemail.com: domain of herbert@gondor.apana.org.au designates 216.24.177.18 as permitted sender) smtp.mailfrom=herbert@gondor.apana.org.au X-Stat-Signature: xcxf6do153xwwnqmfpcdypdbfjmi488i X-HE-Tag: 1649756478-358812 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Apr 12, 2022 at 10:32:58AM +0100, Catalin Marinas wrote: > > At a quick grep, most cra_alignmask values are currently 15 or smaller. > I'm not convinced the driver needs to know about the CPU cache > alignment. We could set cra_alignmask to CRYPTO_MINALIGN but that would > incur unnecessary overhead via function like setkey_unaligned() when the > arch_kmalloc_minalign() was already sufficient for DMA safety. > > Maybe I miss some use-cases or I focus too much on DMA safety. The alignment was never designed for DMA. It's mainly for CPUs that provide accelerated instructions that require a certain amount of alignment, most commonly 16 bytes. Therefore CRYPTO_MINALIGN was never meant to be a guarantee for DMA alignment. Any drivers relying on this is simply broken. I understand that on ARM for historical reasons you have had a situation that CRYPTO_MINALIGN happened to be large enough to guarantee DMA alignment. I totally agree with your patch to try to fix this but it should not penalise other architectures and raise the CRYPTO_MINALIGN unnecessarily. I think if CRYPTO_MINALIGN makes those drivers work then so should cra_alignmask. And that would be a relatively easy patch to do. Cheers, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt