On 2020-02-17 08:03, Robin Murphy wrote:
On 14/02/2020 11:06 pm, Isaac J. Manjarres wrote:The usecases where the IOVA space has been fragmented have non-deterministic allocation
From: Liam Mark <lmark@xxxxxxxxxxxxxx>
Using the best-fit algorithm, instead of the first-fit
algorithm, may reduce fragmentation when allocating
IOVAs.
What kind of pathological allocation patterns make that a serious
problem? Is there any scope for simply changing the order of things in
the callers? Do these drivers also run under other DMA API backends
(e.g. 32-bit Arm)?
patterns, and thus, it's not feasible to change the allocation order to avoid fragmenting
the IOVA space.
From what we've observed, the usecases involve allocations of two types of
buffers: one type of buffer between 1 KB to 4 MB in size, and another type of
buffer between 1 KB to 400 MB in size.
The pathological scenarios seem to arise when there are
many (100+) randomly distributed non-power of two allocations, which in some cases leaves
behind holes of up to 100+ MB in the IOVA space.
Here are some examples that show the state of the IOVA space under which failure to
allocate an IOVA was observed:
Instance 1:
ÂÂÂÂCurrently mapped total size : ~1.3GB
ÂÂÂÂFree space available : ~2GB
ÂÂÂÂMap for ~162MB fails.
ÂÂÂÂÂÂÂ Max contiguous space available : < 162MB
Instance 2:
ÂÂÂÂCurrently mapped total size : ~950MB
ÂÂÂÂFree space available : ~2.3GB
ÂÂÂÂMap for ~320MB fails.
ÂÂÂÂMax contiguous space available : ~189MB
Instance 3:
ÂÂÂÂCurrently mapped total size : ~1.2GB
ÂÂÂÂFree space available : ~2.7GB
ÂÂÂÂMap for ~162MB fails.
ÂÂÂÂMax contiguous space available : <162MB
We are still in the process of collecting data with the best-fit algorithm enabled
to provide some numbers to show that it results in less IOVA space
fragmentation.
To answer your question about whether if this driver run under other DMA API backends:
yes, such as 32 bit ARM.