dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: DMA-resvusage@phenom.ffwll.local
Cc: daniel.vetter@ffwll.ch,
	"Christian König" <christian.koenig@amd.com>,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 08/16] drm/etnaviv: always wait for kernel fences
Date: Wed, 6 Apr 2022 14:46:58 +0200	[thread overview]
Message-ID: <Yk2LwlWJkSebt21o@phenom.ffwll.local> (raw)
In-Reply-To: <20220406075132.3263-9-christian.koenig@amd.com>

On Wed, Apr 06, 2022 at 09:51:24AM +0200, Christian König wrote:
> Even for explicit synchronization we should wait for kernel fences.

Yeah I don't think this patch makes much sense, because aside from etnaviv
there's also msm and lima which allow you to ignore all dma_resv fences
completely.

But it's also not an issue because these drivers don't move buffers, don't
have any other kernel fences and also don't do dynamic importing. I think
the real fix is replacing the write argument to
drm_sched_job_add_implicit_dependencies with dma_resv_usage and rolling
that out.

I'd just drop this for now, seems like a detour.
-Daniel

> 
> Signed-off-by: Christian König <christian.koenig@amd.com>
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c | 27 ++++++++++++++++++--
>  1 file changed, 25 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> index 98bb5c9239de..3fedd29732d5 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gem_submit.c
> @@ -171,6 +171,26 @@ static int submit_lock_objects(struct etnaviv_gem_submit *submit,
>  	return ret;
>  }
>  
> +/* TODO: This should be moved into the GPU scheduler if others need it */
> +static int submit_fence_kernel_sync(struct etnaviv_gem_submit *submit,
> +				    struct dma_resv *resv)
> +{
> +	struct dma_resv_iter cursor;
> +	struct dma_fence *fence;
> +	int ret;
> +
> +	dma_resv_for_each_fence(&cursor, resv, DMA_RESV_USAGE_KERNEL, fence) {
> +		/* Make sure to grab an additional ref on the added fence */
> +		dma_fence_get(fence);
> +		ret = drm_sched_job_add_dependency(&submit->sched_job, fence);
> +		if (ret) {
> +			dma_fence_put(fence);
> +			return ret;
> +		}
> +	}
> +	return 0;
> +}
> +
>  static int submit_fence_sync(struct etnaviv_gem_submit *submit)
>  {
>  	int i, ret = 0;
> @@ -183,8 +203,11 @@ static int submit_fence_sync(struct etnaviv_gem_submit *submit)
>  		if (ret)
>  			return ret;
>  
> -		if (submit->flags & ETNA_SUBMIT_NO_IMPLICIT)
> -			continue;
> +		if (submit->flags & ETNA_SUBMIT_NO_IMPLICIT) {
> +			ret = submit_fence_kernel_sync(submit, robj);
> +			if (ret)
> +				return ret;
> +		}
>  
>  		ret = drm_sched_job_add_implicit_dependencies(&submit->sched_job,
>  							      &bo->obj->base,
> -- 
> 2.25.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2022-04-06 12:47 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-06  7:51 Christian König
2022-04-06  7:51 ` [PATCH 01/16] dma-buf/drivers: make reserving a shared slot mandatory v4 Christian König
2022-04-06 12:21   ` Daniel Vetter
2022-04-06  7:51 ` [PATCH 02/16] dma-buf: add enum dma_resv_usage v4 Christian König
2022-04-06  7:51 ` [PATCH 03/16] dma-buf: specify usage while adding fences to dma_resv obj v6 Christian König
2022-04-06 12:32   ` Daniel Vetter
2022-04-06 12:35     ` Daniel Vetter
2022-04-07  8:01       ` Christian König
2022-04-07  9:26         ` Daniel Vetter
2022-04-06  7:51 ` [PATCH 04/16] dma-buf & drm/amdgpu: remove dma_resv workaround Christian König
2022-04-06 12:39   ` Daniel Vetter
2022-04-06  7:51 ` [PATCH 05/16] dma-buf: add DMA_RESV_USAGE_KERNEL v3 Christian König
2022-04-06 12:41   ` Daniel Vetter
2022-04-06  7:51 ` [PATCH 06/16] drm/amdgpu: use DMA_RESV_USAGE_KERNEL Christian König
2022-04-06 12:42   ` Daniel Vetter
2022-04-06 14:54     ` Christian König
2022-04-06  7:51 ` [PATCH 07/16] drm/radeon: " Christian König
2022-04-06 12:43   ` Daniel Vetter
2022-04-06  7:51 ` [PATCH 08/16] drm/etnaviv: always wait for kernel fences Christian König
2022-04-06 12:46   ` Daniel Vetter [this message]
2022-04-06  7:51 ` [PATCH 09/16] drm/nouveau: only wait for kernel fences in nouveau_bo_vm_cleanup Christian König
2022-04-06 12:47   ` Daniel Vetter
2022-04-06  7:51 ` [PATCH 10/16] RDMA: use DMA_RESV_USAGE_KERNEL Christian König
2022-04-06 12:48   ` Daniel Vetter
2022-04-06  7:51 ` [PATCH 11/16] dma-buf: add DMA_RESV_USAGE_BOOKKEEP v3 Christian König
2022-04-06  7:51 ` [PATCH 12/16] drm/amdgpu: use DMA_RESV_USAGE_BOOKKEEP Christian König
2022-04-06  7:51 ` [PATCH 13/16] dma-buf: wait for map to complete for static attachments Christian König
2022-04-06  7:51 ` [PATCH 14/16] drm/i915: drop bo->moving dependency Christian König
2022-04-06 13:24   ` Matthew Auld
2022-04-06  7:51 ` [PATCH 15/16] drm/ttm: remove bo->moving Christian König
2022-04-06 12:52   ` Daniel Vetter
2022-04-06  7:51 ` [PATCH 16/16] dma-buf: drop seq count based update Christian König
2022-04-06 13:00   ` Daniel Vetter
2022-04-06 12:59 ` Daniel Vetter

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=Yk2LwlWJkSebt21o@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=DMA-resvusage@phenom.ffwll.local \
    --cc=christian.koenig@amd.com \
    --cc=daniel.vetter@ffwll.ch \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox