From: "Nicolai Hähnle" <nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: "Nicolai Hähnle" <nicolai.haehnle-5C7GfCeVMHo@public.gmane.org>,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH 2/5] drm/amd/amdgpu: move eviction counting to amdgpu_bo_move_notify
Date: Thu, 15 Dec 2016 18:10:12 +0100 [thread overview]
Message-ID: <1481821815-9971-3-git-send-email-nhaehnle@gmail.com> (raw)
In-Reply-To: <1481821815-9971-1-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
From: Nicolai Hähnle <nicolai.haehnle@amd.com>
This catches evictions of shadow page tables from the GART. Since shadow
page tables are always stored in system memory, amdgpu_bo_move is never
called for them.
This fixes a crash during command submission that occurs when only a shadow
page table and no other BOs were evicted since the last submission.
Fixes: 1baa439fb2f4e586 ("drm/amdgpu: allocate shadow for pd/pt bo V2")
Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 4 ++++
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 4 ----
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
index c29db99..d94cdef 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_object.c
@@ -855,20 +855,24 @@ void amdgpu_bo_move_notify(struct ttm_buffer_object *bo,
struct amdgpu_device *adev = amdgpu_ttm_adev(bo->bdev);
struct amdgpu_bo *abo;
struct ttm_mem_reg *old_mem = &bo->mem;
if (!amdgpu_ttm_bo_is_amdgpu_bo(bo))
return;
abo = container_of(bo, struct amdgpu_bo, tbo);
amdgpu_vm_bo_invalidate(adev, abo);
+ /* remember the eviction */
+ if (evict)
+ atomic64_inc(&adev->num_evictions);
+
/* update statistics */
if (!new_mem)
return;
/* move_notify is called before move happens */
amdgpu_update_memory_usage(adev, &bo->mem, new_mem);
trace_amdgpu_ttm_bo_move(abo, new_mem->mem_type, old_mem->mem_type);
}
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 8f18b8e..80924c2 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -460,24 +460,20 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo,
struct ttm_mem_reg *old_mem = &bo->mem;
int r;
/* Can't move a pinned BO */
abo = container_of(bo, struct amdgpu_bo, tbo);
if (WARN_ON_ONCE(abo->pin_count > 0))
return -EINVAL;
adev = amdgpu_ttm_adev(bo->bdev);
- /* remember the eviction */
- if (evict)
- atomic64_inc(&adev->num_evictions);
-
if (old_mem->mem_type == TTM_PL_SYSTEM && bo->ttm == NULL) {
amdgpu_move_null(bo, new_mem);
return 0;
}
if ((old_mem->mem_type == TTM_PL_TT &&
new_mem->mem_type == TTM_PL_SYSTEM) ||
(old_mem->mem_type == TTM_PL_SYSTEM &&
new_mem->mem_type == TTM_PL_TT)) {
/* bind is enough */
amdgpu_move_null(bo, new_mem);
--
2.7.4
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2016-12-15 17:10 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-15 17:10 [PATCH 0/5] drm/ttm, amdgpu: fix crashes due to shadow page table evictions Nicolai Hähnle
[not found] ` <1481821815-9971-1-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-15 17:10 ` [PATCH 1/5] drm/ttm: add evict parameter to ttm_bo_driver::move_notify Nicolai Hähnle
[not found] ` <1481821815-9971-2-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-16 2:49 ` zhoucm1
[not found] ` <5853564E.5020005-5C7GfCeVMHo@public.gmane.org>
2016-12-21 15:12 ` Nicolai Hähnle
[not found] ` <8f68adf1-52bc-b2ef-2fa7-79a8f9695164-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-03 11:42 ` Christian König
2016-12-15 17:10 ` Nicolai Hähnle [this message]
[not found] ` <1481821815-9971-3-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-16 2:50 ` [PATCH 2/5] drm/amd/amdgpu: move eviction counting to amdgpu_bo_move_notify zhoucm1
2016-12-15 17:10 ` [PATCH 3/5] drm/amd/amdgpu: add amdgpu_bo_gpu_accessible helper function Nicolai Hähnle
[not found] ` <1481821815-9971-4-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-16 2:48 ` zhoucm1
2016-12-15 17:10 ` [PATCH 4/5] drm/amd/amdgpu: add check that shadow page directory is GPU-accessible Nicolai Hähnle
[not found] ` <1481821815-9971-5-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-16 2:49 ` zhoucm1
2016-12-15 17:10 ` [PATCH 5/5] drm/amd/amdgpu: add check that shadow page tables are GPU-accessible Nicolai Hähnle
[not found] ` <1481821815-9971-6-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-15 17:59 ` [PATCH v2] " Nicolai Hähnle
[not found] ` <1481824743-11139-1-git-send-email-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-12-16 2:48 ` zhoucm1
2016-12-16 2:07 ` [PATCH 5/5] " zhoucm1
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1481821815-9971-3-git-send-email-nhaehnle@gmail.com \
--to=nhaehnle-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=nicolai.haehnle-5C7GfCeVMHo@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox