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

Configure Feed

Select the types of activity you want to include in your feed.

drm/xe: Prep page reclaim in tlb inval job

Use page reclaim list as indicator if page reclaim action is desired and
pass it to tlb inval fence to handle.

Job will need to maintain its own embedded copy to ensure lifetime of
PRL exist until job has run.

v2:
- Use xe variant of WARN_ON (Michal)

v3:
- Add comments for PRL tile handling and flush behavior with media.
(Matthew Brost)

Signed-off-by: Brian Nguyen <brian3.nguyen@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20251212213225.3564537-19-brian3.nguyen@intel.com

authored by

Brian Nguyen and committed by
Matthew Brost
9945e6a5 2b192beb

+40
+11
drivers/gpu/drm/xe/xe_pt.c
··· 2512 2512 goto kill_vm_tile1; 2513 2513 } 2514 2514 update.ijob = ijob; 2515 + /* 2516 + * Only add page reclaim for the primary GT. Media GT does not have 2517 + * any PPC to flush, so enabling the PPC flush bit for media is 2518 + * effectively a NOP and provides no performance benefit nor 2519 + * interfere with primary GT. 2520 + */ 2521 + if (xe_page_reclaim_list_valid(&pt_update_ops->prl)) { 2522 + xe_tlb_inval_job_add_page_reclaim(ijob, &pt_update_ops->prl); 2523 + /* Release ref from alloc, job will now handle it */ 2524 + xe_page_reclaim_list_invalidate(&pt_update_ops->prl); 2525 + } 2515 2526 2516 2527 if (tile->media_gt) { 2517 2528 dep_scheduler = to_dep_scheduler(q, tile->media_gt);
+25
drivers/gpu/drm/xe/xe_tlb_inval_job.c
··· 7 7 #include "xe_dep_job_types.h" 8 8 #include "xe_dep_scheduler.h" 9 9 #include "xe_exec_queue.h" 10 + #include "xe_gt_printk.h" 10 11 #include "xe_gt_types.h" 12 + #include "xe_page_reclaim.h" 11 13 #include "xe_tlb_inval.h" 12 14 #include "xe_tlb_inval_job.h" 13 15 #include "xe_migrate.h" ··· 118 116 job->start = start; 119 117 job->end = end; 120 118 job->fence_armed = false; 119 + xe_page_reclaim_list_init(&job->prl); 121 120 job->dep.ops = &dep_job_ops; 122 121 job->type = type; 123 122 kref_init(&job->refcount); ··· 152 149 return ERR_PTR(err); 153 150 } 154 151 152 + /** 153 + * xe_tlb_inval_job_add_page_reclaim() - Embed PRL into a TLB job 154 + * @job: TLB invalidation job that may trigger reclamation 155 + * @prl: Page reclaim list populated during unbind 156 + * 157 + * Copies @prl into the job and takes an extra reference to the entry page so 158 + * ownership can transfer to the TLB fence when the job is pushed. 159 + */ 160 + void xe_tlb_inval_job_add_page_reclaim(struct xe_tlb_inval_job *job, 161 + struct xe_page_reclaim_list *prl) 162 + { 163 + struct xe_device *xe = gt_to_xe(job->q->gt); 164 + 165 + xe_gt_WARN_ON(job->q->gt, !xe->info.has_page_reclaim_hw_assist); 166 + job->prl = *prl; 167 + /* Pair with put in job_destroy */ 168 + xe_page_reclaim_entries_get(job->prl.entries); 169 + } 170 + 155 171 static void xe_tlb_inval_job_destroy(struct kref *ref) 156 172 { 157 173 struct xe_tlb_inval_job *job = container_of(ref, typeof(*job), ··· 180 158 struct xe_exec_queue *q = job->q; 181 159 struct xe_device *xe = gt_to_xe(q->gt); 182 160 struct xe_vm *vm = job->vm; 161 + 162 + /* BO creation retains a copy (if used), so no longer needed */ 163 + xe_page_reclaim_entries_put(job->prl.entries); 183 164 184 165 if (!job->fence_armed) 185 166 kfree(ifence);
+4
drivers/gpu/drm/xe/xe_tlb_inval_job.h
··· 12 12 struct xe_dep_scheduler; 13 13 struct xe_exec_queue; 14 14 struct xe_migrate; 15 + struct xe_page_reclaim_list; 15 16 struct xe_tlb_inval; 16 17 struct xe_tlb_inval_job; 17 18 struct xe_vm; ··· 21 20 xe_tlb_inval_job_create(struct xe_exec_queue *q, struct xe_tlb_inval *tlb_inval, 22 21 struct xe_dep_scheduler *dep_scheduler, 23 22 struct xe_vm *vm, u64 start, u64 end, int type); 23 + 24 + void xe_tlb_inval_job_add_page_reclaim(struct xe_tlb_inval_job *job, 25 + struct xe_page_reclaim_list *prl); 24 26 25 27 int xe_tlb_inval_job_alloc_dep(struct xe_tlb_inval_job *job); 26 28