Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3611285pxu; Tue, 8 Dec 2020 17:16:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJyuFYqdDDOPRIZpU4aDjfJIvG7LZjeRarbtnbFJtTecMmTMv5dMurNdy8/cMylRPo2YJMI0 X-Received: by 2002:a17:907:435c:: with SMTP id oc20mr86074ejb.286.1607476590035; Tue, 08 Dec 2020 17:16:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607476590; cv=none; d=google.com; s=arc-20160816; b=gLgsEPLCXslZgfwSOQWDyvoFZMiD6/PPQk+FqO2yamXdWWUVV+bOMHwGsnpPzPddDm D54Uk1i8Jduxize0xgRROqgFSHoZpDyAaGu6rC4xKzzDYf0VIirIAH/FfmFrKDNL9ECH s9EMDhlbrSUG3Jsb6Pjt3CXyNt4MxDc6wrG+S6/sUcW5gaF9RMRsir0LkEFwK1Y9C+qt wl6OA2PoXDBMNESu7Ze0hFilpgTFLxHqRqAXOXChNBpkEP6bkFyC9SkIjSkd799TMneg asf/BaU0IL+HKEzV3ga4A+MeNNbn4VaK/mJdGtmIh6rw7xAeHMdOKpWbKm45oDQmo/Ww cSJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:dkim-signature :date; bh=gwwVo2UYALDlXgQVP9zfPSqgh6x3Qq2AuWfWA4AYG94=; b=V6askDhP3zPbu5fVeJrIwUoDlk+k5H3o5XWW49WQMMcOK2Wqgc/6K6JGccq1s5DuLG uOB7zIcmb5uWgqyIyGI71go/3UIaoSQ/Ly//xdGAiicRWuCmfn9Y14pNd3Ug5Xg9swMh 9oT6tw69c9EkBe1gDQuKGjFxZ/ZyxD2uJmPrrbrktzaZKRlGMFkaDkMnAF65LClRV+LM kitp983c4BQYVIJB6p4hHK/EJ7vVd74t/OQ0u8/lfM7JADqHVlUijG/AYCAnawrDyXAx bteCUFGszPlJt56Eq5bqfihZEz5OymgcSi6brikm9e1WhIx4ZhTCPX8ULKxUG2jxl5I9 ox+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jiTAcSlB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mh22si109916ejb.506.2020.12.08.17.16.07; Tue, 08 Dec 2020 17:16:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jiTAcSlB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731608AbgLHXIh (ORCPT + 99 others); Tue, 8 Dec 2020 18:08:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:49326 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729455AbgLHXIc (ORCPT ); Tue, 8 Dec 2020 18:08:32 -0500 Date: Tue, 8 Dec 2020 15:07:50 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1607468872; bh=nHqLjGa7WrRpzyyp54HyHUJiZs7T5K709l/dHW3MvIo=; h=From:To:Cc:Subject:In-Reply-To:References:From; b=jiTAcSlBteT4edoQqPTbYzc9uZN9uGlK31Aq295tsGDqB7M+JyZSlP6IxdD6I5pP4 5Z/EGkrqlHe8qaG/mf4k1o8rCzZ+l4PNjF/S/ZxcG4ggilpGJsuCEX6k4UIjQEHNf0 CgF7KS6xiA1VOTHsOi9d8Y//20JXs4RGDEaSa06H6OKBSDaHUJs5vsl1SdcQfLKFls l7SiKB+GkxgcuYSdCFE8rdiF+80vK0d2RwM7B0MpwQtOT51egmKfnfhctX6YyP+KpF AMM7qf+hEoZsL+JsFThaMYWKdBabzmB9S4GVrkMiQWXjk4A2WCZnh106CdZ9xou7hC SsE+EkqZQzRyw== From: Jakub Kicinski To: Sven Van Asbroeck Cc: Andrew Lunn , Bryan Whitehead , Microchip Linux Driver Support , David S Miller , netdev , Linux Kernel Mailing List Subject: Re: [PATCH net v1 2/2] lan743x: boost performance: limit PCIe bandwidth requirement Message-ID: <20201208150750.75afc991@kicinski-fedora-pc1c0hjn.DHCP.thefacebook.com> In-Reply-To: References: <20201206034408.31492-1-TheSven73@gmail.com> <20201206034408.31492-2-TheSven73@gmail.com> <20201208114314.743ee6ec@kicinski-fedora-pc1c0hjn.DHCP.thefacebook.com> <20201208225125.GA2602479@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 8 Dec 2020 18:02:30 -0500 Sven Van Asbroeck wrote: > On Tue, Dec 8, 2020 at 5:51 PM Andrew Lunn wrote: > > > So I assumed that it's a PCIe dma bandwidth issue, but I could be wrong - > > > I didn't do any PCIe bandwidth measurements. > > > > Sometimes it is actually cache operations which take all the > > time. This needs to invalidate the cache, so that when the memory is > > then accessed, it get fetched from RAM. On SMP machines, cache > > invalidation can be expensive, due to all the cross CPU operations. > > I've actually got better performance by building a UP kernel on some > > low core count ARM CPUs. > > > > There are some tricks which can be played. Do you actually need all > > 9K? Does the descriptor tell you actually how much is used? You can > > get a nice speed up if you just unmap 64 bytes for a TCP ACK, rather > > than the full 9K. Good point! > Thank you for the suggestion! The original driver developer chose 9K because > presumably that's the largest frame size supported by the chip. > > Yes, I believe the chip will tell us via the descriptor how much it has > written, I would have to double-check. I was already looking for a > "trick" to transfer only the required number of bytes, but I was led to > believe that dma_map_single() and dma_unmap_single() always needed to match. > > So: > dma_map_single(9K) followed by dma_unmap_single(9K) is correct, and > dma_map_single(9K) followed by dma_unmap_single(1500 bytes) means trouble. > > How can we get around that? You can set DMA_ATTR_SKIP_CPU_SYNC and then sync only the part of the buffer that got written.