AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Chunming Zhou <david1.zhou-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: "Christian König"
	<ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Christian König" <christian.koenig-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 1/2] drm/amdgpu: re-validate per VM BOs if required
Date: Mon, 26 Mar 2018 16:29:54 +0800	[thread overview]
Message-ID: <20180326082955.11488-1-david1.zhou@amd.com> (raw)

From: Christian König <ckoenig.leichtzumerken@gmail.com>

If a per VM BO ends up in a allowed domain it never moves back into the
prefered domain.

Change-Id: Ifb3e561785d3b464da28c439b271c26825224c5e
Signed-off-by: Christian König <christian.koenig@amd.com>
Reviewed-and-Tested-by: Chunming Zhou <david1.zhou@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index e9a41dd05345..7db411a282ce 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -1808,14 +1808,16 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev,
 
 	spin_lock(&vm->status_lock);
 	while (!list_empty(&vm->moved)) {
-		struct amdgpu_bo_va *bo_va;
 		struct reservation_object *resv;
+		struct amdgpu_bo_va *bo_va;
+		struct amdgpu_bo *bo;
 
 		bo_va = list_first_entry(&vm->moved,
 			struct amdgpu_bo_va, base.vm_status);
 		spin_unlock(&vm->status_lock);
 
-		resv = bo_va->base.bo->tbo.resv;
+		bo = bo_va->base.bo;
+		resv = bo->tbo.resv;
 
 		/* Per VM BOs never need to bo cleared in the page tables */
 		if (resv == vm->root.base.bo->tbo.resv)
@@ -1835,6 +1837,15 @@ int amdgpu_vm_handle_moved(struct amdgpu_device *adev,
 			kcl_reservation_object_unlock(resv);
 
 		spin_lock(&vm->status_lock);
+
+		/* If the BO prefers to be in VRAM, but currently isn't add it
+		 * back to the evicted list so that it gets validated again on
+		 * the next command submission.
+		 */
+		if (resv == vm->root.base.bo->tbo.resv &&
+		    bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM &&
+		    bo->tbo.mem.mem_type != TTM_PL_VRAM)
+			list_add_tail(&bo_va->base.vm_status, &vm->evicted);
 	}
 	spin_unlock(&vm->status_lock);
 
-- 
2.14.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

             reply	other threads:[~2018-03-26  8:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-26  8:29 Chunming Zhou [this message]
     [not found] ` <20180326082955.11488-1-david1.zhou-5C7GfCeVMHo@public.gmane.org>
2018-03-26  8:29   ` [PATCH 2/2] drm/amdgpu: add per vm bo validation order Chunming Zhou
     [not found]     ` <20180326082955.11488-2-david1.zhou-5C7GfCeVMHo@public.gmane.org>
2018-03-26  8:34       ` zhoucm1
  -- strict thread matches above, loose matches on Subject: below --
2018-03-26  8:47 [PATCH 1/2] drm/amdgpu: re-validate per VM BOs if required Chunming Zhou
     [not found] ` <20180326084717.15465-1-david1.zhou-5C7GfCeVMHo@public.gmane.org>
2018-03-26 10:38   ` Christian König

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=20180326082955.11488-1-david1.zhou@amd.com \
    --to=david1.zhou-5c7gfcevmho@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@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