Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1028284pxb; Fri, 15 Apr 2022 18:52:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzO3c9L7pY6ugidDbV1QByffXr7mjPaPXz2eNWTUYQ+OWKYFm8+54WKU1wAhUADz1r4wJao X-Received: by 2002:a65:410a:0:b0:399:38b9:8ba with SMTP id w10-20020a65410a000000b0039938b908bamr1300354pgp.526.1650073933903; Fri, 15 Apr 2022 18:52:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650073933; cv=none; d=google.com; s=arc-20160816; b=LaqlaoVHlBWof0l3eVTlzAC1HQQs1ijIu0UAar5XxNZnaXrcVeVao+V5KlZd9uGvcS na3MvoAdVmi8vP9vyBNaFRM/MrqHzXYHFjdOuGwpTPtvXoZQWTzTazhE9BV5ZY4Ke5MZ z0Nj10nvRRhxAI6X/w9YQ0hsTypSSzs8RX+MP4XpacaJfjpneQnXClNkh3hysuvP2VO+ nrl11u+oq4TmaQQFMgRzHeZcumbCcdqdqoB/GDoN8C4YuH0eyX+0fQkI+xZGlzCHwfro zPybsFssLx4iV3woi0uJNwb48jwUyJ6WNUBEWZfDP2xwn/SL6vFyA7ye/zLxD4kOVQZX lmaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=G/8Vojd3Gi0Nv94JVtFw1H+tEocKko6M3l/N1DPb7Ek=; b=azEroiQykq4054WJWfmuR/ZAuBwpgW8OQRX1Mk63evOEHuo7ZFeQoYn159ib0kqsZZ GTjMwhZbJpbPnjuDVVT/VE1BY7NRw5gfOyGjLap+KioBl9+pcTkypbz5C5LZxwJOKTQm GPz33GNd/V6wkA33kjjXWIbNCpDxeAloS8x1eK/AaKg74cZH2d982TQgl2qHK2mLxx1p V4vMBKdUOo8oI4BfvdSq/2S5tIhA8sMb6h+AHbcaYV+XSPePlWotZGR6U/VGvhLVz1C+ F9JAet4uBA+Lwve0VtxZi5yD0nLpxLjGraaxPJF31a3b02L1w/bpFxy7HO+Rx1mmlbYz khQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Tgeo6+Cl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id r195-20020a632bcc000000b0039daa5c0eafsi2764767pgr.446.2022.04.15.18.52.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 18:52:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Tgeo6+Cl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 396C4197ADE; Fri, 15 Apr 2022 18:13:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351220AbiDOHv7 (ORCPT + 99 others); Fri, 15 Apr 2022 03:51:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232094AbiDOHv5 (ORCPT ); Fri, 15 Apr 2022 03:51:57 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BEFEF13F6D for ; Fri, 15 Apr 2022 00:49:28 -0700 (PDT) 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 10279B82BA2 for ; Fri, 15 Apr 2022 07:49:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B08B9C385AB 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-f45.google.com with SMTP id 586e51a60fabf-deb9295679so7501751fac.6 for ; Fri, 15 Apr 2022 00:49:25 -0700 (PDT) X-Gm-Message-State: AOAM530ONzeWbaRI8ZBArLRq6sWFXnKQz+g27SFFZ1z3jyXlC8qZvIwO m8hDW6ghWxXLNNpvhfgiam4Y/TkL6d6P2uYDLHQ= 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-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 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.