Re: [PATCH v13 4/6] iommu/vt-d: Add support for IOMMU default DMA mode build options

From: John Garry
Date: Fri Jun 18 2021 - 03:37:34 EST


On 18/06/2021 02:46, Lu Baolu wrote:

Hi baolu,

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.

ok, I can go with that, which Robin mostly agrees with.

Thanks,
John