AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: SRINIVASAN SHANMUGAM <srinivasan.shanmugam@amd.com>
To: "Christian König" <christian.koenig@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>
Cc: amd-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/amd/amdgpu: Add missing parameter for amdgpu_sdma_register_on_reset_callbacks
Date: Wed, 5 Mar 2025 22:19:30 +0530	[thread overview]
Message-ID: <fac31d8a-30bd-493b-b2f1-15694114476e@amd.com> (raw)
In-Reply-To: <2dbe7e0b-86c4-46c3-9b0f-4cb5a12668c7@amd.com>


On 2/24/2025 6:54 PM, Christian König wrote:
> Am 24.02.25 um 12:45 schrieb Srinivasan Shanmugam:
>> This commit updates the documentation for the function
>> amdgpu_sdma_register_on_reset_callbacks to include a description
>> for the 'adev' parameter.
>>
>> The 'adev' parameter is a pointer to the amdgpu_device structure,
>> which is necessary for registering SDMA reset callbacks.
>>
>> Fixes the below with gcc W=1:
>> drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c:474: warning: Function parameter or struct member 'adev' not described in 'amdgpu_sdma_register_on_reset_callbacks'
>>
>> Cc: Christian König <christian.koenig@amd.com>
>> Cc: Alex Deucher <alexander.deucher@amd.com>
>> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@amd.com>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
>> index 42a7b86e41c3..82856592039b 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sdma.c
>> @@ -464,6 +464,7 @@ void amdgpu_sdma_sysfs_reset_mask_fini(struct amdgpu_device *adev)
>>   
>>   /**
>>    * amdgpu_sdma_register_on_reset_callbacks - Register SDMA reset callbacks
> Why do we have a function to dynamically register callbacks in the first place?

Hi Christian,

Looks like this change comes from commit:

commit 938b123d7c85971328712c6173268d7de66ba843
Author: Jesse.zhang@amd.com <Jesse.zhang@amd.com>
Date:   Tue Jan 21 09:18:44 2025 +0800

     drm/amdgpu/kfd: Add shared SDMA reset functionality with callback 
support

     This patch introduces shared SDMA reset functionality between 
AMDGPU and KFD.
     The implementation includes the following key changes:

     1. Added `amdgpu_sdma_reset_queue`:
        - Resets a specific SDMA queue by instance ID.
        - Invokes registered pre-reset and post-reset callbacks to allow 
KFD and AMDGPU
          to save/restore their state during the reset process.

     2. Added `amdgpu_set_on_reset_callbacks`:
        - Allows KFD and AMDGPU to register callback functions for 
pre-reset and
          post-reset operations.
        - Callbacks are stored in a global linked list and invoked in 
the correct order
          during SDMA reset.

     This patch ensures that both AMDGPU and KFD can handle SDMA reset 
events
     gracefully, with proper state saving and restoration. It also 
provides a flexible
     callback mechanism for future extensions.

looks like may be design choice though not sure, where this callback 
mechanism is to provides flexibility in handling SDMA reset events. By 
allowing both KFD (Kernel Fusion Driver) and AMDGPU to register their 
own pre-reset and post-reset functions,

May I please have your suggestions, if we might further improve this 
mechanism or any other aspects of the implementation.

Thanks in advance,

Srini

>
> That doesn't seem to make much sense.
>
> Regards,
> Christian.
>
>> + * @adev: Pointer to the amdgpu_device structure
>>    * @funcs: Pointer to the callback structure containing pre_reset and post_reset functions
>>    *
>>    * This function allows KFD and AMDGPU to register their own callbacks for handling

      reply	other threads:[~2025-03-05 16:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-24 11:45 [PATCH] drm/amd/amdgpu: Add missing parameter for amdgpu_sdma_register_on_reset_callbacks Srinivasan Shanmugam
2025-02-24 13:24 ` Christian König
2025-03-05 16:49   ` SRINIVASAN SHANMUGAM [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fac31d8a-30bd-493b-b2f1-15694114476e@amd.com \
    --to=srinivasan.shanmugam@amd.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox