Skip to contentSkip to conversation

drm/amdgpu: print more accurate error messages on IB submission failure

PATCH In review Marek Olšák 3 participants 3 messages Aug 1, 2016 – Aug 3, 2016 2 messages not in the archive

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

PATCH 1/1 drm/amdgpu: print more accurate error messages on IB submission failure

From: Marek Olšák <[email protected]>

It's useful for debugging.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +13 -4
index 45d5227..e4617c4 100644
@@ -387,8 +387,10 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 
 		r = ttm_eu_reserve_buffers(&p->ticket, &p->validated, true,
 					   &duplicates);
-		if (unlikely(r != 0))
+		if (unlikely(r != 0)) {
+			DRM_ERROR("ttm_eu_reserve_buffers failed.\n");
 			goto error_free_pages;
+		}
 
 		/* Without a BO list we don't have userptr BOs */
 		if (!p->bo_list)
@@ -428,9 +430,10 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 		/* Unreserve everything again. */
 		ttm_eu_backoff_reservation(&p->ticket, &p->validated);
 
-		/* We tried to often, just abort */
+		/* We tried too many times, just abort */
 		if (!--tries) {
 			r = -EDEADLK;
+			DRM_ERROR("deadlock in %s\n", __func__);
 			goto error_free_pages;
 		}
 
@@ -442,11 +445,13 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 							 sizeof(struct page*));
 			if (!e->user_pages) {
 				r = -ENOMEM;
+				DRM_ERROR("calloc failure in %s\n", __func__);
 				goto error_free_pages;
 			}
 
 			r = amdgpu_ttm_tt_get_user_pages(ttm, e->user_pages);
 			if (r) {
+				DRM_ERROR("amdgpu_ttm_tt_get_user_pages failed.\n");
 				drm_free_large(e->user_pages);
 				e->user_pages = NULL;
 				goto error_free_pages;
@@ -463,12 +468,16 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 	p->bytes_moved = 0;
 
 	r = amdgpu_cs_list_validate(p, &duplicates);
-	if (r)
+	if (r) {
+		DRM_ERROR("amdgpu_cs_list_validate(duplicates) failed.\n");
 		goto error_validate;
+	}
 
 	r = amdgpu_cs_list_validate(p, &p->validated);
-	if (r)
+	if (r) {
+		DRM_ERROR("amdgpu_cs_list_validate(validated) failed.\n");
 		goto error_validate;
+	}
 
 	fpriv->vm.last_eviction_counter =
 		atomic64_read(&p->adev->num_evictions);
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): 1470073361-30019-1-git-send-email-maraeo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 5 lines · Marek Olšák

From: Marek Olšák <[email protected]>

It's useful for debugging.

Quoted 68 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +13 -5
index 45d5227..e4617c4 100644
@@ -387,8 +387,10 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 
                r = ttm_eu_reserve_buffers(&p->ticket, &p->validated, true,
                                           &duplicates);
-               if (unlikely(r != 0))
+               if (unlikely(r != 0)) {
+                       DRM_ERROR("ttm_eu_reserve_buffers failed.\n");
                        goto error_free_pages;
+               }
 
                /* Without a BO list we don't have userptr BOs */
                if (!p->bo_list)
@@ -428,9 +430,10 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
                /* Unreserve everything again. */
                ttm_eu_backoff_reservation(&p->ticket, &p->validated);
 
-               /* We tried to often, just abort */
+               /* We tried too many times, just abort */
                if (!--tries) {
                        r = -EDEADLK;
+                       DRM_ERROR("deadlock in %s\n", __func__);
                        goto error_free_pages;
                }
 
@@ -442,11 +445,13 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
                                                         sizeof(struct page*));
                        if (!e->user_pages) {
                                r = -ENOMEM;
+                               DRM_ERROR("calloc failure in %s\n", __func__);
                                goto error_free_pages;
                        }
 
                        r = amdgpu_ttm_tt_get_user_pages(ttm, e->user_pages);
                        if (r) {
+                               DRM_ERROR("amdgpu_ttm_tt_get_user_pages failed.\n");
                                drm_free_large(e->user_pages);
                                e->user_pages = NULL;
                                goto error_free_pages;
@@ -463,12 +468,16 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
        p->bytes_moved = 0;
 
        r = amdgpu_cs_list_validate(p, &duplicates);
-       if (r)
+       if (r) {
+               DRM_ERROR("amdgpu_cs_list_validate(duplicates) failed.\n");
                goto error_validate;
+       }
 
        r = amdgpu_cs_list_validate(p, &p->validated);
-       if (r)
+       if (r) {
+               DRM_ERROR("amdgpu_cs_list_validate(validated) failed.\n");
                goto error_validate;
+       }
 
        fpriv->vm.last_eviction_counter =
                atomic64_read(&p->adev->num_evictions);
--

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

A message that is not in the archive (sent off-list or not yet received): CADnq5_P2eaOgV43+ebDp4cwDZPeVsc7w3W2mLbF8KUpUn5g3xA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#4 lore raw

Am 01.08.2016 um 19:52 schrieb Alex Deucher:

Quoted 7 lines · Marek Olšák
Quoted 5 lines

From: Marek Olšák <[email protected]>

It's useful for debugging.

If you haven't already committed it the patch is Reviewed-by: Christian König <[email protected]> as well.

Regards,
Christian.

Quoted 69 lines
Quoted 69 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c | 17 +++++++++++++----
  1 file changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c +13 -5
index 45d5227..e4617c4 100644
@@ -387,8 +387,10 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
 
                 r = ttm_eu_reserve_buffers(&p->ticket, &p->validated, true,
                                            &duplicates);
-               if (unlikely(r != 0))
+               if (unlikely(r != 0)) {
+                       DRM_ERROR("ttm_eu_reserve_buffers failed.\n");
                         goto error_free_pages;
+               }
 
                 /* Without a BO list we don't have userptr BOs */
                 if (!p->bo_list)
@@ -428,9 +430,10 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
                 /* Unreserve everything again. */
                 ttm_eu_backoff_reservation(&p->ticket, &p->validated);
 
-               /* We tried to often, just abort */
+               /* We tried too many times, just abort */
                 if (!--tries) {
                         r = -EDEADLK;
+                       DRM_ERROR("deadlock in %s\n", __func__);
                         goto error_free_pages;
                 }
 
@@ -442,11 +445,13 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
                                                          sizeof(struct page*));
                         if (!e->user_pages) {
                                 r = -ENOMEM;
+                               DRM_ERROR("calloc failure in %s\n", __func__);
                                 goto error_free_pages;
                         }
 
                         r = amdgpu_ttm_tt_get_user_pages(ttm, e->user_pages);
                         if (r) {
+                               DRM_ERROR("amdgpu_ttm_tt_get_user_pages failed.\n");
                                 drm_free_large(e->user_pages);
                                 e->user_pages = NULL;
                                 goto error_free_pages;
@@ -463,12 +468,16 @@ static int amdgpu_cs_parser_bos(struct amdgpu_cs_parser *p,
         p->bytes_moved = 0;
 
         r = amdgpu_cs_list_validate(p, &duplicates);
-       if (r)
+       if (r) {
+               DRM_ERROR("amdgpu_cs_list_validate(duplicates) failed.\n");
                 goto error_validate;
+       }
 
         r = amdgpu_cs_list_validate(p, &p->validated);
-       if (r)
+       if (r) {
+               DRM_ERROR("amdgpu_cs_list_validate(validated) failed.\n");
                 goto error_validate;
+       }
 
         fpriv->vm.last_eviction_counter =
                 atomic64_read(&p->adev->num_evictions);
--

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