From: "Christian König" <ckoenig.leichtzumerken@gmail.com>
To: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
dri-devel@lists.freedesktop.org
Cc: intel-gfx@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org,
"Christian König" <christian.koenig@amd.com>,
linux-media@vger.kernel.org
Subject: Re: [Intel-gfx] [Linaro-mm-sig] [PATCH 1/2] dma-buf: Fix dma_resv_wait_timeout handling of timeout = 0.
Date: Mon, 18 Oct 2021 13:20:58 +0200 [thread overview]
Message-ID: <ff661be5-3a7a-3868-a67f-c3c80d91f385@gmail.com> (raw)
In-Reply-To: <20211015115720.79958-2-maarten.lankhorst@linux.intel.com>
Am 15.10.21 um 13:57 schrieb Maarten Lankhorst:
> Commit ada5c48b11a3 ("dma-buf: use new iterator in dma_resv_wait_timeout")
> accidentally started mishandling timeout = 0, by forcing a blocking wait
> with timeout = 1 passed to fences. This is not intended, as timeout = 0
> may be used for peeking, similar to test_signaled.
>
> Fixes: ada5c48b11a3 ("dma-buf: use new iterator in dma_resv_wait_timeout")
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Sorry for the delay, back from sick leave just today.
Good catch, but when I read the old code correctly that was also broken
before by passing in 1 to dma_fence_wait_timeout() for a timeout of 0.
> ---
> drivers/dma-buf/dma-resv.c | 12 ++++++------
> 1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/dma-buf/dma-resv.c b/drivers/dma-buf/dma-resv.c
> index 9eb2baa387d4..70a8082660c5 100644
> --- a/drivers/dma-buf/dma-resv.c
> +++ b/drivers/dma-buf/dma-resv.c
> @@ -617,18 +617,18 @@ EXPORT_SYMBOL_GPL(dma_resv_get_fences);
> long dma_resv_wait_timeout(struct dma_resv *obj, bool wait_all, bool intr,
> unsigned long timeout)
> {
> - long ret = timeout ? timeout : 1;
> + long ret = timeout ?: 1;
Please don't change the coding style here.
Apart from that looks good to me.
Christian.
> struct dma_resv_iter cursor;
> struct dma_fence *fence;
>
> dma_resv_iter_begin(&cursor, obj, wait_all);
> dma_resv_for_each_fence_unlocked(&cursor, fence) {
> + ret = dma_fence_wait_timeout(fence, intr, timeout);
> + if (ret <= 0)
> + break;
>
> - ret = dma_fence_wait_timeout(fence, intr, ret);
> - if (ret <= 0) {
> - dma_resv_iter_end(&cursor);
> - return ret;
> - }
> + if (timeout)
> + timeout = ret;
> }
> dma_resv_iter_end(&cursor);
>
next prev parent reply other threads:[~2021-10-18 12:19 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-15 11:57 [Intel-gfx] [PATCH 0/2] dma-buf: Fix breakages from dma_resv_iter conversion Maarten Lankhorst
2021-10-15 11:57 ` [Intel-gfx] [PATCH 1/2] dma-buf: Fix dma_resv_wait_timeout handling of timeout = 0 Maarten Lankhorst
2021-10-18 11:20 ` Christian König [this message]
2021-10-15 11:57 ` [Intel-gfx] [PATCH 2/2] dma-buf: Fix dma_resv_test_signaled Maarten Lankhorst
2021-10-15 12:07 ` Christian König
2021-10-15 12:52 ` Maarten Lankhorst
2021-10-15 12:56 ` [Intel-gfx] [Linaro-mm-sig] " Christian König
2021-10-21 12:08 ` Daniel Vetter
2021-10-15 12:38 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for dma-buf: Fix breakages from dma_resv_iter conversion Patchwork
2021-10-15 13:08 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2021-10-15 19:58 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
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=ff661be5-3a7a-3868-a67f-c3c80d91f385@gmail.com \
--to=ckoenig.leichtzumerken@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-media@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.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