Am 12.07.22 um 06:22 schrieb John Stultz:
After having to debug down through the kernel to figure out
why my _WAIT calls were always timing out, I realized its
an absolute timeout value instead of the more common relative
timeouts.
This detail should be called out in the documentation, as while
the absolute value makes sense here, its not as common for timeout
values.
Well absolute timeout values are mandatory for making -ERESTARTSYS work
without any additional handling.
So using them is recommended for ~20 years now and IIRC even documented
somewhere.
See here as well https://lwn.net/Articles/17744/ how much trouble system
calls with relative timeouts are.
Regards,
Christian.
Cc: Maarten Lankhorst <[email protected]>
Cc: Maxime Ripard <[email protected]>
Cc: Thomas Zimmermann <[email protected]>
Cc: Jason Ekstrand <[email protected]>
Cc: Christian König <[email protected]>
Cc: Lionel Landwerlin <[email protected]>
Cc: Chunming Zhou <[email protected]>
Cc: David Airlie <[email protected]>
Cc: Daniel Vetter <[email protected]>
Cc: [email protected]
Signed-off-by: John Stultz <[email protected]>
---
drivers/gpu/drm/drm_syncobj.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 7e48dcd1bee4..b84d842a1c21 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -136,6 +136,10 @@
* requirement is inherited from the wait-before-signal behavior required by
* the Vulkan timeline semaphore API.
*
+ * It should be noted, that both &DRM_IOCTL_SYNCOBJ_WAIT and
+ * &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT takes an *absolute* CLOCK_MONOTONIC
+ * nanosecond value for the timeout value. Accidentally passing relative time
+ * values will likely result in an immediate -ETIME return.
*
* Import/export of syncobjs
* -------------------------