Skip to content

Commit 3c6c7ca

Browse files
mbrost05Luben Tuikov
authored andcommitted
drm/sched: Add a helper to queue TDR immediately
Add a helper whereby a driver can invoke TDR immediately. v2: - Drop timeout args, rename function, use mod delayed work (Luben) v3: - s/XE/Xe (Luben) - present tense in commit message (Luben) - Adjust comment for drm_sched_tdr_queue_imm (Luben) v4: - Adjust commit message (Luben) Cc: Luben Tuikov <[email protected]> Signed-off-by: Matthew Brost <[email protected]> Reviewed-by: Luben Tuikov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Luben Tuikov <[email protected]>
1 parent 7a36dcf commit 3c6c7ca

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

drivers/gpu/drm/scheduler/sched_main.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ static void drm_sched_start_timeout(struct drm_gpu_scheduler *sched)
338338

339339
if (sched->timeout != MAX_SCHEDULE_TIMEOUT &&
340340
!list_empty(&sched->pending_list))
341-
queue_delayed_work(sched->timeout_wq, &sched->work_tdr, sched->timeout);
341+
mod_delayed_work(sched->timeout_wq, &sched->work_tdr, sched->timeout);
342342
}
343343

344344
static void drm_sched_start_timeout_unlocked(struct drm_gpu_scheduler *sched)
@@ -348,6 +348,22 @@ static void drm_sched_start_timeout_unlocked(struct drm_gpu_scheduler *sched)
348348
spin_unlock(&sched->job_list_lock);
349349
}
350350

351+
/**
352+
* drm_sched_tdr_queue_imm: - immediately start job timeout handler
353+
*
354+
* @sched: scheduler for which the timeout handling should be started.
355+
*
356+
* Start timeout handling immediately for the named scheduler.
357+
*/
358+
void drm_sched_tdr_queue_imm(struct drm_gpu_scheduler *sched)
359+
{
360+
spin_lock(&sched->job_list_lock);
361+
sched->timeout = 0;
362+
drm_sched_start_timeout(sched);
363+
spin_unlock(&sched->job_list_lock);
364+
}
365+
EXPORT_SYMBOL(drm_sched_tdr_queue_imm);
366+
351367
/**
352368
* drm_sched_fault - immediately start timeout handler
353369
*

include/drm/gpu_scheduler.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ void drm_sched_entity_modify_sched(struct drm_sched_entity *entity,
557557
struct drm_gpu_scheduler **sched_list,
558558
unsigned int num_sched_list);
559559

560+
void drm_sched_tdr_queue_imm(struct drm_gpu_scheduler *sched);
560561
void drm_sched_job_cleanup(struct drm_sched_job *job);
561562
void drm_sched_wakeup_if_can_queue(struct drm_gpu_scheduler *sched);
562563
bool drm_sched_wqueue_ready(struct drm_gpu_scheduler *sched);

0 commit comments

Comments
 (0)