Re: [PATCH 1/6] iommu: Move IOVA power-of-2 roundup into allocator

John Garry
2021-04-06T16:56:41Z

>>>> So then we have the issue of how to dynamically increase this rcache
>>>> threshold. The problem is that we may have many devices associated with
>>>> the same domain. So, in theory, we can't assume that when we increase
>>>> the threshold that some other device will try to fast free an IOVA
>>>> which
>>>> was allocated prior to the increase and was not rounded up.
>>>>
>>>> I'm very open to better (or less bad) suggestions on how to do this ...
>>> ...but yes, regardless of exactly where it happens, rounding up or not
>>> is the problem for rcaches in general. I've said several times that my
>>> preferred approach is to not change it that dynamically at all, but
>>> instead treat it more like we treat the default domain type.
>>>
>>
>> Can you remind me of that idea? I don't remember you mentioning using
>> default domain handling as a reference in any context.
>

Hi Robin,

> Sorry if the phrasing was unclear there - the allusion to default
> domains is new, it just occurred to me that what we do there is in fact
> fairly close to what I've suggested previously for this. In that case,
> we have a global policy set by the command line, which *can* be
> overridden per-domain via sysfs at runtime, provided the user is willing
> to tear the whole thing down. Using a similar approach here would give a
> fair degree of flexibility but still mean that changes never have to be
> made dynamically to a live domain.

So are you saying that we can handle it similar to how we now can handle
changing default domain for an IOMMU group via sysfs? If so, that just
is not practical here. Reason being that this particular DMA engine
provides the block device giving / mount point, so if we unbind the
driver, we lose / mount point.

And I am not sure if the end user would even know how to set such a
tunable. Or, in this case, why the end user would not want the optimized
range configured always.

I'd still rather if the device driver could provide info which can be
used to configure this before or during probing.

Cheers,
John