[PATCH 2/2] drm/amd/swsmu: correct smu lock type on smu_read_sensor()
Wang, Kevin(Yang)
Kevin1.Wang at amd.com
Mon Jul 27 04:55:20 UTC 2020
[AMD Official Use Only - Internal Distribution Only]
yes, i know what you want to say.
the "smu->mutex" as a global lock in smu driver, and it seems that the lock grain size is a little big.
and it's better to rename it, eg: smu->api_lock, ...
Best Regards,
Kevin
________________________________
From: Quan, Evan <Evan.Quan at amd.com>
Sent: Monday, July 27, 2020 12:01 PM
To: Wang, Kevin(Yang) <Kevin1.Wang at amd.com>; amd-gfx at lists.freedesktop.org <amd-gfx at lists.freedesktop.org>
Cc: Wang, Kevin(Yang) <Kevin1.Wang at amd.com>; Feng, Kenneth <Kenneth.Feng at amd.com>
Subject: RE: [PATCH 2/2] drm/amd/swsmu: correct smu lock type on smu_read_sensor()
[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 at lists.freedesktop.org> On Behalf Of Kevin Wang
Sent: Monday, July 27, 2020 11:05 AM
To: amd-gfx at lists.freedesktop.org
Cc: Wang, Kevin(Yang) <Kevin1.Wang at amd.com>; Feng, Kenneth <Kenneth.Feng at amd.com>
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 at amd.com>
---
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 at lists.freedesktop.org
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=02%7C01%7Cevan.quan%40amd.com%7C59903ad7916e46d3996908d831d9c8fc%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637314158764254291&sdata=4oXm1j7KHefIx73tvURU627HeY8FNw0N5IjBRfzEmFQ%3D&reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20200727/6f36457a/attachment-0001.htm>
More information about the amd-gfx
mailing list