Re: [PATCH] iommu: Print default strict or lazy mode at init time

From: John Garry
Date: Tue Jun 01 2021 - 13:44:57 EST



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