From decbbf35041e7e551b3f354e582daaa5c8c3cc0a Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Fri, 15 Feb 2019 16:14:19 +0530 Subject: [PATCH] gpu: nvgpu: fix trace ring read after invalid entry gk20a_fecs_trace_poll() right now calls gk20a_fecs_trace_ring_read() to read the trace ring buffer written by FECS gk20a_fecs_trace_ring_read() returns number of trace entries written to local buffer if successful, otherwise returns error In case there is really an invalid entry, gk20a_fecs_trace_poll() will just stop reading more entries, write current read pointer to h/w and return When gk20a_fecs_trace_poll() is called next time, we again read that invalid entry, and again skip it, and again return This keeps happening, and we never move on to read new entries Fix this by always continuing to read next entry irrespective of current entry is valid or not gk20a_fecs_trace_poll() now just prints a debug message instead of breaking the loop Bug 200491708 Change-Id: I8cf823d7dc5f72ebd70cab2f115af32f3d20ac78 Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/2020167 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Debarshi Dutta Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c index b2da013f1..c623e8602 100644 --- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c @@ -360,8 +360,10 @@ int gk20a_fecs_trace_poll(struct gk20a *g) while (read != write) { cnt = gk20a_fecs_trace_ring_read(g, read); - if (cnt <= 0) - break; + if (cnt > 0) { + nvgpu_log(g, gpu_dbg_ctxsw, + "number of trace entries added: %d", cnt); + } /* Get to next record. */ read = (read + 1) & (GK20A_FECS_TRACE_NUM_RECORDS - 1);