[Spice-devel] [Linaro-mm-sig] [PATCH v2 3/5] dma-buf: Move all dma-bufs to dynamic locking specification

Dmitry Osipenko dmitry.osipenko at collabora.com
Fri Aug 12 11:46:20 UTC 2022


On 8/12/22 14:34, Christian König wrote:
> 
> 
> Am 10.08.22 um 20:53 schrieb Dmitry Osipenko:
>> On 8/10/22 21:25, Christian König wrote:
>>> Am 10.08.22 um 19:49 schrieb Dmitry Osipenko:
>>>> On 8/10/22 14:30, Christian König wrote:
>>>>> Am 25.07.22 um 17:18 schrieb Dmitry Osipenko:
>>>>>> This patch moves the non-dynamic dma-buf users over to the dynamic
>>>>>> locking specification. The strict locking convention prevents
>>>>>> deadlock
>>>>>> situation for dma-buf importers and exporters.
>>>>>>
>>>>>> Previously the "unlocked" versions of the dma-buf API functions
>>>>>> weren't
>>>>>> taking the reservation lock and this patch makes them to take the
>>>>>> lock.
>>>>>>
>>>>>> Intel and AMD GPU drivers already were mapping imported dma-bufs
>>>>>> under
>>>>>> the held lock, hence the "locked" variant of the functions are added
>>>>>> for them and the drivers are updated to use the "locked" versions.
>>>>> In general "Yes, please", but that won't be that easy.
>>>>>
>>>>> You not only need to change amdgpu and i915, but all drivers
>>>>> implementing the map_dma_buf(), unmap_dma_buf() callbacks.
>>>>>
>>>>> Auditing all that code is a huge bunch of work.
>>>> Hm, neither of drivers take the resv lock in map_dma_buf/unmap_dma_buf.
>>>> It's easy to audit them all and I did it. So either I'm missing
>>>> something or it doesn't take much time to check them all. Am I really
>>>> missing something?
>>> Ok, so this is only changing map/unmap now?
>> It also vmap/vunmap and attach/detach: In the previous patch I added the
>> _unlocked postfix to the func names and in this patch I made them all to
>> actually take the lock.
> 
> 
> Take your patch "[PATCH v2 2/5] drm/gem: Take reservation lock for
> vmap/vunmap operations" as a blueprint on how to approach it.
> 
> E.g. one callback at a time and then document the result in the end.

Yeah, I'll do it for v3. I'm vaguely recalling that there was a problem
when I wanted to split this patch in the past, but don't remember what
it was.. maybe that problem is gone now, will see :)

-- 
Best regards,
Dmitry


More information about the Spice-devel mailing list