From: "Grodzovsky, Andrey" <Andrey.Grodzovsky@amd.com>
To: "Koenig, Christian" <Christian.Koenig@amd.com>,
"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Cc: "S, Shirish" <Shirish.S@amd.com>
Subject: Re: [PATCH 1/2] drm/sched: Set error to s_fence if HW job submission failed.
Date: Fri, 25 Oct 2019 14:57:03 +0000 [thread overview]
Message-ID: <1638959e-08ef-3a24-babc-5cbddcae0575@amd.com> (raw)
In-Reply-To: <dbc0cddf-e1e1-fa36-df26-b784aea6dc12@gmail.com>
On 10/25/19 4:44 AM, Christian König wrote:
> Am 24.10.19 um 21:57 schrieb Andrey Grodzovsky:
>> Problem:
>> When run_job fails and HW fence returned is NULL we still signal
>> the s_fence to avoid hangs but the user has no way of knowing if
>> the actual HW job was ran and finished.
>>
>> Fix:
>> Allow .run_job implementations to return ERR_PTR in the fence pointer
>> returned and then set this error for s_fence->finished fence so whoever
>> wait on this fence can inspect the signaled fence for an error.
>>
>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
>> ---
>> drivers/gpu/drm/scheduler/sched_main.c | 19 ++++++++++++++++---
>> 1 file changed, 16 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/scheduler/sched_main.c
>> b/drivers/gpu/drm/scheduler/sched_main.c
>> index 9a0ee74..f39b97e 100644
>> --- a/drivers/gpu/drm/scheduler/sched_main.c
>> +++ b/drivers/gpu/drm/scheduler/sched_main.c
>> @@ -479,6 +479,7 @@ void drm_sched_resubmit_jobs(struct
>> drm_gpu_scheduler *sched)
>> struct drm_sched_job *s_job, *tmp;
>> uint64_t guilty_context;
>> bool found_guilty = false;
>> + struct dma_fence *fence;
>> list_for_each_entry_safe(s_job, tmp,
>> &sched->ring_mirror_list, node) {
>> struct drm_sched_fence *s_fence = s_job->s_fence;
>> @@ -492,7 +493,16 @@ void drm_sched_resubmit_jobs(struct
>> drm_gpu_scheduler *sched)
>> dma_fence_set_error(&s_fence->finished, -ECANCELED);
>> dma_fence_put(s_job->s_fence->parent);
>> - s_job->s_fence->parent = sched->ops->run_job(s_job);
>> + fence = sched->ops->run_job(s_job);
>> +
>> + if (IS_ERR_OR_NULL(fence)) {
>> + s_job->s_fence->parent = NULL;
>> + dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
>> + } else {
>> + s_job->s_fence->parent = fence;
>> + }
>> +
>> +
>
> Maybe time for a drm_sched_run_job() function which does that
> handling? And why don't we need to install the callback here?
What code do you want to put in drm_sched_run_job ?
We reinstall the callback later in drm_sched_start,
drm_sched_resubmit_jobs is conditional on whether the guilty fence did
signal by this time or not and so the split of the logic into
drm_sched_start and drm_sched_resubmit_jobs.
Andrey
>
> Apart from that looks good to me,
> Christian.
>
>> }
>> }
>> EXPORT_SYMBOL(drm_sched_resubmit_jobs);
>> @@ -720,7 +730,7 @@ static int drm_sched_main(void *param)
>> fence = sched->ops->run_job(sched_job);
>> drm_sched_fence_scheduled(s_fence);
>> - if (fence) {
>> + if (!IS_ERR_OR_NULL(fence)) {
>> s_fence->parent = dma_fence_get(fence);
>> r = dma_fence_add_callback(fence, &sched_job->cb,
>> drm_sched_process_job);
>> @@ -730,8 +740,11 @@ static int drm_sched_main(void *param)
>> DRM_ERROR("fence add callback failed (%d)\n",
>> r);
>> dma_fence_put(fence);
>> - } else
>> + } else {
>> +
>> + dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
>> drm_sched_process_job(NULL, &sched_job->cb);
>> + }
>> wake_up(&sched->job_scheduled);
>> }
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: "Grodzovsky, Andrey" <Andrey.Grodzovsky@amd.com>
To: "Koenig, Christian" <Christian.Koenig@amd.com>,
"amd-gfx@lists.freedesktop.org" <amd-gfx@lists.freedesktop.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Cc: "S, Shirish" <Shirish.S@amd.com>
Subject: Re: [PATCH 1/2] drm/sched: Set error to s_fence if HW job submission failed.
Date: Fri, 25 Oct 2019 14:57:03 +0000 [thread overview]
Message-ID: <1638959e-08ef-3a24-babc-5cbddcae0575@amd.com> (raw)
Message-ID: <20191025145703.kjESkUhA4UoF0BnqUIGH5ZlRacRR8oKV1ZwJexm4yuo@z> (raw)
In-Reply-To: <dbc0cddf-e1e1-fa36-df26-b784aea6dc12@gmail.com>
On 10/25/19 4:44 AM, Christian König wrote:
> Am 24.10.19 um 21:57 schrieb Andrey Grodzovsky:
>> Problem:
>> When run_job fails and HW fence returned is NULL we still signal
>> the s_fence to avoid hangs but the user has no way of knowing if
>> the actual HW job was ran and finished.
>>
>> Fix:
>> Allow .run_job implementations to return ERR_PTR in the fence pointer
>> returned and then set this error for s_fence->finished fence so whoever
>> wait on this fence can inspect the signaled fence for an error.
>>
>> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
>> ---
>> drivers/gpu/drm/scheduler/sched_main.c | 19 ++++++++++++++++---
>> 1 file changed, 16 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/scheduler/sched_main.c
>> b/drivers/gpu/drm/scheduler/sched_main.c
>> index 9a0ee74..f39b97e 100644
>> --- a/drivers/gpu/drm/scheduler/sched_main.c
>> +++ b/drivers/gpu/drm/scheduler/sched_main.c
>> @@ -479,6 +479,7 @@ void drm_sched_resubmit_jobs(struct
>> drm_gpu_scheduler *sched)
>> struct drm_sched_job *s_job, *tmp;
>> uint64_t guilty_context;
>> bool found_guilty = false;
>> + struct dma_fence *fence;
>> list_for_each_entry_safe(s_job, tmp,
>> &sched->ring_mirror_list, node) {
>> struct drm_sched_fence *s_fence = s_job->s_fence;
>> @@ -492,7 +493,16 @@ void drm_sched_resubmit_jobs(struct
>> drm_gpu_scheduler *sched)
>> dma_fence_set_error(&s_fence->finished, -ECANCELED);
>> dma_fence_put(s_job->s_fence->parent);
>> - s_job->s_fence->parent = sched->ops->run_job(s_job);
>> + fence = sched->ops->run_job(s_job);
>> +
>> + if (IS_ERR_OR_NULL(fence)) {
>> + s_job->s_fence->parent = NULL;
>> + dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
>> + } else {
>> + s_job->s_fence->parent = fence;
>> + }
>> +
>> +
>
> Maybe time for a drm_sched_run_job() function which does that
> handling? And why don't we need to install the callback here?
What code do you want to put in drm_sched_run_job ?
We reinstall the callback later in drm_sched_start,
drm_sched_resubmit_jobs is conditional on whether the guilty fence did
signal by this time or not and so the split of the logic into
drm_sched_start and drm_sched_resubmit_jobs.
Andrey
>
> Apart from that looks good to me,
> Christian.
>
>> }
>> }
>> EXPORT_SYMBOL(drm_sched_resubmit_jobs);
>> @@ -720,7 +730,7 @@ static int drm_sched_main(void *param)
>> fence = sched->ops->run_job(sched_job);
>> drm_sched_fence_scheduled(s_fence);
>> - if (fence) {
>> + if (!IS_ERR_OR_NULL(fence)) {
>> s_fence->parent = dma_fence_get(fence);
>> r = dma_fence_add_callback(fence, &sched_job->cb,
>> drm_sched_process_job);
>> @@ -730,8 +740,11 @@ static int drm_sched_main(void *param)
>> DRM_ERROR("fence add callback failed (%d)\n",
>> r);
>> dma_fence_put(fence);
>> - } else
>> + } else {
>> +
>> + dma_fence_set_error(&s_fence->finished, PTR_ERR(fence));
>> drm_sched_process_job(NULL, &sched_job->cb);
>> + }
>> wake_up(&sched->job_scheduled);
>> }
>
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2019-10-25 14:57 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-24 19:57 [PATCH 1/2] drm/sched: Set error to s_fence if HW job submission failed Andrey Grodzovsky
2019-10-24 19:57 ` Andrey Grodzovsky
2019-10-24 19:57 ` Andrey Grodzovsky
2019-10-24 19:57 ` [PATCH 2/2] drm/amdgpu: If amdgpu_ib_schedule fails return back the error Andrey Grodzovsky
2019-10-24 19:57 ` Andrey Grodzovsky
2019-10-24 19:57 ` Andrey Grodzovsky
[not found] ` <1571947050-26276-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2019-10-25 8:44 ` [PATCH 1/2] drm/sched: Set error to s_fence if HW job submission failed Christian König
2019-10-25 8:44 ` Christian König
2019-10-25 8:44 ` Christian König
2019-10-25 14:57 ` Grodzovsky, Andrey [this message]
2019-10-25 14:57 ` Grodzovsky, Andrey
[not found] ` <1638959e-08ef-3a24-babc-5cbddcae0575-5C7GfCeVMHo@public.gmane.org>
2019-10-25 15:55 ` Koenig, Christian
2019-10-25 15:55 ` Koenig, Christian
2019-10-25 15:55 ` Koenig, Christian
2019-10-25 15:56 ` Grodzovsky, Andrey
2019-10-25 15:56 ` Grodzovsky, Andrey
2019-10-25 15:58 ` Koenig, Christian
2019-10-25 15:58 ` Koenig, Christian
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=1638959e-08ef-3a24-babc-5cbddcae0575@amd.com \
--to=andrey.grodzovsky@amd.com \
--cc=Christian.Koenig@amd.com \
--cc=Shirish.S@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.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.