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 D197BC433F5 for ; Fri, 15 Apr 2022 07:49:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3CA7F6B0071; Fri, 15 Apr 2022 03:49:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 379646B0073; Fri, 15 Apr 2022 03:49:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 28FEC6B0074; Fri, 15 Apr 2022 03:49:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 1A7A26B0071 for ; Fri, 15 Apr 2022 03:49:28 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C66A120671 for ; Fri, 15 Apr 2022 07:49:27 +0000 (UTC) X-FDA: 79358338374.07.107449C Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf31.hostedemail.com (Postfix) with ESMTP id 4ADC620003 for ; Fri, 15 Apr 2022 07:49:27 +0000 (UTC) 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 dfw.source.kernel.org (Postfix) with ESMTPS id 463FF620BA for ; Fri, 15 Apr 2022 07:49:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA034C385A5 for ; Fri, 15 Apr 2022 07:49:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1650008965; bh=eUOjRVyTAm6jKWk8U3u/0yQXmGiR3R5Y9bZ0+t0UrtQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Tgeo6+Clc418620BErs3GyqutJjfjRqL0t9r6nifTXUraL7SJSk7tYwedEMXDuXI4 zOKU2Ffi7IRo2g6XNcZJl1ZkATSIY3khnW00JjuEGnZmJla4EXIRb3Qq509B2eN+HV VHnD0FN50CVIDCfxCEx+L7uW8JQ2DxpEJZXYKSJT1HLLh43qPdd1kFkmN3b1JOEiIk +yIubk07HJ/u9JqFEznxezUiGrKuOmQ+bvXNjuOXRM3Cw37wz6qHqqTtNzCTOPsIcb XejXR8iBGPbPTEy9IRTFC87D8/ZGKhE3VRhLWfhV2aTfosu9pk/idNlqUhYU59l24d 074EhqW0Uq71w== Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-df22f50e0cso7513946fac.3 for ; Fri, 15 Apr 2022 00:49:25 -0700 (PDT) X-Gm-Message-State: AOAM533HXyVA5BEtGvr94+R3Wh0QZ+NQQa2p+Z6tz5sosWFDZN0Ih+q6 4pkmsWD8SVKNpSUSFQD4Gb0gJDregU8XPOdMc9w= X-Google-Smtp-Source: ABdhPJx0lEA3e7WZ7cSEpjFA0JVG8HISWN9TfswZhcy4XaorGyyF3eX+1q+lZphMFO5POQFTd5DpcRU8cQKweCLTWxI= X-Received: by 2002:a05:6870:eaa5:b0:da:b3f:2b45 with SMTP id s37-20020a056870eaa500b000da0b3f2b45mr982816oap.228.1650008964845; Fri, 15 Apr 2022 00:49:24 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Ard Biesheuvel Date: Fri, 15 Apr 2022 09:49:12 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 07/10] crypto: Use ARCH_DMA_MINALIGN instead of ARCH_KMALLOC_MINALIGN To: Herbert Xu Cc: Catalin Marinas , Will Deacon , Marc Zyngier , Arnd Bergmann , Greg Kroah-Hartman , Andrew Morton , Linus Torvalds , Linux Memory Management List , Linux ARM , Linux Kernel Mailing List , "David S. Miller" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 4ADC620003 X-Rspam-User: Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Tgeo6+Cl; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf31.hostedemail.com: domain of ardb@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=ardb@kernel.org X-Stat-Signature: ocdeprsw9icjzfs4ixgs34j7a83ag3b5 X-HE-Tag: 1650008967-102791 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 Fri, 15 Apr 2022 at 08:51, Herbert Xu wrote: > > On Wed, Apr 13, 2022 at 09:47:29AM +0100, Catalin Marinas wrote: > > > > With my series, there is no change to the value of CRYPTO_MINALIGN for > > arm64 or any other architecture, so point 3 is unaffected. The series > > does change the kmalloc() alignment and that may be smaller than > > CRYPTO_MINALIGN but neither of points 1 or 2 above are affected since > > (a) we still have a sufficiently large ARCH_KMALLOC_MINALIGN of 64 and > > (b) the kmalloc'ed buffers are safe for non-coherent DMA. > > > > Herbert, Ard, if I missed anything please let me know but based on my > > understanding, this series is safe for the crypto code. > > Sorry, but you can't change CRYPTO_MINALIGN to a value greater > than the minimum alignment returned by kmalloc. That simply > doesn't work. There is no magic in the Crypto API that makes > this work. > I'm not sure I understand what would go wrong if that assumption no longer holds, but if CRYPTO_MINALIGN needs to remain equal to ARCH_KMALLOC_MINALIGN, let's at least decouple it from ARCH_DMA_MINALIGN, as I do in my series. As I pointed out before, ARCH_DMA_MINALIGN has nothing to do with DMA addressing capabilities of individual masters, it is simply a worst case cacheline size that needs to be taken into account to avoid corruption when doing cache invalidation for non-cache coherent inbound DMA. I'll rename the flag I proposed from CRYPTO_ALG_NEED_DMA_ALIGNMENT to CRYPTO_ALG_NEED_DMA_PADDING to make this clearer, and given that only a few drivers should be relying on DMA to write into request/TFM context structures, hopefully we can fix those to stop doing that, and get rid of this flag again entirely.