From: Andrzej Hajda <andrzej.hajda@intel.com>
To: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>,
Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Daniel Vetter <daniel@ffwll.ch>,
intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
Chris Wilson <chris.p.wilson@intel.com>
Subject: Re: [Intel-gfx] [PATCH 3/3] drm/i915: Never return 0 if request wait succeeds
Date: Wed, 16 Nov 2022 15:42:46 +0100 [thread overview]
Message-ID: <cd0c8e1e-743c-f3d7-5e2e-91f7a8144c7d@intel.com> (raw)
In-Reply-To: <20221116112532.36253-4-janusz.krzysztofik@linux.intel.com>
On 16.11.2022 12:25, Janusz Krzysztofik wrote:
> According to the docs of i915_request_wait_timeout(), its return value
> "may be zero if the request is unfinished after the timeout expires."
> However, 0 is also returned when the request is found finished right
> after the timeout has expired.
>
> Since the docs also state: "If the timeout is 0, it will return 1 if the
> fence is signaled.", return 1 also when the fence is found signaled after
> non-zero timeout has expired.
As I understand the patch "drm/i915: Fix i915_request fence wait
semantics", and the docs "timeout is 0" means the initial value of
timeout argument and this is handled already on the beginning of the
function.
In case initial timeout is greater than zero and then it expires,
function should return 0 regardless of fence state. This is what I have
understood from reading docs and implementation of
dma_fence_default_wait [1], which should be the best source of info
about "dma_fence wait semantic".
As I said already, mixing remaining time and bool in return value of
dma_fence_wait* functions is very confusing, but changing it would
require major rework of the framework.
[1]:
https://elixir.bootlin.com/linux/latest/source/drivers/dma-buf/dma-fence.c#L753
Regards
Andrzej
>
> Fixes: 7e2e69ed4678 ("drm/i915: Fix i915_request fence wait semantics")
> Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>
> Cc: stable@vger.kernel.org # v5.17
> ---
> drivers/gpu/drm/i915/i915_request.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/i915_request.c b/drivers/gpu/drm/i915/i915_request.c
> index f949a9495758a..406ddfafbed4d 100644
> --- a/drivers/gpu/drm/i915/i915_request.c
> +++ b/drivers/gpu/drm/i915/i915_request.c
> @@ -2079,6 +2079,8 @@ long i915_request_wait_timeout(struct i915_request *rq,
>
> timeout = io_schedule_timeout(timeout);
> }
> + if (!timeout) /* expired but signaled, we shouldn't return 0 */
> + timeout = 1;
> __set_current_state(TASK_RUNNING);
>
> if (READ_ONCE(wait.tsk))
next prev parent reply other threads:[~2022-11-16 14:42 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-16 11:25 [Intel-gfx] [PATCH 0/3] drm/i915: Fix timeout handling when retiring requests Janusz Krzysztofik
2022-11-16 11:25 ` [Intel-gfx] [PATCH 1/3] drm/i915: Fix negative remaining time after retire requests Janusz Krzysztofik
2022-11-16 13:13 ` Andrzej Hajda
2022-11-17 9:58 ` Das, Nirmoy
2022-11-16 11:25 ` [Intel-gfx] [PATCH 2/3] drm/i915: Never return 0 on timeout when retiring requests Janusz Krzysztofik
2022-11-16 14:15 ` Andrzej Hajda
2022-11-17 9:53 ` Das, Nirmoy
2022-11-16 11:25 ` [Intel-gfx] [PATCH 3/3] drm/i915: Never return 0 if request wait succeeds Janusz Krzysztofik
2022-11-16 14:42 ` Andrzej Hajda [this message]
2022-11-16 15:48 ` Janusz Krzysztofik
2022-11-16 19:06 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915: Fix timeout handling when retiring requests Patchwork
2022-11-17 3:27 ` [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=cd0c8e1e-743c-f3d7-5e2e-91f7a8144c7d@intel.com \
--to=andrzej.hajda@intel.com \
--cc=chris.p.wilson@intel.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=janusz.krzysztofik@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=tvrtko.ursulin@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