Message ID | 20240126135456.704351-4-aleksander.lobakin@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-40152-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:e09d:b0:103:945f:af90 with SMTP id gm29csp682659dyb; Fri, 26 Jan 2024 06:09:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJtTiFmsHSKzolhjP4ovDZnHClC0VkIDKHsvPeDSl7gOoO0cQ2FNEKYiezUpXXI5vUuf/Q X-Received: by 2002:a05:6a20:43a1:b0:19c:8263:eda8 with SMTP id i33-20020a056a2043a100b0019c8263eda8mr1546645pzl.56.1706278192645; Fri, 26 Jan 2024 06:09:52 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706278192; cv=pass; d=google.com; s=arc-20160816; b=Qyra2d9AuD/xNOlqg43hJBRNgJJPiTpFGHLGCjfvMAmgfwQWRi0VOPbVBDcIvfVUsh vad4NMK0MAkc+mSCrlp+xmfYy8ZSoyWSB9za0+a6EPSV9Bde1yCskgPJs/8vuboLvVL/ BnyjqogY+x7/Dr197iiB123g87izHWU4XR8tKvjyLWZqr6v78bis+srpFJPwsw72FpD5 SenM/y22ksc/D/TkyZxgY9BWFyONZ4vYxiELzQ4MMtq67D1/y1yZzY8UwgyxRFe4bvG+ UEZIbaibImW/DohgXmr0TIW+vTCCfgaTEc+Ce6ABgp0gGQHdn+TZwoQeMlHpl16+sD0a wI7w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9E85X19nXwm1VRh7OajnlPlYxNaiHd23A0Bg/yw8/20=; fh=eTd7umz5bDwrA2O8RT65r37r0t9PpqaUSn0Me2ng9gY=; b=ZPTxY2Ivu9jeOVRyv1yykmXKuFUZPFYni1qLaw9ZM0v0NM7H7/9sRs9vS80WXdLAfu JiUKOa+jAGn9QSHhZb2vugMGEoko7Jgw0ryJeUPj8DzRyvfJaTZNIcX45CFLNhJXk4nx 3RQHFg6ET5n63sebr1fY0Bsqc9nzCtpIoYVNX4mgBAVtgNIlveAb+ef9ZaxdNYGAsqIv BDZvqar8Wcp7FIbiA5X9PtH81HWoV8jbe0rWHBkY3xi4+DKsBQsqJuCswZbbtiKABHaC wyG5xKgdREvdbvB3x6yJy+Wjaq931My6sPiKuhWxaSAK6d5Ca5x1UDPwxXX2Dnd7awqF rx+A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YRUyy89n; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-40152-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40152-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id bx31-20020a056a02051f00b005d5d32bf0cbsi1252022pgb.463.2024.01.26.06.09.52 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 06:09:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40152-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YRUyy89n; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-40152-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40152-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B621A28777C for <ouuuleilei@gmail.com>; Fri, 26 Jan 2024 13:57:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4B5C1BC24; Fri, 26 Jan 2024 13:56:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YRUyy89n" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 198B91C2AD; Fri, 26 Jan 2024 13:56:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.8 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706277368; cv=none; b=gPS6OFdDu/jS7gh44sBEjqIUM+K47zQmd0VgosHSe88gsCMYj7Gd12GGKrsVykkfqNZi2rk7cXKCcB0b7pm1yhzIWUMhEVCBFlUK2ADqghBE46BdferLsTK+W9XPczupKuVuUkY2ewOUY4b4I9+lLGGeynTqODe/UFlv7Y1wAFs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706277368; c=relaxed/simple; bh=BFe+2/b+8r0zXOXtDJDjBJWS1BOIPOK8VSmGKtnTIZ4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TZm6beWc0efBmfnlhdJNkXNRD/n3x4wQPU6r1f8O8cgxd3nBjFGO7i1hhlZ13QFk6fyiDC9Nh62yzQVHmUn1T0ntNV2Tfxk7ZjHuO7jIjQccZILbC+U9RHrLuN9s2rybytiQOq6b6CkVeTyQRlZEvw1+iAhQCtoG4Ucc4qy3UTM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YRUyy89n; arc=none smtp.client-ip=192.198.163.8 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706277367; x=1737813367; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=BFe+2/b+8r0zXOXtDJDjBJWS1BOIPOK8VSmGKtnTIZ4=; b=YRUyy89nQu3NCLXnTVx6feNVZ7MKZ3NLgXz7q5Vv5on4SWsTyi+zkdVY 3aZqFCz47wsXPhO8G2ks4Aw9CcfTGCeoo6V7p3Xki/0OJYF39ijhtHHZH ZwCD61G23OK1INNKu0NbhJ1DqxqxGx33QwsuwNC84ZU4G24nnTtt7gLfj ExSzvDQ6FfZSFLfDOlnk6odvGROpLhfbCyWmL/qV/QpTrkVvyEVDOdHSq +YHcRF5vFHqkkZ0UxFcc4tQW0VbHSB9rdyAob+XxQiHfvivueZ5je3hSR nC5O35mzmw43HXivOJXqiBjjCFt02tiAT4/aR33neN7339Divt4/Lxty4 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="15998455" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="15998455" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2024 05:56:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="821142910" X-IronPort-AV: E=Sophos;i="6.05,216,1701158400"; d="scan'208";a="821142910" Received: from newjersey.igk.intel.com ([10.102.20.203]) by orsmga001.jf.intel.com with ESMTP; 26 Jan 2024 05:56:01 -0800 From: Alexander Lobakin <aleksander.lobakin@intel.com> To: "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> Cc: Alexander Lobakin <aleksander.lobakin@intel.com>, Christoph Hellwig <hch@lst.de>, Marek Szyprowski <m.szyprowski@samsung.com>, Robin Murphy <robin.murphy@arm.com>, Joerg Roedel <joro@8bytes.org>, Will Deacon <will@kernel.org>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J. Wysocki" <rafael@kernel.org>, Magnus Karlsson <magnus.karlsson@intel.com>, Maciej Fijalkowski <maciej.fijalkowski@intel.com>, Alexander Duyck <alexanderduyck@fb.com>, bpf@vger.kernel.org, netdev@vger.kernel.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH net-next 3/7] iommu/dma: avoid expensive indirect calls for sync operations Date: Fri, 26 Jan 2024 14:54:52 +0100 Message-ID: <20240126135456.704351-4-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240126135456.704351-1-aleksander.lobakin@intel.com> References: <20240126135456.704351-1-aleksander.lobakin@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789162361814395805 X-GMAIL-MSGID: 1789162361814395805 |
Series |
dma: skip calling no-op sync ops when possible
|
|
Commit Message
Alexander Lobakin
Jan. 26, 2024, 1:54 p.m. UTC
From: Eric Dumazet <edumazet@google.com> Use the new dma_map_ops::can_skip_sync() callback in IOMMU DMA. It is enough to check only for the DMA coherence, as SWIOTLB is checked dynamically later. perf profile before the patch: 18.53% [kernel] [k] gq_rx_skb 14.77% [kernel] [k] napi_reuse_skb 8.95% [kernel] [k] skb_release_data 5.42% [kernel] [k] dev_gro_receive 5.37% [kernel] [k] memcpy <*> 5.26% [kernel] [k] iommu_dma_sync_sg_for_cpu 4.78% [kernel] [k] tcp_gro_receive <*> 4.42% [kernel] [k] iommu_dma_sync_sg_for_device 4.12% [kernel] [k] ipv6_gro_receive 3.65% [kernel] [k] gq_pool_get 3.25% [kernel] [k] skb_gro_receive 2.07% [kernel] [k] napi_gro_frags 1.98% [kernel] [k] tcp6_gro_receive 1.27% [kernel] [k] gq_rx_prep_buffers 1.18% [kernel] [k] gq_rx_napi_handler 0.99% [kernel] [k] csum_partial 0.74% [kernel] [k] csum_ipv6_magic 0.72% [kernel] [k] free_pcp_prepare 0.60% [kernel] [k] __napi_poll 0.58% [kernel] [k] net_rx_action 0.56% [kernel] [k] read_tsc <*> 0.50% [kernel] [k] __x86_indirect_thunk_r11 0.45% [kernel] [k] memset After patch, lines with <*> no longer show up, and overall cpu usage looks much better (~60% instead of ~72%) 25.56% [kernel] [k] gq_rx_skb 9.90% [kernel] [k] napi_reuse_skb 7.39% [kernel] [k] dev_gro_receive 6.78% [kernel] [k] memcpy 6.53% [kernel] [k] skb_release_data 6.39% [kernel] [k] tcp_gro_receive 5.71% [kernel] [k] ipv6_gro_receive 4.35% [kernel] [k] napi_gro_frags 4.34% [kernel] [k] skb_gro_receive 3.50% [kernel] [k] gq_pool_get 3.08% [kernel] [k] gq_rx_napi_handler 2.35% [kernel] [k] tcp6_gro_receive 2.06% [kernel] [k] gq_rx_prep_buffers 1.32% [kernel] [k] csum_partial 0.93% [kernel] [k] csum_ipv6_magic 0.65% [kernel] [k] net_rx_action iavf yields +10% of Mpps on Rx. This also unblocks batch allocations of XSk buffers when IOMMU is active. Signed-off-by: Eric Dumazet <edumazet@google.com> Co-developed-by: Alexander Lobakin <aleksander.lobakin@intel.com> Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> --- drivers/iommu/dma-iommu.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 50ccc4f1ef81..86290562eda5 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -1720,6 +1720,7 @@ static const struct dma_map_ops iommu_dma_ops = { .unmap_page = iommu_dma_unmap_page, .map_sg = iommu_dma_map_sg, .unmap_sg = iommu_dma_unmap_sg, + .can_skip_sync = dev_is_dma_coherent, .sync_single_for_cpu = iommu_dma_sync_single_for_cpu, .sync_single_for_device = iommu_dma_sync_single_for_device, .sync_sg_for_cpu = iommu_dma_sync_sg_for_cpu,