From 37b747ca450a3afa5e7101f3c0d41929f472c721 Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Thu, 26 May 2016 18:44:40 -0700 Subject: gpu: nvgpu: fix pid retrieval on tsg reset On engine reset, an event is generate for FECS trace. In case a TSG context is currentlu loaded on GR engine, we retrieve the pid of the TSG from the first channel in the ch_list. Fixed invalid invocation of list_entry that led to crash. Bug 200193891 Change-Id: I79358bbb6685748cde68396ce220ab7b660d414d Signed-off-by: Thomas Fleury Reviewed-on: http://git-master/r/1154811 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Richard Zhao GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c index 77e93458..3682d904 100644 --- a/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/ctxsw_trace_gk20a.c @@ -686,11 +686,13 @@ void gk20a_ctxsw_trace_tsg_reset(struct gk20a *g, struct tsg_gk20a *tsg) return; mutex_lock(&tsg->ch_list_lock); - ch = list_entry(&tsg->ch_list, struct channel_gk20a, ch_entry); + if (!list_empty(&tsg->ch_list)) { + ch = list_entry(tsg->ch_list.next, + struct channel_gk20a, ch_entry); + entry.pid = ch->pid; + } mutex_unlock(&tsg->ch_list_lock); - entry.pid = ch->pid; - gk20a_ctxsw_trace_write(g, &entry); gk20a_ctxsw_trace_wake_up(g, 0); #endif -- cgit v1.2.2