Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2444629pxb; Sun, 17 Apr 2022 23:27:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWDLDGabc3ZjHUSHOzl03SKGw0Ha5ZYXW+piWLCokw0lb4uXeAObWjMI6lJCvBa73cMemm X-Received: by 2002:a17:90b:4a02:b0:1c6:c1a1:d65c with SMTP id kk2-20020a17090b4a0200b001c6c1a1d65cmr11340521pjb.97.1650263249242; Sun, 17 Apr 2022 23:27:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650263249; cv=none; d=google.com; s=arc-20160816; b=Pm2idUHAUcAmYX/uzZ0/Anfr7ZNNfF3uTAzjkVij4HWemfWJvY9bDld2h1nJWgAFGm xBvksQ61ht+Bzi+2QAkD1JbDnOZoGmnjNVloFN49ckaYpi8VBUcbg4Dr9h391rWkA7RE wCM0K3m26mKBuxBLOTZzmys3z2q4ca44F4KxFsPfj5mkjZdz8Ognke5qPhMpeptCDgPZ kAFX2n+A5Jo7s2SRi6LZC2kPs3Mb9ryL6nsYbD8B7cMz0um6Zss1XGk0Tf4RCOeF9L64 zbpw8yyElPhNvVRnhDjCRwXrTjpUE6JhuwElfTBVJOWB/TTzeYj7uey3Oxe1M7H15PUE 2WWw== 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=tzCjMatteFBJkexLxOxjNS8nztJs84LA7Y4zlY7Cw2U=; b=Xu5brpdTluRbY7HFvrJP7I/YAKXIWYMHfCyN1+tWHzOmxhkVjYiYQH6u9cUJ+p2AJ+ 8iC4NuVuynprvyICnQWC+XYPNWvlB3M6wAyS9GxdkKN+yGlcxiLbK1MUDQoQQH+3IKgv fsSryZVLTzyp+X7+FCezHXwtnJLUusK5zv2fp7wPeC2K43aUAR9IGkKFAIQAu8vVtXLk EEel06q6lSFrIgQgCrG2tK323vAPTzdM3wVklJR+uEt6g57++oPvmgR9FRsaZQdNa5lx 4FHcA4h7YIWD7jXsf+sFySjRCWaQ/qmrasrahwEDS3qdpX6Df5cVOFMepwjqiEY/nPyJ 3Luw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b2-20020a170902b60200b00158cefcc031si8364616pls.216.2022.04.17.23.27.14; Sun, 17 Apr 2022 23:27:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233712AbiDQIxe (ORCPT + 99 others); Sun, 17 Apr 2022 04:53:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231579AbiDQIxd (ORCPT ); Sun, 17 Apr 2022 04:53:33 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F10621A388 for ; Sun, 17 Apr 2022 01:50:58 -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 9B3C3B808C0 for ; Sun, 17 Apr 2022 08:50:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50D38C385A4; Sun, 17 Apr 2022 08:50:54 +0000 (UTC) Date: Sun, 17 Apr 2022 09:50:50 +0100 From: Catalin Marinas To: Herbert Xu Cc: Ard Biesheuvel , 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" 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=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 Sun, Apr 17, 2022 at 04:35:58PM +0800, Herbert Xu wrote: > On Sun, Apr 17, 2022 at 09:31:09AM +0100, Catalin Marinas wrote: > > > > Not with my series, the non-sharing of cache lines is preserved. > > kmalloc() still returns objects aligned to a cache-line. > > ARCH_DMA_MINALIGN was chosen as the cover-all value for all SoCs > > supported but I want to reduce the kmalloc() alignment to a cache line > > size if a platform has a cache line smaller than ARCH_DMA_MINALIGN (most > > arm64 SoCs have a cache line of 64 bytes rather than 128). > > OK, but then you don't need to play with CRYPTO_MINALIGN at all, > right? All you need to do is add the padding between the Crypto > API fields and the context structure, right? Right, if that's what you prefer. Something like: diff --git a/include/linux/crypto.h b/include/linux/crypto.h index 2324ab6f1846..bb645b2f2718 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h @@ -645,7 +645,7 @@ struct crypto_tfm { struct crypto_alg *__crt_alg; - void *__crt_ctx[] CRYPTO_MINALIGN_ATTR; + void *__crt_ctx[] __aligned(ARCH_DMA_MINALIGN); }; But once we do that, are there any other CRYPTO_MINALIGN left around? -- Catalin