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 9377BC433EF for ; Mon, 28 Feb 2022 09:44:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233912AbiB1JpD (ORCPT ); Mon, 28 Feb 2022 04:45:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231599AbiB1JpC (ORCPT ); Mon, 28 Feb 2022 04:45:02 -0500 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BB8169CC4 for ; Mon, 28 Feb 2022 01:44:23 -0800 (PST) Received: from fraeml714-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4K6b6729ZDz67xv7; Mon, 28 Feb 2022 17:43:11 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml714-chm.china.huawei.com (10.206.15.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Mon, 28 Feb 2022 10:44:21 +0100 Received: from [10.47.86.223] (10.47.86.223) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.21; Mon, 28 Feb 2022 09:44:20 +0000 Message-ID: Date: Mon, 28 Feb 2022 09:44:19 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1 Subject: Re: [PATCH v5 0/5] iommu: Allow IOVA rcache range be configured To: , , CC: , , , , , , , , References: <1644859746-20279-1-git-send-email-john.garry@huawei.com> From: John Garry In-Reply-To: <1644859746-20279-1-git-send-email-john.garry@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.47.86.223] X-ClientProxiedBy: lhreml708-chm.china.huawei.com (10.201.108.57) To lhreml724-chm.china.huawei.com (10.201.108.75) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 14/02/2022 17:29, John Garry wrote: Hi guys, And a friendly reminder on this series also. Cheers, john > For streaming DMA mappings involving an IOMMU and whose IOVA len regularly > exceeds the IOVA rcache upper limit (meaning that they are not cached), > performance can be reduced. > > This may be much more pronounced from commit 4e89dce72521 ("iommu/iova: > Retry from last rb tree node if iova search fails"), as discussed at [0]. > > IOVAs which cannot be cached are highly involved in the IOVA ageing issue, > as discussed at [1]. > > This series allows the IOVA rcache range be configured, so that we may > cache all IOVAs per domain, thus improving performance. > > A new IOMMU group sysfs file is added - max_opt_dma_size - which is used > indirectly to configure the IOVA rcache range: > /sys/kernel/iommu_groups/X/max_opt_dma_size > > This file is updated same as how the IOMMU group default domain type is > updated, i.e. must unbind the only device in the group first. > > The inspiration here comes from block layer request queue sysfs > "optimal_io_size" file, in /sys/block/sdX/queue/optimal_io_size > > Some old figures* for storage scenario (when increasing IOVA rcache range > to cover all DMA mapping sizes from the LLD): > v5.13-rc1 baseline: 1200K IOPS > With series: 1800K IOPS > > All above are for IOMMU strict mode. Non-strict mode gives ~1800K IOPS in > all scenarios. > > Based on v5.17-rc4 + [2] > * I lost my high data throughout test setup > > Differences to v4: > https://lore.kernel.org/linux-iommu/1626259003-201303-1-git-send-email-john.garry@huawei.com/ > - Major rebase > - Change the "Refactor iommu_group_store_type()" to not use a callback > and an op type enum instead > - I didn't pick up Will's Ack as it has changed so much > - Use a domain feature flag to keep same default group type > - Add wrapper for default IOVA rcache range > - Combine last 2x patches > > [0] https://lore.kernel.org/linux-iommu/20210129092120.1482-1-thunder.leizhen@huawei.com/ > [1] https://lore.kernel.org/linux-iommu/1607538189-237944-1-git-send-email-john.garry@huawei.com/ > [2] https://lore.kernel.org/linux-iommu/20220203063345-mutt-send-email-mst@kernel.org/T/#m5b2b59576d35cad544314470f32e5f40ac5d1fe9 > > John Garry (5): > iommu: Refactor iommu_group_store_type() > iova: Allow rcache range upper limit to be flexible > iommu: Allow iommu_change_dev_def_domain() realloc same default domain > type > iommu: Allow max opt DMA len be set for a group via sysfs > iova: Add iova_len argument to iova_domain_init_rcaches() > > .../ABI/testing/sysfs-kernel-iommu_groups | 16 ++ > drivers/iommu/dma-iommu.c | 15 +- > drivers/iommu/iommu.c | 202 +++++++++++++----- > drivers/iommu/iova.c | 37 ++-- > drivers/vdpa/vdpa_user/iova_domain.c | 4 +- > include/linux/iommu.h | 7 + > include/linux/iova.h | 6 +- > 7 files changed, 212 insertions(+), 75 deletions(-) >