From b2dd107455267b7f5ed3c6687c2bba48f3bdb941 Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Mon, 21 Mar 2016 11:16:47 -0700 Subject: gpu: nvgpu: add trace event for channel reset Change-Id: I319e877978b7f483108ef8f67c05702b71709f62 Signed-off-by: Thomas Fleury Reviewed-on: http://git-master/r/1120501 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/channel_gk20a.c | 2 ++ drivers/gpu/nvgpu/gk20a/fifo_gk20a.c | 7 ++++++- drivers/gpu/nvgpu/vgpu/fifo_vgpu.c | 4 ++++ include/trace/events/gk20a.h | 19 +++++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c index da73d95d..58175141 100644 --- a/drivers/gpu/nvgpu/gk20a/channel_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/channel_gk20a.c @@ -853,6 +853,7 @@ static void gk20a_free_channel(struct channel_gk20a *ch) unsigned long timeout = gk20a_get_gr_idle_timeout(g); struct dbg_session_gk20a *dbg_s; bool was_reset; + gk20a_dbg_fn(""); WARN_ON(ch->g == NULL); @@ -901,6 +902,7 @@ static void gk20a_free_channel(struct channel_gk20a *ch) /* if lock is already taken, a reset is taking place so no need to repeat */ if (!was_reset) { + trace_gk20a_channel_reset(ch->hw_chid, ch->tsgid); gk20a_fifo_reset_engine(g, g->fifo.deferred_fault_engines); } diff --git a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c index 9421c017..27a3992d 100644 --- a/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fifo_gk20a.c @@ -1053,8 +1053,13 @@ static bool gk20a_fifo_handle_mmu_fault( mutex_lock(&g->fifo.gr_reset_mutex); /* if lock is already taken, a reset is taking place so no need to repeat */ - if (!was_reset) + if (!was_reset) { + trace_gk20a_channel_reset( + ch ? ch->hw_chid : ~0, + tsg ? tsg->tsgid : + NVGPU_INVALID_TSG_ID); gk20a_fifo_reset_engine(g, engine_id); + } mutex_unlock(&g->fifo.gr_reset_mutex); } /* disable the channel/TSG from hw and increment diff --git a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c index afe3c24b..ac506a34 100644 --- a/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/fifo_vgpu.c @@ -14,6 +14,8 @@ */ #include +#include + #include "vgpu/vgpu.h" #include "gk20a/hw_fifo_gk20a.h" #include "gk20a/hw_ram_gk20a.h" @@ -625,6 +627,8 @@ int vgpu_fifo_isr(struct gk20a *g, struct tegra_vgpu_fifo_intr_info *info) gk20a_err(dev_from_gk20a(g), "fifo intr (%d) on ch %u", info->type, info->chid); + trace_gk20a_channel_reset(ch->hw_chid, ch->tsgid); + switch (info->type) { case TEGRA_VGPU_FIFO_INTR_PBDMA: gk20a_set_error_notifier(ch, NVGPU_CHANNEL_PBDMA_ERROR); diff --git a/include/trace/events/gk20a.h b/include/trace/events/gk20a.h index 23b5b642..c382099a 100644 --- a/include/trace/events/gk20a.h +++ b/include/trace/events/gk20a.h @@ -285,6 +285,25 @@ TRACE_EVENT(gk20a_channel_submitted_gpfifo, __entry->flags, __entry->incr_id, __entry->incr_value) ); +TRACE_EVENT(gk20a_channel_reset, + TP_PROTO(u32 hw_chid, u32 tsgid), + + TP_ARGS(hw_chid, tsgid), + + TP_STRUCT__entry( + __field(u32, hw_chid) + __field(u32, tsgid) + ), + + TP_fast_assign( + __entry->hw_chid = hw_chid; + __entry->tsgid = tsgid; + ), + + TP_printk("hw_chid=%d, tsgid=%d", + __entry->hw_chid, __entry->tsgid) +); + TRACE_EVENT(gk20a_as_dev_open, TP_PROTO(const char *name), -- cgit v1.2.2