Skip to content

Commit

Permalink
drm/i915: Introduce new macros for tracing
Browse files Browse the repository at this point in the history
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: Venkata Sandeep Dhanalakota <venkata.s.dhanalakota@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20191213155152.69182-2-venkata.s.dhanalakota@intel.com
  • Loading branch information
Venkata Sandeep Dhanalakota authored and Chris Wilson committed Dec 13, 2019
1 parent 3dc716f commit 639f2f2
Show file tree
Hide file tree
Showing 14 changed files with 112 additions and 111 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/i915/gem/i915_gem_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down
11 changes: 4 additions & 7 deletions drivers/gpu/drm/i915/gt/intel_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,8 @@ 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->ring->head, ce->ring->tail);
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 */

Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions drivers/gpu/drm/i915/gt/intel_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
7 changes: 7 additions & 0 deletions drivers/gpu/drm/i915/gt/intel_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/gt/intel_engine_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand All @@ -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;
}

Expand All @@ -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));
}
Expand Down
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/gt/intel_engine_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ static int __engine_unpark(struct intel_wakeref *wf)
container_of(wf, typeof(*engine), wakeref);
void *map;

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

intel_gt_pm_get(engine->gt);

Expand Down Expand Up @@ -80,7 +80,7 @@ __queue_and_release_pm(struct i915_request *rq,
{
struct intel_gt_timelines *timelines = &engine->gt->timelines;

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

/*
* We have to serialise all potential retirement paths with our
Expand Down Expand Up @@ -204,7 +204,7 @@ static int __engine_park(struct intel_wakeref *wf)
if (!switch_to_kernel_context(engine))
return -EBUSY;

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

call_idle_barriers(engine); /* cleanup after wedging */

Expand Down
6 changes: 6 additions & 0 deletions drivers/gpu/drm/i915/gt/intel_gt.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@

struct drm_i915_private;

#define GT_TRACE(gt__, fmt, ...) do { \
typecheck(struct intel_gt, *(gt__)); \
GEM_TRACE("%s " fmt, dev_name(gt->i915->drm.dev), \
##__VA_ARGS__); \
} while (0)

static inline struct intel_gt *uc_to_gt(struct intel_uc *uc)
{
return container_of(uc, struct intel_gt, uc);
Expand Down
15 changes: 7 additions & 8 deletions drivers/gpu/drm/i915/gt/intel_gt_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static int __gt_unpark(struct intel_wakeref *wf)
struct intel_gt *gt = container_of(wf, typeof(*gt), wakeref);
struct drm_i915_private *i915 = gt->i915;

GEM_TRACE("\n");
GT_TRACE(gt, "\n");

i915_globals_unpark();

Expand Down Expand Up @@ -76,7 +76,7 @@ static int __gt_park(struct intel_wakeref *wf)
intel_wakeref_t wakeref = fetch_and_zero(&gt->awake);
struct drm_i915_private *i915 = gt->i915;

GEM_TRACE("\n");
GT_TRACE(gt, "\n");

intel_gt_park_requests(gt);

Expand Down Expand Up @@ -141,7 +141,7 @@ void intel_gt_sanitize(struct intel_gt *gt, bool force)
enum intel_engine_id id;
intel_wakeref_t wakeref;

GEM_TRACE("force:%s\n", yesno(force));
GT_TRACE(gt, "force:%s", yesno(force));

/* Use a raw wakeref to avoid calling intel_display_power_get early */
wakeref = intel_runtime_pm_get(gt->uncore->rpm);
Expand Down Expand Up @@ -188,7 +188,7 @@ int intel_gt_resume(struct intel_gt *gt)
enum intel_engine_id id;
int err = 0;

GEM_TRACE("\n");
GT_TRACE(gt, "\n");

/*
* After resume, we may need to poke into the pinned kernel
Expand Down Expand Up @@ -301,20 +301,19 @@ void intel_gt_suspend_late(struct intel_gt *gt)

intel_gt_sanitize(gt, false);

GEM_TRACE("\n");
GT_TRACE(gt, "\n");
}

void intel_gt_runtime_suspend(struct intel_gt *gt)
{
intel_uc_runtime_suspend(&gt->uc);

GEM_TRACE("\n");
GT_TRACE(gt, "\n");
}

int intel_gt_runtime_resume(struct intel_gt *gt)
{
GEM_TRACE("\n");

GT_TRACE(gt, "\n");
intel_gt_init_swizzling(gt);

return intel_uc_runtime_resume(&gt->uc);
Expand Down
Loading

0 comments on commit 639f2f2

Please sign in to comment.