Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2585580pxm; Mon, 28 Feb 2022 01:59:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwPrhwSxaLddZpOqcp23UWggC/zpJebJG8dFz223nrsm8MLKdoJwHTsaj4UmrkkJ+q7lDLt X-Received: by 2002:a17:90a:ac09:b0:1bc:3e9d:158 with SMTP id o9-20020a17090aac0900b001bc3e9d0158mr15647686pjq.235.1646042353927; Mon, 28 Feb 2022 01:59:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646042353; cv=none; d=google.com; s=arc-20160816; b=YWE7zZ22+aPRpDbKhuPelz/RbRPHxEFyxbqtiJFLjHTxwLww8n2hgKEOQmsjJdyZsv T21sRzu0pqj/pYKVFPfC2Vk+q/0kNLBcAnsz8jCyBUD4/SfnXrjFNmQr1fUu9EZinRkV kZ8gDmj/bV9zj8t9M8SlZUGTMGe9ANGOMVdqgEix4CsMF2EICnRQUFb0aQhKudJ5RVsm M1ASMUrniTki+vFT88GNGM6usTRdKDC/ndF7NkAwUS+J7cvfIb9GQEECSai/BVWnFRYJ 6cW3J3xEuJUG8QSwivXF7UXIQfOIVEyBUH06nwPENVSWS9pj39di36HZ5dHiBA/S2nzp 3+1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=2tjQ7fK/COL1S2BhApj/o49XtSfu+jXLqB6CLevi1/8=; b=YX3y+fLMXN+3JF1YdEZcZWodckYsBjtQlgS1+pDgUvB38C3rkZDreRM9eALNqBrXYl ujVMQLOvurh7JHLj7QkCuiOmEShwkXsNZszntxBxnfceu7K0135TwK1wIqLBGyplu6Kc iyDltlwEgwu0Mohh5cHTSKlSe7UFSzf/s3StNGcBqjcnOHcxwDq4sfGyd9zQRcieeKtP C6mS4h2g7YFAg2XlBNNR6Fk2LLyB3J4n7uWUmRsPCGhJPdsJbpUCL4YvZh9E9XUUO3Tz rFVxoPq6rj92J4NVLRDYpD+kcn4fCr/bdcSD+p96IDGoPV1rzA10AeDF9wWnthDPadyj pMJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q21-20020a170902edd500b0014faf204b42si8529204plk.368.2022.02.28.01.58.59; Mon, 28 Feb 2022 01:59:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232628AbiB1JpD (ORCPT + 99 others); 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 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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(-) >