Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/scheduler: track GPU active time per entity

Track the accumulated time that jobs from this entity were active
on the GPU. This allows drivers using the scheduler to trivially
implement the DRM fdinfo when the hardware doesn't provide more
specific information than signalling job completion anyways.

[Bagas: Append missing colon to @elapsed_ns]
Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Reviewed-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>

+13
+6
drivers/gpu/drm/scheduler/sched_main.c
··· 895 895 896 896 spin_unlock(&sched->job_list_lock); 897 897 898 + if (job) { 899 + job->entity->elapsed_ns += ktime_to_ns( 900 + ktime_sub(job->s_fence->finished.timestamp, 901 + job->s_fence->scheduled.timestamp)); 902 + } 903 + 898 904 return job; 899 905 } 900 906
+7
include/drm/gpu_scheduler.h
··· 228 228 */ 229 229 struct rb_node rb_tree_node; 230 230 231 + /** 232 + * @elapsed_ns: 233 + * 234 + * Records the amount of time where jobs from this entity were active 235 + * on the GPU. 236 + */ 237 + uint64_t elapsed_ns; 231 238 }; 232 239 233 240 /**