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 081AFC433FE for ; Mon, 3 Oct 2022 17:39:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 656DE6B0071; Mon, 3 Oct 2022 13:39:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 604566B0073; Mon, 3 Oct 2022 13:39:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4CBF18E0001; Mon, 3 Oct 2022 13:39:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 3CC4C6B0071 for ; Mon, 3 Oct 2022 13:39:52 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 102A8140961 for ; Mon, 3 Oct 2022 17:39:52 +0000 (UTC) X-FDA: 79980351024.27.35D1734 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf06.hostedemail.com (Postfix) with ESMTP id 7EF67180016 for ; Mon, 3 Oct 2022 17:39:51 +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 9241E61189; Mon, 3 Oct 2022 17:39:50 +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: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664818791; a=rsa-sha256; cv=none; b=jbejTr0fB+M/+aHfwFdT8I24rmP4SG9OBBHK3aQzXTi2TL4+8bklmzcJwywDSTXa4KhA3h dAsEjpKDiA7vFe2KgtGMtIvilI+uLLMvQFYKos2fh4NG702x/6zcGnl3X0fUIieE7XGNxE 7LF4vlz2K+17FPy0a35+cdwc0G/XHoY= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf06.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664818791; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=raBfm/1w+mJc4+z3m+m7AECobfRO0X4LAOveheDXQqM=; b=4QGRDKqZVO1u4lpAmJLPHIA0779Dknz8cJFiwjR/lW4KKD4MizxiMQQz9e7NkviJy6Gx2H xQz16O05R45h9UWmSHzrLxxvq5H5OWDHir2dzZdQXsFj7tvZh7zDXW672KDmSxmkUHGfSy sDB8U+iGe3ppmXPU7sD21qs6/pol+FE= X-Rspamd-Server: rspam08 X-Rspam-User: X-Rspamd-Queue-Id: 7EF67180016 Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=fail reason="SPF not aligned (relaxed), No valid DKIM" header.from=arm.com (policy=none); spf=pass (imf06.hostedemail.com: domain of cmarinas@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=cmarinas@kernel.org X-Stat-Signature: 7yx3dzgynkpxxaykiez6z9rtk31azncj X-HE-Tag: 1664818791-480961 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 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