All of lore.kernel.org
 help / color / mirror / Atom feed
From: Chris Wilson <chris@chris-wilson.co.uk>
To: airlied@linux.ie, dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, robdclark@gmail.com
Cc: Robert Foss <robert.foss@collabora.com>
Subject: Re: [PATCH v1] drm/msm: Move fence put to where failure occurs
Date: Thu, 01 Nov 2018 16:26:15 +0000	[thread overview]
Message-ID: <154108957570.30246.16686926988338640470@skylake-alporthouse-com> (raw)
In-Reply-To: <20181101161228.19432-1-robert.foss@collabora.com>

Quoting Robert Foss (2018-11-01 16:12:28)
> If dma_fence_wait fails to wait for a supplied in-fence in
> msm_ioctl_gem_submit, make sure we release that in-fence.
> 
> Also remove this dma_fence_put() from the 'out' label.
> 
> Signed-off-by: Robert Foss <robert.foss@collabora.com>
> ---
>  drivers/gpu/drm/msm/msm_gem_submit.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
> index a90aedd6883a..3e7704af5b24 100644
> --- a/drivers/gpu/drm/msm/msm_gem_submit.c
> +++ b/drivers/gpu/drm/msm/msm_gem_submit.c
> @@ -411,7 +411,6 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
>         struct msm_file_private *ctx = file->driver_priv;
>         struct msm_gem_submit *submit;
>         struct msm_gpu *gpu = priv->gpu;
> -       struct dma_fence *in_fence = NULL;
>         struct sync_file *sync_file = NULL;
>         struct msm_gpu_submitqueue *queue;
>         struct msm_ringbuffer *ring;
> @@ -444,7 +443,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
>         ring = gpu->rb[queue->prio];
>  
>         if (args->flags & MSM_SUBMIT_FENCE_FD_IN) {
> -               in_fence = sync_file_get_fence(args->fence_fd);
> +               struct dma_fence *in_fence = sync_file_get_fence(
> +                       args->fence_fd);
>  
>                 if (!in_fence)
>                         return -EINVAL;
> @@ -455,8 +455,10 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
>                  */
>                 if (!dma_fence_match_context(in_fence, ring->fctx->context)) {
>                         ret = dma_fence_wait(in_fence, true);
> -                       if (ret)
> +                       if (ret) {
> +                               dma_fence_put(in_fence);
>                                 return ret;
> +                       }
>                 }

Careful, we need to keep the put for the normal path. Maybe,

if (args->flags & MSM_SUBMIT_FENCE_FD_IN) {
	struct dma_fence *in_fence;

	in_fence = sync_file_get_fence(args->fence_fd); // keep line breaks natural
	if (!in_fence)
		return -EINVAL;
	
	ret = 0;
	if (!dma_fence_match_match_context(in_fence, ring->fctx->context)
		ret = dma_fence_wait(in_fence, true);
	dma_fence_put(in_fence);
	if (ret)
		return ret;
}

WARNING: multiple messages have this Message-ID (diff)
From: Chris Wilson <chris@chris-wilson.co.uk>
To: Robert Foss <robert.foss@collabora.com>,
	airlied@linux.ie, dri-devel@lists.freedesktop.org,
	freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, robdclark@gmail.com
Cc: Robert Foss <robert.foss@collabora.com>
Subject: Re: [PATCH v1] drm/msm: Move fence put to where failure occurs
Date: Thu, 01 Nov 2018 16:26:15 +0000	[thread overview]
Message-ID: <154108957570.30246.16686926988338640470@skylake-alporthouse-com> (raw)
In-Reply-To: <20181101161228.19432-1-robert.foss@collabora.com>

Quoting Robert Foss (2018-11-01 16:12:28)
> If dma_fence_wait fails to wait for a supplied in-fence in
> msm_ioctl_gem_submit, make sure we release that in-fence.
> 
> Also remove this dma_fence_put() from the 'out' label.
> 
> Signed-off-by: Robert Foss <robert.foss@collabora.com>
> ---
>  drivers/gpu/drm/msm/msm_gem_submit.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c
> index a90aedd6883a..3e7704af5b24 100644
> --- a/drivers/gpu/drm/msm/msm_gem_submit.c
> +++ b/drivers/gpu/drm/msm/msm_gem_submit.c
> @@ -411,7 +411,6 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
>         struct msm_file_private *ctx = file->driver_priv;
>         struct msm_gem_submit *submit;
>         struct msm_gpu *gpu = priv->gpu;
> -       struct dma_fence *in_fence = NULL;
>         struct sync_file *sync_file = NULL;
>         struct msm_gpu_submitqueue *queue;
>         struct msm_ringbuffer *ring;
> @@ -444,7 +443,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
>         ring = gpu->rb[queue->prio];
>  
>         if (args->flags & MSM_SUBMIT_FENCE_FD_IN) {
> -               in_fence = sync_file_get_fence(args->fence_fd);
> +               struct dma_fence *in_fence = sync_file_get_fence(
> +                       args->fence_fd);
>  
>                 if (!in_fence)
>                         return -EINVAL;
> @@ -455,8 +455,10 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
>                  */
>                 if (!dma_fence_match_context(in_fence, ring->fctx->context)) {
>                         ret = dma_fence_wait(in_fence, true);
> -                       if (ret)
> +                       if (ret) {
> +                               dma_fence_put(in_fence);
>                                 return ret;
> +                       }
>                 }

Careful, we need to keep the put for the normal path. Maybe,

if (args->flags & MSM_SUBMIT_FENCE_FD_IN) {
	struct dma_fence *in_fence;

	in_fence = sync_file_get_fence(args->fence_fd); // keep line breaks natural
	if (!in_fence)
		return -EINVAL;
	
	ret = 0;
	if (!dma_fence_match_match_context(in_fence, ring->fctx->context)
		ret = dma_fence_wait(in_fence, true);
	dma_fence_put(in_fence);
	if (ret)
		return ret;
}

  reply	other threads:[~2018-11-01 16:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-01 16:12 [PATCH v1] drm/msm: Move fence put to where failure occurs Robert Foss
2018-11-01 16:12 ` Robert Foss
2018-11-01 16:26 ` Chris Wilson [this message]
2018-11-01 16:26   ` Chris Wilson
2018-11-01 17:08   ` Robert Foss
2018-11-01 17:08     ` Robert Foss

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=154108957570.30246.16686926988338640470@skylake-alporthouse-com \
    --to=chris@chris-wilson.co.uk \
    --cc=airlied@linux.ie \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@gmail.com \
    --cc=robert.foss@collabora.com \
    /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.