Skip to contentSkip to conversation

drm/amdgpu: fix sdma v4 ring is disabled accidently

PATCH In review Yang, Philip 4 participants 4 messages Oct 19, 2018 – Oct 22, 2018 2 messages not in the archive

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

PATCH 1/1 drm/amdgpu: fix sdma v4 ring is disabled accidently

For sdma v4, there is bug caused by
commit d4e869b6b5d6 ("drm/amdgpu: add ring test for page queue")'

local variable ring is reused and changed, so amdgpu_ttm_set_buffer_funcs_status(adev, true) is skipped accidently. As a result, amdgpu_fill_buffer() will fail, kernel message:

[drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.

[   25.260444] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.260627] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.290119] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.290370] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.319971] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.320486] amdgpu 0000:19:00.0: [mmhub] VMC page fault (src_id:0 ring:154 vmid:8 pasid:32768, for process  pid 0 thread  pid 0)
[   25.320533] amdgpu 0000:19:00.0:   in page starting at address 0x0000000000000000 from 18
[   25.320563] amdgpu 0000:19:00.0: VM_L2_PROTECTION_FAULT_STATUS:0x00800134
Change-Id Idacdf8e60557edb0a4a499aa4051b75d87ce4091
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +4 -3
index ede149a..cd368ac 100644
@@ -1151,10 +1151,11 @@ static int sdma_v4_0_start(struct amdgpu_device *adev)
 		}
 
 		if (adev->sdma.has_page_queue) {
-			ring = &adev->sdma.instance[i].page;
-			r = amdgpu_ring_test_ring(ring);
+			struct amdgpu_ring *page = &adev->sdma.instance[i].page;
+
+			r = amdgpu_ring_test_ring(page);
 			if (r) {
-				ring->ready = false;
+				page->ready = false;
 				return r;
 			}
 		}
Signature · 6 lines
2.7.4

_______________________________________________
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): 1539976426-10271-1-git-send-email-Philip.Yang-5C7GfCeVMHo@public.gmane.org

#2 lore raw

[+Christian]

Should the buffer funcs also use the paging ring? I think that would be important for being able to clear page tables or migrating a BO while handling a page fault.

Regards,
  Felix

Quoted 31 lines · Philip

For sdma v4, there is bug caused by
commit d4e869b6b5d6 ("drm/amdgpu: add ring test for page queue")'

local variable ring is reused and changed, so amdgpu_ttm_set_buffer_funcs_status(adev, true) is skipped accidently. As a result, amdgpu_fill_buffer() will fail, kernel message:

[drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.

[   25.260444] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.260627] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.290119] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.290370] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.319971] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.320486] amdgpu 0000:19:00.0: [mmhub] VMC page fault (src_id:0 ring:154 vmid:8 pasid:32768, for process  pid 0 thread  pid 0)
[   25.320533] amdgpu 0000:19:00.0:   in page starting at address 0x0000000000000000 from 18
[   25.320563] amdgpu 0000:19:00.0: VM_L2_PROTECTION_FAULT_STATUS:0x00800134
Change-Id Idacdf8e60557edb0a4a499aa4051b75d87ce4091
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +0 -1
index ede149a..cd368ac 100644
@@ -1151,10 +1151,11 @@ static int sdma_v4_0_start(struct amdgpu_device *adev)
 		}
 
 		if (adev->sdma.has_page_queue) {
-			ring = &adev->sdma.instance[i].page;

drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c static int sdma_v4_0_start(struct amdgpu_device *adev) · line 1161

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +4 -2
-			r = amdgpu_ring_test_ring(ring);
+			struct amdgpu_ring *page = &adev->sdma.instance[i].page;
+
+			r = amdgpu_ring_test_ring(page);
 			if (r) {
-				ring->ready = false;
+				page->ready = false;
 				return r;
 			}
 		}

_______________________________________________
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): 9928307d-a99c-2c9c-c579-fc3a3b5c6c94-5C7GfCeVMHo@public.gmane.org

#4 lore raw

Mhm, good catch.

And yes using the paging queue when it is available sounds like a good idea to me as well.

So far I've only used it for VM updates to actually test if it works as expected.

Regards,
Christian.

Am 19.10.18 um 21:53 schrieb Kuehling, Felix:

Quoted 39 lines

[+Christian]

Should the buffer funcs also use the paging ring? I think that would be important for being able to clear page tables or migrating a BO while handling a page fault.

Regards,
  Felix

Quoted 29 lines · Philip

For sdma v4, there is bug caused by
commit d4e869b6b5d6 ("drm/amdgpu: add ring test for page queue")'

local variable ring is reused and changed, so amdgpu_ttm_set_buffer_funcs_status(adev, true) is skipped accidently. As a result, amdgpu_fill_buffer() will fail, kernel message:

[drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.

[   25.260444] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.260627] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.290119] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.290370] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.319971] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.320486] amdgpu 0000:19:00.0: [mmhub] VMC page fault (src_id:0 ring:154 vmid:8 pasid:32768, for process  pid 0 thread  pid 0)
[   25.320533] amdgpu 0000:19:00.0:   in page starting at address 0x0000000000000000 from 18
[   25.320563] amdgpu 0000:19:00.0: VM_L2_PROTECTION_FAULT_STATUS:0x00800134
Change-Id Idacdf8e60557edb0a4a499aa4051b75d87ce4091
---
  drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +0 -0
index ede149a..cd368ac 100644
@@ -1151,10 +1151,11 @@ static int sdma_v4_0_start(struct amdgpu_device *adev)
  		}
 
Quoted 12 lines

drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c static int sdma_v4_0_start(struct amdgpu_device *adev) · line 1161

Quoted 12 lines
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +4 -3
  		if (adev->sdma.has_page_queue) {
-			ring = &adev->sdma.instance[i].page;
-			r = amdgpu_ring_test_ring(ring);
+			struct amdgpu_ring *page = &adev->sdma.instance[i].page;
+
+			r = amdgpu_ring_test_ring(page);
  			if (r) {
-				ring->ready = false;
+				page->ready = false;
  				return r;
  			}
  		}

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

Reviewed-by
#5 lore raw
In reply to a message not in the archive

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Yang, Philip <[email protected]>
Sent: Friday, October 19, 2018 3:13:56 PM
To: [email protected]
Cc: Yang, Philip
Subject: [PATCH] drm/amdgpu: fix sdma v4 ring is disabled accidently

For sdma v4, there is bug caused by
commit d4e869b6b5d6 ("drm/amdgpu: add ring test for page queue")'

local variable ring is reused and changed, so amdgpu_ttm_set_buffer_funcs_status(adev, true) is skipped accidently. As a result, amdgpu_fill_buffer() will fail, kernel message:

[drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.

[   25.260444] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.260627] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.290119] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.290370] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.319971] [drm:amdgpu_fill_buffer [amdgpu]] *ERROR* Trying to clear memory with ring turned off.
[   25.320486] amdgpu 0000:19:00.0: [mmhub] VMC page fault (src_id:0 ring:154 vmid:8 pasid:32768, for process  pid 0 thread  pid 0)
[   25.320533] amdgpu 0000:19:00.0:   in page starting at address 0x0000000000000000 from 18
[   25.320563] amdgpu 0000:19:00.0: VM_L2_PROTECTION_FAULT_STATUS:0x00800134
Change-Id Idacdf8e60557edb0a4a499aa4051b75d87ce4091
---
 drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/sdma_v4_0.c +4 -3
index ede149a..cd368ac 100644
@@ -1151,10 +1151,11 @@ static int sdma_v4_0_start(struct amdgpu_device *adev)
                 }
 
                 if (adev->sdma.has_page_queue) {
-                       ring = &adev->sdma.instance[i].page;
-                       r = amdgpu_ring_test_ring(ring);
+                       struct amdgpu_ring *page = &adev->sdma.instance[i].page;
+
+                       r = amdgpu_ring_test_ring(page);
                         if (r) {
-                               ring->ready = false;
+                               page->ready = false;
                                 return r;
                         }
                 }

--
2.7.4

_______________________________________________
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