[Intel-xe] Refcounting in drm_exec

Thomas Hellström thomas at shipmail.org
Thu Aug 31 15:45:17 UTC 2023


On 8/31/23 17:19, Christian König wrote:
> Hi Thomas,
>
> Am 31.08.23 um 17:12 schrieb Thomas Hellström:
>> Hi, Christian, Danilo
>>
>> Looking at the drm_exec code it seems we refcount *all* locked 
>> objects until drm_exec_fini(). Are callers supposed to be able to 
>> *rely* on this?
>
> Yes, that's one of the motivations for this component.


OK, isn't that a pretty big overhead?


>
>> I'm asking because refcounting appears only strictly necessary for 
>> contended- and prelocked objects, and callers would otherwise need to 
>> make sure they don't drop a locked object across the lock? It's going 
>> to be pretty hard to change this in the future if we want for added 
>> efficiency if people start to rely on it.
>>
>> Also seems drm_exec_unlock_all() drops the prelocked object without 
>> unlocking. I'll put together a patch.
>
> That's correct behavior.
>
> The prelocked object is part of the locked objects array as well. So 
> we just need to drop the reference.
>
> This was actually a bug in one of the earlier versions.

Hmm. I just got a warning that drm_exec_unlock_all() freed a locked 
object. Need to dig a bit deeper then.

/Thomas


>
> Regards,
> Christian.
>
>>
>> Thanks,
>>
>> Thomas'
>>


More information about the Intel-xe mailing list