Skip to content

Commit 53fdfa1

Browse files
ifdumbrost05
authored andcommitted
drm/xe/hw_engine_group: Add helper to suspend faulting LR jobs
This is a required feature for dma fence jobs to preempt faulting long running jobs in order to ensure mutual exclusion on a given hw engine group. v2: Pipeline calls to suspend(q) and suspend_wait(q) to improve efficiency, switch to lockdep_assert_held_write (Matt Brost) v3: Return error on suspend_wait failure to propagate on the call stack up to IOCTL (Matt Brost) Signed-off-by: Francois Dugast <francois.dugast@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Matthew Brost <matthew.brost@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20240809155156.1955925-5-francois.dugast@intel.com
1 parent 7970cb3 commit 53fdfa1

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

drivers/gpu/drm/xe/xe_hw_engine_group.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,39 @@ void xe_hw_engine_group_del_exec_queue(struct xe_hw_engine_group *group, struct
166166

167167
up_write(&group->mode_sem);
168168
}
169+
170+
/**
171+
* xe_hw_engine_group_suspend_faulting_lr_jobs() - Suspend the faulting LR jobs of this group
172+
* @group: The hw engine group
173+
*
174+
* Return: 0 on success, negative error code on error.
175+
*/
176+
static int xe_hw_engine_group_suspend_faulting_lr_jobs(struct xe_hw_engine_group *group)
177+
{
178+
int err;
179+
struct xe_exec_queue *q;
180+
181+
lockdep_assert_held_write(&group->mode_sem);
182+
183+
list_for_each_entry(q, &group->exec_queue_list, hw_engine_group_link) {
184+
if (!xe_vm_in_fault_mode(q->vm))
185+
continue;
186+
187+
q->ops->suspend(q);
188+
}
189+
190+
list_for_each_entry(q, &group->exec_queue_list, hw_engine_group_link) {
191+
if (!xe_vm_in_fault_mode(q->vm))
192+
continue;
193+
194+
err = q->ops->suspend_wait(q);
195+
if (err)
196+
goto err_suspend;
197+
}
198+
199+
return 0;
200+
201+
err_suspend:
202+
up_write(&group->mode_sem);
203+
return err;
204+
}

0 commit comments

Comments
 (0)