On 12/11/2026 14:51, Christian König wrote:
And btw above you said that this is done so that drivers can do
something "accurately" :)
Well "more accurately", e.g. the accuracy increases from completely off to only
slightly off :)
Yeah it works pretty well expect one corner case on AMD which I
discovered couple days ago but that's unrelated to this.
For what DRM scheduler is concerned, this patch is only adding a
time_after() guard so shouldn't really be controversial. Any further
improvements can be done on top.
Because of the interrupt latency and everything involved a submission which
takes 3ms can report in anything from 3ms to 6ms runtime from my experience.
If somebody wants this to be really accurate we would need to record the HW
timestamps. That is possible, Intel does that for example, but for AMD HW
nobody really cared enough so far to requests this.
On Intel context's runtime is recorded by the GPU on context save. This
makes it almost trivial and removes any complications with queue depth
etc. Only trick is when a context is currently running to report last
known hardware runtime plus the time between last schedule in and the
query. And it requires the driver to know how to convert between the GPU
and system clock domains but that's trivial.
Does AMD have something similar? If so perhaps it could also solve the
problem of the high priority and normal priority gfx rings randomly
inflating the reported runtime to sum up above 100%. Then we could add a
mechanism for the DRM scheduler to either ask the driver, or allow the
driver to provide accurate job runtime.
Regards,
Tvrtko