Re: [RFC PATCH] dma-iommu: Add iommu_dma_max_mapping_size()

From: Joerg Roedel
Date: Fri May 20 2022 - 04:52:06 EST


On Wed, May 18, 2022 at 03:13:53PM +0200, Christoph Hellwig wrote:
> On Tue, May 17, 2022 at 01:02:00PM +0100, Robin Murphy wrote:
> >> So how to inform the SCSI driver of this caching limit then so that it may
> >> limit the SGL length?
> >
> > Driver-specific mechanism; block-layer-specific mechanism; redefine this
> > whole API to something like dma_opt_mapping_size(), as a limit above which
> > mappings might become less efficient or start to fail (callback to my
> > thoughts on [1] as well, I suppose); many options. Just not imposing a
> > ridiculously low *maximum* on everyone wherein mapping calls "should not be
> > larger than the returned value" when that's clearly bollocks.
>
> Well, for swiotlb it is a hard limit. So if we want to go down that
> route we need two APIs, one for the optimal size and one for the
> hard limit.

I agree with Robin, and if it really helps some drivers I am all for
doing a dma_opt_mapping_size() instead. Limiting DMA mapping sizes to
make drivers perform better gets a clear NAK from my side.

Regards,

Joerg