All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Andrey Grodzovsky
	<andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>,
	amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Christian.Koenig-5C7GfCeVMHo@public.gmane.org
Subject: Re: [PATCH 2/2] dmr/amdgpu: Move old fence waiting before reservation lock is aquired.
Date: Mon, 9 Oct 2017 10:36:05 +0200	[thread overview]
Message-ID: <715810ad-26cc-506d-624d-8e5024968ea0@gmail.com> (raw)
In-Reply-To: <1507314021-18323-2-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>

Am 06.10.2017 um 20:20 schrieb Andrey Grodzovsky:
> From: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
>
> This allows to avoid deadlock during GPU reset.
>
> Change-Id: I817e351b02e653f078063c57cec8a0d94062de12
> Signed-off-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c  | 15 +++++++++++++++
>   drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c |  8 ++------
>   2 files changed, 17 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> index 0fa1bc7..79fefc8 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cs.c
> @@ -931,6 +931,9 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev,
>   {
>   	int i, j;
>   	int r, ce_preempt = 0, de_preempt = 0;
> +	struct amdgpu_ctx_ring *cring;
> +	unsigned idx = 0;
> +	struct dma_fence *other = NULL;
>   
>   	for (i = 0, j = 0; i < parser->nchunks && j < parser->job->num_ibs; i++) {
>   		struct amdgpu_cs_chunk *chunk;
> @@ -983,6 +986,18 @@ static int amdgpu_cs_ib_fill(struct amdgpu_device *adev,
>   	    parser->job->ring->funcs->type == AMDGPU_RING_TYPE_VCE))
>   		return -EINVAL;
>   
> +	cring = &parser->ctx->rings[parser->job->ring->idx];
> +	idx = cring->sequence & (amdgpu_sched_jobs - 1);
> +	other = cring->fences[idx];
> +	if (other) {
> +		signed long r;
> +		r = dma_fence_wait_timeout(other, false, MAX_SCHEDULE_TIMEOUT);
> +		if (r < 0) {
> +			DRM_ERROR("Error (%ld) waiting for fence!\n", r);
> +			return r;
> +		}
> +	}
> +

Please move that into a helper function in amdgpu_ctx.c

Apart from that the change looks good to me.

Christian.

>   	return 0;
>   }
>   
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> index c073a68..758b643 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c
> @@ -260,12 +260,8 @@ uint64_t amdgpu_ctx_add_fence(struct amdgpu_ctx *ctx, struct amdgpu_ring *ring,
>   
>   	idx = seq & (amdgpu_sched_jobs - 1);
>   	other = cring->fences[idx];
> -	if (other) {
> -		signed long r;
> -		r = dma_fence_wait_timeout(other, false, MAX_SCHEDULE_TIMEOUT);
> -		if (r < 0)
> -			DRM_ERROR("Error (%ld) waiting for fence!\n", r);
> -	}
> +	if (other)
> +		BUG_ON(!dma_fence_is_signaled(other));
>   
>   	dma_fence_get(fence);
>   


_______________________________________________
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:36 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-06 18:20 [PATCH 1/2] drm/amdgpu:resolv deadlock between reset and cs_ioctl v4 Andrey Grodzovsky
     [not found] ` <1507314021-18323-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2017-10-06 18:20   ` [PATCH 2/2] dmr/amdgpu: Move old fence waiting before reservation lock is aquired Andrey Grodzovsky
     [not found]     ` <1507314021-18323-2-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2017-10-09  6:21       ` Liu, Monk
2017-10-09  8:36       ` Christian König [this message]
     [not found]         ` <715810ad-26cc-506d-624d-8e5024968ea0-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-10-10 20:50           ` [PATCH v2 1/2] drm/amdgpu: Refactor amdgpu_cs_ib_vm_chunk and amdgpu_cs_ib_fill Andrey Grodzovsky
     [not found]             ` <1507668617-27299-1-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2017-10-10 20:50               ` [PATCH v2 2/2] drm/amdgpu: Move old fence waiting before reservation lock is aquired Andrey Grodzovsky
     [not found]                 ` <1507668617-27299-2-git-send-email-andrey.grodzovsky-5C7GfCeVMHo@public.gmane.org>
2017-10-11  3:28                   ` Liu, Monk
     [not found]                     ` <BLUPR12MB0449BE6E515A61B36980F88F844A0-7LeqcoF/hwpTIQvHjXdJlwdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2017-10-11  7:25                       ` Christian König
     [not found]                         ` <aaf4f94a-8099-ca6a-9c2f-8355909c7b60-5C7GfCeVMHo@public.gmane.org>
2017-10-11  7:41                           ` Chunming Zhou
     [not found]                             ` <59b614d8-a5ba-e4c4-dcf2-60984f0cd257-5C7GfCeVMHo@public.gmane.org>
2017-10-11  7:49                               ` Liu, Monk
2017-10-11  7:57                   ` Christian König
     [not found]                     ` <35727ec2-b806-0944-ed55-bda3136b760a-5C7GfCeVMHo@public.gmane.org>
2017-10-11 21:13                       ` [PATCH] drm/amdgpu: Fix extra call to amdgpu_ctx_put Andrey Grodzovsky
     [not found]                         ` <1507756382-19390-1-git-send-email-Andrey.Grodzovsky-5C7GfCeVMHo@public.gmane.org>
2017-10-12  7:17                           ` Christian König
2017-10-11  7:33               ` [PATCH v2 1/2] drm/amdgpu: Refactor amdgpu_cs_ib_vm_chunk and amdgpu_cs_ib_fill Christian König
2017-10-09  2:56   ` [PATCH 1/2] drm/amdgpu:resolv deadlock between reset and cs_ioctl v4 Chunming Zhou
2017-10-09  8:34   ` Christian König
     [not found]     ` <9fc20357-db3e-3823-3073-c70ead162f4e-5C7GfCeVMHo@public.gmane.org>
2017-10-10  3:31       ` andrey
     [not found]         ` <da1bc7eb-acce-b11b-44ba-694adf19cb59-5C7GfCeVMHo@public.gmane.org>
2017-10-10  7:05           ` 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=715810ad-26cc-506d-624d-8e5024968ea0@gmail.com \
    --to=ckoenig.leichtzumerken-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=Christian.Koenig-5C7GfCeVMHo@public.gmane.org \
    --cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=andrey.grodzovsky-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 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.