drm/i915/selftests: Change priority overflow detection
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 19 May 2020 06:31:13 +0000 (07:31 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Tue, 19 May 2020 14:28:26 +0000 (15:28 +0100)
Check for integer overflow in the priority chain, rather than against a
type-constricted max-priority check.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200519063123.20673-2-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/gt/selftest_lrc.c

index 94854a4..3e042fa 100644 (file)
@@ -2735,12 +2735,12 @@ static int live_preempt_gang(void *arg)
                        /* Submit each spinner at increasing priority */
                        engine->schedule(rq, &attr);
 
+                       if (prio < attr.priority)
+                               break;
+
                        if (prio <= I915_PRIORITY_MAX)
                                continue;
 
-                       if (prio > (INT_MAX >> I915_USER_PRIORITY_SHIFT))
-                               break;
-
                        if (__igt_timeout(end_time, NULL))
                                break;
                } while (1);