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=-5.9 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 7C974C47080 for ; Tue, 1 Jun 2021 17:44:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62F62610C9 for ; Tue, 1 Jun 2021 17:44:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234581AbhFARqh (ORCPT ); Tue, 1 Jun 2021 13:46:37 -0400 Received: from frasgout.his.huawei.com ([185.176.79.56]:3129 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231331AbhFARqf (ORCPT ); Tue, 1 Jun 2021 13:46:35 -0400 Received: from fraeml744-chm.china.huawei.com (unknown [172.18.147.200]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4FvfWz0HFmz6P3Ml; Wed, 2 Jun 2021 01:38:23 +0800 (CST) Received: from lhreml724-chm.china.huawei.com (10.201.108.75) by fraeml744-chm.china.huawei.com (10.206.15.225) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 1 Jun 2021 19:44:52 +0200 Received: from [10.47.91.52] (10.47.91.52) by lhreml724-chm.china.huawei.com (10.201.108.75) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Tue, 1 Jun 2021 18:44:51 +0100 Subject: Re: [PATCH] iommu: Print default strict or lazy mode at init time To: Robin Murphy , , CC: , , References: <1622209074-37899-1-git-send-email-john.garry@huawei.com> <3ee986a0-29c1-100c-c72f-360f919caf7d@arm.com> <58ea001c-4c37-9c5a-77be-38ac3bea2476@arm.com> From: John Garry Message-ID: <72eb3de9-1d1c-ae46-c5a9-95f26525d435@huawei.com> Date: Tue, 1 Jun 2021 18:44:00 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <58ea001c-4c37-9c5a-77be-38ac3bea2476@arm.com> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.47.91.52] X-ClientProxiedBy: lhreml729-chm.china.huawei.com (10.201.108.80) 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 >> >> pr_info("DMA domain default TLB invalidation policy: %s mode %s\n", >>                iommu_dma_strict ? "strict" : "lazy", >>                 (iommu_cmd_line & IOMMU_CMD_LINE_STRICT) ? >>                         "(set via kernel command line)" : ""); >> >> I think it's worth mentioning "default" somewhere, as not all IOMMUs >> or devices will use lazy mode even if it's default. > > But that's part of what I think is misleading - I boot and see that the > default is something, so I reboot with iommu.strict to explicitly set it > the other way, but now that's the default... huh? > > The way I see it, we're saying what the current IOMMU API policy is - > the value of iommu_dma_strict at any given time is fact - but we're not > necessarily saying how widely that policy is enforced. We similarly > report the type for default domains from global policy even though that > may also be overridden per-group by drivers and/or userspace later; > we > don't say it's the *default* default domain type. I think that is this is the behavior a user would understand from that message. However from a glance at the intel IOMMU driver, it seems possible to change default domain type after iommu_subsys_init(). > > However, having now debugged the AMD issue from another thread, I think > doing this at subsys_initcall is in fact going to be too early to be > meaningful, since it ignores drivers' ability to change the global > policy :( A user may still learn the IOMMU group domain type from sysfs. There is no such thing for TLB invalidation mode - how about add a file for this? It would be useful. Thanks, John