Skip to contentSkip to conversation

drm/amdgpu:no gpu scheduler for KIQ

PATCH Superseded Trigger Huang 3 participants 3 messages Nov 1, 2016 2 messages not in the archive

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu:no gpu scheduler for KIQ

KIQ is used for interaction between driver and CP, and not exposed to outside client, as such it doesn't need to be handled by GPU scheduler.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c  | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +4 -0
index 77b34ec..c2a2d19 100644
@@ -382,6 +382,10 @@ int amdgpu_fence_driver_init_ring(struct amdgpu_ring *ring,
 	if (!ring->fence_drv.fences)
 		return -ENOMEM;
 
+	/* Doesn't need gpu scheduler */
+	if (!num_hw_submission)
+		return 0;
+
 	timeout = msecs_to_jiffies(amdgpu_lockup_timeout);
 	if (timeout == 0) {
 		/*
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +4 -2
index 4c99282..a254c38 100644
@@ -168,6 +168,7 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
 		     unsigned irq_type)
 {
 	int r;
+	int entry_num = amdgpu_sched_hw_submission;
 
 	if (ring->adev == NULL) {
 		if (adev->num_rings >= AMDGPU_MAX_RINGS)
@@ -176,8 +177,9 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
 		ring->adev = adev;
 		ring->idx = adev->num_rings++;
 		adev->rings[ring->idx] = ring;
-		r = amdgpu_fence_driver_init_ring(ring,
-			amdgpu_sched_hw_submission);
+		if (ring->funcs->type == AMDGPU_RING_TYPE_KIQ)
+			entry_num = 0;
+		r = amdgpu_fence_driver_init_ring(ring, entry_num);
 		if (r)
 			return r;
 	}
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by Alex Deucher
#2 lore raw
In reply to a message not in the archive
Quoted 26 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Trigger Huang
Sent: Tuesday, November 01, 2016 3:22 AM
To: [email protected]
Cc: Yu, Xiangliang; Liu, Monk; Huang, Trigger
Subject: [PATCH] drm/amdgpu:no gpu scheduler for KIQ

KIQ is used for interaction between driver and CP, and not exposed to outside client, as such it doesn't need to be handled by GPU scheduler.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 ++++
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c  | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +0 -0
index 77b34ec..c2a2d19 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c int amdgpu_fence_driver_init_ring(struct · line 389

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +4 -0
@@ -382,6 +382,10 @@ int amdgpu_fence_driver_init_ring(struct
 amdgpu_ring *ring,
 	if (!ring->fence_drv.fences)
 		return -ENOMEM;
 
+	/* Doesn't need gpu scheduler */
+	if (!num_hw_submission)
+		return 0;
+

Rather than returning early here, I'd suggest wrapping the scheduler setup conditionally. E.g.,

if (num_hw_submission) {
/* setup scheduler */
....
}

That way if we add anything else to that function, we don't accidently break KIQ.

With that fixed:

Alex

Quoted 33 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +0 -0
 	timeout = msecs_to_jiffies(amdgpu_lockup_timeout);
 	if (timeout == 0) {
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +0 -0
 		/*
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 -0
index 4c99282..a254c38 100644
@@ -168,6 +168,7 @@ int amdgpu_ring_init(struct amdgpu_device *adev,
 struct amdgpu_ring *ring,
 		     unsigned irq_type)
 {
 	int r;
+	int entry_num = amdgpu_sched_hw_submission;
 
 	if (ring->adev == NULL) {
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +3 -2
 		if (adev->num_rings >= AMDGPU_MAX_RINGS)
@@ -176,8 +177,9 @@ int amdgpu_ring_init(struct amdgpu_device *adev,
 struct amdgpu_ring *ring,
 		ring->adev = adev;
 		ring->idx = adev->num_rings++;
 		adev->rings[ring->idx] = ring;
-		r = amdgpu_fence_driver_init_ring(ring,
-			amdgpu_sched_hw_submission);
+		if (ring->funcs->type == AMDGPU_RING_TYPE_KIQ)
+			entry_num = 0;
+		r = amdgpu_fence_driver_init_ring(ring, entry_num);
 		if (r)
 			return r;

}
--
2.7.4

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

#4 lore raw
In reply to a message not in the archive

Am 01.11.2016 um 16:27 schrieb Deucher, Alexander:

Quoted 48 lines
Quoted 26 lines

-----Original Message-----
From: amd-gfx [mailto:[email protected]] On Behalf Of Trigger Huang
Sent: Tuesday, November 01, 2016 3:22 AM
To: [email protected]
Cc: Yu, Xiangliang; Liu, Monk; Huang, Trigger
Subject: [PATCH] drm/amdgpu:no gpu scheduler for KIQ

KIQ is used for interaction between driver and CP, and not exposed to outside client, as such it doesn't need to be handled by GPU scheduler.

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c | 4 ++++
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c  | 6 ++++--
  2 files changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +0 -0
index 77b34ec..c2a2d19 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c int amdgpu_fence_driver_init_ring(struct · line 389

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +4 -0
@@ -382,6 +382,10 @@ int amdgpu_fence_driver_init_ring(struct
 amdgpu_ring *ring,
  	if (!ring->fence_drv.fences)
  		return -ENOMEM;
 
+	/* Doesn't need gpu scheduler */
+	if (!num_hw_submission)
+		return 0;
+

Rather than returning early here, I'd suggest wrapping the scheduler setup conditionally. E.g.,

if (num_hw_submission) {
    /* setup scheduler */

....
}

That way if we add anything else to that function, we don't accidently break KIQ.

With that fixed:

Alex

Quoted 14 lines
Quoted 9 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fence.c +0 -0
  	timeout = msecs_to_jiffies(amdgpu_lockup_timeout);
  	if (timeout == 0) {

/*

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
index 4c99282..a254c38 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c int amdgpu_ring_init(struct amdgpu_device *adev, · line 172

Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 -0
@@ -168,6 +168,7 @@ int amdgpu_ring_init(struct amdgpu_device *adev,
 struct amdgpu_ring *ring,
  		     unsigned irq_type)
  {
  	int r;
+	int entry_num = amdgpu_sched_hw_submission;

Additionally to Alex comment above please move the new local variable into the "if" where it is used.

With that fixed the patch is Reviewed-by: Christian König <[email protected]> as well.

Regards,
Christian.

Quoted 19 lines
Quoted 19 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +3 -2
  	if (ring->adev == NULL) {
  		if (adev->num_rings >= AMDGPU_MAX_RINGS)
@@ -176,8 +177,9 @@ int amdgpu_ring_init(struct amdgpu_device *adev,
 struct amdgpu_ring *ring,
  		ring->adev = adev;
  		ring->idx = adev->num_rings++;
  		adev->rings[ring->idx] = ring;
-		r = amdgpu_fence_driver_init_ring(ring,
-			amdgpu_sched_hw_submission);
+		if (ring->funcs->type == AMDGPU_RING_TYPE_KIQ)
+			entry_num = 0;
+		r = amdgpu_fence_driver_init_ring(ring, entry_num);
  		if (r)
  			return r;

}
--
2.7.4

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