drm/amd/powerplay: change metrics update period from 1ms to 100ms
Subsystems (2)
PATCH 1/2 drm/amd/powerplay: change metrics update period from 1ms to 100ms
too high frequence to update mertrics table will cause smu firmware error,so change mertrics table update period from 1ms to 100ms (navi10, 12, 14)
--- drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -1
@@ -548,7 +548,7 @@ static int navi10_get_metrics_table(struct smu_context *smu,struct smu_table_context *smu_table= &smu->smu_table;int ret =0 ; -if (!smu_table->metrics_time ||time_after (jiffies, smu_table->metrics_time +HZ /1000 )) { +if (!smu_table->metrics_time ||time_after (jiffies, smu_table->metrics_time +msecs_to_jiffies (10 ))) { ret =smu_update_table (smu,SMU_TABLE_SMU_METRICS ,0 , (void *)smu_table->metrics_table, false);if (ret) {
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 2/2 drm/amd/powerplay: add sensor lock support for smu
when multithreading access sysfs of amdgpu_pm_info at the sametime. the swsmu driver cause smu firmware hang.
eg:
single thread access:
Message A + Param A ==> right
Message B + Param B ==> right
Message C + Param C ==> right
multithreading access:
Message A + Param B ==> error
Message B + Param A ==> error
Message C + Param C ==> right
the patch will add sensor lock(mutex) to avoid this error.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++ drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 2 ++ 5 files changed, 9 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
@@ -840,6 +840,8 @@ static int smu_sw_init(void *handle) smu->smu_baco.state =SMU_BACO_STATE_EXIT ; smu->smu_baco.platform_support = false; +mutex_init (&smu->sensor_lock); + smu->watermarks_bitmap =0 ; smu->power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ; smu->default_power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ;
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +2 -0
@@ -1025,6 +1025,7 @@ static int arcturus_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm;
@@ -1051,6 +1052,7 @@ static int arcturus_read_sensor(struct smu_context *smu,default : ret =smu_smc_read_sensor (smu, sensor, data, size); } +mutex_unlock (&smu->sensor_lock);return ret; }
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
@@ -350,6 +350,7 @@ struct smu_contextconst struct smu_funcs *funcs;const struct pptable_funcs *ppt_funcs;struct mutex mutex; +struct mutex sensor_lock;uint64_t pool_size;struct smu_table_context smu_table;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +2 -0
@@ -1387,6 +1387,7 @@ static int navi10_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm;
@@ -1410,6 +1411,7 @@ static int navi10_read_sensor(struct smu_context *smu,default : ret =smu_smc_read_sensor (smu, sensor, data, size); } +mutex_unlock (&smu->sensor_lock);return ret; }
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +2 -0
@@ -3017,6 +3017,7 @@ static int vega20_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm;
@@ -3042,6 +3043,7 @@ static int vega20_read_sensor(struct smu_context *smu,default : ret =smu_smc_read_sensor (smu, sensor, data, size); } +mutex_unlock (&smu->sensor_lock);return ret; }
Signature · 6 lines
2.17.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): [email protected]
Feng, Kenneth
Reviewed-by Kenneth FengRE: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
Here's the case: the user mode driver and the tester access the sysfs simultaneously. That causes the message/parameter mismatch.
-----Original Message-----
From: Wang, Kevin(Yang)
Sent: Thursday, September 26, 2019 4:56 PM
To: [email protected]
Cc: Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
when multithreading access sysfs of amdgpu_pm_info at the sametime. the swsmu driver cause smu firmware hang.
eg:
single thread access:
Message A + Param A ==> right
Message B + Param B ==> right
Message C + Param C ==> right
multithreading access:
Message A + Param B ==> error
Message B + Param A ==> error
Message C + Param C ==> right
the patch will add sensor lock(mutex) to avoid this error.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++ drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 2 ++ 5 files changed, 9 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
@@ -840,6 +840,8 @@ static int smu_sw_init(void *handle) smu->smu_baco.state =SMU_BACO_STATE_EXIT ; smu->smu_baco.platform_support = false; +mutex_init (&smu->sensor_lock); + smu->watermarks_bitmap =0 ; smu->power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ; smu->default_power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ;
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +1 -0
@@ -1025,6 +1025,7 @@ static int arcturus_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1051,6 +1052,7 @@ static int arcturus_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}
+ mutex_unlock(&smu->sensor_lock);
return ret;
}
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
@@ -350,6 +350,7 @@ struct smu_contextconst struct smu_funcs *funcs;const struct pptable_funcs *ppt_funcs;struct mutex mutex; +struct mutex sensor_lock;uint64_t pool_size;struct smu_table_context smu_table;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -0
@@ -1387,6 +1387,7 @@ static int navi10_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1410,6 +1411,7 @@ static int navi10_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}
+ mutex_unlock(&smu->sensor_lock);
return ret;
}
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +1 -0
@@ -3017,6 +3017,7 @@ static int vega20_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -3042,6 +3043,7 @@ static int vega20_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}
+ mutex_unlock(&smu->sensor_lock);
return ret;
}
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
RE: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
In reply to a message not in the archiveHow about adding the mutex protection in smu_v11_0_send_msg_with_param and smu_v11_0_send_msg? That seems able to simplify the code.
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Wang, Kevin(Yang)
Sent: Thursday, September 26, 2019 4:56 PM
To: [email protected]
Cc: Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
when multithreading access sysfs of amdgpu_pm_info at the sametime. the swsmu driver cause smu firmware hang.
eg:
single thread access:
Message A + Param A ==> right
Message B + Param B ==> right
Message C + Param C ==> right
multithreading access:
Message A + Param B ==> error
Message B + Param A ==> error
Message C + Param C ==> right
the patch will add sensor lock(mutex) to avoid this error.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++ drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 2 ++ 5 files changed, 9 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
@@ -840,6 +840,8 @@ static int smu_sw_init(void *handle) smu->smu_baco.state =SMU_BACO_STATE_EXIT ; smu->smu_baco.platform_support = false; +mutex_init (&smu->sensor_lock); + smu->watermarks_bitmap =0 ; smu->power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ; smu->default_power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ;
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +1 -0
@@ -1025,6 +1025,7 @@ static int arcturus_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1051,6 +1052,7 @@ static int arcturus_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}
+ mutex_unlock(&smu->sensor_lock);
return ret;
}
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
@@ -350,6 +350,7 @@ struct smu_contextconst struct smu_funcs *funcs;const struct pptable_funcs *ppt_funcs;struct mutex mutex; +struct mutex sensor_lock;uint64_t pool_size;struct smu_table_context smu_table;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -0
@@ -1387,6 +1387,7 @@ static int navi10_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1410,6 +1411,7 @@ static int navi10_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}
+ mutex_unlock(&smu->sensor_lock);
return ret;
}
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +1 -0
@@ -3017,6 +3017,7 @@ static int vega20_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -3042,6 +3043,7 @@ static int vega20_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}
+ mutex_unlock(&smu->sensor_lock);
return ret;
}
--
2.17.1
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): MN2PR12MB334488D05D2FAEF84C6D550EE4860-rweVpJHSKToDMgCC8P//[email protected]
Re: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
sure, you are right, the origin design should be add this lock into these functions, but only add these functions can't fix this issue.
eg:
"watch -n 0 /sys/kenel/debug/dri0/amdgpu_pm_info"
16 threads run this command will cause smu error.
so this is workaound fix about sensor interface.
in fact, the smu driver need more lock to protect smu resource. but too many locks can easily lead to deadlocks in smu driver. solve the problem temporarily first and optimize this part later
1. Message + Param ==> message param lock 2. Message + Message Result ==> message result lock 3. Message1 + Message2 ==> message pair lock (eg: SetFeatureLow and SetFeatureHigh)
Best Regars,
Kevin
________________________________
From: Quan, Evan <[email protected]>
Sent: Thursday, September 26, 2019 8:22 PM
To: Wang, Kevin(Yang) <[email protected]>; [email protected] <[email protected]>
Cc: Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: RE: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
How about adding the mutex protection in smu_v11_0_send_msg_with_param and smu_v11_0_send_msg? That seems able to simplify the code.
-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Wang, Kevin(Yang)
Sent: Thursday, September 26, 2019 4:56 PM
To: [email protected]
Cc: Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
when multithreading access sysfs of amdgpu_pm_info at the sametime. the swsmu driver cause smu firmware hang.
eg:
single thread access:
Message A + Param A ==> right
Message B + Param B ==> right
Message C + Param C ==> right
multithreading access:
Message A + Param B ==> error
Message B + Param A ==> error
Message C + Param C ==> right
the patch will add sensor lock(mutex) to avoid this error.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++ drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 2 ++ 5 files changed, 9 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
@@ -840,6 +840,8 @@ static int smu_sw_init(void *handle) smu->smu_baco.state =SMU_BACO_STATE_EXIT ; smu->smu_baco.platform_support = false; +mutex_init (&smu->sensor_lock); + smu->watermarks_bitmap =0 ; smu->power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ; smu->default_power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ;
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +1 -0
@@ -1025,6 +1025,7 @@ static int arcturus_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1051,6 +1052,7 @@ static int arcturus_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}+ mutex_unlock(&smu->sensor_lock);
return ret;
}
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
@@ -350,6 +350,7 @@ struct smu_contextconst struct smu_funcs *funcs;const struct pptable_funcs *ppt_funcs;struct mutex mutex; +struct mutex sensor_lock;uint64_t pool_size;struct smu_table_context smu_table;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -0
@@ -1387,6 +1387,7 @@ static int navi10_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1410,6 +1411,7 @@ static int navi10_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}+ mutex_unlock(&smu->sensor_lock);
return ret;
}
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +1 -0
@@ -3017,6 +3017,7 @@ static int vega20_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -3042,6 +3043,7 @@ static int vega20_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}+ mutex_unlock(&smu->sensor_lock);
return ret;
}
--
2.17.1
_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): MN2PR12MB3296504F830A8D72700D11B1A2860-rweVpJHSKTqAm9ToKNQgFgdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
Re: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
Does the older powerplay code need a similar fix?
Alex
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Wang, Kevin(Yang) <[email protected]>
Sent: Thursday, September 26, 2019 9:06 AM
To: Quan, Evan <[email protected]>; [email protected] <[email protected]>
Cc: Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>
Subject: Re: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
sure, you are right, the origin design should be add this lock into these functions, but only add these functions can't fix this issue.
eg:
"watch -n 0 /sys/kenel/debug/dri0/amdgpu_pm_info"
16 threads run this command will cause smu error.
so this is workaound fix about sensor interface.
in fact, the smu driver need more lock to protect smu resource. but too many locks can easily lead to deadlocks in smu driver. solve the problem temporarily first and optimize this part later
1. Message + Param ==> message param lock 2. Message + Message Result ==> message result lock 3. Message1 + Message2 ==> message pair lock (eg: SetFeatureLow and SetFeatureHigh)
Best Regars,
Kevin
________________________________
From: Quan, Evan <[email protected]>
Sent: Thursday, September 26, 2019 8:22 PM
To: Wang, Kevin(Yang) <[email protected]>; [email protected] <[email protected]>
Cc: Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: RE: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
How about adding the mutex protection in smu_v11_0_send_msg_with_param and smu_v11_0_send_msg? That seems able to simplify the code.
-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> On Behalf Of Wang, Kevin(Yang)
Sent: Thursday, September 26, 2019 4:56 PM
To: [email protected]
Cc: Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>; Wang, Kevin(Yang) <[email protected]>
Subject: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
when multithreading access sysfs of amdgpu_pm_info at the sametime. the swsmu driver cause smu firmware hang.
eg:
single thread access:
Message A + Param A ==> right
Message B + Param B ==> right
Message C + Param C ==> right
multithreading access:
Message A + Param B ==> error
Message B + Param A ==> error
Message C + Param C ==> right
the patch will add sensor lock(mutex) to avoid this error.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++ drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 2 ++ 5 files changed, 9 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
@@ -840,6 +840,8 @@ static int smu_sw_init(void *handle) smu->smu_baco.state =SMU_BACO_STATE_EXIT ; smu->smu_baco.platform_support = false; +mutex_init (&smu->sensor_lock); + smu->watermarks_bitmap =0 ; smu->power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ; smu->default_power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ;
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +1 -0
@@ -1025,6 +1025,7 @@ static int arcturus_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1051,6 +1052,7 @@ static int arcturus_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}+ mutex_unlock(&smu->sensor_lock);
return ret;
}
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
@@ -350,6 +350,7 @@ struct smu_contextconst struct smu_funcs *funcs;const struct pptable_funcs *ppt_funcs;struct mutex mutex; +struct mutex sensor_lock;uint64_t pool_size;struct smu_table_context smu_table;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -0
@@ -1387,6 +1387,7 @@ static int navi10_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1410,6 +1411,7 @@ static int navi10_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}+ mutex_unlock(&smu->sensor_lock);
return ret;
}
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +1 -0
@@ -3017,6 +3017,7 @@ static int vega20_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -3042,6 +3043,7 @@ static int vega20_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}+ mutex_unlock(&smu->sensor_lock);
return ret;
}
--
2.17.1
_______________________________________________
amd-gfx mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): BN6PR12MB180969DC3D8DCB2FBE655DB8F7860-/b2+HYfkarSEx6ez0IUAagdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org
RE: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
There should be no issue with old powerplay routines. As there is API lock(hwmgr->smu_lock) in amd_powerplay.c. It's quite coarse-grained but working.
In fact, I'm considering whether we need to take the same way in swSMU routine.
Since for now it's hard to define what we are protecting for and thus find a better fine-grained mutex.
Regards,
Evan
From: Deucher, Alexander <[email protected]>
Sent: Thursday, September 26, 2019 11:06 PM
To: Wang, Kevin(Yang) <[email protected]>; Quan, Evan <[email protected]>; [email protected]
Cc: Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>
Subject: Re: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
Does the older powerplay code need a similar fix?
Alex
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Sent: Thursday, September 26, 2019 9:06 AM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Huang, Ray <[email protected]<mailto:[email protected]>>; Feng, Kenneth <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
sure, you are right, the origin design should be add this lock into these functions, but only add these functions can't fix this issue.
eg:
"watch -n 0 /sys/kenel/debug/dri0/amdgpu_pm_info"
16 threads run this command will cause smu error.
so this is workaound fix about sensor interface.
in fact, the smu driver need more lock to protect smu resource. but too many locks can easily lead to deadlocks in smu driver. solve the problem temporarily first and optimize this part later
1. Message + Param ==> message param lock 2. Message + Message Result ==> message result lock 3. Message1 + Message2 ==> message pair lock (eg: SetFeatureLow and SetFeatureHigh)
Best Regars,
Kevin
________________________________
From: Quan, Evan <[email protected]<mailto:[email protected]>>
Sent: Thursday, September 26, 2019 8:22 PM
To: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Huang, Ray <[email protected]<mailto:[email protected]>>; Feng, Kenneth <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
How about adding the mutex protection in smu_v11_0_send_msg_with_param and smu_v11_0_send_msg? That seems able to simplify the code.
-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> On Behalf Of Wang, Kevin(Yang)
Sent: Thursday, September 26, 2019 4:56 PM
To: [email protected]<mailto:[email protected]>
Cc: Huang, Ray <[email protected]<mailto:[email protected]>>; Feng, Kenneth <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Subject: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
when multithreading access sysfs of amdgpu_pm_info at the sametime. the swsmu driver cause smu firmware hang.
eg:
single thread access:
Message A + Param A ==> right
Message B + Param B ==> right
Message C + Param C ==> right
multithreading access:
Message A + Param B ==> error
Message B + Param A ==> error
Message C + Param C ==> right
the patch will add sensor lock(mutex) to avoid this error.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++ drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 2 ++ 5 files changed, 9 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
@@ -840,6 +840,8 @@ static int smu_sw_init(void *handle) smu->smu_baco.state =SMU_BACO_STATE_EXIT ; smu->smu_baco.platform_support = false; +mutex_init (&smu->sensor_lock); + smu->watermarks_bitmap =0 ; smu->power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ; smu->default_power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ;
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +1 -0
@@ -1025,6 +1025,7 @@ static int arcturus_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1051,6 +1052,7 @@ static int arcturus_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}+ mutex_unlock(&smu->sensor_lock);
return ret;
}
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
@@ -350,6 +350,7 @@ struct smu_contextconst struct smu_funcs *funcs;const struct pptable_funcs *ppt_funcs;struct mutex mutex; +struct mutex sensor_lock;uint64_t pool_size;struct smu_table_context smu_table;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -0
@@ -1387,6 +1387,7 @@ static int navi10_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1410,6 +1411,7 @@ static int navi10_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}+ mutex_unlock(&smu->sensor_lock);
return ret;
}
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +1 -0
@@ -3017,6 +3017,7 @@ static int vega20_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -3042,6 +3043,7 @@ static int vega20_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}+ mutex_unlock(&smu->sensor_lock);
return ret;
}
--
2.17.1
_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
A message that is not in the archive (sent off-list or not yet received): MN2PR12MB334452EBB72B75C0B7A0E870E4810-rweVpJHSKToDMgCC8P//[email protected]
Re: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
the smu driver need to split and optimize "smu->mutex" first,
because this lock is used on most scene.
after this lock clearly, we can define more fine-grained lock resource in smu driver.
Best Regards,
Kevin
________________________________
From: Quan, Evan <[email protected]>
Sent: Friday, September 27, 2019 9:18 AM
To: Deucher, Alexander <[email protected]>; Wang, Kevin(Yang) <[email protected]>; [email protected] <amd-gfx-PD4FTy7X32lNgt0PjOBp9/[email protected]>
Cc: Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>
Subject: RE: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
There should be no issue with old powerplay routines.
As there is API lock(hwmgr->smu_lock) in amd_powerplay.c.
It’s quite coarse-grained but working.
In fact, I’m considering whether we need to take the same way in swSMU routine.
Since for now it’s hard to define what we are protecting for and thus find a better fine-grained mutex.
Regards,
Evan
From: Deucher, Alexander <[email protected]>
Sent: Thursday, September 26, 2019 11:06 PM
To: Wang, Kevin(Yang) <[email protected]>; Quan, Evan <[email protected]>; [email protected]
Cc: Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>
Subject: Re: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
Does the older powerplay code need a similar fix?
Alex
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Sent: Thursday, September 26, 2019 9:06 AM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Huang, Ray <[email protected]<mailto:[email protected]>>; Feng, Kenneth <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
sure, you are right, the origin design should be add this lock into these functions,
but only add these functions can't fix this issue.
eg:
"watch -n 0 /sys/kenel/debug/dri0/amdgpu_pm_info"
16 threads run this command will cause smu error.
so this is workaound fix about sensor interface.
in fact, the smu driver need more lock to protect smu resource.
but too many locks can easily lead to deadlocks in smu driver. solve the problem temporarily first and optimize this part later
1. Message + Param ==> message param lock 2. Message + Message Result ==> message result lock 3. Message1 + Message2 ==> message pair lock (eg: SetFeatureLow and SetFeatureHigh)
Best Regars,
Kevin
________________________________
From: Quan, Evan <[email protected]<mailto:[email protected]>>
Sent: Thursday, September 26, 2019 8:22 PM
To: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Huang, Ray <[email protected]<mailto:[email protected]>>; Feng, Kenneth <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
How about adding the mutex protection in smu_v11_0_send_msg_with_param and smu_v11_0_send_msg? That seems able to simplify the code.
-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> On Behalf Of Wang, Kevin(Yang)
Sent: Thursday, September 26, 2019 4:56 PM
To: [email protected]<mailto:[email protected]>
Cc: Huang, Ray <[email protected]<mailto:[email protected]>>; Feng, Kenneth <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Subject: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
when multithreading access sysfs of amdgpu_pm_info at the sametime. the swsmu driver cause smu firmware hang.
eg:
single thread access:
Message A + Param A ==> right
Message B + Param B ==> right
Message C + Param C ==> right
multithreading access:
Message A + Param B ==> error
Message B + Param A ==> error
Message C + Param C ==> right
the patch will add sensor lock(mutex) to avoid this error.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++ drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 2 ++ 5 files changed, 9 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
@@ -840,6 +840,8 @@ static int smu_sw_init(void *handle) smu->smu_baco.state =SMU_BACO_STATE_EXIT ; smu->smu_baco.platform_support = false; +mutex_init (&smu->sensor_lock); + smu->watermarks_bitmap =0 ; smu->power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ; smu->default_power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ;
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +1 -0
@@ -1025,6 +1025,7 @@ static int arcturus_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1051,6 +1052,7 @@ static int arcturus_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}+ mutex_unlock(&smu->sensor_lock);
return ret;
}
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
@@ -350,6 +350,7 @@ struct smu_contextconst struct smu_funcs *funcs;const struct pptable_funcs *ppt_funcs;struct mutex mutex; +struct mutex sensor_lock;uint64_t pool_size;struct smu_table_context smu_table;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -0
@@ -1387,6 +1387,7 @@ static int navi10_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1410,6 +1411,7 @@ static int navi10_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}+ mutex_unlock(&smu->sensor_lock);
return ret;
}
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +1 -0
@@ -3017,6 +3017,7 @@ static int vega20_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -3042,6 +3043,7 @@ static int vega20_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}+ mutex_unlock(&smu->sensor_lock);
return ret;
}
--
2.17.1
_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Re: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
In reply to a message not in the archiveThat might be easier for swSMU as well since this is generally not performance sensitive.
Alex
________________________________
From: Quan, Evan <[email protected]>
Sent: Thursday, September 26, 2019 9:18 PM
To: Deucher, Alexander <[email protected]>; Wang, Kevin(Yang) <[email protected]>; [email protected] <amd-gfx-PD4FTy7X32lNgt0PjOBp9/[email protected]>
Cc: Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>
Subject: RE: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
There should be no issue with old powerplay routines.
As there is API lock(hwmgr->smu_lock) in amd_powerplay.c.
It’s quite coarse-grained but working.
In fact, I’m considering whether we need to take the same way in swSMU routine.
Since for now it’s hard to define what we are protecting for and thus find a better fine-grained mutex.
Regards,
Evan
From: Deucher, Alexander <[email protected]>
Sent: Thursday, September 26, 2019 11:06 PM
To: Wang, Kevin(Yang) <[email protected]>; Quan, Evan <[email protected]>; [email protected]
Cc: Huang, Ray <[email protected]>; Feng, Kenneth <[email protected]>
Subject: Re: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
Does the older powerplay code need a similar fix?
Alex
________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> on behalf of Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Sent: Thursday, September 26, 2019 9:06 AM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Huang, Ray <[email protected]<mailto:[email protected]>>; Feng, Kenneth <[email protected]<mailto:[email protected]>>
Subject: Re: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
sure, you are right, the origin design should be add this lock into these functions,
but only add these functions can't fix this issue.
eg:
"watch -n 0 /sys/kenel/debug/dri0/amdgpu_pm_info"
16 threads run this command will cause smu error.
so this is workaound fix about sensor interface.
in fact, the smu driver need more lock to protect smu resource.
but too many locks can easily lead to deadlocks in smu driver. solve the problem temporarily first and optimize this part later
1. Message + Param ==> message param lock 2. Message + Message Result ==> message result lock 3. Message1 + Message2 ==> message pair lock (eg: SetFeatureLow and SetFeatureHigh)
Best Regars,
Kevin
________________________________
From: Quan, Evan <[email protected]<mailto:[email protected]>>
Sent: Thursday, September 26, 2019 8:22 PM
To: Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Huang, Ray <[email protected]<mailto:[email protected]>>; Feng, Kenneth <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
How about adding the mutex protection in smu_v11_0_send_msg_with_param and smu_v11_0_send_msg? That seems able to simplify the code.
-----Original Message-----
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org<mailto:[email protected]>> On Behalf Of Wang, Kevin(Yang)
Sent: Thursday, September 26, 2019 4:56 PM
To: [email protected]<mailto:[email protected]>
Cc: Huang, Ray <[email protected]<mailto:[email protected]>>; Feng, Kenneth <[email protected]<mailto:[email protected]>>; Wang, Kevin(Yang) <[email protected]<mailto:[email protected]>>
Subject: [PATCH 2/2] drm/amd/powerplay: add sensor lock support for smu
when multithreading access sysfs of amdgpu_pm_info at the sametime. the swsmu driver cause smu firmware hang.
eg:
single thread access:
Message A + Param A ==> right
Message B + Param B ==> right
Message C + Param C ==> right
multithreading access:
Message A + Param B ==> error
Message B + Param A ==> error
Message C + Param C ==> right
the patch will add sensor lock(mutex) to avoid this error.
--- drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 2 ++ drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 1 + drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 2 ++ drivers/gpu/drm/amd/powerplay/vega20_ppt.c | 2 ++ 5 files changed, 9 insertions(+)
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +2 -0
@@ -840,6 +840,8 @@ static int smu_sw_init(void *handle) smu->smu_baco.state =SMU_BACO_STATE_EXIT ; smu->smu_baco.platform_support = false; +mutex_init (&smu->sensor_lock); + smu->watermarks_bitmap =0 ; smu->power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ; smu->default_power_profile_mode =PP_SMC_POWER_PROFILE_BOOTUP_DEFAULT ;
drivers/gpu/drm/amd/powerplay/arcturus_ppt.c +1 -0
@@ -1025,6 +1025,7 @@ static int arcturus_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1051,6 +1052,7 @@ static int arcturus_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}+ mutex_unlock(&smu->sensor_lock);
return ret;
}
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +1 -0
@@ -350,6 +350,7 @@ struct smu_contextconst struct smu_funcs *funcs;const struct pptable_funcs *ppt_funcs;struct mutex mutex; +struct mutex sensor_lock;uint64_t pool_size;struct smu_table_context smu_table;
drivers/gpu/drm/amd/powerplay/navi10_ppt.c +1 -0
@@ -1387,6 +1387,7 @@ static int navi10_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1410,6 +1411,7 @@ static int navi10_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}+ mutex_unlock(&smu->sensor_lock);
return ret;
}
drivers/gpu/drm/amd/powerplay/vega20_ppt.c +1 -0
@@ -3017,6 +3017,7 @@ static int vega20_read_sensor(struct smu_context *smu,if (!data || !size)return -EINVAL ; +mutex_lock (&smu->sensor_lock);switch (sensor) {case AMDGPU_PP_SENSOR_MAX_FAN_RPM : *(uint32_t *)data = pptable->FanMaximumRpm; @@ -3042,6 +3043,7 @@ static int vega20_read_sensor(struct smu_context *smu,
default:
ret = smu_smc_read_sensor(smu, sensor, data, size);
}+ mutex_unlock(&smu->sensor_lock);
return ret;
}
--
2.17.1
_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx