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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 21E0AC433FE for ; Mon, 3 Oct 2022 17:41:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9enMfx8tQ1huUOoZwyI2FgLhpqyS9QI5gf2L8TjbLGQ=; b=tobNZjo2O4hVNl 0ZZlnddzAeK6xKP4lg3N9vcZN2F66Vi7lLKaEo1TlxOoVW2/ieWCk/IE8adRkQTcv2j/AN08+xJpC iF05RB0olrEBGalQyIW81mZknKF9YZzEAjHOJb+Ys7pGiJgmLWdr5ZspGkAtBeKrLIJow6ZBYkscF J2GMcPN2u4heAxcK6SnKVdOy8mnjhOC15CnEFaASsVvXBCR9BXF411wrx7FVJcjoWvfMRSzRoKQiY fA4G0w/9XELrOau2odi5i5/OAAB7yittiyfClkD7KpozCV+SZZs8b33yLogT4/ZvNzEPWZg6J0YJ2 /6si+yR570ZiE6hW8osQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofPQ2-0075dl-Md; Mon, 03 Oct 2022 17:39:54 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ofPQ0-0075cj-0y for linux-arm-kernel@lists.infradead.org; Mon, 03 Oct 2022 17:39:53 +0000 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-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221003_103952_140861_C1629754 X-CRM114-Status: GOOD ( 17.89 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel