drm/i915: Skip repeated calls to i915_gem_set_wedged()
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 23 Jul 2018 14:53:35 +0000 (15:53 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 25 Jul 2018 07:06:33 +0000 (08:06 +0100)
If we already wedged, i915_gem_set_wedged() becomes a complicated no-op.

References: https://bugs.freedesktop.org/show_bug.cgi?id=107343
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180723145335.24579-1-chris@chris-wilson.co.uk
drivers/gpu/drm/i915/i915_gem.c

index 8b52cb768a6799d87b4198a0b226bc62c14e45fc..a4031fab57b0aab5f8befb07d76909c01270dcad 100644 (file)
@@ -3312,8 +3312,8 @@ void i915_gem_set_wedged(struct drm_i915_private *i915)
                        intel_engine_dump(engine, &p, "%s\n", engine->name);
        }
 
-       set_bit(I915_WEDGED, &i915->gpu_error.flags);
-       smp_mb__after_atomic();
+       if (test_and_set_bit(I915_WEDGED, &i915->gpu_error.flags))
+               goto out;
 
        /*
         * First, stop submission to hw, but do not yet complete requests by
@@ -3372,6 +3372,7 @@ void i915_gem_set_wedged(struct drm_i915_private *i915)
                i915_gem_reset_finish_engine(engine);
        }
 
+out:
        GEM_TRACE("end\n");
 
        wake_up_all(&i915->gpu_error.reset_queue);