diff mbox

[1/2] drm/amdgpu: Skip drm_sched_entity realted ops for KIQ ring.

Message ID 1526412674-15913-1-git-send-email-andrey.grodzovsky@amd.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrey Grodzovsky May 15, 2018, 7:31 p.m. UTC
Follwoing change 75fbed2 we need to skip KIQ ring when iterating
amdgpu_ctx's scheduler entites.

Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

Comments

Alex Deucher May 15, 2018, 7:42 p.m. UTC | #1
On Tue, May 15, 2018 at 3:31 PM, Andrey Grodzovsky
<andrey.grodzovsky@amd.com> wrote:
> Follwoing change 75fbed2 we need to skip KIQ ring when iterating
> amdgpu_ctx's scheduler entites.
>
> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>

Typo in the title: realted -> related
Typo in the description: Follwoing -> Following
Also expand on the reasoning a bit in the patch description.  E.g., we
never initialize or use the GPU scheduler for KIQ.
With those things fixes:
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

Alex

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 21 ++++++++++++++++++---
>  1 file changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index 6741a62..744519b 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -173,9 +173,14 @@ static void amdgpu_ctx_do_release(struct kref *ref)
>
>         ctx = container_of(ref, struct amdgpu_ctx, refcount);
>
> -       for (i = 0; i < ctx->adev->num_rings; i++)
> +       for (i = 0; i < ctx->adev->num_rings; i++) {
> +
> +               if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)
> +                       continue;
> +
>                 drm_sched_entity_fini(&ctx->adev->rings[i]->sched,
>                         &ctx->rings[i].entity);
> +       }
>
>         amdgpu_ctx_fini(ref);
>  }
> @@ -452,12 +457,17 @@ void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr)
>                 if (!ctx->adev)
>                         return;
>
> -               for (i = 0; i < ctx->adev->num_rings; i++)
> +               for (i = 0; i < ctx->adev->num_rings; i++) {
> +
> +                       if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)
> +                               continue;
> +
>                         if (kref_read(&ctx->refcount) == 1)
>                                 drm_sched_entity_do_release(&ctx->adev->rings[i]->sched,
>                                                   &ctx->rings[i].entity);
>                         else
>                                 DRM_ERROR("ctx %p is still alive\n", ctx);
> +               }
>         }
>  }
>
> @@ -474,12 +484,17 @@ void amdgpu_ctx_mgr_entity_cleanup(struct amdgpu_ctx_mgr *mgr)
>                 if (!ctx->adev)
>                         return;
>
> -               for (i = 0; i < ctx->adev->num_rings; i++)
> +               for (i = 0; i < ctx->adev->num_rings; i++) {
> +
> +                       if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)
> +                               continue;
> +
>                         if (kref_read(&ctx->refcount) == 1)
>                                 drm_sched_entity_cleanup(&ctx->adev->rings[i]->sched,
>                                         &ctx->rings[i].entity);
>                         else
>                                 DRM_ERROR("ctx %p is still alive\n", ctx);
> +               }
>         }
>  }
>
> --
> 2.7.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Christian König May 16, 2018, 7:05 a.m. UTC | #2
Am 15.05.2018 um 21:42 schrieb Alex Deucher:
> On Tue, May 15, 2018 at 3:31 PM, Andrey Grodzovsky
> <andrey.grodzovsky@amd.com> wrote:
>> Follwoing change 75fbed2 we need to skip KIQ ring when iterating
>> amdgpu_ctx's scheduler entites.
>>
>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
> Typo in the title: realted -> related
> Typo in the description: Follwoing -> Following
> Also expand on the reasoning a bit in the patch description.  E.g., we
> never initialize or use the GPU scheduler for KIQ.
> With those things fixes:
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

With the typos fixed Reviewed-by: Christian König 
<christian.koenig@amd.com>.

Christian.

>
> Alex
>
>> ---
>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 21 ++++++++++++++++++---
>>   1 file changed, 18 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
>> index 6741a62..744519b 100644
>> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
>> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
>> @@ -173,9 +173,14 @@ static void amdgpu_ctx_do_release(struct kref *ref)
>>
>>          ctx = container_of(ref, struct amdgpu_ctx, refcount);
>>
>> -       for (i = 0; i < ctx->adev->num_rings; i++)
>> +       for (i = 0; i < ctx->adev->num_rings; i++) {
>> +
>> +               if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)
>> +                       continue;
>> +
>>                  drm_sched_entity_fini(&ctx->adev->rings[i]->sched,
>>                          &ctx->rings[i].entity);
>> +       }
>>
>>          amdgpu_ctx_fini(ref);
>>   }
>> @@ -452,12 +457,17 @@ void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr)
>>                  if (!ctx->adev)
>>                          return;
>>
>> -               for (i = 0; i < ctx->adev->num_rings; i++)
>> +               for (i = 0; i < ctx->adev->num_rings; i++) {
>> +
>> +                       if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)
>> +                               continue;
>> +
>>                          if (kref_read(&ctx->refcount) == 1)
>>                                  drm_sched_entity_do_release(&ctx->adev->rings[i]->sched,
>>                                                    &ctx->rings[i].entity);
>>                          else
>>                                  DRM_ERROR("ctx %p is still alive\n", ctx);
>> +               }
>>          }
>>   }
>>
>> @@ -474,12 +484,17 @@ void amdgpu_ctx_mgr_entity_cleanup(struct amdgpu_ctx_mgr *mgr)
>>                  if (!ctx->adev)
>>                          return;
>>
>> -               for (i = 0; i < ctx->adev->num_rings; i++)
>> +               for (i = 0; i < ctx->adev->num_rings; i++) {
>> +
>> +                       if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)
>> +                               continue;
>> +
>>                          if (kref_read(&ctx->refcount) == 1)
>>                                  drm_sched_entity_cleanup(&ctx->adev->rings[i]->sched,
>>                                          &ctx->rings[i].entity);
>>                          else
>>                                  DRM_ERROR("ctx %p is still alive\n", ctx);
>> +               }
>>          }
>>   }
>>
>> --
>> 2.7.4
>>
>> _______________________________________________
>> dri-devel mailing list
>> dri-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/dri-devel
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
index 6741a62..744519b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
@@ -173,9 +173,14 @@  static void amdgpu_ctx_do_release(struct kref *ref)
 
 	ctx = container_of(ref, struct amdgpu_ctx, refcount);
 
-	for (i = 0; i < ctx->adev->num_rings; i++)
+	for (i = 0; i < ctx->adev->num_rings; i++) {
+
+		if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)
+			continue;
+
 		drm_sched_entity_fini(&ctx->adev->rings[i]->sched,
 			&ctx->rings[i].entity);
+	}
 
 	amdgpu_ctx_fini(ref);
 }
@@ -452,12 +457,17 @@  void amdgpu_ctx_mgr_entity_fini(struct amdgpu_ctx_mgr *mgr)
 		if (!ctx->adev)
 			return;
 
-		for (i = 0; i < ctx->adev->num_rings; i++)
+		for (i = 0; i < ctx->adev->num_rings; i++) {
+
+			if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)
+				continue;
+
 			if (kref_read(&ctx->refcount) == 1)
 				drm_sched_entity_do_release(&ctx->adev->rings[i]->sched,
 						  &ctx->rings[i].entity);
 			else
 				DRM_ERROR("ctx %p is still alive\n", ctx);
+		}
 	}
 }
 
@@ -474,12 +484,17 @@  void amdgpu_ctx_mgr_entity_cleanup(struct amdgpu_ctx_mgr *mgr)
 		if (!ctx->adev)
 			return;
 
-		for (i = 0; i < ctx->adev->num_rings; i++)
+		for (i = 0; i < ctx->adev->num_rings; i++) {
+
+			if (ctx->adev->rings[i] == &ctx->adev->gfx.kiq.ring)
+				continue;
+
 			if (kref_read(&ctx->refcount) == 1)
 				drm_sched_entity_cleanup(&ctx->adev->rings[i]->sched,
 					&ctx->rings[i].entity);
 			else
 				DRM_ERROR("ctx %p is still alive\n", ctx);
+		}
 	}
 }