Commit 6ca87397aeeb ("drm/syncobj: Limit the number of handles and use
kvmalloc for user-sized arrays") rejects more than 1M (1 << 20) handles
with -EINVAL in all syncobj ioctls that take an array of handles: wait,
timeline_wait, reset, signal, query and timeline_signal.

Document the limit next to count_handles in the four uAPI structs those
ioctls use, so that userspace knows about it. The define itself stays
kernel internal.

Suggested-by: Christian König <[email protected]>
Signed-off-by: Fei Yu <[email protected]>
---
This documents the limit added by the fix below, which is in mainline
since v7.4-rc4 (6ca87397aeeb) but not yet in drm-misc-next. The patch
only touches comments, so it applies and builds on drm-misc-next as is:
https://lore.kernel.org/all/[email protected]/

As discussed in the v2 thread, the define stays kernel internal and the
limit is only documented here:
https://lore.kernel.org/all/[email protected]/

 include/uapi/drm/drm.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/uapi/drm/drm.h b/include/uapi/drm/drm.h
index bc7ef7684099..59b6e2558d82 100644
--- a/include/uapi/drm/drm.h
+++ b/include/uapi/drm/drm.h
@@ -963,6 +963,7 @@ struct drm_syncobj_wait {
        __u64 handles;
        /* absolute timeout */
        __s64 timeout_nsec;
+       /* at most 1M (1 << 20) handles, more return -EINVAL */
        __u32 count_handles;
        __u32 flags;
        __u32 first_signaled; /* only valid when not waiting all */
@@ -983,6 +984,7 @@ struct drm_syncobj_timeline_wait {
        __u64 points;
        /* absolute timeout */
        __s64 timeout_nsec;
+       /* at most 1M (1 << 20) handles, more return -EINVAL */
        __u32 count_handles;
        __u32 flags;
        __u32 first_signaled; /* only valid when not waiting all */
@@ -1021,6 +1023,7 @@ struct drm_syncobj_eventfd {
 
 struct drm_syncobj_array {
        __u64 handles;
+       /* at most 1M (1 << 20) handles, more return -EINVAL */
        __u32 count_handles;
        __u32 pad;
 };
@@ -1029,6 +1032,7 @@ struct drm_syncobj_array {
 struct drm_syncobj_timeline_array {
        __u64 handles;
        __u64 points;
+       /* at most 1M (1 << 20) handles, more return -EINVAL */
        __u32 count_handles;
        __u32 flags;
 };

base-commit: 2f50e0a0f9d319678a67715d4160ee890f5ee6f6
-- 
2.53.0

Reply via email to