On Thu, 2026-11-12 at 15:15 +0100, Christian König wrote:
> 
> To allow drivers to more accurately calculate how much time the job spend on 
> the HW.

It's still just not a very good idea to randomly overwrite a fence's
internal value without a formal API contract. This should have done
through a dma_fence_overwrite_timestamp() which is responsible
centrally for the ordering, or, even better, through a separate
timestamp in drm_sched_fence.

Why do they care btw? As far as I have ever seen only amdgpu uses the
scheduled fence. What do you do with it?

I see why Tvrtko needs it, to do the fairness algorithm.

> The time it was pushed the to HW queue is pretty uninteresting for the time 
> spend on the HW.
> 
> What you need is the time it started running and that is when a the previous 
> fence completes.

OK, I see.

> > Is it guaranteed that this fence is signaled and, thus, has a
> > timestamp, or is it not? If it's guaranteed, the test_bit() is actually
> > unnecessary. If it is not guaranteed, then there can be misordering
> > between the two operations and it's UB and, thus, a bug.
> > 
> > That said, I'm OK with your patch here being merged since you did not
> > cause that chaos / problem, but a second patch with a FIXME about the
> > issue that links this mail-thread would be good.
> 
> I've considered this approach as well when we originally merged the
> change, but the timestamps are only like 90% accurate anyway so to be
> honest I don't think it really matters.

You have considered which approach?
What do you think of the memory ordering problem I point out?

And btw above you said that this is done so that drivers can do
something "accurately" :)

But as I said to Tvrtko, we are where we are. This here is no big deal,
but I really want to get the dma_fence memory ordering set straight and
well-documented. The usage patterns have fragmented. It's completely
unclear whether what drm_sched does here is actually legal.


P.

Reply via email to