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

drm/xe: Use q->xef for accessing xe file

No need to traverse through the vm object as each exec queue maintains a
reference to xe_file. Also improve/simplify the comment on why xef is
checked.

Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20241218053122.2730195-2-lucas.demarchi@intel.com
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>

+4 -8
+4 -8
drivers/gpu/drm/xe/xe_exec_queue.c
··· 770 770 void xe_exec_queue_update_run_ticks(struct xe_exec_queue *q) 771 771 { 772 772 struct xe_device *xe = gt_to_xe(q->gt); 773 - struct xe_file *xef; 774 773 struct xe_lrc *lrc; 775 774 u32 old_ts, new_ts; 776 775 int idx; 777 776 778 777 /* 779 - * Jobs that are run during driver load may use an exec_queue, but are 780 - * not associated with a user xe file, so avoid accumulating busyness 781 - * for kernel specific work. 778 + * Jobs that are executed by kernel doesn't have a corresponding xe_file 779 + * and thus are not accounted. 782 780 */ 783 - if (!q->vm || !q->vm->xef) 781 + if (!q->xef) 784 782 return; 785 783 786 784 /* Synchronize with unbind while holding the xe file open */ 787 785 if (!drm_dev_enter(&xe->drm, &idx)) 788 786 return; 789 - 790 - xef = q->vm->xef; 791 787 792 788 /* 793 789 * Only sample the first LRC. For parallel submission, all of them are ··· 795 799 */ 796 800 lrc = q->lrc[0]; 797 801 new_ts = xe_lrc_update_timestamp(lrc, &old_ts); 798 - xef->run_ticks[q->class] += (new_ts - old_ts) * q->width; 802 + q->xef->run_ticks[q->class] += (new_ts - old_ts) * q->width; 799 803 800 804 drm_dev_exit(idx); 801 805 }