Re: [PATCH v4] iommu: Optimise PCI SAC address trick

From: Robin Murphy
Date: Thu Jun 15 2023 - 05:05:08 EST


On 2023-06-15 08:49, John Garry wrote:
On 13/06/2023 18:58, Jakub Kicinski wrote:
On Fri, 14 Apr 2023 13:45:34 +0200 Joerg Roedel wrote:
Thanks for working on this, I think this is good to go. But given the
issues we had with last attempt I'd like to have this in linux-next for
a few weeks before sending it upstream. Therefore I will defer this
patch and merge it early in the next cycle.
Is this patch queued up? I don't see it in linux-next and we keep
hitting this issue in production. After a few NIC reconfigurations
IOMMU starts consuming 90+% of CPU time.


Since we're at rc6 time and a cautious approach was wanted to merge this change, I doubt that this will be merged for this cycle. That's quite unfortunate.

Please note what I mentioned earlier about using dma_opt_mapping_size(). This API is used by some block storage drivers to avoid your same problem, by clamping max_sectors_kb at this size - see sysfs-block Doc for info there. Maybe it can be used similarly for network drivers.

It's not the same problem - in this case the mappings are already small enough to use the rcaches, and it seems more to do with the total number of unusable cached IOVAs being enough to keep the 32-bit space almost-but-not-quite full most of the time, defeating the max32_alloc_size optimisation whenever the caches run out of the right size entries.

The manual workaround for now would be to boot with "iommu.forcedac=1" and hope that no other devices break because of it.

Thanks,
Robin.