From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
To: Jammy Zhou <Jammy.Zhou@amd.com>
Cc: alexander.deucher@amd.com, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 1/1] reservation: wait only with non-zero timeout specified (v2)
Date: Tue, 13 Jan 2015 07:50:26 +0100 [thread overview]
Message-ID: <54B4C032.5010403@canonical.com> (raw)
In-Reply-To: <1421128234-11968-1-git-send-email-Jammy.Zhou@amd.com>
Hey,
Can't you simply add if (!timeout) return !reservation_object_test_signaled_rcu(obj, wait_all); to the beginning instead?
Waiting with timeout = 0 is not really defined. Look at fence_default_wait for example. It returns timeout
if the fence is signaled, but since this is 0 you can't distinguish between timed out wait and succesful wait.
Also why do you need this? Why not simply return 0 with timeout = 0.
~Maarten
On 13-01-15 06:50, Jammy Zhou wrote:
> When the timeout value passed to reservation_object_wait_timeout_rcu
> is zero, no wait should be done if the fences are not signaled.
>
> Return '1' for idle and '0' for busy if the specified timeout is '0'
> to keep consistent with the case of non-zero timeout.
>
> v2: call fence_put if not signaled in the case of timeout==0
>
> Signed-off-by: Jammy Zhou <Jammy.Zhou@amd.com>
> Reviewed-by: Christian König <christian.koenig@amd.com>
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
> ---
> drivers/dma-buf/reservation.c | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/reservation.c b/drivers/dma-buf/reservation.c
> index 3c97c8f..b1d554f 100644
> --- a/drivers/dma-buf/reservation.c
> +++ b/drivers/dma-buf/reservation.c
> @@ -380,12 +380,19 @@ retry:
> }
>
> rcu_read_unlock();
> - if (fence) {
> + if (fence && timeout) {
> ret = fence_wait_timeout(fence, intr, ret);
> fence_put(fence);
> if (ret > 0 && wait_all && (i + 1 < shared_count))
> goto retry;
> }
> +
> + if (fence && !timeout)
> + fence_put(fence);
> +
> + if (!fence && !timeout)
> + ret = 1;
> +
> return ret;
>
> unlock_retry:
>
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-01-13 6:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-13 5:50 [PATCH 1/1] reservation: wait only with non-zero timeout specified (v2) Jammy Zhou
2015-01-13 6:50 ` Maarten Lankhorst [this message]
2015-01-13 7:59 ` Zhou, Jammy
2015-01-13 8:05 ` Maarten Lankhorst
2015-01-13 8:53 ` Zhou, Jammy
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=54B4C032.5010403@canonical.com \
--to=maarten.lankhorst@canonical.com \
--cc=Jammy.Zhou@amd.com \
--cc=alexander.deucher@amd.com \
--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 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.