[PATCH 3/3] drm/i915: Never return 0 if request wait succeeds
Janusz Krzysztofik
janusz.krzysztofik at linux.intel.com
Wed Nov 16 11:25:32 UTC 2022
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.
Fixes: 7e2e69ed4678 ("drm/i915: Fix i915_request fence wait semantics")
Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
Cc: stable at 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))
--
2.25.1
More information about the dri-devel
mailing list