summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
diff options
context:
space:
mode:
authorThomas Fleury <tfleury@nvidia.com>2017-01-24 11:39:54 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-01-31 19:23:23 -0500
commitcae5a0bc3607cf453dc3cffff7f405b2111f4299 (patch)
treee844b857fad4aea9a5ec2313a14e84228c2f668e /drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
parentd2de17bfb0eb24ac020e2dfa3ce0dd4f9d0332f9 (diff)
gpu: nvgpu: empty FECS buffer on trace enable
Currently, when reading from ctxsw device node, we are collecting traces that occurred before enabling tracing. This is not wanted, and makes testing unpredicatable. This change drops existing data in FECS ring buffer when enabling traces, as currently done on vm-server side. Jira EVLR-991 Change-Id: Idd2544d4667396f90778b7be82bdf73d1f8b8dc8 Signed-off-by: Thomas Fleury <tfleury@nvidia.com> Reviewed-on: http://git-master/r/1293303 Reviewed-by: Vishnu Reddy Mandalapu <vmandalapu@nvidia.com> Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
index 6b77dff5..1f86fd8f 100644
--- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
@@ -720,15 +720,27 @@ static int gk20a_fecs_trace_enable(struct gk20a *g)
720{ 720{
721 struct gk20a_fecs_trace *trace = g->fecs_trace; 721 struct gk20a_fecs_trace *trace = g->fecs_trace;
722 struct task_struct *task; 722 struct task_struct *task;
723 int write;
723 724
724 if (!trace->poll_task) { 725 if (!trace)
725 task = kthread_run(gk20a_fecs_trace_periodic_polling, g, __func__); 726 return -EINVAL;
726 if (unlikely(IS_ERR(task))) { 727
727 gk20a_warn(dev_from_gk20a(g), "failed to create FECS polling task"); 728 if (trace->poll_task)
728 return PTR_ERR(task); 729 return 0;
729 } 730
730 trace->poll_task = task; 731 /* drop data in hw buffer */
732 if (g->ops.fecs_trace.flush)
733 g->ops.fecs_trace.flush(g);
734 write = gk20a_fecs_trace_get_write_index(g);
735 gk20a_fecs_trace_set_read_index(g, write);
736
737 task = kthread_run(gk20a_fecs_trace_periodic_polling, g, __func__);
738 if (unlikely(IS_ERR(task))) {
739 gk20a_warn(dev_from_gk20a(g),
740 "failed to create FECS polling task");
741 return PTR_ERR(task);
731 } 742 }
743 trace->poll_task = task;
732 744
733 return 0; 745 return 0;
734} 746}