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 X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 04231C12002 for ; Thu, 15 Jul 2021 01:27:46 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C6F40613CC for ; Thu, 15 Jul 2021 01:27:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C6F40613CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Cc:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FQkNU+5TcC05akyZZS2Dd4Vfd96qGGjUVCzmSx/JL2M=; b=bSx/IzxXPIv9swnAXHyuEO8tUL chUrc/muDJPHDw94jIRPDXhIlh4uX7rdWzb1vRi/0LwABoRLYkK85QoHREBMedULa26kkpmV4GE9U fDRpQQoo5NaEs3r/C0XKZMKZHPw/TQpMLSGT5urlGRtswvtXypxRXq5h5nI5jMByLPIHmsfhS/Gsg 1APMlKVgjonG1EAvEkclE/Y5G4HmQa8ljhBuW7Yp3AuTuQn4Iof2pz4qPRuJXbwWaWEQ5khVKsAVx 8frZaHB0hKPS2zIIaoHsVHS38QaJXbL53XgG2Ox7Om/wd3pH7n6JkHhcgyCo5Bfc62AiQ6qZnCVBQ d8Au4BWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3q85-00GlVC-Rw; Thu, 15 Jul 2021 01:25:33 +0000 Received: from mga04.intel.com ([192.55.52.120]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3q81-00GlUf-W0 for linux-arm-kernel@lists.infradead.org; Thu, 15 Jul 2021 01:25:31 +0000 X-IronPort-AV: E=McAfee;i="6200,9189,10045"; a="208638532" X-IronPort-AV: E=Sophos;i="5.84,240,1620716400"; d="scan'208";a="208638532" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.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-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210714_182530_097908_360AD72E X-CRM114-Status: GOOD ( 23.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel