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.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 F29D1C07E9A for ; Wed, 14 Jul 2021 14:24:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BEB6D6117A for ; Wed, 14 Jul 2021 14:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232268AbhGNO12 (ORCPT ); Wed, 14 Jul 2021 10:27:28 -0400 Received: from mail.kernel.org ([198.145.29.99]:52870 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231977AbhGNO11 (ORCPT ); Wed, 14 Jul 2021 10:27:27 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 57CFD61154; Wed, 14 Jul 2021 14:24:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626272675; bh=uGr4g/Ee6pV+EYvldgWLzrmg2C688Tc8vlJSlq63pk8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=cET9p+pZsUlfkwOTPAtB5/mDe7yDJsg4FzfZffrQRnOVuD0rYqFVb6ZeVscmNktjM bNA7IV3qJNt14ok7rAS5FJ3LfAXGNCKyl42bXGsyuyHfNyQIkBZURhjTYhGVDqTBSH TxgYKIosOSty1JV9snDp7ZdJ2NYRoq/gkKi0nMNIZMI7NA/frs3I90G5cVnZT1Cid6 WIvbWsHG0zjCrPhEFXqGGcASjc9YI16y+p/Xh8ELeyNyhOoZo7e9/786yUHZUa6oAg Do/lYC41xrtfNZS757OeycCgPNWOg2pYEI3fjwaTGVfKxUaSRe6HSlXOboC0wLIOdF XC0EsUYXlRjdg== Subject: Re: [PATCH v7 00/15] Optimizing iommu_[map/unmap] performance To: Georgi Djakov , will@kernel.org, robin.murphy@arm.com Cc: joro@8bytes.org, isaacm@codeaurora.org, baolu.lu@linux.intel.com, pratikp@codeaurora.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <1623850736-389584-1-git-send-email-quic_c_gdjako@quicinc.com> From: Georgi Djakov Message-ID: Date: Wed, 14 Jul 2021 17:24:29 +0300 MIME-Version: 1.0 In-Reply-To: <1623850736-389584-1-git-send-email-quic_c_gdjako@quicinc.com> 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 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. Thanks, Georgi 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=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 B6B97C07E9A for ; Wed, 14 Jul 2021 15:04:30 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (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 5505A613C5 for ; Wed, 14 Jul 2021 15:04:30 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5505A613C5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 0060683CBB; Wed, 14 Jul 2021 15:04:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qkTps4LTewbu; Wed, 14 Jul 2021 15:04:29 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id EDCBB83CA3; Wed, 14 Jul 2021 15:04:28 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 94B6AC001A; Wed, 14 Jul 2021 15:04:28 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id B12E4C000E for ; Wed, 14 Jul 2021 14:24:36 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 92CCE83BFB for ; Wed, 14 Jul 2021 14:24:36 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pgaSQ9rQjEPg for ; Wed, 14 Jul 2021 14:24:36 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp1.osuosl.org (Postfix) with ESMTPS id 1DB6383BF8 for ; Wed, 14 Jul 2021 14:24:36 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 57CFD61154; Wed, 14 Jul 2021 14:24:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626272675; bh=uGr4g/Ee6pV+EYvldgWLzrmg2C688Tc8vlJSlq63pk8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=cET9p+pZsUlfkwOTPAtB5/mDe7yDJsg4FzfZffrQRnOVuD0rYqFVb6ZeVscmNktjM bNA7IV3qJNt14ok7rAS5FJ3LfAXGNCKyl42bXGsyuyHfNyQIkBZURhjTYhGVDqTBSH TxgYKIosOSty1JV9snDp7ZdJ2NYRoq/gkKi0nMNIZMI7NA/frs3I90G5cVnZT1Cid6 WIvbWsHG0zjCrPhEFXqGGcASjc9YI16y+p/Xh8ELeyNyhOoZo7e9/786yUHZUa6oAg Do/lYC41xrtfNZS757OeycCgPNWOg2pYEI3fjwaTGVfKxUaSRe6HSlXOboC0wLIOdF XC0EsUYXlRjdg== Subject: Re: [PATCH v7 00/15] Optimizing iommu_[map/unmap] performance To: Georgi Djakov , will@kernel.org, robin.murphy@arm.com References: <1623850736-389584-1-git-send-email-quic_c_gdjako@quicinc.com> From: Georgi Djakov Message-ID: Date: Wed, 14 Jul 2021 17:24:29 +0300 MIME-Version: 1.0 In-Reply-To: <1623850736-389584-1-git-send-email-quic_c_gdjako@quicinc.com> Content-Language: en-US X-Mailman-Approved-At: Wed, 14 Jul 2021 15:04:27 +0000 Cc: isaacm@codeaurora.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, pratikp@codeaurora.org, linux-arm-kernel@lists.infradead.org X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" 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. Thanks, Georgi _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu 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=-4.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED 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 01533C07E9A for ; Wed, 14 Jul 2021 14:26:29 +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 BC0BD611AD for ; Wed, 14 Jul 2021 14:26:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BC0BD611AD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=fpibPj4v+SNvjpj/vMEortxYQtWoYK3hzNNHrinVA+A=; b=MkR936nboCiq9fsTcrx72m4wwM Lep84Fwvpgwqqoi2Puxmhqds4EMNZQJlBCSlt0lFsjB9sU0+IMqxvomJei4k0P7HvBBzMdn4s5FsG VF+RfhN5cfkauuD0c/JZ9O45B/86UK9bm60Y2tzpbV9svanUHy+2NCxTo6jm2VR+Z7aiAdRXD+syo nDjKzDg79K83p34Rt6dB5l81VuPT6rb4wkW2lx/LJEVRHfSh3ikPFUahN/gdNlsLgtEKLSPMh6C4U kMK8K0qNnNCMdStvt/WCUgLL2oOceztlSb6AMgYO0hhQN1CiQ2qwA0Urexqj47Gv4mt/Logy10NFY dRh7Da5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3foW-00Dpdj-NY; Wed, 14 Jul 2021 14:24:40 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m3foS-00DpdG-F7 for linux-arm-kernel@lists.infradead.org; Wed, 14 Jul 2021 14:24:37 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 57CFD61154; Wed, 14 Jul 2021 14:24:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626272675; bh=uGr4g/Ee6pV+EYvldgWLzrmg2C688Tc8vlJSlq63pk8=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=cET9p+pZsUlfkwOTPAtB5/mDe7yDJsg4FzfZffrQRnOVuD0rYqFVb6ZeVscmNktjM bNA7IV3qJNt14ok7rAS5FJ3LfAXGNCKyl42bXGsyuyHfNyQIkBZURhjTYhGVDqTBSH TxgYKIosOSty1JV9snDp7ZdJ2NYRoq/gkKi0nMNIZMI7NA/frs3I90G5cVnZT1Cid6 WIvbWsHG0zjCrPhEFXqGGcASjc9YI16y+p/Xh8ELeyNyhOoZo7e9/786yUHZUa6oAg Do/lYC41xrtfNZS757OeycCgPNWOg2pYEI3fjwaTGVfKxUaSRe6HSlXOboC0wLIOdF XC0EsUYXlRjdg== Subject: Re: [PATCH v7 00/15] Optimizing iommu_[map/unmap] performance To: Georgi Djakov , will@kernel.org, robin.murphy@arm.com Cc: joro@8bytes.org, isaacm@codeaurora.org, baolu.lu@linux.intel.com, pratikp@codeaurora.org, iommu@lists.linux-foundation.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org References: <1623850736-389584-1-git-send-email-quic_c_gdjako@quicinc.com> From: Georgi Djakov Message-ID: Date: Wed, 14 Jul 2021 17:24:29 +0300 MIME-Version: 1.0 In-Reply-To: <1623850736-389584-1-git-send-email-quic_c_gdjako@quicinc.com> Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210714_072436_578137_23DDC9C5 X-CRM114-Status: GOOD ( 20.27 ) 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 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. Thanks, Georgi _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel