[PATCH] drm/amdgpu: replace BUG_ON() and BUG()

Dave Airlie airlied at gmail.com
Tue Jul 12 03:35:19 UTC 2016


On 12 July 2016 at 10:16, jimqu <Jim.Qu at amd.com> wrote:
> Sometimes, it maybe a ring test failure during S3 resume. When that
> happens, it will be kernel panic in the fence interrupt and  will
> hangs up system. it is difficult to get any information from kernel
> for debug.

Please just use WARN or WARN_ON.

Dave.

>
> Change-Id: Iafa6c3793be151b8b85cf4299b929ba333b6174e
> Signed-off-by: JimQu <Jim.Qu at amd.com>
> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu.h       | 15 +++++++++++++++
>  drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c |  4 ++--
>  2 files changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> index c3bf33f..15b6c5d 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
> @@ -2242,6 +2242,21 @@ amdgpu_get_sdma_instance(struct amdgpu_ring *ring)
>  }
>
>  /*
> + * Debug helpers
> + */
> +#define AMDGPU_BUG() do { \
> +               printk(KERN_ERR "BUG: failure at %s:%d/%s()!\n", __FILE__, __LINE__, __FUNCTION__); \
> +               dump_stack(); \
> +               for (;;); \
> +       } while (0)
> +
> +#define AMDGPU_BUG_ON(condition) do { \
> +               if (unlikely((condition)!= 0)) { \
> +                       AMDGPU_BUG(); \
> +               } \
> +       } while (0)
> +
> +/*
>   * ASICs macro.
>   */
>  #define amdgpu_asic_set_vga_state(adev, state) (adev)->asic_funcs->set_vga_state((adev), (state))
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> index d155876..b8e5fa7 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c
> @@ -213,13 +213,13 @@ void amdgpu_fence_process(struct amdgpu_ring *ring)
>                 fence = rcu_dereference_protected(*ptr, 1);
>                 RCU_INIT_POINTER(*ptr, NULL);
>
> -               BUG_ON(!fence);
> +               AMDGPU_BUG_ON(!fence);
>
>                 r = fence_signal(fence);
>                 if (!r)
>                         FENCE_TRACE(fence, "signaled from irq context\n");
>                 else
> -                       BUG();
> +                       AMDGPU_BUG();
>
>                 fence_put(fence);
>         }
> --
> 1.9.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list