I need to change that. How about this:
bool print_warning = false;
for_each_active_iommu(iommu, drhd) {
/*
* The flush queue implementation does not perform
* page-selective invalidations that are required for efficient
* TLB flushes in virtual environments. The benefit of batching
* is likely to be much lower than the overhead of synchronizing
* the virtual and physical IOMMU page-tables.
*/
if (!print_warning && cap_caching_mode(iommu->cap)) {
pr_warn("IOMMU batching disallowed due to virtualization\n");
iommu_set_dma_strict(true);
print_warning = true;
}
...
}
or use pr_warn_once().
From my p.o.v, pr_xxxx_once() is better.
How about using a pr_info_once()? I don't think it's a warning, it's
just a policy choice in VM environment.