mirror of
https://github.com/torvalds/linux.git
synced 2026-04-21 16:23:59 -04:00
drm/sched: Add a simple timeout test
Add a very simple timeout test which submits a single job and verifies that the timeout handling will run if the backend failed to complete the job in time. Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com> Cc: Christian König <christian.koenig@amd.com> Cc: Danilo Krummrich <dakr@kernel.org> Cc: Matthew Brost <matthew.brost@intel.com> Cc: Philipp Stanner <phasta@kernel.org> Acked-by: Christian König <christian.koenig@amd.com> Signed-off-by: Philipp Stanner <phasta@kernel.org> Link: https://patchwork.freedesktop.org/patch/msgid/20250324092633.49746-4-tvrtko.ursulin@igalia.com
This commit is contained in:
committed by
Philipp Stanner
parent
5a99350794
commit
53e6597492
@@ -203,7 +203,11 @@ static struct dma_fence *mock_sched_run_job(struct drm_sched_job *sched_job)
|
||||
static enum drm_gpu_sched_stat
|
||||
mock_sched_timedout_job(struct drm_sched_job *sched_job)
|
||||
{
|
||||
return DRM_GPU_SCHED_STAT_ENODEV;
|
||||
struct drm_mock_sched_job *job = drm_sched_job_to_mock_job(sched_job);
|
||||
|
||||
job->flags |= DRM_MOCK_SCHED_JOB_TIMEDOUT;
|
||||
|
||||
return DRM_GPU_SCHED_STAT_NOMINAL;
|
||||
}
|
||||
|
||||
static void mock_sched_free_job(struct drm_sched_job *sched_job)
|
||||
@@ -234,17 +238,18 @@ static const struct drm_sched_backend_ops drm_mock_scheduler_ops = {
|
||||
* drm_mock_sched_new - Create a new mock scheduler
|
||||
*
|
||||
* @test: KUnit test owning the job
|
||||
* @timeout: Job timeout to set
|
||||
*
|
||||
* Returns: New mock scheduler with allocation managed by the test
|
||||
*/
|
||||
struct drm_mock_scheduler *drm_mock_sched_new(struct kunit *test)
|
||||
struct drm_mock_scheduler *drm_mock_sched_new(struct kunit *test, long timeout)
|
||||
{
|
||||
struct drm_sched_init_args args = {
|
||||
.ops = &drm_mock_scheduler_ops,
|
||||
.num_rqs = DRM_SCHED_PRIORITY_COUNT,
|
||||
.credit_limit = U32_MAX,
|
||||
.hang_limit = 1,
|
||||
.timeout = MAX_SCHEDULE_TIMEOUT,
|
||||
.timeout = timeout,
|
||||
.name = "drm-mock-scheduler",
|
||||
};
|
||||
struct drm_mock_scheduler *sched;
|
||||
|
||||
Reference in New Issue
Block a user