[PATCH] drm/amdgpu: reduce the full access time by about 50ms

Paul Menzel pmenzel at molgen.mpg.de
Thu Dec 24 22:44:09 UTC 2020


Dear Peng Ju,


Thank you for your patch.

Am 24.12.20 um 07:04 schrieb pengzhou:

Could you please configure your name in git:

     git config --global user.name "Peng Zhou" # or Peng Ju Zhou

Also, please mention PSP in some way in the git commit message summary. 
Maybe:

 > drm/amdgpu: Reduce delay in PSP command submit by …

> The function msleep(1) can be delay to 10+ ms sometimes,
> which contributes a big delay during the full access time.

Do you have the Linux log messages with timestamps, where the delay can 
be seen?

> Changing msleep(1) to usleep_range(10, 100)
> and it can reduce about 50ms delay during full access time.

(Please wrap lines after 75 characters.)

`usleep_range(10, 100)` is 100 μs which is less then 1 ms (= 1.000 μs). 
What datasheet specifies the needed delays?

> Signed-off-by: pengzhou <PengJu.Zhou at amd.com>
> Change-Id: I151a07c55068d5c429553ef0e6668f024c0c0f3d
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> index 523d22db094b..ef69051681cf 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
> @@ -282,7 +282,7 @@ psp_cmd_submit_buf(struct psp_context *psp,
>   		ras_intr = amdgpu_ras_intr_triggered();
>   		if (ras_intr)
>   			break;
> -		msleep(1);
> +		usleep_range(10, 100);

With `timeout = 2000`, this was a maximum of two seconds (or even 20 
seconds judging from your commit message). With your change it seems the 
waiting time is reduced to 0.2 seconds.

I do not understand, how you reach 50 ms in the commit message title? 
Only if the msleep would take 50 ms, which is unlikely.

>   		amdgpu_asic_invalidate_hdp(psp->adev, NULL);
>   	}

It’s great to see these kind of optimizations, as amdgpu takes 400 ms to 
load on my system.

In a followup the logging should be improved too. Maybe, print a 
warning, should it take longer than five milliseconds.

I tested that it still boots on my MSI B350M MORTAR (MS-7A37) with AMD 
Ryzen 3 2200G, but couldn’t determine if the patch improved the boot 
time in anyway due to absent logging.


Kind regards,

Paul


More information about the amd-gfx mailing list