Message ID | 20240205110426.764393-4-aleksander.lobakin@intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-52451-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:168b:b0:106:860b:bbdd with SMTP id ma11csp800644dyb; Mon, 5 Feb 2024 03:06:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IE37uOlJqMFSHYpBiSdEIBOBpDn2wu6S2a+AEh9Z7FfL0u4blAu339sfrhAyXMYgNw9DHOk X-Received: by 2002:a17:907:784a:b0:a37:249c:fc73 with SMTP id lb10-20020a170907784a00b00a37249cfc73mr5536376ejc.15.1707131216177; Mon, 05 Feb 2024 03:06:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707131216; cv=pass; d=google.com; s=arc-20160816; b=jmpKVMy9DgPcxUZSVZZKc17A48ZDaa1fm5lo+9J03a5MpZckzu+YXJxPTPxHWMU+eh rHVgS1yTTGQ+XFzC4iMZkEWxy0MHrIexuSY37i9pr31hkrMSJBuluS8HZF1DuLiDLh/3 YiH+Zrp1Q4NWqo5/RLtCyArO526Hmd+ri+n+gVd0zXXwqCcRCqxJXqcfXwgrnEKAwbCK nIgxQA6oSJCZDbQX/rtdqnJKK/xyzgpf8b4TnGwU/9pInZcW9zwsZrgLxrykTFXhxpYT P567Eq3T5YBkLlj1PzaCth2OIU29ZsoWBFqRVWa670qU4D0sTMajZh5NORBIo2niYW+q 40UQ== 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=3RbYCi97CBUYpb3Qk7i6iB9pJIZcKC+4jz+RMzWKVIE=; fh=q9VfXgg+a8UYJzmEIxPxV3XF3aNZpKZdfjHgQurc4dE=; b=Dpv8SAtENW0fvKS3wGVgi6aMWTB3CYy3ZmS4qI8n2zcqK2Y/oEx+UZ76ZTo41vEq68 6Vc8C+JyKZ9FPqifwQ9tHSYGwfOzVkZqqcachGZ7Y4zBsxa337aI9eV08no290y+SH60 mMHGyYiWtH/m8MvIm3BxLOIyNJjbCOlze+rJK5FYrmiS6s8UyxVmUJH/+MiT49plZ2+C BXyxqVEf9QQym9DLlBzVCn3RcaKTZ7s0vyht44b8zS80/jbZqS6pwOGw+wt5TaYtzX9H k+2cJw6VndDy16WM+Usute3JhVjBOydLYrc1GivwEVrKGiT7l8oc6dvrGSIExxG3QSkn FHQg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OFn7ejKn; 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-52451-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52451-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Forwarded-Encrypted: i=1; AJvYcCWaEcZAQ3NXG/6ku4SJmU83cRrc8XdRgxiW8tPKauiaZGUQLPKhgAA0Ssdg5mwCqKVB6MMm7G8t2xgjfQXAJclVky+O9g== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id gq8-20020a170906e24800b00a37f5b4225asi28853ejb.707.2024.02.05.03.06.55 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Feb 2024 03:06:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-52451-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=OFn7ejKn; 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-52451-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-52451-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 853E01F21099 for <ouuuleilei@gmail.com>; Mon, 5 Feb 2024 11:06:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E44531B7FC; Mon, 5 Feb 2024 11:05:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OFn7ejKn" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (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 33A241A5BA; Mon, 5 Feb 2024 11:05:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707131122; cv=none; b=D0ShCv9zCDsh8jIdjUAnEnbuC/p63X/N2nhsA1I6Op6vm5rgCFbbb+yJbXz9/Xm4BB/99sXvlxKPRKPqHho0E1CShcJ7nj6EPcpmAF309f7kdvHE6unP9umtARKNYbHIXeh/XuBZTnHk+TEa4VVjSrkJ0MdRYidqrKwtaTbdqPg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707131122; c=relaxed/simple; bh=LVf5BgWT9OSmbGH+Qwko5u5SJBVWf1jKCf7S7n+8WTs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tC3pSOWbc108x9GxKS5KzXIs6lxA75TqBhDd2cgPfUURonUcO7SrzMGGBggEY0PVLJAheqbn7oRm6pB6A4NwQzYdGa/y8y2Rup1jVwzAdTPhHUagwk+Zu1308HjZokAa4nIAifk7FWp+I/T9asvVFQ9gVP5vtpIAj7ZQNu+DiuM= 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=OFn7ejKn; arc=none smtp.client-ip=192.198.163.7 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=1707131120; x=1738667120; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LVf5BgWT9OSmbGH+Qwko5u5SJBVWf1jKCf7S7n+8WTs=; b=OFn7ejKnfVsTz6m1MRO70tcOjMaFMF+XZPm/Zk6SoyjQV7gEyCq6xDo1 Isut9fXYTBYalKqIy6erni7Wjb8FHh7eKFdMaFhpa0zfYKuQ6TF+Y3qZu duG7l0vYo7YdjOmcle33LruJrkr1/mNISGmhNs7KA2U6xRtwavma3bOzu 1JsbTNMqlbyQU27obpMk8iymkKGhkEvnULjS8ZqjnYgD964kQT4pR8AZ6 T6iWi2mSZ37B+VOOXLV0hjy+maAHtOoow7QuywTLvTYItt9wI1BiqQX6h Ug9NA7tyuut7O6xGL+2WAb2nhDzh7iEMTxswhA+4LN9bptKnt6r+NNzMj w==; X-IronPort-AV: E=McAfee;i="6600,9927,10974"; a="25945326" X-IronPort-AV: E=Sophos;i="6.05,245,1701158400"; d="scan'208";a="25945326" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Feb 2024 03:05:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,245,1701158400"; d="scan'208";a="5328048" Received: from newjersey.igk.intel.com ([10.102.20.203]) by fmviesa004.fm.intel.com with ESMTP; 05 Feb 2024 03:05:15 -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 v2 3/7] iommu/dma: avoid expensive indirect calls for sync operations Date: Mon, 5 Feb 2024 12:04:22 +0100 Message-ID: <20240205110426.764393-4-aleksander.lobakin@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240205110426.764393-1-aleksander.lobakin@intel.com> References: <20240205110426.764393-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: 1790056822061821877 X-GMAIL-MSGID: 1790056822061821877 |
Series |
dma: skip calling no-op sync ops when possible
|
|
Commit Message
Alexander Lobakin
Feb. 5, 2024, 11:04 a.m. UTC
When IOMMU is on, the actual synchronization happens in the same cases as with the direct DMA. Advertise %DMA_F_CAN_SKIP_SYNC in IOMMU DMA to skip sync ops calls (indirect) for non-SWIOTLB buffers. 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 batched allocations of XSk buffers when IOMMU is active. Co-developed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Alexander Lobakin <aleksander.lobakin@intel.com> --- drivers/iommu/dma-iommu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 50ccc4f1ef81..4ab9ac13d362 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -1707,7 +1707,8 @@ static size_t iommu_dma_opt_mapping_size(void) } static const struct dma_map_ops iommu_dma_ops = { - .flags = DMA_F_PCI_P2PDMA_SUPPORTED, + .flags = DMA_F_PCI_P2PDMA_SUPPORTED | + DMA_F_CAN_SKIP_SYNC, .alloc = iommu_dma_alloc, .free = iommu_dma_free, .alloc_pages = dma_common_alloc_pages,