<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Arial;font-size:10pt;color:#0078D7;margin:15pt;" align="Left">
[AMD Official Use Only - Internal Distribution Only]<br>
</p>
<br>
<div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
yes, i know what you want to say.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">the "smu->mutex" as a global lock in smu driver, and i</span><span style="color: rgb(0, 0, 0); font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt;">t
 seems that the lock grain size is a little big.</span></div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
and it's better to rename it, eg: smu->api_lock, ...</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Best Regards,<br>
Kevin</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Quan, Evan <Evan.Quan@amd.com><br>
<b>Sent:</b> Monday, July 27, 2020 12:01 PM<br>
<b>To:</b> Wang, Kevin(Yang) <Kevin1.Wang@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Wang, Kevin(Yang) <Kevin1.Wang@amd.com>; Feng, Kenneth <Kenneth.Feng@amd.com><br>
<b>Subject:</b> RE: [PATCH 2/2] drm/amd/swsmu: correct smu lock type on smu_read_sensor()</font>
<div> </div>
</div>
<div class="BodyFragment"><font face="Times New Roman" size="3"><span style="font-size:12pt"><a name="BM_BEGIN"></a>
<div><font size="2"><span style="font-size:11pt">[AMD Official Use Only - Internal Distribution Only]<br>
<br>
It's OK to drop sensor_lock. But please keep smu->mutex in smu_read_sensor.<br>
All top APIs from amdgpu_smu.c come with smu->mutex to avoid potential race issue.<br>
<br>
-----Original Message-----<br>
From: amd-gfx <amd-gfx-bounces@lists.freedesktop.org> On Behalf Of Kevin Wang<br>
Sent: Monday, July 27, 2020 11:05 AM<br>
To: amd-gfx@lists.freedesktop.org<br>
Cc: Wang, Kevin(Yang) <Kevin1.Wang@amd.com>; Feng, Kenneth <Kenneth.Feng@amd.com><br>
Subject: [PATCH 2/2] drm/amd/swsmu: correct smu lock type on smu_read_sensor()<br>
<br>
instead "mutex" with "sensor_lock" on smu_read_sensor().<br>
<br>
Signed-off-by: Kevin Wang <kevin1.wang@amd.com><br>
---<br>
 drivers/gpu/drm/amd/powerplay/amdgpu_smu.c         | 4 ++--<br>
 drivers/gpu/drm/amd/powerplay/arcturus_ppt.c       | 2 --<br>
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c         | 2 --<br>
 drivers/gpu/drm/amd/powerplay/renoir_ppt.c         | 2 --<br>
 drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c | 2 --<br>
 5 files changed, 2 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
index 55463e7a11e2..69d7f7de9adf 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c<br>
@@ -1946,7 +1946,7 @@ int smu_read_sensor(struct smu_context *smu,<br>
 if (!data || !size)<br>
 return -EINVAL;<br>
<br>
-mutex_lock(&smu->mutex);<br>
+mutex_lock(&smu->sensor_lock);<br>
<br>
 if (smu->ppt_funcs->read_sensor)<br>
 if (!smu->ppt_funcs->read_sensor(smu, sensor, data, size)) @@ -1988,7 +1988,7 @@ int smu_read_sensor(struct smu_context *smu,<br>
 }<br>
<br>
 unlock:<br>
-mutex_unlock(&smu->mutex);<br>
+mutex_unlock(&smu->sensor_lock);<br>
<br>
 return ret;<br>
 }<br>
diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
index f13979687b9e..5e56509a8f54 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c<br>
@@ -1066,7 +1066,6 @@ static int arcturus_read_sensor(struct smu_context *smu,<br>
 if (!data || !size)<br>
 return -EINVAL;<br>
<br>
-mutex_lock(&smu->sensor_lock);<br>
 switch (sensor) {<br>
 case AMDGPU_PP_SENSOR_MAX_FAN_RPM:<br>
 *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1109,7 +1108,6 @@ static int arcturus_read_sensor(struct smu_context *smu,<br>
 ret = -EOPNOTSUPP;<br>
 break;<br>
 }<br>
-mutex_unlock(&smu->sensor_lock);<br>
<br>
 return ret;<br>
 }<br>
diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
index 6aaf483858a0..ece0f2a37704 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c<br>
@@ -1710,7 +1710,6 @@ static int navi10_read_sensor(struct smu_context *smu,<br>
 if(!data || !size)<br>
 return -EINVAL;<br>
<br>
-mutex_lock(&smu->sensor_lock);<br>
 switch (sensor) {<br>
 case AMDGPU_PP_SENSOR_MAX_FAN_RPM:<br>
 *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1749,7 +1748,6 @@ static int navi10_read_sensor(struct smu_context *smu,<br>
 ret = -EOPNOTSUPP;<br>
 break;<br>
 }<br>
-mutex_unlock(&smu->sensor_lock);<br>
<br>
 return ret;<br>
 }<br>
diff --git a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
index 575ae4be98a2..3f4de2c30bfc 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/renoir_ppt.c<br>
@@ -950,7 +950,6 @@ static int renoir_read_sensor(struct smu_context *smu,<br>
 if (!data || !size)<br>
 return -EINVAL;<br>
<br>
-mutex_lock(&smu->sensor_lock);<br>
 switch (sensor) {<br>
 case AMDGPU_PP_SENSOR_GPU_LOAD:<br>
 ret = renoir_get_current_activity_percent(smu, sensor, (uint32_t *)data); @@ -974,7 +973,6 @@ static int renoir_read_sensor(struct smu_context *smu,<br>
 ret = -EOPNOTSUPP;<br>
 break;<br>
 }<br>
-mutex_unlock(&smu->sensor_lock);<br>
<br>
 return ret;<br>
 }<br>
diff --git a/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c b/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c<br>
index dcc5d25a7894..d4e52866e04f 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/sienna_cichlid_ppt.c<br>
@@ -1521,7 +1521,6 @@ static int sienna_cichlid_read_sensor(struct smu_context *smu,<br>
 if(!data || !size)<br>
 return -EINVAL;<br>
<br>
-mutex_lock(&smu->sensor_lock);<br>
 switch (sensor) {<br>
 case AMDGPU_PP_SENSOR_MAX_FAN_RPM:<br>
 *(uint32_t *)data = pptable->FanMaximumRpm; @@ -1560,7 +1559,6 @@ static int sienna_cichlid_read_sensor(struct smu_context *smu,<br>
 ret = -EOPNOTSUPP;<br>
 break;<br>
 }<br>
-mutex_unlock(&smu->sensor_lock);<br>
<br>
 return ret;<br>
 }<br>
--<br>
2.27.0<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="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">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</a><br>
</span></font></div>
</span></font></div>
</div>
</body>
</html>