[PATCH v2 1/2] drm/amdgpu: save the reset dump register value for devcoredump

Christian König christian.koenig at amd.com
Tue May 31 13:24:44 UTC 2022


I strongly recommend installing coding style setting for your favorite 
editor.

Those should be available for pretty much every more widely used code 
editor.

Regards,
Christian.

Am 31.05.22 um 15:17 schrieb Sharma, Shashank:
>
> It’s not correct even in the snapshot 😃.
>
> The **a**dev->reset_dump line should start just below the open brace 
> in the line above “dumps*(*adev->reset”.
>
> Check the Linux kernel coding guidelines for extending the line below 
> the open brace.
>
> Regards
>
> Shashank
>
> *From:* Somalapuram, Amaranath <Amaranath.Somalapuram at amd.com>
> *Sent:* Tuesday, May 31, 2022 3:09 PM
> *To:* Sharma, Shashank <Shashank.Sharma at amd.com>; Somalapuram, 
> Amaranath <Amaranath.Somalapuram at amd.com>; amd-gfx at lists.freedesktop.org
> *Cc:* Koenig, Christian <Christian.Koenig at amd.com>; Deucher, Alexander 
> <Alexander.Deucher at amd.com>
> *Subject:* Re: [PATCH v2 1/2] drm/amdgpu: save the reset dump register 
> value for devcoredump
>
> On 5/26/2022 3:24 PM, Sharma, Shashank wrote:
>
>     Hey Amar,
>
>     On 5/26/2022 11:48 AM, Somalapuram Amaranath wrote:
>
>         Allocate memory for register value and use the same values for
>         devcoredump.
>         v1 -> V2: Change krealloc_array() to kmalloc_array()
>
>         Signed-off-by: Somalapuram Amaranath
>         <Amaranath.Somalapuram at amd.com>
>         <mailto:Amaranath.Somalapuram at amd.com>
>         ---
>           drivers/gpu/drm/amd/amdgpu/amdgpu.h         | 1 +
>           drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c | 7 +++++++
>           drivers/gpu/drm/amd/amdgpu/amdgpu_device.c  | 6 +++---
>           3 files changed, 11 insertions(+), 3 deletions(-)
>
>         diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>         b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>         index 76df583663c7..c79d9992b113 100644
>         --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>         +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h
>         @@ -1042,6 +1042,7 @@ struct amdgpu_device {
>                 /* reset dump register */
>               uint32_t *reset_dump_reg_list;
>         +    uint32_t            *reset_dump_reg_value;
>               int                             num_regs;
>                 struct amdgpu_reset_domain    *reset_domain;
>         diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>         b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>         index eedb12f6b8a3..f3ac7912c29c 100644
>         --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>         +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
>         @@ -1709,17 +1709,24 @@ static ssize_t
>         amdgpu_reset_dump_register_list_write(struct file *f,
>                   i++;
>               } while (len < size);
>           +    new = kmalloc_array(i, sizeof(uint32_t), GFP_KERNEL);
>         +    if (!new) {
>         +        ret = -ENOMEM;
>         +        goto error_free;
>         +    }
>               ret = down_write_killable(&adev->reset_domain->sem);
>               if (ret)
>                   goto error_free;
>                 swap(adev->reset_dump_reg_list, tmp);
>         +    swap(adev->reset_dump_reg_value, new);
>               adev->num_regs = i;
>               up_write(&adev->reset_domain->sem);
>               ret = size;
>             error_free:
>               kfree(tmp);
>         +    kfree(new);
>               return ret;
>           }
>           diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>         b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>         index 4daa0e893965..866b4980a6fa 100644
>         --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>         +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
>         @@ -4720,15 +4720,15 @@ int
>         amdgpu_device_pre_asic_reset(struct amdgpu_device *adev,
>             static int amdgpu_reset_reg_dumps(struct amdgpu_device *adev)
>           {
>         -    uint32_t reg_value;
>               int i;
>         lockdep_assert_held(&adev->reset_domain->sem);
>               dump_stack();
>                 for (i = 0; i < adev->num_regs; i++) {
>         -        reg_value = RREG32(adev->reset_dump_reg_list[i]);
>         - trace_amdgpu_reset_reg_dumps(adev->reset_dump_reg_list[i],
>         reg_value);
>         +        adev->reset_dump_reg_value[i] =
>         RREG32(adev->reset_dump_reg_list[i]);
>         + trace_amdgpu_reset_reg_dumps(adev->reset_dump_reg_list[i],
>         +                adev->reset_dump_reg_value[i]);
>
> Alignment is showing spaces in email. But its 2 tabs in code.
>
>
> Regards,
> S.Amarnath
>
>     Please fix the alignment with the line above, after that, please
>     feel free to use:
>     Reviewed-by: Shashank Sharma <shashank.sharma at amd.com>
>     <mailto:shashank.sharma at amd.com>
>
>     - Shashank
>
>               }
>                 return 0;
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20220531/84d1875a/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 10366 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20220531/84d1875a/attachment-0001.png>


More information about the amd-gfx mailing list