Commit 639f2f24 authored by Venkata Sandeep Dhanalakota's avatar Venkata Sandeep Dhanalakota Committed by Chris Wilson
Browse files

drm/i915: Introduce new macros for tracing



New macros ENGINE_TRACE(), CE_TRACE(), RQ_TRACE() and
GT_TRACE() are introduce to tag device name and engine
name with contexts and requests tracing in i915.

Cc: Sudeep Dutt <sudeep.dutt@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarVenkata Sandeep Dhanalakota <venkata.s.dhanalakota@intel.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20191213155152.69182-2-venkata.s.dhanalakota@intel.com
parent 3dc716fd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -13,7 +13,7 @@

void i915_gem_suspend(struct drm_i915_private *i915)
{
	GEM_TRACE("\n");
	GEM_TRACE("%s\n", dev_name(i915->drm.dev));

	intel_wakeref_auto(&i915->ggtt.userfault_wakeref, 0);
	flush_workqueue(i915->wq);
@@ -99,7 +99,7 @@ void i915_gem_suspend_late(struct drm_i915_private *i915)

void i915_gem_resume(struct drm_i915_private *i915)
{
	GEM_TRACE("\n");
	GEM_TRACE("%s\n", dev_name(i915->drm.dev));

	intel_uncore_forcewake_get(&i915->uncore, FORCEWAKE_ALL);

+4 −7
Original line number Diff line number Diff line
@@ -68,8 +68,7 @@ int __intel_context_do_pin(struct intel_context *ce)
		if (err)
			goto err;

		GEM_TRACE("%s context:%llx pin ring:{head:%04x, tail:%04x}\n",
			  ce->engine->name, ce->timeline->fence_context,
		CE_TRACE(ce, "pin ring:{head:%04x, tail:%04x}\n",
			 ce->ring->head, ce->ring->tail);

		i915_gem_context_get(ce->gem_context); /* for ctx->ppgtt */
@@ -98,8 +97,7 @@ void intel_context_unpin(struct intel_context *ce)
	mutex_lock_nested(&ce->pin_mutex, SINGLE_DEPTH_NESTING);

	if (likely(atomic_dec_and_test(&ce->pin_count))) {
		GEM_TRACE("%s context:%llx retire\n",
			  ce->engine->name, ce->timeline->fence_context);
		CE_TRACE(ce, "retire\n");

		ce->ops->unpin(ce);

@@ -141,8 +139,7 @@ static void __intel_context_retire(struct i915_active *active)
{
	struct intel_context *ce = container_of(active, typeof(*ce), active);

	GEM_TRACE("%s context:%llx retire\n",
		  ce->engine->name, ce->timeline->fence_context);
	CE_TRACE(ce, "retire\n");

	set_bit(CONTEXT_VALID_BIT, &ce->flags);
	if (ce->state)
+7 −0
Original line number Diff line number Diff line
@@ -15,6 +15,13 @@
#include "intel_ring_types.h"
#include "intel_timeline_types.h"

#define CE_TRACE(ce, fmt, ...) do {					\
	const struct intel_context *ce__ = (ce);			\
	ENGINE_TRACE(ce__->engine, "context:%llx" fmt,			\
		     ce__->timeline->fence_context,			\
		     ##__VA_ARGS__);					\
} while (0)

void intel_context_init(struct intel_context *ce,
			struct i915_gem_context *ctx,
			struct intel_engine_cs *engine);
+7 −0
Original line number Diff line number Diff line
@@ -29,6 +29,13 @@ struct intel_gt;
#define CACHELINE_BYTES 64
#define CACHELINE_DWORDS (CACHELINE_BYTES / sizeof(u32))

#define ENGINE_TRACE(e, fmt, ...) do {					\
	const struct intel_engine_cs *e__ __maybe_unused = (e);		\
	GEM_TRACE("%s %s: " fmt,					\
		  dev_name(e__->i915->drm.dev), e__->name,		\
		  ##__VA_ARGS__);					\
} while (0)

/*
 * The register defines to be used with the following macros need to accept a
 * base param, e.g:
+3 −3
Original line number Diff line number Diff line
@@ -912,7 +912,7 @@ int intel_engine_stop_cs(struct intel_engine_cs *engine)
	if (INTEL_GEN(engine->i915) < 3)
		return -ENODEV;

	GEM_TRACE("%s\n", engine->name);
	ENGINE_TRACE(engine, "\n");

	intel_uncore_write_fw(uncore, mode, _MASKED_BIT_ENABLE(STOP_RING));

@@ -921,7 +921,7 @@ int intel_engine_stop_cs(struct intel_engine_cs *engine)
					 mode, MODE_IDLE, MODE_IDLE,
					 1000, stop_timeout(engine),
					 NULL)) {
		GEM_TRACE("%s: timed out on STOP_RING -> IDLE\n", engine->name);
		ENGINE_TRACE(engine, "timed out on STOP_RING -> IDLE\n");
		err = -ETIMEDOUT;
	}

@@ -933,7 +933,7 @@ int intel_engine_stop_cs(struct intel_engine_cs *engine)

void intel_engine_cancel_stop_cs(struct intel_engine_cs *engine)
{
	GEM_TRACE("%s\n", engine->name);
	ENGINE_TRACE(engine, "\n");

	ENGINE_WRITE_FW(engine, RING_MI_MODE, _MASKED_BIT_DISABLE(STOP_RING));
}
Loading