Unverified Commit cdc8a1e1 authored by Matthew Brost's avatar Matthew Brost Committed by Rodrigo Vivi
Browse files

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: dd08ebf6 ("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: default avatarMatthew Brost <matthew.brost@intel.com>
Reviewed-by: default avatarDaniele Ceraolo Spurio <daniele.ceraolospurio@intel.com>
Link: https://patch.msgid.link/20260115004546.58060-1-matthew.brost@intel.com


(cherry picked from commit 2bcbf2dc)
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 11439c46
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -280,6 +280,9 @@ static void __emit_job_gen12_simple(struct xe_sched_job *job, struct xe_lrc *lrc

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

	/* Don't preempt fence signaling */
	dw[i++] = MI_ARB_ON_OFF | MI_ARB_DISABLE;

	if (job->user_fence.used) {
		i = emit_flush_dw(dw, i);
		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,

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

	/* Don't preempt fence signaling */
	dw[i++] = MI_ARB_ON_OFF | MI_ARB_DISABLE;

	if (job->user_fence.used) {
		i = emit_flush_dw(dw, i);
		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,

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

	/* Don't preempt fence signaling */
	dw[i++] = MI_ARB_ON_OFF | MI_ARB_DISABLE;

	i = emit_render_cache_flush(job, dw, i);

	if (job->user_fence.used)