[Intel-gfx] [PATCH] drm/i915: Fix DMA mapped scatterlist walks

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Wed Sep 9 13:43:58 UTC 2020


On 09/09/2020 14:03, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2020-09-09 13:44:57)
>> From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
>>
>> When walking DMA mapped scatterlists sg_dma_len has to be used since it
>> can be different (coalesced) from the backing store entry.
>>
>> This also means we have to end the walk when encountering a zero length
>> DMA entry and cannot rely on the normal sg list end marker.
>>
>> Both issues were there in theory for some time but were hidden by the fact
>> Intel IOMMU driver was never coalescing entries. As there are ongoing
>> efforts to change this we need to start handling it.
> 
> Does this change anything if we were already feeding in coalesced
> entries? I doubt we made all sg generators compact the lists though.

I don't think so. My takeaway from this was a realization that page and 
dma coalescing can be completely different (more so once the iommu 
patches get in). I did not think of any other problems as long as the 
dma remapping fits into the number of available sg table entries we 
allocated. It is just a bit weird, this duality of sg_table "views".

> The change looks reasonable, it seems you have kept the dma and page
> iterators distinct, which was the only worry that occurred to me.

It surprised me we have two iterators, well one and a half. The sgt_dma 
one being the half of an iterator. :)

Regards,

Tvrtko

P.S. Well as I was writing this reply full test results came in and 
something is still broken, so scratch that..


More information about the Intel-gfx mailing list