[PATCH 3/5] drm/amdgpu/smu: add metrics table lock for navi

Deucher, Alexander Alexander.Deucher at amd.com
Tue Dec 17 20:12:24 UTC 2019


[AMD Official Use Only - Internal Distribution Only]

yeah, they need some fixes.

Alex
________________________________
From: Pelloux-prayer, Pierre-eric <Pierre-eric.Pelloux-prayer at amd.com>
Sent: Tuesday, December 17, 2019 1:56 PM
To: Alex Deucher <alexdeucher at gmail.com>; amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Deucher, Alexander <Alexander.Deucher at amd.com>
Subject: Re: [PATCH 3/5] drm/amdgpu/smu: add metrics table lock for navi

Hi Alex,

Isn't this patch missing something like this:

    pr_info("Failed to export SMU metrics table!\n");
+   mutex_unlock(&smu->metrics_lock);
    return ret;

to release the lock in case of error?

Regards,
Pierre-Eric


On 17/12/2019 15:55, Alex Deucher wrote:
> To protect access to the metrics table.
>
> Bug: https://gitlab.freedesktop.org/drm/amd/issues/900
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>  drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
> index 15403b7979d6..102fddda925b 100644
> --- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
> +++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
> @@ -564,6 +564,7 @@ static int navi10_get_metrics_table(struct smu_context *smu,
>        struct smu_table_context *smu_table= &smu->smu_table;
>        int ret = 0;
>
> +     mutex_lock(&smu->metrics_lock);
>        if (!smu_table->metrics_time || time_after(jiffies, smu_table->metrics_time + msecs_to_jiffies(100))) {
>                ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, 0,
>                                (void *)smu_table->metrics_table, false);
> @@ -575,6 +576,7 @@ static int navi10_get_metrics_table(struct smu_context *smu,
>        }
>
>        memcpy(metrics_table, smu_table->metrics_table, sizeof(SmuMetrics_t));
> +     mutex_unlock(&smu->metrics_lock);
>
>        return ret;
>  }
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20191217/fe77cd4a/attachment-0001.htm>


More information about the amd-gfx mailing list