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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CECAC63797 for ; Mon, 6 Feb 2023 11:05:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229844AbjBFLFl (ORCPT ); Mon, 6 Feb 2023 06:05:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57562 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229827AbjBFLFi (ORCPT ); Mon, 6 Feb 2023 06:05:38 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A5D6DEC71; Mon, 6 Feb 2023 03:05:37 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id AFE9313D5; Mon, 6 Feb 2023 03:06:19 -0800 (PST) Received: from [10.57.89.151] (unknown [10.57.89.151]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C1EF43F8C6; Mon, 6 Feb 2023 03:05:35 -0800 (PST) Message-ID: Date: Mon, 6 Feb 2023 11:05:32 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH] iommu/vt-d: Avoid superfluous IOTLB tracking in lazy mode Content-Language: en-GB To: Jacob Pan , LKML , iommu@lists.linux.dev, Lu Baolu , Joerg Roedel Cc: David Woodhouse , Raj Ashok , "Tian, Kevin" , Yi Liu , stable@vger.kernel.org, Sanjay Kumar References: <20230203230417.1287325-1-jacob.jun.pan@linux.intel.com> From: Robin Murphy In-Reply-To: <20230203230417.1287325-1-jacob.jun.pan@linux.intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-02-03 23:04, Jacob Pan wrote: > Intel IOMMU driver implements IOTLB flush queue with domain selective > or PASID selective invalidations. In this case there's no need to track > IOVA page range and sync IOTLBs, which may cause significant performance > hit. > > This patch adds a check to avoid IOVA gather page and IOTLB sync for > the lazy path. > > The performance difference on Sapphire Rapids 100Gb NIC is improved by > the following (as measured by iperf send): > > w/o this fix~48 Gbits/s. with this fix ~54 Gbits/s Reviewed-by: Robin Murphy > Cc: > Tested-by: Sanjay Kumar > Signed-off-by: Sanjay Kumar > Signed-off-by: Jacob Pan > --- > drivers/iommu/intel/iommu.c | 8 +++++++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c > index b4878c7ac008..705a1c66691a 100644 > --- a/drivers/iommu/intel/iommu.c > +++ b/drivers/iommu/intel/iommu.c > @@ -4352,7 +4352,13 @@ static size_t intel_iommu_unmap(struct iommu_domain *domain, > if (dmar_domain->max_addr == iova + size) > dmar_domain->max_addr = iova; > > - iommu_iotlb_gather_add_page(domain, gather, iova, size); > + /* > + * We do not use page-selective IOTLB invalidation in flush queue, > + * There is no need to track page and sync iotlb. Domain-selective or > + * PASID-selective validation are used in the flush queue. > + */ > + if (!gather->queued) > + iommu_iotlb_gather_add_page(domain, gather, iova, size); > > return size; > }