drm/msm: A couple GPU devcore enhancements
Subsystems (4)
cover drm/msm: A couple GPU devcore enhancements
From: Rob Clark <[email protected]>
A couple things useful for debugging iova faults:
1. caputre all buffer addresses and sizes even if we don't capture their contents.
2. capture the GEM buffer debug labels
Rob Clark (2):
drm/msm/gpu: Capture all BO addr+size in devcore drm/msm/gpu: Add GEM debug label to devcore
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 1 + drivers/gpu/drm/msm/msm_gpu.c | 40 ++++++++----------------- drivers/gpu/drm/msm/msm_gpu.h | 1 + 3 files changed, 14 insertions(+), 28 deletions(-)
Signature · 1 line
2.36.1
PATCH 1/2 drm/msm/gpu: Capture all BO addr+size in devcore
From: Rob Clark <[email protected]>
It is useful to know what buffers userspace thinks are associated with the submit, even if we don't care to capture their content. This brings things more inline with $debugfs/rd cmdstream dumping.
--- drivers/gpu/drm/msm/msm_gpu.c | 36 ++++++++--------------------------- 1 file changed, 8 insertions(+), 28 deletions(-)
drivers/gpu/drm/msm/msm_gpu.c +8 -28
@@ -221,7 +221,7 @@ static void msm_gpu_devcoredump_free(void *data) }static void msm_gpu_crashstate_get_bo (struct msm_gpu_state *state, -struct msm_gem_object *obj,u64 iova,u32 flags) +struct msm_gem_object *obj,u64 iova,bool full) {struct msm_gpu_state_bo *state_bo = &state->bos[state->nr_bos];
@@ -229,8 +229,7 @@ static void msm_gpu_crashstate_get_bo(struct msm_gpu_state *state, state_bo->size = obj->base.size; state_bo->iova = iova; -/* Only store data for non imported buffer objects marked for read */ -if ((flags &MSM_SUBMIT_BO_READ ) && !obj->base.import_attach) { +if (full) {void *ptr; state_bo->data =kvmalloc (obj->base.size,GFP_KERNEL );
@@ -276,34 +275,15 @@ static void msm_gpu_crashstate_capture(struct msm_gpu *gpu, state->fault_info = gpu->fault_info;if (submit) { -int i, nr =0 ; - -/* count # of buffers to dump: */ -for (i =0 ; i < submit->nr_bos; i++) -if (should_dump (submit, i)) - nr++; -/* always dump cmd bo's, but don't double count them: */ -for (i =0 ; i < submit->nr_cmds; i++) -if (!should_dump (submit, submit->cmd[i].idx)) - nr++; - - state->bos =kcalloc (nr, +int i; + + state->bos =kcalloc (submit->nr_bos,sizeof (struct msm_gpu_state_bo ),GFP_KERNEL );for (i =0 ; state->bos && i < submit->nr_bos; i++) { -if (should_dump (submit, i)) { -msm_gpu_crashstate_get_bo (state, submit->bos[i].obj, - submit->bos[i].iova, submit->bos[i].flags); - } - } - -for (i =0 ; state->bos && i < submit->nr_cmds; i++) { -int idx = submit->cmd[i].idx; - -if (!should_dump (submit, submit->cmd[i].idx)) { -msm_gpu_crashstate_get_bo (state, submit->bos[idx].obj, - submit->bos[idx].iova, submit->bos[idx].flags); - } +msm_gpu_crashstate_get_bo (state, submit->bos[i].obj, + submit->bos[i].iova, +should_dump (submit, i)); } }
Signature · 1 line
2.36.1
PATCH 2/2 drm/msm/gpu: Add GEM debug label to devcore
In reply to Rob ClarkFrom: Rob Clark <[email protected]>
When trying to understand an iova fault devcore, once you figure out which buffer we accessed beyond the end of, it is useful to see the buffer's debug label.
--- drivers/gpu/drm/msm/adreno/adreno_gpu.c | 1 + drivers/gpu/drm/msm/msm_gpu.c | 4 ++++ drivers/gpu/drm/msm/msm_gpu.h | 1 + 3 files changed, 6 insertions(+)
drivers/gpu/drm/msm/adreno/adreno_gpu.c +1 -0
@@ -824,6 +824,7 @@ void adreno_show(struct msm_gpu *gpu, struct msm_gpu_state *state,drm_printf (p," - iova: 0x%016llx\n" , state->bos[i].iova);drm_printf (p," size: %zd\n" , state->bos[i].size); +drm_printf (p," name: %-32s\n" , state->bos[i].name);adreno_show_object (p, &state->bos[i].data, state->bos[i].size, &state->bos[i].encoded);
drivers/gpu/drm/msm/msm_gpu.c +4 -0
@@ -229,6 +229,10 @@ static void msm_gpu_crashstate_get_bo(struct msm_gpu_state *state, state_bo->size = obj->base.size; state_bo->iova = iova; +BUILD_BUG_ON (sizeof (state_bo->name) !=sizeof (obj->name)); + +memcpy (state_bo->name, obj->name,sizeof (state_bo->name)); +if (full) {void *ptr;
drivers/gpu/drm/msm/msm_gpu.h +1 -0
@@ -476,6 +476,7 @@ struct msm_gpu_state_bo {size_t size;void *data;bool encoded; +char name[32 ]; };struct msm_gpu_state {
Signature · 1 line
2.36.1