RE: [PATCH 2/2] drm/amd/swsmu: correct smu lock type on smu_read_sensor()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[AMD Official Use Only - Internal Distribution Only]

It's OK to drop sensor_lock. But please keep smu->mutex in smu_read_sensor.
All top APIs from amdgpu_smu.c come with smu->mutex to avoid potential race issue.

-----Original Message-----
From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> On Behalf Of Kevin Wang
Sent: Monday, July 27, 2020 11:05 AM
To: amd-gfx@xxxxxxxxxxxxxxxxxxxxx
Cc: Wang, Kevin(Yang) <Kevin1.Wang@xxxxxxx>; Feng, Kenneth <Kenneth.Feng@xxxxxxx>
Subject: [PATCH 2/2] drm/amd/swsmu: correct smu lock type on smu_read_sensor()

instead "mutex" with "sensor_lock" on smu_read_sensor().

Signed-off-by: Kevin Wang <kevin1.wang@xxxxxxx>
---
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c         | 4 ++--
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c       | 2 --
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c         | 2 --
 drivers/gpu/drm/amd/powerplay/renoir_ppt.c         | 2 --
 drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c | 2 --
 5 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 55463e7a11e2..69d7f7de9adf 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -1946,7 +1946,7 @@ int smu_read_sensor(struct smu_context *smu,
 if (!data || !size)
 return -EINVAL;

-mutex_lock(&smu->mutex);
+mutex_lock(&smu->sensor_lock);

 if (smu->ppt_funcs->read_sensor)
 if (!smu->ppt_funcs->read_sensor(smu, sensor, data, size)) @@ -1988,7 +1988,7 @@ int smu_read_sensor(struct smu_context *smu,
 }

 unlock:
-mutex_unlock(&smu->mutex);
+mutex_unlock(&smu->sensor_lock);

 return ret;
 }
diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
index f13979687b9e..5e56509a8f54 100644
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
@@ -1066,7 +1066,6 @@ 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; @@ -1109,7 +1108,6 @@ static int arcturus_read_sensor(struct smu_context *smu,
 ret = -EOPNOTSUPP;
 break;
 }
-mutex_unlock(&smu->sensor_lock);

 return ret;
 }
diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
index 6aaf483858a0..ece0f2a37704 100644
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
@@ -1710,7 +1710,6 @@ 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; @@ -1749,7 +1748,6 @@ static int navi10_read_sensor(struct smu_context *smu,
 ret = -EOPNOTSUPP;
 break;
 }
-mutex_unlock(&smu->sensor_lock);

 return ret;
 }
diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
index 575ae4be98a2..3f4de2c30bfc 100644
--- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c
@@ -950,7 +950,6 @@ static int renoir_read_sensor(struct smu_context *smu,
 if (!data || !size)
 return -EINVAL;

-mutex_lock(&smu->sensor_lock);
 switch (sensor) {
 case AMDGPU_PP_SENSOR_GPU_LOAD:
 ret = renoir_get_current_activity_percent(smu, sensor, (uint32_t *)data); @@ -974,7 +973,6 @@ static int renoir_read_sensor(struct smu_context *smu,
 ret = -EOPNOTSUPP;
 break;
 }
-mutex_unlock(&smu->sensor_lock);

 return ret;
 }
diff --git a/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c
index dcc5d25a7894..d4e52866e04f 100644
--- a/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c
@@ -1521,7 +1521,6 @@ static int sienna_cichlid_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; @@ -1560,7 +1559,6 @@ static int sienna_cichlid_read_sensor(struct smu_context *smu,
 ret = -EOPNOTSUPP;
 break;
 }
-mutex_unlock(&smu->sensor_lock);

 return ret;
 }
--
2.27.0

_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=02%7C01%7Cevan.quan%40amd.com%7C59903ad7916e46d3996908d831d9c8fc%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637314158764254291&amp;sdata=4oXm1j7KHefIx73tvURU627HeY8FNw0N5IjBRfzEmFQ%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
amd-gfx@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux