Received: by 2002:a19:f614:0:0:0:0:0 with SMTP id x20csp26483lfe; Fri, 15 Apr 2022 17:48:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfXmhf+WUFEPzAq1qlm38rfPURUpZbuwEOgc47rPSLOUJmFWYnQz4OvWvJy3N13Gu5vIZq X-Received: by 2002:a05:6a00:b8e:b0:505:8d7e:cb02 with SMTP id g14-20020a056a000b8e00b005058d7ecb02mr1415574pfj.68.1650070101550; Fri, 15 Apr 2022 17:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650070101; cv=none; d=google.com; s=arc-20160816; b=ZRP+Yx3jS1BZIyWskjZZ2XheV1BaW+JoLkEg5nCe5B3SH5yKYQVUnRshm7ozfYdKOB STs3ugTPl6Sqnih4gO4Lp9ENzHQFs/he/MlDukuoxwDKac9FsQEgEJ8N4NCJCilz0Bv9 aW2RMifs7iCG8pvqpHVZLtphc/N9eHASxmv+5X3xI/Jc8FJkki25LRM/jJUxihqf3Xpe /PKSzdMJ1Fm3bJlC6+JCieuXw/h4zxUwIjVeinJ30t6KfdmKusWhfou92166WEMSulQn T2/s/WP8p41xJufAAKNjE/7eP/7axLJ2zt2xoCjmDawppm5gVJucfWJYig7rm5gMTJJD nxww== 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=9kRJOSgjfdwD+hezDYiksMSJ8mkz7QYoxjrUnKbDo/M=; b=jHJq4B808sreQOYG/YvApaTz+E/HhzgBNanepnABBPp2MTIodj+u4pH8q7MGCx3Bav dCJeYMyDtzpSrWNQ7v2xlLmK6JznJTciTpa2RmPiVxd2ESSxb1g1wCfVs9hYBrkvxMuj b62dZegz/Xf8aQ72YeBOOF+yN++k+n7F/KiJlJVILBvhQkKZ/9bvuj2iTZvTStCXOVOz k7ibQpvta2SyJrlWQOAPaGLu8IhxXiODAA0yIg2XVLrJ1V3vqfiamRL+mSDHovpVkcEk w/wt4BIspRbCqSLCxkq0HHLbfhsldIoQyvBOyjzlt031wKivNhxmwhtBsQOjGyZP/qJg Lbtw== 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:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id y4-20020a63e244000000b003864fd74329si2833692pgj.80.2022.04.15.17.48.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 17:48:21 -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; 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D53F4100774; Fri, 15 Apr 2022 17:39:10 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352240AbiDOKsg (ORCPT + 99 others); Fri, 15 Apr 2022 06:48:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242993AbiDOKsf (ORCPT ); Fri, 15 Apr 2022 06:48:35 -0400 Received: from fornost.hmeau.com (helcar.hmeau.com [216.24.177.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F8E5BCB75 for ; Fri, 15 Apr 2022 03:46:06 -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 1nfJSV-003GU9-5k; Fri, 15 Apr 2022 20:45:48 +1000 Received: by gwarestrin.arnor.me.apana.org.au (sSMTP sendmail emulation); Fri, 15 Apr 2022 18:45:47 +0800 Date: Fri, 15 Apr 2022 18:45:47 +0800 From: Herbert Xu To: Ard Biesheuvel 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" 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 Fri, Apr 15, 2022 at 12:22:27PM +0200, Ard Biesheuvel wrote: > > Subsequent objects are owned by the driver, and it is the > responsibility of the driver not to modify the fields while it is also > mapped for DMA (and we have had issues in the past where drivers > violated this rule). So as long as ARCH_KMALLOC_ALIGN guarantees > actual DMA minimum alignment for both the start and the end, we > shouldn't need any explicit padding at the end. I don't understand why this is guaranteed. The driver context size is arbitrary so it could end in the middle of a cacheline. The slab allocator could well lay it out so that the next kmalloc object starts right after the end of the context, in which case they would share a cache-line. The next kmalloc object could be (and in fact is likely to be) of the same type. Previously this wasn't possible because kmalloc guaranteed alignment. > I'l do a scan of drivers/crypto to figure out how much we are relying > on this to begin with. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt