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 <dnibade@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2020167
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Debarshi Dutta <ddutta@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Deepak Nibade
2019-02-15 16:14:19 +05:30
committed by mobile promotions
parent d8c5ce3c85
commit decbbf3504

View File

@@ -360,8 +360,10 @@ int gk20a_fecs_trace_poll(struct gk20a *g)
while (read != write) { while (read != write) {
cnt = gk20a_fecs_trace_ring_read(g, read); cnt = gk20a_fecs_trace_ring_read(g, read);
if (cnt <= 0) if (cnt > 0) {
break; nvgpu_log(g, gpu_dbg_ctxsw,
"number of trace entries added: %d", cnt);
}
/* Get to next record. */ /* Get to next record. */
read = (read + 1) & (GK20A_FECS_TRACE_NUM_RECORDS - 1); read = (read + 1) & (GK20A_FECS_TRACE_NUM_RECORDS - 1);