]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915: Skip unused contexts for context_barrier_task()
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 29 Apr 2019 09:07:35 +0000 (10:07 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 29 Apr 2019 10:12:37 +0000 (11:12 +0100)
If the context has not been used yet, it needs no barrier, and in the
process fix up the selftest in mock_contexts.

Testcase: igt/gem_ctx_clone/vm
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190429090735.326-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem_context.c
drivers/gpu/drm/i915/selftests/i915_gem_context.c

index 939c1707078062ea48db412b2ce54a8c3bb910e9..65cefc520e79ff6e98def7c7488c8d875cf0b44c 100644 (file)
@@ -924,15 +924,15 @@ static int context_barrier_task(struct i915_gem_context *ctx,
        for_each_gem_engine(ce, i915_gem_context_lock_engines(ctx), it) {
                struct i915_request *rq;
 
-               if (!(ce->engine->mask & engines))
-                       continue;
-
                if (I915_SELFTEST_ONLY(context_barrier_inject_fault &
                                       ce->engine->mask)) {
                        err = -ENXIO;
                        break;
                }
 
+               if (!(ce->engine->mask & engines) || !ce->state)
+                       continue;
+
                rq = intel_context_create_request(ce);
                if (IS_ERR(rq)) {
                        err = PTR_ERR(rq);
index b62f005e4d5085b46ae1c9ac378f1d69be8380d9..34ac5cc6d59fb54bd30e7026e5b6a2608fb83d83 100644 (file)
@@ -1665,7 +1665,7 @@ static int mock_context_barrier(void *arg)
                goto out;
        }
        if (counter == 0) {
-               pr_err("Did not retire immediately for all inactive engines\n");
+               pr_err("Did not retire immediately for all unused engines\n");
                err = -EINVAL;
                goto out;
        }