[PATCH v2 5/5] drm/amdgpu/smu: add metrics table lock for vega20 (v2)

Quan, Evan Evan.Quan at amd.com
Wed Dec 18 01:52:40 UTC 2019


It's fine with me to check them in as a temporary workaround. 
Series is reviewed-by: Evan Quan <evan.quan at amd.com>

> -----Original Message-----
> From: amd-gfx <amd-gfx-bounces at lists.freedesktop.org> On Behalf Of Alex
> Deucher
> Sent: Wednesday, December 18, 2019 5:46 AM
> To: amd-gfx at lists.freedesktop.org
> Cc: Deucher, Alexander <Alexander.Deucher at amd.com>
> Subject: [PATCH v2 5/5] drm/amdgpu/smu: add metrics table lock for vega20
> (v2)
> 
> To protect access to the metrics table.
> 
> v2: unlock on error
> 
> Bug:
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.fre
> edesktop.org%2Fdrm%2Famd%2Fissues%2F900&data=02%7C01%7Cevan.q
> uan%40amd.com%7Cefa0dd86e5a74ead810708d7833a823e%7C3dd8961fe488
> 4e608e11a82d994e183d%7C0%7C0%7C637122159732784832&sdata=X0Z
> UV1r90Dy3mvlp8zONFcxKQcSaciwkVt7GJabYH0I%3D&reserved=0
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>  drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
> b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
> index 2b1c3f8a0415..250ff5aa1305 100644
> --- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
> +++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
> @@ -1678,17 +1678,20 @@ static int vega20_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 + HZ / 1000)) {
>  		ret = smu_update_table(smu, SMU_TABLE_SMU_METRICS, 0,
>  				(void *)smu_table->metrics_table, false);
>  		if (ret) {
>  			pr_info("Failed to export SMU metrics table!\n");
> +			mutex_unlock(&smu->metrics_lock);
>  			return ret;
>  		}
>  		smu_table->metrics_time = jiffies;
>  	}
> 
>  	memcpy(metrics_table, smu_table->metrics_table,
> sizeof(SmuMetrics_t));
> +	mutex_unlock(&smu->metrics_lock);
> 
>  	return ret;
>  }
> --
> 2.23.0
> 
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.free
> desktop.org%2Fmailman%2Flistinfo%2Famd-
> gfx&data=02%7C01%7Cevan.quan%40amd.com%7Cefa0dd86e5a74ead81
> 0708d7833a823e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637
> 122159732784832&sdata=xFCKqTGqv57k9SucgTc7Ur5AGctpMO%2BbPvw
> RKz53whI%3D&reserved=0


More information about the amd-gfx mailing list