AMD-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Monk Liu <Monk.Liu-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 06/12] drm/amdgpu/sriov:handle more jobs hang in different ring case
Date: Mon, 9 Oct 2017 10:18:26 +0200	[thread overview]
Message-ID: <37b83485-b549-82a4-5497-e2d32646b779@gmail.com> (raw)
In-Reply-To: <1506751432-21789-7-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>

Am 30.09.2017 um 08:03 schrieb Monk Liu:
> quit first and try later if gpu_reset is already running, this
> way we can handle different jobs hang on different ring and
> crash each other on the same time

Using schedule like this is not good coding style, please use a lock or 
completion event instead.

Christian.

>
> Change-Id: I0c6bc8d76959c5053e7523c41b2305032fc6b79a
> Signed-off-by: Monk Liu <Monk.Liu@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_device.c |  4 ++--
>   drivers/gpu/drm/amd/amdgpu/amdgpu_job.c    | 15 ++++++++++++---
>   2 files changed, 14 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> index 31a5608..9efbb33 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
> @@ -2754,9 +2754,9 @@ int amdgpu_sriov_gpu_reset(struct amdgpu_device *adev, struct amdgpu_job *job)
>   	struct amdgpu_ring *ring;
>   	struct dma_fence *fence = NULL, *next = NULL;
>   
> -	/* other thread is already into the gpu reset so just quit */
> +	/* other thread is already into the gpu reset so just quit and come later */
>   	if (!atomic_add_unless(&adev->in_sriov_reset, 1, 1))
> -		return 0;
> +		return -EAGAIN;
>   
>   	atomic_inc(&adev->gpu_reset_counter);
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> index 4510627..0db81a4 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c
> @@ -37,10 +37,19 @@ static void amdgpu_job_timedout(struct amd_sched_job *s_job)
>   		  atomic_read(&job->ring->fence_drv.last_seq),
>   		  job->ring->fence_drv.sync_seq);
>   
> -	if (amdgpu_sriov_vf(job->adev))
> -		amdgpu_sriov_gpu_reset(job->adev, job);
> -	else
> +	if (amdgpu_sriov_vf(job->adev)) {
> +		int r;
> +
> +try_again:
> +		r = amdgpu_sriov_gpu_reset(job->adev, job);
> +		if (r == -EAGAIN) {
> +			/* maye two different schedulers all have hang job, try later */
> +			schedule();
> +			goto try_again;
> +		}
> +	} else {
>   		amdgpu_gpu_reset(job->adev);
> +	}
>   }
>   
>   int amdgpu_job_alloc(struct amdgpu_device *adev, unsigned num_ibs,


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

  parent reply	other threads:[~2017-10-09  8:18 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-30  6:03 [PATCH 00/12] *** SRIOV GPU RESET PATCHES *** Monk Liu
     [not found] ` <1506751432-21789-1-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-09-30  6:03   ` [PATCH 01/12] drm/amdgpu/sriov:now must reinit psp Monk Liu
2017-09-30  6:03   ` [PATCH 02/12] drm/amdgpu/sriov:fix memory leak in psp_load_fw Monk Liu
2017-09-30  6:03   ` [PATCH 03/12] drm/amdgpu/sriov:use atomic type for sriov_reset Monk Liu
2017-09-30  6:03   ` [PATCH 04/12] drm/amdgpu/sriov:cleanup gpu rest mlock Monk Liu
2017-09-30  6:03   ` [PATCH 05/12] drm/amdgpu/sriov:accurate description for sriov_gpu_reset Monk Liu
2017-09-30  6:03   ` [PATCH 06/12] drm/amdgpu/sriov:handle more jobs hang in different ring case Monk Liu
     [not found]     ` <1506751432-21789-7-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-09  8:18       ` Christian König [this message]
2017-09-30  6:03   ` [PATCH 07/12] drm/amdgpu/sriov:implement strict gpu reset Monk Liu
     [not found]     ` <1506751432-21789-8-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-09  8:20       ` Christian König
     [not found]         ` <250ce10a-cca0-0193-b2ed-cc2f04e80d0c-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-09  8:30           ` Liu, Monk
2017-10-09 10:58       ` Nicolai Hähnle
2017-09-30  6:03   ` [PATCH 08/12] drm/amdgpu:explicitly call fence_process Monk Liu
     [not found]     ` <1506751432-21789-9-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-09  8:23       ` Christian König
     [not found]         ` <5cb1ae43-ec3a-2b0b-b78b-91cefd575672-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-09  8:32           ` Liu, Monk
     [not found]             ` <BLUPR12MB04491DDBC8ACFE2FB43D0F0084740-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-09  8:40               ` Christian König
     [not found]                 ` <62bb9496-b29f-0230-8fa4-0bad470c12c8-5C7GfCeVMHo@public.gmane.org>
2017-10-09  8:51                   ` Liu, Monk
     [not found]                     ` <BLUPR12MB0449E49C10230F350B9BD3B284740-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-09  8:52                       ` Liu, Monk
     [not found]                         ` <BLUPR12MB04495DD27084790E5B219D7384740-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-09  8:58                           ` Christian König
2017-09-30  6:03   ` [PATCH 09/12] drm/amdgpu/sriov:return -ENODEV if gpu reseted Monk Liu
     [not found]     ` <1506751432-21789-10-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-09  8:25       ` Christian König
     [not found]         ` <6e81d8b0-267a-1ea8-b228-93286fc6a954-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-09  8:35           ` Liu, Monk
     [not found]             ` <BLUPR12MB0449531313F50BE080F7746D84740-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-09  8:54               ` Christian König
2017-10-09 11:01               ` Nicolai Hähnle
     [not found]                 ` <71b411c8-21a6-fe9b-ed33-7928571a88da-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-10  4:26                   ` Liu, Monk
     [not found]                     ` <BLUPR12MB04492B28DF57EACE2149562D84750-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-10  6:58                       ` Christian König
     [not found]                         ` <85c67ae9-bfe2-390a-79d0-6e5872b9be62-5C7GfCeVMHo@public.gmane.org>
2017-10-10  7:12                           ` Liu, Monk
     [not found]                             ` <BLUPR12MB04497B5442F66C969861742584750-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-10  7:25                               ` Christian König
     [not found]                                 ` <f06b80fa-fc96-a93c-59b7-2460dba95e94-5C7GfCeVMHo@public.gmane.org>
2017-10-10  8:21                                   ` Liu, Monk
     [not found]                                     ` <BLUPR12MB0449B68E81C778A9D07FB38584750-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-10  8:57                                       ` Nicolai Hähnle
2017-10-10  7:19                           ` Liu, Monk
2017-10-10  7:47                           ` Michel Dänzer
     [not found]                             ` <0c91bb14-a874-9ee6-8756-2a31eb41d5b2-otUistvHUpPR7s880joybQ@public.gmane.org>
2017-10-10  7:57                               ` Christian König
     [not found]                                 ` <36f5b680-c881-3b4f-0784-3cd624064004-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-10  8:17                                   ` Michel Dänzer
2017-09-30  6:03   ` [PATCH 10/12] drm/amdgpu/sriov:implement guilty ctx for loose reset Monk Liu
     [not found]     ` <1506751432-21789-11-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-09  8:27       ` Christian König
     [not found]         ` <e4c96014-b4f4-e013-a966-9e2e03b9a62b-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-09  8:39           ` Liu, Monk
     [not found]             ` <BLUPR12MB0449C8E878F09AE59BA816E284740-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-09  9:03               ` Christian König
     [not found]                 ` <d249cc75-29e3-713f-fc5a-2f26f555500b-5C7GfCeVMHo@public.gmane.org>
2017-10-09  9:14                   ` Liu, Monk
     [not found]                     ` <BLUPR12MB04498EE183C86C2B93DDA85484740-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-09  9:24                       ` Christian König
2017-09-30  6:03   ` [PATCH 11/12] drm/amdgpu/sriov:show error if ib test failed Monk Liu
     [not found]     ` <1506751432-21789-12-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-09  8:29       ` Christian König
2017-09-30  6:03   ` [PATCH 12/12] drm/amdgpu/sriov:no shadow buffer recovery Monk Liu
     [not found]     ` <1506751432-21789-13-git-send-email-Monk.Liu-5C7GfCeVMHo@public.gmane.org>
2017-10-01  9:32       ` Christian König
2017-10-01  9:36       ` Christian König
     [not found]         ` <e767c6f2-4050-c697-2075-c3d744e6b379-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-04  9:41           ` Liu, Monk
     [not found]             ` <BLUPR12MB0449346A746E70A7BE88FEA084730-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-04 10:56               ` Christian König
     [not found]                 ` <9b08e030-1a47-39ef-8010-64c51d4560e8-5C7GfCeVMHo@public.gmane.org>
2017-10-09  4:12                   ` Liu, Monk
2017-10-01  9:31   ` [PATCH 00/12] *** SRIOV GPU RESET PATCHES *** 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=37b83485-b549-82a4-5497-e2d32646b779@gmail.com \
    --to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Monk.Liu-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=christian.koenig-5C7GfCeVMHo@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