Re: [PATCH 2/3] dma-buf: dma-fence: Add dma_fence_overwrite_timestamp()

From: Philipp Stanner

Date: Fri Nov 20 2026 - 05:02:20 EST


On Fri, 2026-11-20 at 10:38 +0100, Christian König wrote:
> On 11/19/26 14:18, Philipp Stanner wrote:
> > A fence's timestamp is just an opportunistic data point for debugging
> > information etc. drm_sched, for example, uses the timestamps for its
> > scheduling algorithms.
> >
> > In rare situations it can make sense to allow users to overwrite a
> > timestamp with a more accurate value. This is relatively harmless since
> > the timestamp has no meaning for the implementation itself.
> >
> > Add dma_fence_overwrite_timestamp().
>
> I think that this is a very bad idea since it gives the impression
> that overwriting the timestamp on a fence is ok.
>
> That was only done on the scheduled dma-fence because nobody cares
> about that time in the uAPI. For all other cases that can blow up.
>
> I would rather come up with a clean approach for the scheduler to
> track the spend time per entity which would make that hack completely
> superfluous.

Yes, I agree.

The *one* feature we would have needed in C is a public-private system.
With structs in APIs it's often completely undefined what the user can
and cannot touch.

That led to API ossification. Just look at drm_sched, where we now
cannot trivially change API internals anymore because external parties
conveniently use this or that.

> IIRC Tvrtko already created patches for that, I'm just not sure if
> they were ever committed.

I suppose it should be somewhat easy to track that data in
drm_sched_fence.

Maybe Tvrtko can point me to his ideas so I can take a look.

Thx
P.