Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/sched: Fix a race in DRM_GPU_SCHED_STAT_NO_HANG test

The "skip reset" test waits for the timeout handler to run for the
duration of 2 * MOCK_TIMEOUT, and because the mock scheduler opted to
remove the "skip reset" flag once it fires, this gives opportunity for the
timeout handler to run twice. Second time the job will be removed from the
mock scheduler job list and the drm_mock_sched_advance() call in the test
will fail.

Fix it by making the "don't reset" flag persist for the lifetime of the
job and add a new flag to verify that the code path had executed as
expected.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Fixes: 1472e7549f84 ("drm/sched: Add new test for DRM_GPU_SCHED_STAT_NO_HANG")
Cc: Maíra Canal <mcanal@igalia.com>
Cc: Philipp Stanner <phasta@kernel.org>
Reviewed-by: Maíra Canal <mcanal@igalia.com>
Signed-off-by: Philipp Stanner <phasta@kernel.org>
Link: https://lore.kernel.org/r/20250716084817.56797-1-tvrtko.ursulin@igalia.com

authored by

Tvrtko Ursulin and committed by
Philipp Stanner
2650bc40 28c5c486

+7 -6
+1 -1
drivers/gpu/drm/scheduler/tests/mock_scheduler.c
··· 219 219 unsigned long flags; 220 220 221 221 if (job->flags & DRM_MOCK_SCHED_JOB_DONT_RESET) { 222 - job->flags &= ~DRM_MOCK_SCHED_JOB_DONT_RESET; 222 + job->flags |= DRM_MOCK_SCHED_JOB_RESET_SKIPPED; 223 223 return DRM_GPU_SCHED_STAT_NO_HANG; 224 224 } 225 225
+4 -3
drivers/gpu/drm/scheduler/tests/sched_tests.h
··· 95 95 96 96 struct completion done; 97 97 98 - #define DRM_MOCK_SCHED_JOB_DONE 0x1 99 - #define DRM_MOCK_SCHED_JOB_TIMEDOUT 0x2 100 - #define DRM_MOCK_SCHED_JOB_DONT_RESET 0x4 98 + #define DRM_MOCK_SCHED_JOB_DONE 0x1 99 + #define DRM_MOCK_SCHED_JOB_TIMEDOUT 0x2 100 + #define DRM_MOCK_SCHED_JOB_DONT_RESET 0x4 101 + #define DRM_MOCK_SCHED_JOB_RESET_SKIPPED 0x8 101 102 unsigned long flags; 102 103 103 104 struct list_head link;
+2 -2
drivers/gpu/drm/scheduler/tests/tests_basic.c
··· 317 317 KUNIT_ASSERT_FALSE(test, done); 318 318 319 319 KUNIT_ASSERT_EQ(test, 320 - job->flags & DRM_MOCK_SCHED_JOB_DONT_RESET, 321 - 0); 320 + job->flags & DRM_MOCK_SCHED_JOB_RESET_SKIPPED, 321 + DRM_MOCK_SCHED_JOB_RESET_SKIPPED); 322 322 323 323 i = drm_mock_sched_advance(sched, 1); 324 324 KUNIT_ASSERT_EQ(test, i, 1);