[Intel-gfx] [bug report] drm/i915: Remove I915_USER_PRIORITY_SHIFT

Dan Carpenter dan.carpenter at linaro.org
Fri May 26 11:58:56 UTC 2023


Hello Chris Wilson,

The patch eb5c10cbbc2f: "drm/i915: Remove I915_USER_PRIORITY_SHIFT"
from Jan 20, 2021, leads to the following Smatch static checker
warning:

drivers/gpu/drm/i915/gt/selftest_execlists.c:1544 live_busywait_preempt() error: 'ctx_hi' dereferencing possible ERR_PTR()
drivers/gpu/drm/i915/gt/selftest_execlists.c:1549 live_busywait_preempt() error: 'ctx_lo' dereferencing possible ERR_PTR()
drivers/gpu/drm/i915/gt/selftest_execlists.c:1740 live_preempt() error: 'ctx_hi' dereferencing possible ERR_PTR()
drivers/gpu/drm/i915/gt/selftest_execlists.c:1745 live_preempt() error: 'ctx_lo' dereferencing possible ERR_PTR()
drivers/gpu/drm/i915/gt/selftest_execlists.c:1844 live_late_preempt() error: 'ctx_lo' dereferencing possible ERR_PTR()
drivers/gpu/drm/i915/gt/selftest_execlists.c:1871 live_late_preempt() error: 'ctx_hi' dereferencing possible ERR_PTR()
drivers/gpu/drm/i915/gt/selftest_execlists.c:3382 live_preempt_timeout() error: 'ctx_hi' dereferencing possible ERR_PTR()
drivers/gpu/drm/i915/gt/selftest_execlists.c:3387 live_preempt_timeout() error: 'ctx_lo' dereferencing possible ERR_PTR()

drivers/gpu/drm/i915/gt/selftest_execlists.c
    1525 static int live_busywait_preempt(void *arg)
    1526 {
    1527         struct intel_gt *gt = arg;
    1528         struct i915_gem_context *ctx_hi, *ctx_lo;
    1529         struct intel_engine_cs *engine;
    1530         struct drm_i915_gem_object *obj;
    1531         struct i915_vma *vma;
    1532         enum intel_engine_id id;
    1533         int err = -ENOMEM;
    1534         u32 *map;
    1535 
    1536         /*
    1537          * Verify that even without HAS_LOGICAL_RING_PREEMPTION, we can
    1538          * preempt the busywaits used to synchronise between rings.
    1539          */
    1540 
    1541         ctx_hi = kernel_context(gt->i915, NULL);
    1542         if (!ctx_hi)
                     ^^^^^^^
kernel_context() returns error pointers.

    1543                 return -ENOMEM;
--> 1544         ctx_hi->sched.priority = I915_CONTEXT_MAX_USER_PRIORITY;
    1545 
    1546         ctx_lo = kernel_context(gt->i915, NULL);
    1547         if (!ctx_lo)
                     ^^^^^^^
Same.

It's so weird that I'm getting this warning and today I can't compile
this file...  Plus I'm supposed to be on an ARM config...  Something is
wrong with my setup.  But the warnings looks correct.

    1548                 goto err_ctx_hi;
    1549         ctx_lo->sched.priority = I915_CONTEXT_MIN_USER_PRIORITY;
    1550 
    1551         obj = i915_gem_object_create_internal(gt->i915, PAGE_SIZE);
    1552         if (IS_ERR(obj)) {
    1553                 err = PTR_ERR(obj);
    1554                 goto err_ctx_lo;
    1555         }
    1556 

regards,
dan carpenter


More information about the Intel-gfx mailing list