On 25-Feb-20 1:49 PM, Ray Kinsella wrote:
Hi Anatoly,

On 25/02/2020 13:24, Anatoly Burakov wrote:
Currently, when we are creating DMA mappings for memory that's
either external or is backed by hugepages in IOVA as PA mode, we
assume that each page is necessarily discontiguous. This may not
actually be the case, especially for external memory, where the
user is able to create their own IOVA table and make it
contiguous. This is a problem because VFIO has a limited number
of DMA mappings, and it does not appear to concatenate them and
treats each mapping as separate, even when they cover adjacent
areas.
Fix this so that we always map contiguous memory in a single
chunk, as opposed to mapping each segment separately.

Can I confirm my understanding.

We are essentially correcting user errant behavior,
trading off startup/mapping time to save IOMMU resources?


That's not quite what we're doing.

First of all, in terms of "trading startup/mapping time", i think this will actually be faster because the DMA map is the more resource-intensive part of this loop by far, and we're doing _less_ of those (because we're concatenating). We're also doing the same number of loop iterations as before.

To be perfectly clear: we're not reordering segments here - segments have to be VA- and IOVA-contiguous in the first place, otherwise we're breaking them up. It's just that previously, we were also breaking up contiguous segments into separate, per-page mappings, but now we concatenate them.

--
Thanks,
Anatoly

Reply via email to