Skip to contentSkip to conversation

drm/amd/amdgpu: Remove double lock from gfx v6

PATCH In review Tom St Denis 3 participants 3 messages Sep 7, 2016 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/amdgpu: Remove double lock from gfx v6

The function gfx_v6_0_get_cu_info() was taking the grbm_idx_mutex which was then taken by a dependent function gfx_v6_0_get_cu_active_bitmap().

This patch removes the select from the parent function to avoid the double lock.

---
 drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 4 ----
 1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -4
index a6b76170b9c5..a1484b8f7eb2 100644
@@ -3193,13 +3193,11 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
 
 	memset(cu_info, 0, sizeof(*cu_info));
 
-	mutex_lock(&adev->grbm_idx_mutex);
 	for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
 		for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
 			mask = 1;
 			ao_bitmap = 0;
 			counter = 0;
-			gfx_v6_0_select_se_sh(adev, i, j, 0xffffffff);
 			bitmap = gfx_v6_0_get_cu_active_bitmap(adev, i, j);
 			cu_info->bitmap[i][j] = bitmap;
 
@@ -3215,8 +3213,6 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
 			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
 		}
 	}
-	gfx_v6_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
-	mutex_unlock(&adev->grbm_idx_mutex);
 
 	cu_info->number = active_cu_number;
 	cu_info->ao_cu_mask = ao_cu_mask;
Signature · 6 lines
2.9.3

_______________________________________________
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
#2 lore raw

Am 07.09.2016 um 14:07 schrieb Tom St Denis:

Quoted 8 lines

The function gfx_v6_0_get_cu_info() was taking the grbm_idx_mutex which was then taken by a dependent function gfx_v6_0_get_cu_active_bitmap().

This patch removes the select from the parent function to avoid the double lock.

Quoted 23 lines
---
  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 4 ----
  1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -2
index a6b76170b9c5..a1484b8f7eb2 100644
@@ -3193,13 +3193,11 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
 
  	memset(cu_info, 0, sizeof(*cu_info));
 
-	mutex_lock(&adev->grbm_idx_mutex);
  	for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
  		for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
  			mask = 1;
  			ao_bitmap = 0;
  			counter = 0;
-			gfx_v6_0_select_se_sh(adev, i, j, 0xffffffff);
  			bitmap = gfx_v6_0_get_cu_active_bitmap(adev, i, j);
  			cu_info->bitmap[i][j] = bitmap;
 

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev) · line 3218

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -2
@@ -3215,8 +3213,6 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
  			ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
  		}
  	}
-	gfx_v6_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
-	mutex_unlock(&adev->grbm_idx_mutex);
 
  	cu_info->number = active_cu_number;
  	cu_info->ao_cu_mask = ao_cu_mask;

_______________________________________________
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): 0b05a9be-a9de-bcf9-5b39-772dbbec5424-ANTagKRnAhcb1SvskN2V4Q@public.gmane.org

Reviewed-by Christian König
#4 lore raw

Thanks, I'll push this today after I get a RB/ACK/NAK on the last two cleanups

https://lists.freedesktop.org/archives/amd-gfx/2016-September/002039.html

(note: I changed one of the dev_warn to dev_err to match the original message type)

and

https://lists.freedesktop.org/archives/amd-gfx/2016-September/002042.html

Tom

________________________________
From: Christian König <[email protected]>
Sent: Wednesday, September 7, 2016 08:33
To: Tom St Denis; [email protected]
Cc: StDenis, Tom
Subject: Re: [PATCH] drm/amd/amdgpu: Remove double lock from gfx v6

Am 07.09.2016 um 14:07 schrieb Tom St Denis:

Quoted 8 lines

The function gfx_v6_0_get_cu_info() was taking the grbm_idx_mutex which was then taken by a dependent function gfx_v6_0_get_cu_active_bitmap().

This patch removes the select from the parent function to avoid the double lock.

Quoted 23 lines
---
  drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c | 4 ----
  1 file changed, 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -2
index a6b76170b9c5..a1484b8f7eb2 100644
@@ -3193,13 +3193,11 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
 
       memset(cu_info, 0, sizeof(*cu_info));
 
-     mutex_lock(&adev->grbm_idx_mutex);
       for (i = 0; i < adev->gfx.config.max_shader_engines; i++) {
               for (j = 0; j < adev->gfx.config.max_sh_per_se; j++) {
                       mask = 1;
                       ao_bitmap = 0;
                       counter = 0;
-                     gfx_v6_0_select_se_sh(adev, i, j, 0xffffffff);
                       bitmap = gfx_v6_0_get_cu_active_bitmap(adev, i, j);
                       cu_info->bitmap[i][j] = bitmap;
 

drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev) · line 3218

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/gfx_v6_0.c +0 -2
@@ -3215,8 +3213,6 @@ static void gfx_v6_0_get_cu_info(struct amdgpu_device *adev)
                       ao_cu_mask |= (ao_bitmap << (i * 16 + j * 8));
               }
       }
-     gfx_v6_0_select_se_sh(adev, 0xffffffff, 0xffffffff, 0xffffffff);
-     mutex_unlock(&adev->grbm_idx_mutex);
 
       cu_info->number = active_cu_number;
       cu_info->ao_cu_mask = ao_cu_mask;

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