2024-05-13 15:53:40

by Rob Clark

[permalink] [raw]
Subject: [PATCH] drm/msm: Add obj flags to gpu devcoredump

From: Rob Clark <[email protected]>

When debugging faults, it is useful to know how the BO is mapped (cached
vs WC, gpu readonly, etc).

Signed-off-by: Rob Clark <[email protected]>
---
drivers/gpu/drm/msm/adreno/adreno_gpu.c | 1 +
drivers/gpu/drm/msm/msm_gpu.c | 6 ++++--
drivers/gpu/drm/msm/msm_gpu.h | 1 +
3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index b7bbef2eeff4..d9ea15994ae9 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -887,6 +887,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, " flags: 0x%x\n", state->bos[i].flags);
drm_printf(p, " name: %-32s\n", state->bos[i].name);

adreno_show_object(p, &state->bos[i].data,
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index d14ec058906f..ceaee23a4d22 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -222,14 +222,16 @@ static void msm_gpu_crashstate_get_bo(struct msm_gpu_state *state,
struct drm_gem_object *obj, u64 iova, bool full)
{
struct msm_gpu_state_bo *state_bo = &state->bos[state->nr_bos];
+ struct msm_gem_object *msm_obj = to_msm_bo(obj);

/* Don't record write only objects */
state_bo->size = obj->size;
+ state_bo->flags = msm_obj->flags;
state_bo->iova = iova;

- BUILD_BUG_ON(sizeof(state_bo->name) != sizeof(to_msm_bo(obj)->name));
+ BUILD_BUG_ON(sizeof(state_bo->name) != sizeof(msm_obj->name));

- memcpy(state_bo->name, to_msm_bo(obj)->name, sizeof(state_bo->name));
+ memcpy(state_bo->name, msm_obj->name, sizeof(state_bo->name));

if (full) {
void *ptr;
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index 685470b84708..05bb247e7210 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -527,6 +527,7 @@ struct msm_gpu_submitqueue {
struct msm_gpu_state_bo {
u64 iova;
size_t size;
+ u32 flags;
void *data;
bool encoded;
char name[32];
--
2.45.0



2024-05-14 18:46:45

by Akhil P Oommen

[permalink] [raw]
Subject: Re: [PATCH] drm/msm: Add obj flags to gpu devcoredump

On Mon, May 13, 2024 at 08:51:47AM -0700, Rob Clark wrote:
> From: Rob Clark <[email protected]>
>
> When debugging faults, it is useful to know how the BO is mapped (cached
> vs WC, gpu readonly, etc).
>
> Signed-off-by: Rob Clark <[email protected]>

Reviewed-by: Akhil P Oommen <[email protected]>

-Akhil

> ---
> drivers/gpu/drm/msm/adreno/adreno_gpu.c | 1 +
> drivers/gpu/drm/msm/msm_gpu.c | 6 ++++--
> drivers/gpu/drm/msm/msm_gpu.h | 1 +
> 3 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> index b7bbef2eeff4..d9ea15994ae9 100644
> --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> @@ -887,6 +887,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, " flags: 0x%x\n", state->bos[i].flags);
> drm_printf(p, " name: %-32s\n", state->bos[i].name);
>
> adreno_show_object(p, &state->bos[i].data,
> diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
> index d14ec058906f..ceaee23a4d22 100644
> --- a/drivers/gpu/drm/msm/msm_gpu.c
> +++ b/drivers/gpu/drm/msm/msm_gpu.c
> @@ -222,14 +222,16 @@ static void msm_gpu_crashstate_get_bo(struct msm_gpu_state *state,
> struct drm_gem_object *obj, u64 iova, bool full)
> {
> struct msm_gpu_state_bo *state_bo = &state->bos[state->nr_bos];
> + struct msm_gem_object *msm_obj = to_msm_bo(obj);
>
> /* Don't record write only objects */
> state_bo->size = obj->size;
> + state_bo->flags = msm_obj->flags;
> state_bo->iova = iova;
>
> - BUILD_BUG_ON(sizeof(state_bo->name) != sizeof(to_msm_bo(obj)->name));
> + BUILD_BUG_ON(sizeof(state_bo->name) != sizeof(msm_obj->name));
>
> - memcpy(state_bo->name, to_msm_bo(obj)->name, sizeof(state_bo->name));
> + memcpy(state_bo->name, msm_obj->name, sizeof(state_bo->name));
>
> if (full) {
> void *ptr;
> diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
> index 685470b84708..05bb247e7210 100644
> --- a/drivers/gpu/drm/msm/msm_gpu.h
> +++ b/drivers/gpu/drm/msm/msm_gpu.h
> @@ -527,6 +527,7 @@ struct msm_gpu_submitqueue {
> struct msm_gpu_state_bo {
> u64 iova;
> size_t size;
> + u32 flags;
> void *data;
> bool encoded;
> char name[32];
> --
> 2.45.0
>

2024-05-14 22:18:35

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH] drm/msm: Add obj flags to gpu devcoredump



On 5/13/24 17:51, Rob Clark wrote:
> From: Rob Clark <[email protected]>
>
> When debugging faults, it is useful to know how the BO is mapped (cached
> vs WC, gpu readonly, etc).
>
> Signed-off-by: Rob Clark <[email protected]>
> ---

Acked-by: Konrad Dybcio <[email protected]>

Konrad

2024-05-19 08:40:44

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH] drm/msm: Add obj flags to gpu devcoredump

On Mon, May 13, 2024 at 08:51:47AM -0700, Rob Clark wrote:
> From: Rob Clark <[email protected]>
>
> When debugging faults, it is useful to know how the BO is mapped (cached
> vs WC, gpu readonly, etc).
>
> Signed-off-by: Rob Clark <[email protected]>
> ---
> drivers/gpu/drm/msm/adreno/adreno_gpu.c | 1 +
> drivers/gpu/drm/msm/msm_gpu.c | 6 ++++--
> drivers/gpu/drm/msm/msm_gpu.h | 1 +
> 3 files changed, 6 insertions(+), 2 deletions(-)

Reviewed-by: Dmitry Baryshkov <[email protected]>

--
With best wishes
Dmitry