Skip to contentSkip to conversation

Fix lock imbalance in debugfs wave reader

PATCH In review Tom St Denis 3 participants 4 messages Oct 13, 2016 – Oct 14, 2016 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH 1/1 drm/amd/amdgpu: Fix debugfs wave reader

On non VI/CZ platforms it would not free
the grbm index lock.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -2
index 304f66ae484f..d141f7f6f225 100644
@@ -3025,13 +3025,14 @@ static ssize_t amdgpu_debugfs_wave_read(struct file *f, char __user *buf,
 		data[x++] = wave_read_ind(adev, 0x2378, 0x2379, simd, wave, 0x14);
 		data[x++] = wave_read_ind(adev, 0x2378, 0x2379, simd, wave, 0x1A);
 		data[x++] = wave_read_ind(adev, 0x2378, 0x2379, simd, wave, 0x1B);
-	} else {
-		return -EINVAL;
 	}
 
 	amdgpu_gfx_select_se_sh(adev, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
 	mutex_unlock(&adev->grbm_idx_mutex);
 
+	if (!x)
+		return -EINVAL;
+
 	while (size && (*pos < x * 4)) {
 		uint32_t value;
 
Signature · 6 lines
2.10.0

_______________________________________________
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]

Reviewed-by
#4 lore raw

Re: [PATCH] drm/amd/amdgpu: Fix debugfs wave reader

Quoted 5 lines · Tom St Denis

On non VI/CZ platforms it would not free
the grbm index lock.

---

Quoted 27 lines
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -3
index 304f66ae484f..d141f7f6f225 100644
@@ -3025,13 +3025,14 @@ static ssize_t amdgpu_debugfs_wave_read(struct file *f, char __user *buf,
                data[x++] = wave_read_ind(adev, 0x2378, 0x2379, simd, wave, 0x14);
                data[x++] = wave_read_ind(adev, 0x2378, 0x2379, simd, wave, 0x1A);
                data[x++] = wave_read_ind(adev, 0x2378, 0x2379, simd, wave, 0x1B);
-       } else {
-               return -EINVAL;
        }
 
        amdgpu_gfx_select_se_sh(adev, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
        mutex_unlock(&adev->grbm_idx_mutex);
 
+       if (!x)
+               return -EINVAL;
+
        while (size && (*pos < x * 4)) {
                uint32_t value;
 
--

2.10.0

Quoted 4 lines

_______________________________________________
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): CADnq5_PUtVDe_LTPcTDn_t5APuFz9J_x_aMCVBVF=rMLtnvTXQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

Reviewed-by
#6 lore raw

Re: [PATCH] drm/amd/amdgpu: Fix debugfs wave reader

Am 14.10.2016 um 01:13 schrieb Alex Deucher:

Quoted 7 lines · Tom St Denis
Quoted 5 lines

On non VI/CZ platforms it would not free
the grbm index lock.

---

Quoted 28 lines
Quoted 28 lines
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +3 -3
index 304f66ae484f..d141f7f6f225 100644
@@ -3025,13 +3025,14 @@ static ssize_t amdgpu_debugfs_wave_read(struct file *f, char __user *buf,
                 data[x++] = wave_read_ind(adev, 0x2378, 0x2379, simd, wave, 0x14);
                 data[x++] = wave_read_ind(adev, 0x2378, 0x2379, simd, wave, 0x1A);
                 data[x++] = wave_read_ind(adev, 0x2378, 0x2379, simd, wave, 0x1B);
-       } else {
-               return -EINVAL;
         }
 
         amdgpu_gfx_select_se_sh(adev, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
         mutex_unlock(&adev->grbm_idx_mutex);
 
+       if (!x)
+               return -EINVAL;
+
         while (size && (*pos < x * 4)) {
                 uint32_t value;
 
--

2.10.0

Quoted 8 lines
Quoted 4 lines

_______________________________________________
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

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx