Re: [PATCH v2 3/3] drm/amdgpu: Fix timestamp misordering
From: Christian König
Date: Tue Dec 01 2026 - 09:43:53 EST
On 12/1/26 15:18, Philipp Stanner wrote:
> On Tue, 2026-12-01 at 15:10 +0100, Christian König wrote:
>> On 12/1/26 10:17, Philipp Stanner wrote:
>>>
>
> […]
>
>>>
>>> /* When the fence is not even scheduled it can't have spend time */
>>> s_fence = to_drm_sched_fence(fence);
>>> - if (!test_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &s_fence->scheduled.flags))
>>> + if (!test_bit_acquire(DMA_FENCE_FLAG_TIMESTAMP_BIT, &s_fence->scheduled.flags))
>>
>> That one looks unnecessary to me because we don't really care about the timestamp value.
>
> You do care, you read it at the end of the function. It's just that
> coincidentally another memory barrier is in between which should do the
> ordering.
Yeah good point. That is actually the reason why I don't like the acquire/release API and prefer the barrier API, that was just so much easier to understand.
Regards,
Christian.
>
> I suggest we do this formally correct here.
> Originally btw I wrote it like that because the entire code can be made
> more readable with two helper variables. So this code here could then
> use the new dma_fence_timestamp().
>
> But ultimately your choice, since it's your user whose bypassing the
> API here.
>
>
> P.