msm: kgsl: Fix snapshot dump for hangs involving legacy context switch
The IBs stored by legacy context switch are not stored as part of the
nominal mem_entry accounting that the rest of the process has. As a
result we cannot freeze the legacy context switch IBs for dump. Instead,
dump them into the snapshot as IB sections. Also, store the offset for
the frozen objects to avoid trying to read the gpuaddr of the memdesc after
it had been freed.
Change-Id: Ic0dedbadda43a3025f938b31140d5be19c4706b2
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
diff --git a/drivers/gpu/msm/adreno_snapshot.c b/drivers/gpu/msm/adreno_snapshot.c
index bca7040..e8cb734 100644
--- a/drivers/gpu/msm/adreno_snapshot.c
+++ b/drivers/gpu/msm/adreno_snapshot.c
@@ -657,17 +657,31 @@
parse_ibs = 0;
if (parse_ibs && adreno_cmd_is_ib(rbptr[index])) {
+ unsigned int ibaddr = rbptr[index + 1];
+ unsigned int ibsize = rbptr[index + 2];
+
/*
- * The IB from CP_IB1_BASE goes into the snapshot, all
+ * This will return non NULL if the IB happens to be
+ * part of the context memory (i.e - context switch
+ * command buffers)
+ */
+
+ struct kgsl_memdesc *memdesc =
+ adreno_find_ctxtmem(device, ptbase, ibaddr,
+ ibsize);
+
+ /*
+ * The IB from CP_IB1_BASE and the IBs for legacy
+ * context switch go into the snapshot all
* others get marked at GPU objects
*/
- if (rbptr[index + 1] == ibbase)
+
+ if (ibaddr == ibbase || memdesc != NULL)
push_object(device, SNAPSHOT_OBJ_TYPE_IB,
- ptbase, rbptr[index + 1],
- rbptr[index + 2]);
+ ptbase, ibaddr, ibsize);
else
- ib_add_gpu_object(device, ptbase,
- rbptr[index + 1], rbptr[index + 2]);
+ ib_add_gpu_object(device, ptbase, ibaddr,
+ ibsize);
}
index = index + 1;