Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5106071pxj; Tue, 22 Jun 2021 15:26:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw0esMM2JEZk9bcsJxZ+bo01IEXOuNFD6+Jwd+VJHKMVMEFw+XEzPzirIPins+CQKKYQcVn X-Received: by 2002:a6b:6813:: with SMTP id d19mr4739911ioc.35.1624400782256; Tue, 22 Jun 2021 15:26:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624400782; cv=none; d=google.com; s=arc-20160816; b=PiF7tmAKdlpKWQf5BrZkb/ZBi0gv4KrHsHNnDbqux61bOYDzPGb7CZi3+Ale4/WlAW 94dEFcDHGhxm9gnnheimF0rT3emThFulpv/oIKjb9IbeaXp3aCbYlXXbvbteaoR/1mP+ unYS9lmpPwmmz3L3Z195SBYxaRdcBUNhY/ab5G+4gr8phXJJuuElHsbgdxUPanULP+B6 bAH4UpR8Q6Sgfed1McE+HuqvV0dtabYybLGoaGSMhsmIrmJRXSLznu2c3TYdobfrAayR Ewat+is2fz3n4DCGrjVgJQfKteZbhryXzlEEksv48jpVjoua7xGtC2FG8av0sfj05KeR On0Q== 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:from:references :cc:to:subject; bh=RY1/WxzwTo84sx7MWdPIDQJp5i2jDontailZW7hed0s=; b=M8LOs/VqEDD/3HcxdSOFRI7dRUFY2qjKtN7t63aNLRxd2mbu/Kxt6tna3qzVUyhEiS sMoY74BQJ/p6xfvy1mO0QJkPlMWaHGDtFJ3+akUptJ24FNK1WhnpXLaq+g7nIpSYdcjk 9QJFq34fU5thgpjDB8KFJgkjIvUOlY6MHQ+Sf8JjPvUWJdY5qkcevip2JcVBAggyllLy J2qfnijoLWFzqNQ2R3crE4TZZ0dSy6sDDwNXqP3ZhYTNdu4j7CtrSYA7cCqRGn5Ac6zv FKWN6+GnSBhZrdres5X30UOp79jLZsgzDIL2GkRUcBKBkfWJFiph4Y/Yu/Jq5mFiMqKU +NQg== 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=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a14si23139738ilm.103.2021.06.22.15.26.10; Tue, 22 Jun 2021 15:26:22 -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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230185AbhFVW1i (ORCPT + 99 others); Tue, 22 Jun 2021 18:27:38 -0400 Received: from foss.arm.com ([217.140.110.172]:56108 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbhFVW1i (ORCPT ); Tue, 22 Jun 2021 18:27:38 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CB477ED1; Tue, 22 Jun 2021 15:25:21 -0700 (PDT) Received: from [10.57.9.136] (unknown [10.57.9.136]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 08D383F694; Tue, 22 Jun 2021 15:25:19 -0700 (PDT) Subject: Re: [PATCH v14 6/6] iommu: Remove mode argument from iommu_set_dma_strict() To: Lu Baolu , John Garry , joro@8bytes.org, will@kernel.org, dwmw2@infradead.org, corbet@lwn.net Cc: linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, linuxarm@huawei.com, thunder.leizhen@huawei.com, chenxiang66@hisilicon.com, linux-doc@vger.kernel.org References: <1624016058-189713-1-git-send-email-john.garry@huawei.com> <1624016058-189713-7-git-send-email-john.garry@huawei.com> <60bdd7c3-d73e-c005-ddf7-069bc5065bce@huawei.com> <855dd109-1449-7bc6-3d25-7ffeeeffa82a@linux.intel.com> <2330bb52-1768-5122-9378-7923034c82bd@arm.com> <5564e4b7-99af-c357-594a-1a6efe0c1464@linux.intel.com> From: Robin Murphy Message-ID: Date: Tue, 22 Jun 2021 23:25:14 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <5564e4b7-99af-c357-594a-1a6efe0c1464@linux.intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021-06-21 15:32, Lu Baolu wrote: > Hi Robin, > > On 2021/6/21 19:59, Robin Murphy wrote: >> On 2021-06-21 11:34, John Garry wrote: >>> On 21/06/2021 11:00, Lu Baolu wrote: >>>>> void iommu_set_dma_strict(bool force) >>>>> { >>>>>           if (force == true) >>>>>          iommu_dma_strict = true; >>>>>      else if (!(iommu_cmd_line & IOMMU_CMD_LINE_STRICT)) >>>>>          iommu_dma_strict = true; >>>>> } >>>>> >>>>> So we would use iommu_set_dma_strict(true) for a) and b), but >>>>> iommu_set_dma_strict(false) for c). >>>> >>>> Yes. We need to distinguish the "must" and "nice-to-have" cases of >>>> setting strict mode. >>>> >>>>> >>>>> Then I am not sure what you want to do with the accompanying print >>>>> for c). It was: >>>>> "IOMMU batching is disabled due to virtualization" >>>>> >>>>> And now is from this series: >>>>> "IOMMU batching disallowed due to virtualization" >>>>> >>>>> Using iommu_get_dma_strict(domain) is not appropriate here to know >>>>> the current mode (so we know whether to print). >>>>> >>>>> Note that this change would mean that the current series would >>>>> require non-trivial rework, which would be unfortunate so late in >>>>> the cycle. >>>> >>>> This patch series looks good to me and I have added by reviewed-by. >>>> Probably we could make another patch series to improve it so that the >>>> kernel optimization should not override the user setting. >>> >>> On a personal level I would be happy with that approach, but I think >>> it's better to not start changing things right away in a follow-up >>> series. >>> >>> So how about we add this patch (which replaces 6/6 "iommu: Remove >>> mode argument from iommu_set_dma_strict()")? >>> >>> Robin, any opinion? >> >> For me it boils down to whether there are any realistic workloads >> where non-strict mode *would* still perform better under >> virtualisation. The > > At present, we see that strict mode has better performance in the > virtualization environment because it will make the shadow page table > management more efficient. When the hardware supports nested > translation, we may have to re-evaluate this since there's no need for > a shadowing page table anymore. I guess I was assuming that in most cases, proper nested mode could look distinct enough that we'd be able to treat it differently in the first place. For instance, if it's handing guest tables directly to the hardware, would the host have any reason to still set the "caching mode" ID bit? Robin.