All of 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: Chunming Zhou <David1.Zhou-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 10/18] drm/amd: add last fence in sched entity
Date: Fri, 12 Aug 2016 14:38:59 +0800	[thread overview]
Message-ID: <1470983947-32579-11-git-send-email-David1.Zhou@amd.com> (raw)
In-Reply-To: <1470983947-32579-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>

Change-Id: I68f67da25c482ac9dbd26e186cb953a539555a74
Signed-off-by: Chunming Zhou <David1.Zhou@amd.com>
---
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 9 +++++++--
 drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | 1 +
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
index f96aa82..5dab231 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
@@ -134,6 +134,7 @@ int amd_sched_entity_init(struct amd_gpu_scheduler *sched,
 	INIT_LIST_HEAD(&entity->list);
 	entity->rq = rq;
 	entity->sched = sched;
+	entity->last_fence = NULL;
 
 	spin_lock_init(&entity->queue_lock);
 	r = kfifo_alloc(&entity->job_queue, jobs * sizeof(void *), GFP_KERNEL);
@@ -219,6 +220,7 @@ void amd_sched_entity_fini(struct amd_gpu_scheduler *sched,
 
 	amd_sched_rq_remove_entity(rq, entity);
 	kfifo_free(&entity->job_queue);
+	fence_put(entity->last_fence);
 }
 
 static void amd_sched_entity_wakeup(struct fence *f, struct fence_cb *cb)
@@ -304,6 +306,7 @@ static bool amd_sched_entity_in(struct amd_sched_job *sched_job)
 {
 	struct amd_gpu_scheduler *sched = sched_job->sched;
 	struct amd_sched_entity *entity = sched_job->s_entity;
+	struct amd_sched_fence *s_fence = sched_job->s_fence;
 	bool added, first = false;
 
 	spin_lock(&entity->queue_lock);
@@ -312,9 +315,11 @@ static bool amd_sched_entity_in(struct amd_sched_job *sched_job)
 
 	if (added && kfifo_len(&entity->job_queue) == sizeof(sched_job))
 		first = true;
-
+	if (added) {
+		fence_put(entity->last_fence);
+		entity->last_fence = fence_get(&s_fence->finished);
+	}
 	spin_unlock(&entity->queue_lock);
-
 	/* first job wakes up scheduler */
 	if (first) {
 		/* Add the entity to the run queue */
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
index 7cbbbfb..256a851 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
@@ -49,6 +49,7 @@ struct amd_sched_entity {
 
 	atomic_t			fence_seq;
 	uint64_t                        fence_context;
+	struct fence                    *last_fence;
 
 	struct fence			*dependency;
 	struct fence_cb			cb;
-- 
1.9.1

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

  parent reply	other threads:[~2016-08-12  6:38 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-12  6:38 [PATCH 00/18] shadow page table support V3 Chunming Zhou
     [not found] ` <1470983947-32579-1-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2016-08-12  6:38   ` [PATCH 01/18] drm/amdgpu: add shadow bo support V2 Chunming Zhou
2016-08-12  6:38   ` [PATCH 02/18] drm/amdgpu: validate shadow as well when validating bo Chunming Zhou
2016-08-12  6:38   ` [PATCH 03/18] drm/amdgpu: allocate shadow for pd/pt bo V2 Chunming Zhou
2016-08-12  6:38   ` [PATCH 04/18] drm/amdgpu: add shadow flag V2 Chunming Zhou
2016-08-12  6:38   ` [PATCH 05/18] drm/amdgpu: sync bo and shadow Chunming Zhou
2016-08-12  6:38   ` [PATCH 06/18] drm/amdgpu: implement vm recovery function from shadow Chunming Zhou
2016-08-12  6:38   ` [PATCH 07/18] drm/amdgpu: add shadow_entity for shadow page table updates Chunming Zhou
2016-08-12  6:38   ` [PATCH 08/18] drm/amdgpu: update pd shadow bo Chunming Zhou
     [not found]     ` <1470983947-32579-9-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2016-08-12  9:50       ` Edward O'Callaghan
2016-08-12  6:38   ` [PATCH 09/18] drm/amdgpu: update pt shadow Chunming Zhou
2016-08-12  6:38   ` Chunming Zhou [this message]
2016-08-12  6:39   ` [PATCH 11/18] drm/amdgpu: link all vm clients Chunming Zhou
2016-08-12  6:39   ` [PATCH 12/18] drm/amdgpu: add vm_list_lock Chunming Zhou
2016-08-12  6:39   ` [PATCH 13/18] drm/amd: add block entity function Chunming Zhou
2016-08-12  6:39   ` [PATCH 14/18] drm/amdgpu: add shadow fence owner Chunming Zhou
2016-08-12  6:39   ` [PATCH 15/18] drm/amd: block entity Chunming Zhou
     [not found]     ` <1470983947-32579-16-git-send-email-David1.Zhou-5C7GfCeVMHo@public.gmane.org>
2016-08-12  9:42       ` Edward O'Callaghan
     [not found]         ` <f8dfeb55-132f-1ddf-2e2f-02776aa5d3e0-dczkZgxz+BNUPWh3PAxdjQ@public.gmane.org>
2016-08-12  9:43           ` zhoucm1
2016-08-12  6:39   ` [PATCH 16/18] drm/amdgpu: recover page tables after gpu reset Chunming Zhou
2016-08-12  6:39   ` [PATCH 17/18] drm/amdgpu: add need backup function Chunming Zhou
2016-08-12  6:39   ` [PATCH 18/18] drm/amdgpu: add backup condition for vm Chunming Zhou
2016-08-12  8:00   ` [PATCH 00/18] shadow page table support V3 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=1470983947-32579-11-git-send-email-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.