Commit a2847782 authored by Chris Wilson's avatar Chris Wilson
Browse files

drm/i915/gt: Lift set-wedged engine dumping out of user paths



The user (e.g. gem_eio) can manipulate the driver into wedging itself,
allowing the user to trigger voluminous logging of inconsequential
details. If we lift the dump to direct calls to intel_gt_set_wedged(),
out of the intel_reset failure handling, we keep the detail logging for
what we expect are true HW or test failures without being tricked.

Reported-by: default avatarTomi Sarvela <tomi.p.sarvela@intel.com>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>
Reviewed-by: default avatarMika Kuoppala <mika.kuoppala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200127231540.3302516-6-chris@chris-wilson.co.uk
parent ff3d4ff6
Loading
Loading
Loading
Loading
+22 −9
Original line number Diff line number Diff line
@@ -800,13 +800,6 @@ static void __intel_gt_set_wedged(struct intel_gt *gt)
	if (test_bit(I915_WEDGED, &gt->reset.flags))
		return;

	if (GEM_SHOW_DEBUG() && !intel_engines_are_idle(gt)) {
		struct drm_printer p = drm_debug_printer(__func__);

		for_each_engine(engine, gt, id)
			intel_engine_dump(engine, &p, "%s\n", engine->name);
	}

	GT_TRACE(gt, "start\n");

	/*
@@ -845,10 +838,30 @@ void intel_gt_set_wedged(struct intel_gt *gt)
{
	intel_wakeref_t wakeref;

	if (test_bit(I915_WEDGED, &gt->reset.flags))
		return;

	wakeref = intel_runtime_pm_get(gt->uncore->rpm);
	mutex_lock(&gt->reset.mutex);
	with_intel_runtime_pm(gt->uncore->rpm, wakeref)

	if (GEM_SHOW_DEBUG()) {
		struct drm_printer p = drm_debug_printer(__func__);
		struct intel_engine_cs *engine;
		enum intel_engine_id id;

		drm_printf(&p, "called from %pS\n", (void *)_RET_IP_);
		for_each_engine(engine, gt, id) {
			if (intel_engine_is_idle(engine))
				continue;

			intel_engine_dump(engine, &p, "%s\n", engine->name);
		}
	}

	__intel_gt_set_wedged(gt);

	mutex_unlock(&gt->reset.mutex);
	intel_runtime_pm_put(gt->uncore->rpm, wakeref);
}

static bool __intel_gt_unset_wedged(struct intel_gt *gt)