[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF6AEGvanLri-+Z5KgmgSFX2ShB09T7X7wxcSQk_0JV7PKGRng@mail.gmail.com>
Date: Fri, 3 Feb 2023 10:15:56 -0800
From: Rob Clark <robdclark@...il.com>
To: dri-devel@...ts.freedesktop.org
Cc: Tvrtko Ursulin <tvrtko.ursulin@...el.com>,
Rob Clark <robdclark@...omium.org>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Tvrtko Ursulin <tvrtko.ursulin@...ux.intel.com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Matthew Auld <matthew.auld@...el.com>,
Andrzej Hajda <andrzej.hajda@...el.com>,
Niranjana Vishwanathapura <niranjana.vishwanathapura@...el.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Nirmoy Das <nirmoy.das@...el.com>,
"Jason A. Donenfeld" <Jason@...c4.com>,
Thomas Hellström
<thomas.hellstrom@...ux.intel.com>,
intel-gfx@...ts.freedesktop.org,
open list <linux-kernel@...r.kernel.org>,
jason.ekstrand@...labora.com
Subject: Re: [PATCH] drm/i915: Move fd_install after last use of fence
On Fri, Feb 3, 2023 at 8:49 AM Rob Clark <robdclark@...il.com> wrote:
>
> From: Rob Clark <robdclark@...omium.org>
>
> Because eb_composite_fence_create() drops the fence_array reference
> after creation of the sync_file, only the sync_file holds a ref to the
> fence. But fd_install() makes that reference visable to userspace, so
> it must be the last thing we do with the fence.
>
Fixes: 00dae4d3d35d ("drm/i915: Implement SINGLE_TIMELINE with a syncobj (v4)")
> Signed-off-by: Rob Clark <robdclark@...omium.org>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 14 +++++++-------
> 1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> index f266b68cf012..0f2e056c02dd 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> @@ -3476,38 +3476,38 @@ i915_gem_do_execbuffer(struct drm_device *dev,
>
> err_request:
> eb_requests_get(&eb);
> err = eb_requests_add(&eb, err);
>
> if (eb.fences)
> signal_fence_array(&eb, eb.composite_fence ?
> eb.composite_fence :
> &eb.requests[0]->fence);
>
> + if (unlikely(eb.gem_context->syncobj)) {
> + drm_syncobj_replace_fence(eb.gem_context->syncobj,
> + eb.composite_fence ?
> + eb.composite_fence :
> + &eb.requests[0]->fence);
> + }
> +
> if (out_fence) {
> if (err == 0) {
> fd_install(out_fence_fd, out_fence->file);
> args->rsvd2 &= GENMASK_ULL(31, 0); /* keep in-fence */
> args->rsvd2 |= (u64)out_fence_fd << 32;
> out_fence_fd = -1;
> } else {
> fput(out_fence->file);
> }
> }
>
> - if (unlikely(eb.gem_context->syncobj)) {
> - drm_syncobj_replace_fence(eb.gem_context->syncobj,
> - eb.composite_fence ?
> - eb.composite_fence :
> - &eb.requests[0]->fence);
> - }
> -
> if (!out_fence && eb.composite_fence)
> dma_fence_put(eb.composite_fence);
>
> eb_requests_put(&eb);
>
> err_vma:
> eb_release_vmas(&eb, true);
> WARN_ON(err == -EDEADLK);
> i915_gem_ww_ctx_fini(&eb.ww);
>
> --
> 2.38.1
>
Powered by blists - more mailing lists