Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp85370pxv; Wed, 14 Jul 2021 19:41:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuHGtk1L3pAB+vgPqlAZkxUj1ZHHCpE9+r+9Vt2XcqDqjlxXYZpEZGKSPC8U4JFj+7mq4Z X-Received: by 2002:a05:6402:d54:: with SMTP id ec20mr2686386edb.41.1626316899851; Wed, 14 Jul 2021 19:41:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626316899; cv=none; d=google.com; s=arc-20160816; b=J+JLKQSqqogvmFOjmCD9L5gfxeMci+IP2HUKMxanTl9+LnhkzooKPcotKtg7hXF9Cn njefQCDLWHUkXrQuq4OklvGwEaraHhaKMJ4ejg77CX0Rt10C9IPjVPbelO+MDSe6cH58 HdMOP6FFWwQfoiTBdtqZyXflLSUP+toEqR3HnbHVtXJrUaWkNuQdm8U5MpG/gI0Jy5IR rROdojd18QFBzqqBQVtvVLh0fNl8Anh8uY5gG9fhZsdPnopv93S+VtR5/k0inOIoXoqv skGud94NiUbX8/ExAEzHxOV0TtiW7ie35WeXVABUgXQGjEGDcNzyNPNeUTTsyWVbk4JB t+xQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :to:subject:cc; bh=3BtLqM+RVuPhBU/fnmALQYEM8GcOeM7z0VqRdTNDNCE=; b=uSUHgkMZLJz0K4FCjz5b08dkq70NVSKVM3qwgXhk35oF79masuZLkYupBmyJ2ZtG96 UhrXt7nWUzY77+m7ROOlD5YhC9SkITRPVuOw3jMoetBonsGMC0/2XI7flZZVMmHtsbPC oSJZCihBgRfRFOqGxU7b0xOuCTFuWVp91WmNWsbP5FcVgZhb0Pv7zfvILhec0LohKzcy ll3AC1DlLyieSOgSxnsyt4Gwfp9dZcEVxDFdp9U/wHyR9JFnL5kPuFTWzMquZlxGfz4B qsxNTW5Lnex+TsKWTe6J4rkbGc0GHPhvQDHV1ivvJ0Vhps2x/BXpEUckGZJxln85RrsK pCGg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n23si4897566ejj.608.2021.07.14.19.41.15; Wed, 14 Jul 2021 19:41:39 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234674AbhGOB2V (ORCPT + 99 others); Wed, 14 Jul 2021 21:28:21 -0400 Received: from mga18.intel.com ([134.134.136.126]:37682 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231186AbhGOB2V (ORCPT ); Wed, 14 Jul 2021 21:28:21 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10045"; a="197721681" X-IronPort-AV: E=Sophos;i="5.84,240,1620716400"; d="scan'208";a="197721681" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Jul 2021 18:25:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.84,240,1620716400"; d="scan'208";a="466322019" Received: from allen-box.sh.intel.com (HELO [10.239.159.118]) ([10.239.159.118]) by fmsmga008.fm.intel.com with ESMTP; 14 Jul 2021 18:25:23 -0700 Cc: baolu.lu@linux.intel.com, joro@8bytes.org, isaacm@codeaurora.org, pratikp@codeaurora.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v7 00/15] Optimizing iommu_[map/unmap] performance To: Georgi Djakov , Georgi Djakov , will@kernel.org, robin.murphy@arm.com References: <1623850736-389584-1-git-send-email-quic_c_gdjako@quicinc.com> From: Lu Baolu Message-ID: <4d466ea9-2c1a-2e19-af5b-0434441ee7cb@linux.intel.com> Date: Thu, 15 Jul 2021 09:23:22 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/14/21 10:24 PM, Georgi Djakov wrote: > On 16.06.21 16:38, Georgi Djakov wrote: >> When unmapping a buffer from an IOMMU domain, the IOMMU framework unmaps >> the buffer at a granule of the largest page size that is supported by >> the IOMMU hardware and fits within the buffer. For every block that >> is unmapped, the IOMMU framework will call into the IOMMU driver, and >> then the io-pgtable framework to walk the page tables to find the entry >> that corresponds to the IOVA, and then unmaps the entry. >> >> This can be suboptimal in scenarios where a buffer or a piece of a >> buffer can be split into several contiguous page blocks of the same size. >> For example, consider an IOMMU that supports 4 KB page blocks, 2 MB page >> blocks, and 1 GB page blocks, and a buffer that is 4 MB in size is being >> unmapped at IOVA 0. The current call-flow will result in 4 indirect >> calls, >> and 2 page table walks, to unmap 2 entries that are next to each other in >> the page-tables, when both entries could have been unmapped in one shot >> by clearing both page table entries in the same call. >> >> The same optimization is applicable to mapping buffers as well, so >> these patches implement a set of callbacks called unmap_pages and >> map_pages to the io-pgtable code and IOMMU drivers which unmaps or maps >> an IOVA range that consists of a number of pages of the same >> page size that is supported by the IOMMU hardware, and allows for >> manipulating multiple page table entries in the same set of indirect >> calls. The reason for introducing these callbacks is to give other IOMMU >> drivers/io-pgtable formats time to change to using the new callbacks, so >> that the transition to using this approach can be done piecemeal. > > Hi Will, > > Did you get a chance to look at this patchset? Most patches are already > acked/reviewed and all still applies clean on rc1. I also have the ops->[un]map_pages implementation for the Intel IOMMU driver. I will post them once the iommu/core part get applied. Best regards, baolu