Linux Media Controller development
 help / color / mirror / Atom feed
From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Rob Clark <robdclark@gmail.com>, dri-devel@lists.freedesktop.org
Cc: linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org,
	linux-media@vger.kernel.org
Subject: Re: [PATCH] reservation: don't wait when timeout=0
Date: Tue, 21 Nov 2017 15:27:26 +0100	[thread overview]
Message-ID: <52253a44-112a-9bcb-bceb-2ea53a444265@gmail.com> (raw)
In-Reply-To: <20171121140850.23401-1-robdclark@gmail.com>

Am 21.11.2017 um 15:08 schrieb Rob Clark:
> If we are testing if a reservation object's fences have been
> signaled with timeout=0 (non-blocking), we need to pass 0 for
> timeout to dma_fence_wait_timeout().
>
> Plus bonus spelling correction.
>
> Signed-off-by: Rob Clark <robdclark@gmail.com>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/dma-buf/reservation.c | 11 +++++++++--
>   1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
> index dec3a815455d..71f51140a9ad 100644
> --- a/drivers/dma-buf/reservation.c
> +++ b/drivers/dma-buf/reservation.c
> @@ -420,7 +420,7 @@ EXPORT_SYMBOL_GPL(reservation_object_get_fences_rcu);
>    *
>    * RETURNS
>    * Returns -ERESTARTSYS if interrupted, 0 if the wait timed out, or
> - * greater than zer on success.
> + * greater than zero on success.
>    */
>   long reservation_object_wait_timeout_rcu(struct reservation_object *obj,
>   					 bool wait_all, bool intr,
> @@ -483,7 +483,14 @@ long reservation_object_wait_timeout_rcu(struct reservation_object *obj,
>   			goto retry;
>   		}
>   
> -		ret = dma_fence_wait_timeout(fence, intr, ret);
> +		/*
> +		 * Note that dma_fence_wait_timeout() will return 1 if
> +		 * the fence is already signaled, so in the wait_all
> +		 * case when we go through the retry loop again, ret
> +		 * will be greater than 0 and we don't want this to
> +		 * cause _wait_timeout() to block
> +		 */
> +		ret = dma_fence_wait_timeout(fence, intr, timeout ? ret : 0);
>   		dma_fence_put(fence);
>   		if (ret > 0 && wait_all && (i + 1 < shared_count))
>   			goto retry;

  reply	other threads:[~2017-11-21 14:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-21 14:08 [PATCH] reservation: don't wait when timeout=0 Rob Clark
2017-11-21 14:27 ` Christian König [this message]
2017-11-21 14:38 ` Chris Wilson
2017-11-21 14:59   ` Rob Clark
2017-11-21 15:49     ` Christian König
2017-11-21 15:58       ` Chris Wilson
2017-11-21 16:11         ` 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=52253a44-112a-9bcb-bceb-2ea53a444265@gmail.com \
    --to=ckoenig.leichtzumerken@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=robdclark@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox