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

Qu, Jim Jim.Qu at amd.com
Tue Jul 12 05:11:20 UTC 2016


Hi Dave:


Thanks to your response.  if it uses WARN() or WARN_ON(). Does it also block the process with for() endless loop? I thinks it is essential. What do you think?


Thanks

JimQu

________________________________
发件人: Dave Airlie <airlied at gmail.com>
发送时间: 2016年7月12日 11:35:19
收件人: Qu, Jim
抄送: amd-gfx mailing list
主题: Re: [PATCH] drm/amdgpu: replace BUG_ON() and BUG()

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20160712/80026480/attachment.html>


More information about the amd-gfx mailing list