From f73552baea1ed48758bfece039aaf0c02102e0e7 Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Thu, 13 Nov 2014 14:42:22 +0200 Subject: gpu: nvgpu: cde: add trace events for ctx allocs Trace cde context allocation and deallocation with ftrace. Bug 200052943 Change-Id: Ieeb625166662971fb3eb3fb29c986fdb6809c10b Signed-off-by: Konsta Holtta Reviewed-on: http://git-master/r/602886 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/cde_gk20a.c | 9 +++++++++ include/trace/events/gk20a.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c index f85e0c4c..43e74c85 100644 --- a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c @@ -22,6 +22,8 @@ #include #include +#include + #include "gk20a.h" #include "channel_gk20a.h" #include "mm_gk20a.h" @@ -80,6 +82,8 @@ __must_hold(&cde_app->mutex) struct channel_gk20a *ch = cde_ctx->ch; struct vm_gk20a *vm = ch->vm; + trace_gk20a_cde_remove_ctx(cde_ctx); + /* free the channel */ gk20a_free_channel(cde_ctx->ch, true); @@ -728,6 +732,7 @@ __releases(&cde_app->mutex) struct gk20a_cde_app *cde_app = &cde_ctx->g->cde_app; gk20a_dbg(gpu_dbg_cde_ctx, "releasing use on %p", cde_ctx); + trace_gk20a_cde_release(cde_ctx); mutex_lock(&cde_app->mutex); @@ -808,6 +813,7 @@ __must_hold(&cde_app->mutex) cde_ctx, cde_app->ctx_count, cde_app->ctx_usecount, cde_app->ctx_count_top); + trace_gk20a_cde_get_context(cde_ctx); /* deleter work may be scheduled, but in_use prevents it */ cde_ctx->in_use = true; @@ -833,6 +839,7 @@ __must_hold(&cde_app->mutex) return cde_ctx; } + trace_gk20a_cde_get_context(cde_ctx); cde_ctx->in_use = true; cde_ctx->is_temporary = true; cde_app->ctx_usecount++; @@ -891,6 +898,7 @@ static struct gk20a_cde_ctx *gk20a_cde_allocate_context(struct gk20a *g) gk20a_cde_ctx_deleter_fn); gk20a_dbg(gpu_dbg_fn | gpu_dbg_cde_ctx, "cde: allocated %p", cde_ctx); + trace_gk20a_cde_allocate_context(cde_ctx); return cde_ctx; } @@ -1042,6 +1050,7 @@ __releases(&cde_app->mutex) if (!channel_idle) return; + trace_gk20a_cde_finished_ctx_cb(cde_ctx); gk20a_dbg(gpu_dbg_fn | gpu_dbg_cde_ctx, "cde: finished %p", cde_ctx); WARN(!cde_ctx->in_use, "double finish cde context %p on channel %p", cde_ctx, ch); diff --git a/include/trace/events/gk20a.h b/include/trace/events/gk20a.h index 4b3f94e7..8fa8cb94 100644 --- a/include/trace/events/gk20a.h +++ b/include/trace/events/gk20a.h @@ -293,6 +293,39 @@ TRACE_EVENT(gk20a_mmu_fault, __entry->engine, __entry->client, __entry->fault_type) ); +DECLARE_EVENT_CLASS(gk20a_cde, + TP_PROTO(const void *ctx), + TP_ARGS(ctx), + TP_STRUCT__entry(__field(const void *, ctx)), + TP_fast_assign(__entry->ctx = ctx;), + TP_printk("ctx=%p", __entry->ctx) +); + +DEFINE_EVENT(gk20a_cde, gk20a_cde_remove_ctx, + TP_PROTO(const void *ctx), + TP_ARGS(ctx) +); + +DEFINE_EVENT(gk20a_cde, gk20a_cde_release, + TP_PROTO(const void *ctx), + TP_ARGS(ctx) +); + +DEFINE_EVENT(gk20a_cde, gk20a_cde_get_context, + TP_PROTO(const void *ctx), + TP_ARGS(ctx) +); + +DEFINE_EVENT(gk20a_cde, gk20a_cde_allocate_context, + TP_PROTO(const void *ctx), + TP_ARGS(ctx) +); + +DEFINE_EVENT(gk20a_cde, gk20a_cde_finished_ctx_cb, + TP_PROTO(const void *ctx), + TP_ARGS(ctx) +); + #endif /* _TRACE_GK20A_H */ /* This part must be outside protection */ -- cgit v1.2.2