Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3384997pxb; Wed, 14 Apr 2021 04:27:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzxgcXMf4eLtoKfo5r9LaVcTc7n1bL+SEYcGHE6gTc4AjV8yaZdYZEbZW40J0uGuAgco/jp X-Received: by 2002:a05:6402:105a:: with SMTP id e26mr40326708edu.164.1618399663599; Wed, 14 Apr 2021 04:27:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618399663; cv=none; d=google.com; s=arc-20160816; b=gsqhhQ7b6Jepu2LQVcAfsZuzI525TuVjLwpNbU5i42Nzr7BmT5rTsKPYsrqUsDtLHg 3OyNYEENJ2MLsQdf1Rau7nOFM2nFhL3f/ItCD6np4+gdIZ2HVK6mCgaLk0gNcnCgFssg 219zmeqWXDvvOeV8OrxDPv21VHmQfCMth0c8m/0LRLQ87h1naUSUM9XNaf9m/nfJBARo gYDtJdnyCnvgycO1V3uVTTG/8MQf8U/6ODl2rmC72fTCEMKnMY7MWdpkGuApYrt3PykD WL8e4ByaVMAHND96mETzyxjLr9gluc3GOpr9CCRwsJOXpBVtQXNLNsaPaxkcsBqiuJIj nSpw== 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:subject:from :references:cc:to; bh=mIUIfLYirhEKwscHKnQIsVR2TEMnXBVlKIjt2aMr8FA=; b=oBsT8FKdVRWRZ1dqOKbZ2X+v4BwN2d345ZsTvQKiqDUbMEZxo8qa4GJ6gso3zYY2U/ M1+O8RJ9L0o+4SNHDSsDTtJJ2ulZq9BDV5sDDfnaaJWBe1KJZGNiUQse1V09ALUSKdWu DRyYCq6WeEsAw3IvE0SZNOob46vMIEfK6v9kabHUdyvrRyRUA9f6drFRDNP/6Ja3cECT xlHHVHLloyZ5rsC9po4fhR2UL2VmWdSi5I32wOp8uKBtQJFIecesw4Kt8VLt9+ZYIZLG nap+nAT0jNvmvQUY/geRu8OIFFdtsGHBjxe7brI++Gg85UOhIfmMTMlr9lbyidSch10f glxw== 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=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 11si7037407ejx.245.2021.04.14.04.27.20; Wed, 14 Apr 2021 04:27:43 -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=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344746AbhDNCgz (ORCPT + 99 others); Tue, 13 Apr 2021 22:36:55 -0400 Received: from szxga06-in.huawei.com ([45.249.212.32]:16909 "EHLO szxga06-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230303AbhDNCgy (ORCPT ); Tue, 13 Apr 2021 22:36:54 -0400 Received: from DGGEMS402-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4FKmlM6j0LzjYxw; Wed, 14 Apr 2021 10:34:39 +0800 (CST) Received: from [10.174.185.226] (10.174.185.226) by DGGEMS402-HUB.china.huawei.com (10.3.19.202) with Microsoft SMTP Server id 14.3.498.0; Wed, 14 Apr 2021 10:36:23 +0800 To: Eric Auger , , , , , , , , , , , , , CC: , , , , , , , , , , , , References: <20210411111228.14386-1-eric.auger@redhat.com> From: Xingang Wang Subject: Re: [PATCH v15 00/12] SMMUv3 Nested Stage Setup (IOMMU part) Message-ID: <55930e46-0a45-0d43-b34e-432cf332b42c@huawei.com> Date: Wed, 14 Apr 2021 10:36:11 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: <20210411111228.14386-1-eric.auger@redhat.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.185.226] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Eric, Jean-Philippe On 2021/4/11 19:12, Eric Auger wrote: > SMMUv3 Nested Stage Setup (IOMMU part) > > This series brings the IOMMU part of HW nested paging support > in the SMMUv3. The VFIO part is submitted separately. > > This is based on Jean-Philippe's > [PATCH v14 00/10] iommu: I/O page faults for SMMUv3 > https://www.spinics.net/lists/arm-kernel/msg886518.html > (including the patches that were not pulled for 5.13) > > The IOMMU API is extended to support 2 new API functionalities: > 1) pass the guest stage 1 configuration > 2) pass stage 1 MSI bindings > > Then those capabilities gets implemented in the SMMUv3 driver. > > The virtualizer passes information through the VFIO user API > which cascades them to the iommu subsystem. This allows the guest > to own stage 1 tables and context descriptors (so-called PASID > table) while the host owns stage 2 tables and main configuration > structures (STE). > > Best Regards > > Eric > > This series can be found at: > v5.12-rc6-jean-iopf-14-2stage-v15 > (including the VFIO part in its last version: v13) > I am testing the performance of an accelerator with/without SVA/vSVA, and found there might be some potential performance loss risk for SVA/vSVA. I use a Network and computing encryption device (SEC), and send 1MB request for 10000 times. I trigger mm fault before I send the request, so there should be no iopf. Here's what I got: physical scenario: performance: SVA:9MB/s NOSVA:9MB/s tlb_miss: SVA:302,651 NOSVA:1,223 trans_table_walk_access:SVA:302,276 NOSVA:1,237 VM scenario: performance: vSVA:9MB/s NOvSVA:6MB/s about 30~40% loss tlb_miss: vSVA:4,423,897 NOvSVA:1,907 trans_table_walk_access:vSVA:61,928,430 NOvSVA:21,948 In physical scenario, there's almost no performance loss, but the tlb_miss and trans_table_walk_access of stage 1 for SVA is quite high, comparing to NOSVA. In VM scenario, there's about 30~40% performance loss, this is because the two stage tlb_miss and trans_table_walk_access is even higher, and impact the performance. I compare the procedure of building page table of SVA and NOSVA, and found that NOSVA uses 2MB mapping as far as possible, while SVA uses only 4KB. I retest with huge page, and huge page could solve this problem, the performance of SVA/vSVA is almost the same as NOSVA. I am wondering do you have any other solution for the performance loss of vSVA, or any other method to reduce the tlb_miss/trans_table_walk. Thanks Xingang .