Skip to content

Commit cdc8a1e

Browse files
mbrost05rodrigovivi
authored andcommitted
drm/xe: Do not preempt fence signaling CS instructions
If a batch buffer is complete, it makes little sense to preempt the fence signaling instructions in the ring, as the largest portion of the work (the batch buffer) is already done and fence signaling consists of only a few instructions. If these instructions are preempted, the GuC would need to perform a context switch just to signal the fence, which is costly and delays fence signaling. Avoid this scenario by disabling preemption immediately after the BB start instruction and re-enabling it after executing the fence signaling instructions. Fixes: dd08ebf ("drm/xe: Introduce a new DRM driver for Intel GPUs") Cc: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Cc: Carlos Santa <carlos.santa@intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Daniele Ceraolo Spurio <daniele.ceraolospurio@intel.com> Link: https://patch.msgid.link/20260115004546.58060-1-matthew.brost@intel.com (cherry picked from commit 2bcbf2d) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent 11439c4 commit cdc8a1e

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

drivers/gpu/drm/xe/xe_ring_ops.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,9 @@ static void __emit_job_gen12_simple(struct xe_sched_job *job, struct xe_lrc *lrc
280280

281281
i = emit_bb_start(batch_addr, ppgtt_flag, dw, i);
282282

283+
/* Don't preempt fence signaling */
284+
dw[i++] = MI_ARB_ON_OFF | MI_ARB_DISABLE;
285+
283286
if (job->user_fence.used) {
284287
i = emit_flush_dw(dw, i);
285288
i = emit_store_imm_ppgtt_posted(job->user_fence.addr,
@@ -345,6 +348,9 @@ static void __emit_job_gen12_video(struct xe_sched_job *job, struct xe_lrc *lrc,
345348

346349
i = emit_bb_start(batch_addr, ppgtt_flag, dw, i);
347350

351+
/* Don't preempt fence signaling */
352+
dw[i++] = MI_ARB_ON_OFF | MI_ARB_DISABLE;
353+
348354
if (job->user_fence.used) {
349355
i = emit_flush_dw(dw, i);
350356
i = emit_store_imm_ppgtt_posted(job->user_fence.addr,
@@ -397,6 +403,9 @@ static void __emit_job_gen12_render_compute(struct xe_sched_job *job,
397403

398404
i = emit_bb_start(batch_addr, ppgtt_flag, dw, i);
399405

406+
/* Don't preempt fence signaling */
407+
dw[i++] = MI_ARB_ON_OFF | MI_ARB_DISABLE;
408+
400409
i = emit_render_cache_flush(job, dw, i);
401410

402411
if (job->user_fence.used)

0 commit comments

Comments
 (0)