Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp793758pxb; Tue, 12 Apr 2022 13:38:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhLqhMu+4uvBG48ejO9pY9hRHwqdEdo2b+gokiC3NSsxCFWYonLpVqBgJ+OekOWmVt3zoy X-Received: by 2002:a05:6a00:24cb:b0:505:7935:670e with SMTP id d11-20020a056a0024cb00b005057935670emr24642411pfv.36.1649795884437; Tue, 12 Apr 2022 13:38:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649795884; cv=none; d=google.com; s=arc-20160816; b=EjepD4fkvjWLL3psaX6FFVNYc0zyGfgmbsvLzzctemCuSdn2b1VFq8K+Cl0q5aMrph AnSJDkqy2556T6DFAEFL3kQRVQs3YPc5yEbSl+YnLMlCeHFAb1DQqtnPfU5KGaU5vhhD S4BH3kgMPiHF8OrcD7OAIvYMAfbcTc253Iab7LLR9wyvBPX776/7zskMEIkG0kxAMu6K kzGZqCjbg/IUNbmOCSec2fgwTKVaZFkxe5B7N4ldzHdyVp682/TmevZXFKZnltQF0vjW ksykZWC8sFwcFVlPbtk9eqT+Xhqt1LvPU1sB6DpYxLRy3kOMEdVoAsx90rJOWILNIlr2 FCqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=HMGrhIVHhioVtZs9yv8VbxmwNBeLnU0Et84JjxUhm3I=; b=Ufm6wYHAvL1goJddjj/gO7uEwjNvEx21qieHSBXtrDPd5CG3X/+FBNBT0prDMTzqYr kMoyYyz4pWJQAuxZlTsq18XZY+xGas2pooHWCsNs+3Qb7kKu4+QpygCmBpffGKeC8HYi UfFc2/PceZR+UE53RXUG0bo7gnx5JuCHXOYNMyqzSTPLHf57M3vkwMx6AwCULQgSdpGp tzYtTGIMZCNzgwKyKgByn047GNnVvc+Cd3ecRJ/HHTDeqv25s79fgI1aw4sRm20I+8uL PvwZkAhYNeDYSgc3wAphKjXg5uTOOPj3nxykTtedUqx0+iq8lvuetnqptBmwMeVjyYvR aRIg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id t7-20020a17090ad14700b001c66f2284b7si12245795pjw.49.2022.04.12.13.38.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 13:38:04 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 571A4AF1F7; Tue, 12 Apr 2022 13:11:45 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241869AbiDLK5P (ORCPT + 99 others); Tue, 12 Apr 2022 06:57:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53746 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356630AbiDLKpc (ORCPT ); Tue, 12 Apr 2022 06:45:32 -0400 Received: from fornost.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5812684EE4 for ; Tue, 12 Apr 2022 02:41:24 -0700 (PDT) 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-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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