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 <kholtta@nvidia.com>
Reviewed-on: http://git-master/r/602886
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Konsta Holtta
2014-11-13 14:42:22 +02:00
committed by Dan Willemsen
parent 2d7c5e1a5b
commit f73552baea
2 changed files with 42 additions and 0 deletions

View File

@@ -22,6 +22,8 @@
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/dma-buf.h> #include <linux/dma-buf.h>
#include <trace/events/gk20a.h>
#include "gk20a.h" #include "gk20a.h"
#include "channel_gk20a.h" #include "channel_gk20a.h"
#include "mm_gk20a.h" #include "mm_gk20a.h"
@@ -80,6 +82,8 @@ __must_hold(&cde_app->mutex)
struct channel_gk20a *ch = cde_ctx->ch; struct channel_gk20a *ch = cde_ctx->ch;
struct vm_gk20a *vm = ch->vm; struct vm_gk20a *vm = ch->vm;
trace_gk20a_cde_remove_ctx(cde_ctx);
/* free the channel */ /* free the channel */
gk20a_free_channel(cde_ctx->ch, true); 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; struct gk20a_cde_app *cde_app = &cde_ctx->g->cde_app;
gk20a_dbg(gpu_dbg_cde_ctx, "releasing use on %p", cde_ctx); gk20a_dbg(gpu_dbg_cde_ctx, "releasing use on %p", cde_ctx);
trace_gk20a_cde_release(cde_ctx);
mutex_lock(&cde_app->mutex); mutex_lock(&cde_app->mutex);
@@ -808,6 +813,7 @@ __must_hold(&cde_app->mutex)
cde_ctx, cde_app->ctx_count, cde_ctx, cde_app->ctx_count,
cde_app->ctx_usecount, cde_app->ctx_usecount,
cde_app->ctx_count_top); cde_app->ctx_count_top);
trace_gk20a_cde_get_context(cde_ctx);
/* deleter work may be scheduled, but in_use prevents it */ /* deleter work may be scheduled, but in_use prevents it */
cde_ctx->in_use = true; cde_ctx->in_use = true;
@@ -833,6 +839,7 @@ __must_hold(&cde_app->mutex)
return cde_ctx; return cde_ctx;
} }
trace_gk20a_cde_get_context(cde_ctx);
cde_ctx->in_use = true; cde_ctx->in_use = true;
cde_ctx->is_temporary = true; cde_ctx->is_temporary = true;
cde_app->ctx_usecount++; 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_cde_ctx_deleter_fn);
gk20a_dbg(gpu_dbg_fn | gpu_dbg_cde_ctx, "cde: allocated %p", cde_ctx); gk20a_dbg(gpu_dbg_fn | gpu_dbg_cde_ctx, "cde: allocated %p", cde_ctx);
trace_gk20a_cde_allocate_context(cde_ctx);
return cde_ctx; return cde_ctx;
} }
@@ -1042,6 +1050,7 @@ __releases(&cde_app->mutex)
if (!channel_idle) if (!channel_idle)
return; return;
trace_gk20a_cde_finished_ctx_cb(cde_ctx);
gk20a_dbg(gpu_dbg_fn | gpu_dbg_cde_ctx, "cde: finished %p", 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", WARN(!cde_ctx->in_use, "double finish cde context %p on channel %p",
cde_ctx, ch); cde_ctx, ch);

View File

@@ -293,6 +293,39 @@ TRACE_EVENT(gk20a_mmu_fault,
__entry->engine, __entry->client, __entry->fault_type) __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 */ #endif /* _TRACE_GK20A_H */
/* This part must be outside protection */ /* This part must be outside protection */