Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3246473rwb; Mon, 3 Oct 2022 11:50:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM438rYL1MX59kmZnVmh0/L2u8j5mHrg4MIuQhOqb5Qw16o8gTzzuyCf3JRdAC/DtHAJTrVJ X-Received: by 2002:a05:6402:406:b0:458:a47:d14c with SMTP id q6-20020a056402040600b004580a47d14cmr19789123edv.41.1664823032778; Mon, 03 Oct 2022 11:50:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664823032; cv=none; d=google.com; s=arc-20160816; b=bkGOoMq2pk6TVDUjGqifgR5DHSNnNuMrNEhleqO5bUV5S1+pVnw1eJBfLxTye8zphN IHrPPdcBl2f7YnbqiP/JmIb7589pxIA+Wo6jnQwHYJ4bJSNQvJPUFovos9VJrtjLcr64 hTsQ01Oc3+WRrARJGPh/gVVuvOOiv+OxJwzSKSqup7y3CYr4upuNk06KA18bRlEV/VTV g+qSHNmitJ4vLkyn4Pcu4dA1dRkHP7fsY5O+i6S26zgJeJ6oKVPPEoXzKvfgPLb3b0sK 3UWpFnsZuuYyDfweE7c6CGe/7YD2ur7v1KR1uJ8ATpqLSIMBJ524ppKOAQc73B+yVx9a gKBA== 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=raBfm/1w+mJc4+z3m+m7AECobfRO0X4LAOveheDXQqM=; b=PwmOdf0LnFNRNM6500k5oJ6xSbtIMnYjJtDU+yAFU5r/R84jTyIfBEwZW9Pa/HP7Qg whZGUrHhkg6qjAxJQVUI4aU7J49Du3FXhe4nXs2ZHL+i2fcJb2ARdHC/XWdywx5DGrPd LY/tC22BLJ2iDrDuatA7t6yzN6c+sKcVGes5LG0bxPByagLRqG6yRSqbWJdFO0V3xs24 sNHXaz5SzGUkvb7uU7ZNskg5jtY0YwtsACU0lf3I7lQZo81DdPt4huJP0LlN01bLG0Z0 edclIp+GvnLibmNuw6tEpc77v8HM5qkTmfMi+qRM1QKLXQK2/sedckMEFwuY12o4zi+D 12Jg== 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 cm4-20020a0564020c8400b004517679cd84si4847655edb.51.2022.10.03.11.50.07; Mon, 03 Oct 2022 11:50:32 -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 S229530AbiJCRkY (ORCPT + 99 others); Mon, 3 Oct 2022 13:40:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229844AbiJCRjz (ORCPT ); Mon, 3 Oct 2022 13:39:55 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 807DF165B7 for ; Mon, 3 Oct 2022 10:39:52 -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 3BE6CB811E1 for ; Mon, 3 Oct 2022 17:39:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 253D0C433C1; Mon, 3 Oct 2022 17:39:46 +0000 (UTC) Date: Mon, 3 Oct 2022 18:39:43 +0100 From: Catalin Marinas To: Linus Torvalds Cc: Ard Biesheuvel , Isaac Manjarres , Herbert Xu , Will Deacon , Marc Zyngier , Arnd Bergmann , Greg Kroah-Hartman , Andrew Morton , Linux Memory Management List , Linux ARM , Linux Kernel Mailing List , "David S. Miller" , Saravana Kannan , kernel-team@android.com 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 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, Oct 02, 2022 at 03:24:57PM -0700, Linus Torvalds wrote: > On Sun, Oct 2, 2022 at 3:09 PM Ard Biesheuvel wrote: > > Non-coherent DMA for networking is going to be fun, though. > > I agree that networking is likely the main performance issue, but I > suspect 99% of the cases would come from __alloc_skb(). The problem is not the allocation but rather having a generic enough dma_needs_bounce() check. It won't be able to tell whether some 1500 byte range is for network or for crypto code that uses a small ARCH_KMALLOC_MINALIGN. Getting the actual object size (e.g. with ksize()) doesn't tell the full story on how safe the DMA is. > Similarly, that code already has magic stuff to try to be > cacheline-aligned for accesses, but it's not really for DMA coherency > reasons, just purely for performance reasons (trying to make sure that > the header accesses stay in one cacheline etc). Yeah, __skb_alloc() ends up using SMP_CACHE_BYTES for data alignment (via SKB_DATA_ALIGN). I have a suspicion this may break on SoCs with a 128-byte cache line but I haven't seen any report yet (there aren't many such systems). -- Catalin