From e0a4cc70f6dbb23b5a3656f41e90ebe561fd0585 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Thu, 16 Jun 2011 09:31:25 +0300 Subject: nvhost: Add tracing for submit activity and cdma Adds trace commands for times when a command buffer has been submitted and when the channel's command buffer has been processed. Also adds tracing when cdma buffer is full. This patch fixes a spelling mistake in waitchk trace function. Original-Change-Id: Ib5609a56c6c2d9ce6cbd019a94f3e102d419bb60 Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/36863 Reviewed-by: Varun Colbert Tested-by: Varun Colbert Rebase-Id: R34c172eff1e9c128a7748bb4f9af0cf05a30aa7d --- arch/arm/mach-tegra/include/trace/events/nvhost.h | 61 ++++++++++++++++++++++- drivers/video/tegra/host/nvhost_cdma.c | 4 ++ drivers/video/tegra/host/nvhost_intr.c | 7 ++- drivers/video/tegra/host/t20/channel_t20.c | 8 ++- 4 files changed, 76 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-tegra/include/trace/events/nvhost.h b/arch/arm/mach-tegra/include/trace/events/nvhost.h index 4c8dd67973d1..2a1845950ed5 100644 --- a/arch/arm/mach-tegra/include/trace/events/nvhost.h +++ b/arch/arm/mach-tegra/include/trace/events/nvhost.h @@ -3,7 +3,7 @@ * * Nvhost event logging to ftrace. * - * Copyright (c) 2010, NVIDIA Corporation. + * Copyright (c) 2010-2011, NVIDIA Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -164,7 +164,7 @@ TRACE_EVENT(nvhost_channel_write_waitchks, __entry->waitmask = waitmask; ), - TP_printk("name=%s, waitchks=%lu, waitmask=0x08lx", + TP_printk("name=%s, waitchks=%lu, waitmask=%08lx", __entry->name, (unsigned long)__entry->waitchks, (unsigned long)__entry->waitmask) ); @@ -287,6 +287,63 @@ TRACE_EVENT(nvhost_ioctl_ctrl_syncpt_wait, __entry->id, __entry->threshold, __entry->timeout) ); +TRACE_EVENT(nvhost_channel_submitted, + TP_PROTO(const char *name, u32 syncpt_base, u32 syncpt_max), + + TP_ARGS(name, syncpt_base, syncpt_max), + + TP_STRUCT__entry( + __field(const char *, name) + __field(u32, syncpt_base) + __field(u32, syncpt_max) + ), + + TP_fast_assign( + __entry->name = name; + __entry->syncpt_base = syncpt_base; + __entry->syncpt_max = syncpt_max; + ), + + TP_printk("name=%s, syncpt_base=%d, syncpt_max=%d", + __entry->name, __entry->syncpt_base, __entry->syncpt_max) +); + +TRACE_EVENT(nvhost_channel_submit_complete, + TP_PROTO(const char *name, int count), + + TP_ARGS(name, count), + + TP_STRUCT__entry( + __field(const char *, name) + __field(int, count) + ), + + TP_fast_assign( + __entry->name = name; + __entry->count = count; + ), + + TP_printk("name=%s, count=%d", __entry->name, __entry->count) +); + +TRACE_EVENT(nvhost_wait_cdma, + TP_PROTO(const char *name, u32 eventid), + + TP_ARGS(name, eventid), + + TP_STRUCT__entry( + __field(const char *, name) + __field(u32, eventid) + ), + + TP_fast_assign( + __entry->name = name; + __entry->eventid = eventid; + ), + + TP_printk("name=%s, event=%d", __entry->name, __entry->eventid) +); + #endif /* _TRACE_NVHOST_H */ /* This part must be outside protection */ diff --git a/drivers/video/tegra/host/nvhost_cdma.c b/drivers/video/tegra/host/nvhost_cdma.c index edebeeb5ea7b..24c0c0fff0c0 100644 --- a/drivers/video/tegra/host/nvhost_cdma.c +++ b/drivers/video/tegra/host/nvhost_cdma.c @@ -24,6 +24,7 @@ #include "dev.h" #include #include +#include /* * TODO: * stats @@ -258,6 +259,9 @@ unsigned int nvhost_cdma_wait(struct nvhost_cdma *cdma, enum cdma_event event) if (space) return space; + trace_nvhost_wait_cdma(cdma_to_channel(cdma)->desc->name, + event); + BUG_ON(cdma->event != CDMA_EVENT_NONE); cdma->event = event; diff --git a/drivers/video/tegra/host/nvhost_intr.c b/drivers/video/tegra/host/nvhost_intr.c index ef511392154b..753c18456198 100644 --- a/drivers/video/tegra/host/nvhost_intr.c +++ b/drivers/video/tegra/host/nvhost_intr.c @@ -3,7 +3,7 @@ * * Tegra Graphics Host Interrupt Management * - * Copyright (c) 2010, NVIDIA Corporation. + * Copyright (c) 2010-2011, NVIDIA Corporation. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ #include #include #include +#include @@ -131,6 +132,10 @@ static void action_submit_complete(struct nvhost_waitlist *waiter) struct nvhost_channel *channel = waiter->data; int nr_completed = waiter->count; + /* Add nr_completed to trace */ + trace_nvhost_channel_submit_complete(channel->desc->name, + nr_completed); + nvhost_cdma_update(&channel->cdma); nvhost_module_idle_mult(&channel->mod, nr_completed); } diff --git a/drivers/video/tegra/host/t20/channel_t20.c b/drivers/video/tegra/host/t20/channel_t20.c index ad6a02e16f8c..a3fb15212820 100644 --- a/drivers/video/tegra/host/t20/channel_t20.c +++ b/drivers/video/tegra/host/t20/channel_t20.c @@ -279,6 +279,9 @@ static int t20_channel_submit(struct nvhost_channel *channel, nvhost_cdma_end(&channel->cdma, user_nvmap, syncpt_id, syncval, unpins, nr_unpins); + trace_nvhost_channel_submitted(channel->desc->name, + syncval-syncpt_incrs, syncval); + /* * schedule a context save interrupt (to drain the host FIFO * if necessary, and to release the restore buffer) @@ -289,8 +292,11 @@ static int t20_channel_submit(struct nvhost_channel *channel, NVHOST_INTR_ACTION_CTXSAVE, hwctx_to_save, NULL); /* schedule a submit complete interrupt */ - nvhost_intr_add_action(&channel->dev->intr, syncpt_id, syncval, + err = nvhost_intr_add_action(&channel->dev->intr, syncpt_id, syncval, NVHOST_INTR_ACTION_SUBMIT_COMPLETE, channel, NULL); + /* if add_action failed, the submit has been already completed */ + if (err) + trace_nvhost_channel_submit_complete(channel->desc->name, 1); mutex_unlock(&channel->submitlock); -- cgit v1.2.3