Skip to content

Commit e515af8

Browse files
committed
drm/msm: devcoredump should dump MSM_SUBMIT_BO_DUMP buffers
Also log buffers with the DUMP flag set, to ensure we capture all useful cmdstream in crashdump state with modern mesa. Otherwise we miss out on the contents of "state object" cmdstream buffers. v2: add missing 'inline' Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Jordan Crouse <[email protected]>
1 parent 0478b4f commit e515af8

File tree

3 files changed

+34
-12
lines changed

3 files changed

+34
-12
lines changed

drivers/gpu/drm/msm/msm_gem.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,4 +160,14 @@ struct msm_gem_submit {
160160
} bos[];
161161
};
162162

163+
/* helper to determine of a buffer in submit should be dumped, used for both
164+
* devcoredump and debugfs cmdstream dumping:
165+
*/
166+
static inline bool
167+
should_dump(struct msm_gem_submit *submit, int idx)
168+
{
169+
extern bool rd_full;
170+
return rd_full || (submit->bos[idx].flags & MSM_SUBMIT_BO_DUMP);
171+
}
172+
163173
#endif /* __MSM_GEM_H__ */

drivers/gpu/drm/msm/msm_gpu.c

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,16 +355,34 @@ static void msm_gpu_crashstate_capture(struct msm_gpu *gpu,
355355
state->cmd = kstrdup(cmd, GFP_KERNEL);
356356

357357
if (submit) {
358-
int i;
359-
360-
state->bos = kcalloc(submit->nr_cmds,
358+
int i, nr = 0;
359+
360+
/* count # of buffers to dump: */
361+
for (i = 0; i < submit->nr_bos; i++)
362+
if (should_dump(submit, i))
363+
nr++;
364+
/* always dump cmd bo's, but don't double count them: */
365+
for (i = 0; i < submit->nr_cmds; i++)
366+
if (!should_dump(submit, submit->cmd[i].idx))
367+
nr++;
368+
369+
state->bos = kcalloc(nr,
361370
sizeof(struct msm_gpu_state_bo), GFP_KERNEL);
362371

372+
for (i = 0; i < submit->nr_bos; i++) {
373+
if (should_dump(submit, i)) {
374+
msm_gpu_crashstate_get_bo(state, submit->bos[i].obj,
375+
submit->bos[i].iova, submit->bos[i].flags);
376+
}
377+
}
378+
363379
for (i = 0; state->bos && i < submit->nr_cmds; i++) {
364380
int idx = submit->cmd[i].idx;
365381

366-
msm_gpu_crashstate_get_bo(state, submit->bos[idx].obj,
367-
submit->bos[idx].iova, submit->bos[idx].flags);
382+
if (!should_dump(submit, submit->cmd[i].idx)) {
383+
msm_gpu_crashstate_get_bo(state, submit->bos[idx].obj,
384+
submit->bos[idx].iova, submit->bos[idx].flags);
385+
}
368386
}
369387
}
370388

drivers/gpu/drm/msm/msm_rd.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
#include "msm_gpu.h"
4444
#include "msm_gem.h"
4545

46-
static bool rd_full = false;
46+
bool rd_full = false;
4747
MODULE_PARM_DESC(rd_full, "If true, $debugfs/.../rd will snapshot all buffer contents");
4848
module_param_named(rd_full, rd_full, bool, 0600);
4949

@@ -336,12 +336,6 @@ static void snapshot_buf(struct msm_rd_state *rd,
336336
msm_gem_put_vaddr(&obj->base);
337337
}
338338

339-
static bool
340-
should_dump(struct msm_gem_submit *submit, int idx)
341-
{
342-
return rd_full || (submit->bos[idx].flags & MSM_SUBMIT_BO_DUMP);
343-
}
344-
345339
/* called under struct_mutex */
346340
void msm_rd_dump_submit(struct msm_rd_state *rd, struct msm_gem_submit *submit,
347341
const char *fmt, ...)

0 commit comments

Comments
 (0)