Skip to contentSkip to conversation

drm/amdgpu: do not modify ring before doing ring validation

PATCH In review Nirmoy Das 3 participants 5 messages Feb 25, 2020

Subsystems (2)
lore
Share & tools
lore

Nirmoy Das

author
#0 lore raw

PATCH 1/1 drm/amdgpu: do not modify ring before doing ring validation

changing ring->sched.ready should be done only if the ring is initialized

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -1
index 539be138260e..18e11b0fdc3e 100644
@@ -344,12 +344,13 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
  */
 void amdgpu_ring_fini(struct amdgpu_ring *ring)
 {
-	ring->sched.ready = false;
 
 	/* Not to finish a ring which is not initialized */
 	if (!(ring->adev) || !(ring->adev->rings[ring->idx]))
 		return;
 
+	ring->sched.ready = false;
+
 	amdgpu_device_wb_free(ring->adev, ring->rptr_offs);
 	amdgpu_device_wb_free(ring->adev, ring->wptr_offs);
 
Signature · 6 lines
2.25.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
maintainer
#1 lore raw

Am 25.02.20 um 11:39 schrieb Nirmoy Das:

Quoted 1 line

changing ring->sched.ready should be done only if the ring is initialized

I don't think that this makes much difference. When the rings are freed the hardware and software stack needs to be disabled quite some time before.

Christian.

Quoted 15 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -1
index 539be138260e..18e11b0fdc3e 100644
@@ -344,12 +344,13 @@ int amdgpu_ring_init(struct amdgpu_device *adev, struct amdgpu_ring *ring,
   */
  void amdgpu_ring_fini(struct amdgpu_ring *ring)
  {
-	ring->sched.ready = false;

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

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +2 -0
 
  	/* Not to finish a ring which is not initialized */
  	if (!(ring->adev) || !(ring->adev->rings[ring->idx]))
  		return;
 
+	ring->sched.ready = false;
+
  	amdgpu_device_wb_free(ring->adev, ring->rptr_offs);
  	amdgpu_device_wb_free(ring->adev, ring->wptr_offs);
 

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

#2 lore raw
Quoted 4 lines · Christian König

Am 25.02.20 um 11:39 schrieb Nirmoy Das:

Quoted 1 line

changing ring->sched.ready should be done only if the ring is initialized

I don't think that this makes much difference. When the rings are freed the hardware and software stack needs to be disabled quite some time before.

Yes it doesn't make any difference. I wanted amdgpu_ring_fini() to look bit cleaner.

Regards,

Nirmoy

Quoted 18 lines

Christian.

Quoted 15 lines

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 3 ++-

  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +0 -0
index 539be138260e..18e11b0fdc3e 100644
@@ -344,12 +344,13 @@ int amdgpu_ring_init(struct amdgpu_device 
 *adev, struct amdgpu_ring *ring,
    */
   void amdgpu_ring_fini(struct amdgpu_ring *ring)
   {
Quoted 9 lines

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

Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 -1
-    ring->sched.ready = false;
         /* Not to finish a ring which is not initialized */
       if (!(ring->adev) || !(ring->adev->rings[ring->idx]))
           return;
   +    ring->sched.ready = false;
+
       amdgpu_device_wb_free(ring->adev, ring->rptr_offs);
       amdgpu_device_wb_free(ring->adev, ring->wptr_offs);

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

maintainer
#3 lore raw

Am 25.02.20 um 12:03 schrieb Nirmoy:

Quoted 8 lines · Christian König
Quoted 4 lines

Am 25.02.20 um 11:39 schrieb Nirmoy Das:

Quoted 1 line

changing ring->sched.ready should be done only if the ring is initialized

I don't think that this makes much difference. When the rings are freed the hardware and software stack needs to be disabled quite some time before.

Yes it doesn't make any difference. I wanted amdgpu_ring_fini() to look bit cleaner.

Ok, you should note that in the subject and commit message. Something like "cleanup amdgpu_ring_fini" / "Check the prerequisites before the actual operation".

Otherwise if that is not clearly state somebody might think that this is a bug fix and pick it up for backporting and we probably don't want that.

Regards,
Christian.

Quoted 33 lines

Regards,

Nirmoy

Quoted 27 lines

Christian.

Quoted 23 lines

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 3 ++-

  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 -1
index 539be138260e..18e11b0fdc3e 100644
@@ -344,12 +344,13 @@ int amdgpu_ring_init(struct amdgpu_device 
 *adev, struct amdgpu_ring *ring,
    */
   void amdgpu_ring_fini(struct amdgpu_ring *ring)
   {
-    ring->sched.ready = false;
         /* Not to finish a ring which is not initialized */
       if (!(ring->adev) || !(ring->adev->rings[ring->idx]))
           return;
   +    ring->sched.ready = false;
+
       amdgpu_device_wb_free(ring->adev, ring->rptr_offs);
       amdgpu_device_wb_free(ring->adev, ring->wptr_offs);

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

#4 lore raw
Quoted 6 lines · Christian König

Am 25.02.20 um 12:03 schrieb Nirmoy:

Quoted 5 lines · Christian König
Quoted 3 lines

Am 25.02.20 um 11:39 schrieb Nirmoy Das:

Quoted 1 line

changing ring->sched.ready should be done only if the ring is initialized

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I don't think that this makes much difference. When the rings are freed the hardware and software stack needs to be disabled quite some time before.

Yes it doesn't make any difference. I wanted amdgpu_ring_fini() to look bit cleaner.

Ok, you should note that in the subject and commit message. Something like "cleanup amdgpu_ring_fini" / "Check the prerequisites before the actual operation".

Otherwise if that is not clearly state somebody might think that this is a bug fix and pick it up for backporting and we probably don't want that.

Sorry, true the subject line is confusing with the bug :). I will modify and resend.

Regards,

Nirmoy

Quoted 38 lines

Regards,
Christian.

Quoted 33 lines

Regards,

Nirmoy

Quoted 27 lines

Christian.

Quoted 23 lines

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c | 3 ++-

  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_ring.c +1 -1
index 539be138260e..18e11b0fdc3e 100644
@@ -344,12 +344,13 @@ int amdgpu_ring_init(struct amdgpu_device 
 *adev, struct amdgpu_ring *ring,
    */
   void amdgpu_ring_fini(struct amdgpu_ring *ring)
   {
-    ring->sched.ready = false;
         /* Not to finish a ring which is not initialized */
       if (!(ring->adev) || !(ring->adev->rings[ring->idx]))
           return;
   +    ring->sched.ready = false;
+
       amdgpu_device_wb_free(ring->adev, ring->rptr_offs);
       amdgpu_device_wb_free(ring->adev, ring->wptr_offs);

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