From: Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>
Subject: [PATCH 4/5] drm/amdgpu:cleanup job reset routine
Date: Fri, 20 Oct 2017 11:33:04 +0800 [thread overview]
Message-ID: <1508470385-16164-4-git-send-email-Monk.Liu@amd.com> (raw)
In-Reply-To: <1508470385-16164-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
merge the setting guilty on context into this function
to avoid implement extra routine.
Change-Id: I7a0063464fdc85d5ac9080046380e745565ff540
Signed-off-by: Monk Liu <Monk.Liu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++--
drivers/gpu/drm/amd/scheduler/gpu_scheduler.c | 13 ++++++++++++-
drivers/gpu/drm/amd/scheduler/gpu_scheduler.h | 2 +-
3 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
index dae1e5b..a07544d 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
@@ -2868,7 +2868,7 @@ int amdgpu_sriov_gpu_reset(struct amdgpu_device *adev, struct amdgpu_job *job)
amd_sched_job_kickout(&job->base);
/* only do job_reset on the hang ring if @job not NULL */
- amd_sched_hw_job_reset(&ring->sched);
+ amd_sched_hw_job_reset(&ring->sched, NULL);
/* after all hw jobs are reset, hw fence is meaningless, so force_completion */
amdgpu_fence_driver_force_completion(ring);
@@ -2989,7 +2989,7 @@ int amdgpu_gpu_reset(struct amdgpu_device *adev)
if (!ring || !ring->sched.thread)
continue;
kthread_park(ring->sched.thread);
- amd_sched_hw_job_reset(&ring->sched);
+ amd_sched_hw_job_reset(&ring->sched, NULL);
/* after all hw jobs are reset, hw fence is meaningless, so force_completion */
amdgpu_fence_driver_force_completion(ring);
}
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
index e4d3b4e..322b6c1 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.c
@@ -442,7 +442,14 @@ static void amd_sched_job_timedout(struct work_struct *work)
job->sched->ops->timedout_job(job);
}
-void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched)
+static void amd_sched_set_guilty(struct amd_sched_job *s_job)
+{
+ if (atomic_inc_return(&s_job->karma) > s_job->sched->hang_limit)
+ if (s_job->s_entity->guilty)
+ atomic_set(s_job->s_entity->guilty, 1);
+}
+
+void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched, struct amd_sched_job *bad)
{
struct amd_sched_job *s_job;
@@ -455,6 +462,10 @@ void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched)
s_job->s_fence->parent = NULL;
atomic_dec(&sched->hw_rq_count);
}
+
+ if (bad && bad == s_job) {
+ amd_sched_set_guilty(s_job);
+ }
}
spin_unlock(&sched->job_list_lock);
}
diff --git a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
index 2d59fc5..fff7cc7 100644
--- a/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
+++ b/drivers/gpu/drm/amd/scheduler/gpu_scheduler.h
@@ -172,7 +172,7 @@ int amd_sched_job_init(struct amd_sched_job *job,
struct amd_gpu_scheduler *sched,
struct amd_sched_entity *entity,
void *owner);
-void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched);
+void amd_sched_hw_job_reset(struct amd_gpu_scheduler *sched, struct amd_sched_job *job);
void amd_sched_job_recovery(struct amd_gpu_scheduler *sched);
bool amd_sched_dependency_optimized(struct dma_fence* fence,
struct amd_sched_entity *entity);
--
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:[~2017-10-20 3:33 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-20 3:33 [PATCH 1/5] drm/amdgpu:cleanup force_completion Monk Liu
[not found] ` <1508470385-16164-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-20 3:33 ` [PATCH 2/5] drm/amdgpu:add hang_limit for sched Monk Liu
[not found] ` <1508470385-16164-2-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-20 9:03 ` Christian König
[not found] ` <2002cd84-8f78-52c3-d56c-faa43add4050-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-20 9:41 ` Liu, Monk
2017-10-20 3:33 ` [PATCH 3/5] drm/amdgpu:implement guilty pointer Monk Liu
[not found] ` <1508470385-16164-3-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-20 9:08 ` Christian König
[not found] ` <f3a9431e-31fd-e8a5-79e9-d8bb09de366b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-23 4:26 ` Liu, Monk
[not found] ` <BLUPR12MB0449682AC30F4365B0A5068284460-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-23 7:17 ` Christian König
[not found] ` <9ee4a45a-53c5-5a70-449f-714b90a3de08-5C7GfCeVMHo@public.gmane.org>
2017-10-23 7:53 ` Liu, Monk
2017-10-20 3:33 ` Monk Liu [this message]
[not found] ` <1508470385-16164-4-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-20 9:06 ` [PATCH 4/5] drm/amdgpu:cleanup job reset routine Christian König
[not found] ` <85ee460e-1f65-69c7-c17b-329d9b31d205-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-20 10:00 ` Liu, Monk
2017-10-20 3:33 ` [PATCH 5/5] drm/amdgpu:skip job for guilty ctx in parser_init Monk Liu
[not found] ` <1508470385-16164-5-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-20 9:09 ` Christian König
2017-10-20 7:17 ` [PATCH 1/5] drm/amdgpu:cleanup force_completion 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=1508470385-16164-4-git-send-email-Monk.Liu@amd.com \
--to=monk.liu-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