From: Chunming Zhou <david1.zhou-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Chunming Zhou <david1.zhou-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 2/2] drm/amdgpu: add per vm bo validation order
Date: Mon, 26 Mar 2018 16:29:55 +0800 [thread overview]
Message-ID: <20180326082955.11488-2-david1.zhou@amd.com> (raw)
In-Reply-To: <20180326082955.11488-1-david1.zhou-5C7GfCeVMHo@public.gmane.org>
Change-Id: I59f1da8a765efae8196c0b1599f47a8b8485c4d3
Signed-off-by: Chunming Zhou <david1.zhou@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 12 +++++++++++-
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 6 ++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 7db411a282ce..3543e394adac 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -205,12 +205,20 @@ int amdgpu_vm_validate_pt_bos(struct amdgpu_device *adev, struct amdgpu_vm *vm,
spin_lock(&vm->status_lock);
while (!list_empty(&vm->evicted)) {
- struct amdgpu_vm_bo_base *bo_base;
+ struct amdgpu_vm_bo_base *bo_base, *tmp;
struct amdgpu_bo *bo;
+ u64 bo_order;
bo_base = list_first_entry(&vm->evicted,
struct amdgpu_vm_bo_base,
vm_status);
+ bo_order = bo_base->order;
+ list_for_each_entry(tmp, &vm->evicted, vm_status) {
+ if (tmp->order < bo_order) {
+ bo_order = bo_base->order;
+ bo_base = tmp;
+ }
+ }
spin_unlock(&vm->status_lock);
bo = bo_base->bo;
@@ -1903,6 +1911,7 @@ struct amdgpu_bo_va *amdgpu_vm_bo_add(struct amdgpu_device *adev,
* */
spin_lock(&vm->status_lock);
list_move_tail(&bo_va->base.vm_status, &vm->evicted);
+ bo_va->base.order = (u64)atomic64_inc_return(&vm->bo_order);
spin_unlock(&vm->status_lock);
return bo_va;
@@ -2424,6 +2433,7 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm,
INIT_LIST_HEAD(&vm->relocated);
INIT_LIST_HEAD(&vm->moved);
INIT_LIST_HEAD(&vm->freed);
+ atomic64_set(&vm->bo_order, 0);
/* create scheduler entity for page table updates */
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
index cf2c667ee538..bac5349d291e 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
@@ -152,6 +152,9 @@ struct amdgpu_vm_bo_base {
/* protected by the BO being reserved */
bool moved;
+
+ /* validate order */
+ u64 order;
};
struct amdgpu_vm_pt {
@@ -214,6 +217,9 @@ struct amdgpu_vm {
/* Limit non-retry fault storms */
unsigned int fault_credit;
+
+ /* per vm bo order in this vm */
+ atomic64_t bo_order;
};
struct amdgpu_vm_manager {
--
2.14.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2018-03-26 8:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-26 8:29 [PATCH 1/2] drm/amdgpu: re-validate per VM BOs if required Chunming Zhou
[not found] ` <20180326082955.11488-1-david1.zhou-5C7GfCeVMHo@public.gmane.org>
2018-03-26 8:29 ` Chunming Zhou [this message]
[not found] ` <20180326082955.11488-2-david1.zhou-5C7GfCeVMHo@public.gmane.org>
2018-03-26 8:34 ` [PATCH 2/2] drm/amdgpu: add per vm bo validation order 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 8:47 ` [PATCH 2/2] drm/amdgpu: add per vm bo validation order Chunming Zhou
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-2-david1.zhou@amd.com \
--to=david1.zhou-5c7gfcevmho@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@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