From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: [PATCH 4/8] drm/amdgpu: allow direct submission in the VM backends
Date: Fri, 29 Mar 2019 11:45:03 +0100 [thread overview]
Message-ID: <20190329104507.2602-4-christian.koenig@amd.com> (raw)
In-Reply-To: <20190329104507.2602-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
This allows us to update page tables directly while in a page fault.
Signed-off-by: Christian König <christian.koenig@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h | 5 ++++
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c | 4 +++
drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c | 29 +++++++++++++--------
3 files changed, 27 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
index 91baf95212a6..66e27b941a55 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.h
@@ -191,6 +191,11 @@ struct amdgpu_vm_update_params {
*/
struct amdgpu_vm *vm;
+ /**
+ * @direct: if changes should be made directly
+ */
+ bool direct;
+
/**
* @pages_addr:
*
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
index 5222d165abfc..f94e4896079c 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_cpu.c
@@ -49,6 +49,10 @@ static int amdgpu_vm_cpu_prepare(struct amdgpu_vm_update_params *p, void *owner,
{
int r;
+ /* Don't wait for anything during page fault */
+ if (p->direct)
+ return 0;
+
/* Wait for PT BOs to be idle. PTs share the same resv. object
* as the root PD BO
*/
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
index ddd181f5ed37..891d597063cb 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm_sdma.c
@@ -68,17 +68,17 @@ static int amdgpu_vm_sdma_prepare(struct amdgpu_vm_update_params *p,
if (r)
return r;
- r = amdgpu_sync_fence(p->adev, &p->job->sync, exclusive, false);
- if (r)
- return r;
+ p->num_dw_left = ndw;
+
+ if (p->direct)
+ return 0;
- r = amdgpu_sync_resv(p->adev, &p->job->sync, root->tbo.resv,
- owner, false);
+ r = amdgpu_sync_fence(p->adev, &p->job->sync, exclusive, false);
if (r)
return r;
- p->num_dw_left = ndw;
- return 0;
+ return amdgpu_sync_resv(p->adev, &p->job->sync, root->tbo.resv,
+ owner, false);
}
/**
@@ -99,13 +99,21 @@ static int amdgpu_vm_sdma_commit(struct amdgpu_vm_update_params *p,
struct dma_fence *f;
int r;
- ring = container_of(p->vm->entity.rq->sched, struct amdgpu_ring, sched);
+ if (p->direct)
+ ring = p->adev->vm_manager.page_fault;
+ else
+ ring = container_of(p->vm->entity.rq->sched,
+ struct amdgpu_ring, sched);
WARN_ON(ib->length_dw == 0);
amdgpu_ring_pad_ib(ring, ib);
WARN_ON(ib->length_dw > p->num_dw_left);
- r = amdgpu_job_submit(p->job, &p->vm->entity,
- AMDGPU_FENCE_OWNER_VM, &f);
+
+ if (p->direct)
+ r = amdgpu_job_submit_direct(p->job, ring, &f);
+ else
+ r = amdgpu_job_submit(p->job, &p->vm->entity,
+ AMDGPU_FENCE_OWNER_VM, &f);
if (r)
goto error;
@@ -120,7 +128,6 @@ static int amdgpu_vm_sdma_commit(struct amdgpu_vm_update_params *p,
return r;
}
-
/**
* amdgpu_vm_sdma_copy_ptes - copy the PTEs from mapping
*
--
2.17.1
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2019-03-29 10:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-29 10:45 [PATCH 1/8] drm/amdgpu: fix ATC handling for Ryzen Christian König
[not found] ` <20190329104507.2602-1-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2019-03-29 10:45 ` [PATCH 2/8] drm/amdgpu: handle leaf PDEs as PTEs on Vega Christian König
2019-03-29 10:45 ` [PATCH 3/8] drm/amdgpu: provide the page fault queue to the VM code Christian König
[not found] ` <20190329104507.2602-3-christian.koenig-5C7GfCeVMHo@public.gmane.org>
2019-03-29 14:23 ` Alex Deucher
[not found] ` <CADnq5_Mv5dVc2o5yvnFRJXLAwxuv5ysFLOLGc9OTWeiVBZAeZA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-03-29 14:24 ` Christian König
2019-03-29 10:45 ` Christian König [this message]
2019-03-29 10:45 ` [PATCH 5/8] drm/amdgpu: allow direct submission of PDE updates Christian König
2019-03-29 10:45 ` [PATCH 6/8] drm/amdgpu: allow direct submission of PTE updates Christian König
2019-03-29 10:45 ` [PATCH 7/8] drm/amdgpu: allow direct submission of clears Christian König
2019-03-29 10:45 ` [PATCH 8/8] drm/amdgpu: add graceful VM fault handling Christian König
2019-03-30 0:41 ` [PATCH 1/8] drm/amdgpu: fix ATC handling for Ryzen Kuehling, Felix
[not found] ` <9cd61a18-fe16-f5aa-5b61-fef6d91d143b-5C7GfCeVMHo@public.gmane.org>
2019-04-01 11:23 ` Christian König
[not found] ` <7317b472-f24a-346a-7e6c-97c98b04e600-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-04-01 17:59 ` Kuehling, Felix
[not found] ` <ba45371a-7ea9-5144-c3c9-c59f93b434d8-5C7GfCeVMHo@public.gmane.org>
2019-04-01 18:03 ` Christian König
[not found] ` <a40597e6-1f76-583b-55ad-089dcd9eeed4-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2019-04-01 18:58 ` Kuehling, Felix
[not found] ` <32035eda-563d-b26b-83a6-71db67c846e6-5C7GfCeVMHo@public.gmane.org>
2019-04-03 17:24 ` Koenig, Christian
[not found] ` <c2cfeddb-7217-2110-d335-824b0a22371c-5C7GfCeVMHo@public.gmane.org>
2019-04-03 21:41 ` Kuehling, Felix
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=20190329104507.2602-4-christian.koenig@amd.com \
--to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@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