drm/syncobj: return meaningful value to user space
Subsystems (2)
PATCH 1/1 drm/syncobj: return meaningful value to user space
if WAIT_FOR_SUBMIT isn't set and in the meanwhile no underlying fence on syncobj, then return non-block error code to user sapce.
--- drivers/gpu/drm/drm_syncobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_syncobj.c +2 -2
@@ -252,7 +252,7 @@ int drm_syncobj_find_fence(struct drm_file *file_private,return 0 ;dma_fence_put (*fence); }else { - ret = -EINVAL ; + ret = -ENOTBLK ; }if (!(flags &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT ))
@@ -832,7 +832,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,if (flags &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT ) {continue ; }else { - timeout = -EINVAL ; + timeout = -ENOTBLK ; goto cleanup_entries; } }
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoting Chunming Zhou (2019-07-18 12:13:39)
Quoted 2 lines
if
WAIT_FOR_SUBMITisn't set and in the meanwhile no underlying fence on syncobj, then return non-block error code to user sapce.
Block device required?
I presume you tried the EWOULDBLOCK which would be implied by your sentence and found that would be an interesting experience. -Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines · Chris Wilson
Quoting Chunming Zhou (2019-07-18 12:13:39)
Quoted 2 lines
if
WAIT_FOR_SUBMITisn't set and in the meanwhile no underlying fence on syncobj, then return non-block error code to user sapce.Block device required?
Yes, if WAIT_FOR_SUBMIT is set, then that will block device.
-David
Quoted 4 lines
I presume you tried the EWOULDBLOCK which would be implied by your sentence and found that would be an interesting experience. -Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoting Chunming Zhou (2019-07-18 14:04:09)
Quoted 8 lines · Chris Wilson
Quoted 4 lines
Quoting Chunming Zhou (2019-07-18 12:13:39)
Quoted 2 lines
if
WAIT_FOR_SUBMITisn't set and in the meanwhile no underlying fence on syncobj, then return non-block error code to user sapce.Block device required?
Yes, if
WAIT_FOR_SUBMITis set, then that will block device.
No, the error message is that it requires a "block device", not that it will block the device, which is EWOULDBLOCK.
-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Chris Wilson
Quoting Chunming Zhou (2019-07-18 14:04:09)
Quoted 6 lines · Chris Wilson
Quoted 4 lines
Quoting Chunming Zhou (2019-07-18 12:13:39)
Quoted 2 lines
if
WAIT_FOR_SUBMITisn't set and in the meanwhile no underlying fence on syncobj, then return non-block error code to user sapce.Block device required?
Yes, if
WAIT_FOR_SUBMITis set, then that will block device.No, the error message is that it requires a "block device", not that it will block the device, which is EWOULDBLOCK.
OK, I got your mean.
Any other possile value suggestted?
-David
Quoted 1 line
-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoting Chunming Zhou (2019-07-18 14:15:49)
Quoted 7 lines · Chris Wilson
Quoted 5 lines
Quoting Chunming Zhou (2019-07-18 14:04:09)
Quoted 4 lines · Chris Wilson
Quoted 3 lines
Quoting Chunming Zhou (2019-07-18 12:13:39)
Quoted 2 lines
if
WAIT_FOR_SUBMITisn't set and in the meanwhile no underlying fence on syncobj, then return non-block error code to user sapce.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line
Block device required?
Yes, if
WAIT_FOR_SUBMITis set, then that will block device.No, the error message is that it requires a "block device", not that it will block the device, which is EWOULDBLOCK.
OK, I got your mean.
Any other possile value suggestted?
ENXIO -- for the non-existent "address" along the timeline. EOPNOTSUPP -- also makes sense, but we've started to use that for interface not supported, so would be a bit inconsistent across drm.
Or ENOTBLK, being very clear in the commit message how it doesn't reflect the original meaning (as would be given by strerror()) and why the seemingly more natural EWOULDBLOCK doesn't work for drm in this case, and what use case that needs to distinguish this particular case (i.e. why EINVAL isn't good enough).
-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 10 lines · David(ChunMing)
Quoted 9 lines · Chris Wilson
Quoting Chunming Zhou (2019-07-18 14:04:09)
Quoted 6 lines · Chris Wilson
Quoted 4 lines
Quoting Chunming Zhou (2019-07-18 12:13:39)
Quoted 2 lines
if
WAIT_FOR_SUBMITisn't set and in the meanwhile no underlying fence on syncobj, then return non-block error code to user sapce.Block device required?
Yes, if
WAIT_FOR_SUBMITis set, then that will block device.No, the error message is that it requires a "block device", not that it will block the device, which is EWOULDBLOCK.
Ah, I think I don't want EWOULDBLOCK, which will try again and again ioctl, that is not my movitation.
I just need a meaningful value to identify the underlying fence isn't ready on syncobj.
Because it is in 'else' case, ENOTBLK is correct to say here need block but WAIT_FOR_SUBMIT isn't set.
-David
Quoted 7 lines
OK, I got your mean.
Any other possile value suggestted?
-David
Quoted 1 line
-Chris
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 22 lines · Chunming Zhou
if
WAIT_FOR_SUBMITisn't set and in the meanwhile no underlying fence on syncobj, then return non-block error code to user sapce.Signed-off-by Chunming Zhou <[email protected]>--- drivers/gpu/drm/drm_syncobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_syncobj.c +1
-1@@ -252,7 +252,7 @@ int drm_syncobj_find_fence(struct drm_file *file_private,return 0 ;dma_fence_put (*fence); }else { - ret = -EINVAL ; + ret = -ENOTBLK ; }if (!(flags &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT ))
drivers/gpu/drm/drm_syncobj.c static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, · line 838
Quoted 8 lines
drivers/gpu/drm/drm_syncobj.c +1
-1@@ -832,7 +832,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,if (flags &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT ) {continue ; }else { - timeout = -EINVAL ; + timeout = -ENOTBLK ; goto cleanup_entries; } }
This would break existing tests for binary syncobjs.
Is this really what we want?
-Lionel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 29 lines · Lionel Landwerlin
Quoted 28 lines · Chunming Zhou
if
WAIT_FOR_SUBMITisn't set and in the meanwhile no underlying fence on syncobj,
then return non-block error code to user sapce.Signed-off-by Chunming Zhou <[email protected]>---
drivers/gpu/drm/drm_syncobj.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_syncobj.c +1
-1@@ -252,7 +252,7 @@ int drm_syncobj_find_fence(struct drm_file *file_private, return 0; dma_fence_put(*fence); } else { - ret = -EINVAL; + ret = -ENOTBLK; } if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))@@ -832,7 +832,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { continue; } else {
Quoted 8 lines
Quoted 5 lines
drivers/gpu/drm/drm_syncobj.c +1
-1- timeout = -EINVAL; + timeout = -ENOTBLK; goto cleanup_entries; }}
This would break existing tests for binary syncobjs.
How does this breaks binary syncobj?
Quoted 2 lines
Is this really what we want?
I want to use this meaningful return value to judge if WaitBeforeSignal happens.
I think this is the cheapest change for that.
-David
Quoted 5 lines
-Lionel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 37 lines · Chunming Zhou
Quoted 28 lines · Lionel Landwerlin
Quoted 27 lines · Chunming Zhou
if
WAIT_FOR_SUBMITisn't set and in the meanwhile no underlying fence on syncobj,
then return non-block error code to user sapce.Signed-off-by Chunming Zhou <[email protected]>--- drivers/gpu/drm/drm_syncobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_syncobj.c +1
-1@@ -252,7 +252,7 @@ int drm_syncobj_find_fence(struct drm_file *file_private, return 0; dma_fence_put(*fence); } else { - ret = -EINVAL; + ret = -ENOTBLK; } if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))@@ -832,7 +832,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { continue;Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/drm_syncobj.c +1
-1} else { - timeout = -EINVAL; + timeout = -ENOTBLK; goto cleanup_entries; }}
This would break existing tests for binary syncobjs.
Quoted 1 line
How does this breaks binary syncobj?
This is used in the submission path of several drivers.
Changing the error code will change what the drivers are reporting to userspace and could break tests.
i915 doesn't use that function so it's not affected but lima/panfrost/vc4 seem to be.
Quoted 7 lines
Quoted 3 lines
Is this really what we want?
I want to use this meaningful return value to judge if WaitBeforeSignal happens.
I think this is the cheapest change for that.
I thought the plan was to add a new ioctl to query the last submitted value.
Did I misunderstand?
Thanks,
-Lionel
Quoted 8 lines
-David
Quoted 4 lines
-Lionel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 41 lines · Lionel Landwerlin
Quoted 37 lines · Chunming Zhou
Quoted 28 lines · Lionel Landwerlin
Quoted 27 lines · Chunming Zhou
if
WAIT_FOR_SUBMITisn't set and in the meanwhile no underlying fence on syncobj,
then return non-block error code to user sapce.Signed-off-by Chunming Zhou <[email protected]>---
drivers/gpu/drm/drm_syncobj.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_syncobj.c +1
-1@@ -252,7 +252,7 @@ int drm_syncobj_find_fence(struct drm_file *file_private, return 0; dma_fence_put(*fence); } else { - ret = -EINVAL; + ret = -ENOTBLK; } if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))@@ -832,7 +832,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { continue;Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/drm_syncobj.c +1
-1} else { - timeout = -EINVAL; + timeout = -ENOTBLK; goto cleanup_entries; }}
This would break existing tests for binary syncobjs.
Quoted 1 line
How does this breaks binary syncobj?
Quoted 8 lines
This is used in the submission path of several drivers.
Changing the error code will change what the drivers are reporting to userspace and could break tests.
i915 doesn't use that function so it's not affected but lima/panfrost/vc4 seem to be.
anyone from vc4 can confirm this? There are many place in wait_ioctl being able to return previous EINVAL, not sure what they use to.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Is this really what we want?
Quoted 8 lines
Quoted 4 lines
I want to use this meaningful return value to judge if WaitBeforeSignal happens.
I think this is the cheapest change for that.
I thought the plan was to add a new ioctl to query the last submitted value.
Yes, that is optional way too. I just thought changing return value is very cheap, isn't it?
-David
Quoted 19 lines
Did I misunderstand?
Thanks,
-Lionel
Quoted 8 lines
-David
Quoted 4 lines
-Lionel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 61 lines · Chunming Zhou
Quoted 39 lines · Lionel Landwerlin
Quoted 36 lines · Chunming Zhou
Quoted 27 lines · Lionel Landwerlin
Quoted 26 lines · Chunming Zhou
if
WAIT_FOR_SUBMITisn't set and in the meanwhile no underlying fence on syncobj,
then return non-block error code to user sapce.Signed-off-by Chunming Zhou <[email protected]>--- drivers/gpu/drm/drm_syncobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_syncobj.c +1
-1@@ -252,7 +252,7 @@ int drm_syncobj_find_fence(struct drm_file *file_private, return 0; dma_fence_put(*fence); } else { - ret = -EINVAL; + ret = -ENOTBLK; } if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))@@ -832,7 +832,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) {Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/drm_syncobj.c +1
-1continue; } else { - timeout = -EINVAL; + timeout = -ENOTBLK; goto cleanup_entries; }}
This would break existing tests for binary syncobjs.
Quoted 1 line
How does this breaks binary syncobj?
Quoted 8 lines
This is used in the submission path of several drivers.
Changing the error code will change what the drivers are reporting to userspace and could break tests.
i915 doesn't use that function so it's not affected but lima/panfrost/vc4 seem to be.
anyone from vc4 can confirm this? There are many place in
wait_ioctlbeing able to return previous EINVAL, not sure what they use to.Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Is this really what we want?
I want to use this meaningful return value to judge if WaitBeforeSignal happens.
I think this is the cheapest change for that.
Quoted 7 lines
Quoted 2 lines
I thought the plan was to add a new ioctl to query the last submitted value.
Yes, that is optional way too. I just thought changing return value is very cheap, isn't it?
-David
I could be misguided but I thought the kernel policy was to never break userspace.
I'm not sure where this sits :/
-Lionel
Quoted 10 lines
Quoted 10 lines
Did I misunderstand?
Thanks,
-Lionel
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
-David
Quoted 3 lines
-Lionel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 64 lines · Lionel Landwerlin
Quoted 63 lines · Chunming Zhou
Quoted 39 lines · Lionel Landwerlin
Quoted 36 lines · Chunming Zhou
Quoted 27 lines · Lionel Landwerlin
Quoted 26 lines · Chunming Zhou
if
WAIT_FOR_SUBMITisn't set and in the meanwhile no underlying fence on syncobj,
then return non-block error code to user sapce.Signed-off-by Chunming Zhou <[email protected]>---
drivers/gpu/drm/drm_syncobj.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_syncobj.c +1
-1@@ -252,7 +252,7 @@ int drm_syncobj_find_fence(struct drm_file *file_private, return 0; dma_fence_put(*fence); } else { - ret = -EINVAL; + ret = -ENOTBLK; } if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))@@ -832,7 +832,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) {Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/drm_syncobj.c +1
-1continue; } else { - timeout = -EINVAL; + timeout = -ENOTBLK; goto cleanup_entries; }}
This would break existing tests for binary syncobjs.
Quoted 1 line
How does this breaks binary syncobj?
Quoted 8 lines
This is used in the submission path of several drivers.
Changing the error code will change what the drivers are reporting to userspace and could break tests.
i915 doesn't use that function so it's not affected but lima/panfrost/vc4 seem to be.
anyone from vc4 can confirm this? There are many place in
wait_ioctlbeing able to return previous EINVAL, not sure what they use to.Quoted 10 lines
Quoted 7 lines
Quoted 3 lines
Is this really what we want?
I want to use this meaningful return value to judge if WaitBeforeSignal happens.
I think this is the cheapest change for that.
I thought the plan was to add a new ioctl to query the last submitted value.
Quoted 8 lines
Quoted 5 lines
Yes, that is optional way too. I just thought changing return value is very cheap, isn't it?
-David
I could be misguided but I thought the kernel policy was to never break userspace.
But no one exactly points how to break userspace, doesn't it?
-David
Quoted 24 lines
I'm not sure where this sits :/
-Lionel
Quoted 16 lines
Quoted 16 lines
Did I misunderstand?
Thanks,
-Lionel
Quoted 6 lines
-David
Quoted 3 lines
-Lionel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 13 lines · Chunming Zhou
if
WAIT_FOR_SUBMITisn't set and in the meanwhile no underlying fence on syncobj, then return non-block error code to user sapce.Signed-off-by Chunming Zhou <[email protected]>--- drivers/gpu/drm/drm_syncobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/gpu/drm/drm_syncobj.c +0
-0
drivers/gpu/drm/drm_syncobj.c int drm_syncobj_find_fence(struct drm_file *file_private, · line 255
Quoted 5 lines
drivers/gpu/drm/drm_syncobj.c +1
-1@@ -252,7 +252,7 @@ int drm_syncobj_find_fence(struct drm_file *file_private,return 0 ;dma_fence_put (*fence); }else { - ret = -EINVAL ; + ret = -ENOTBLK ;
This will only return the new error when there is no chain fence in the syncobj?
Don't you want the new error code after dma_fence_chain_find_seqno() too?
Which make me realize there is probably a bug with this code :
ret = dma_fence_chain_find_seqno(fence, point);
if (!ret)
return 0;dma_fence_put(*fence);
Sounds like the condition should be
if (ret)
return ret;
I realize we have introduced a blocking behavior on the transfer ioctl.
If we're going to change this to return EWOULDBLOCK, we might want to get rid of it.
-Lionel
drivers/gpu/drm/drm_syncobj.c static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, · line 838
Quoted 12 lines
drivers/gpu/drm/drm_syncobj.c +1
-1}if (!(flags &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT ))@@ -832,7 +832,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs,if (flags &DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT ) {continue ; }else { - timeout = -EINVAL ; + timeout = -ENOTBLK ; goto cleanup_entries; } }
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 9 lines · Lionel Landwerlin
Quoted 8 lines · Chunming Zhou
if
WAIT_FOR_SUBMITisn't set and in the meanwhile no underlying fence on syncobj, then return non-block error code to user sapce.Signed-off-by Chunming Zhou <[email protected]>---
drivers/gpu/drm/drm_syncobj.c| 4 ++--1 file changed, 2 insertions(+), 2 deletions(-)
Quoted 14 lines
drivers/gpu/drm/drm_syncobj.c int drm_syncobj_find_fence(struct drm_file · line 256
Quoted 11 lines
drivers/gpu/drm/drm_syncobj.c +1
-1@@ -252,7 +252,7 @@ int drm_syncobj_find_fence(struct drm_file *file_private, return 0; dma_fence_put(*fence); } else { - ret = -EINVAL; + ret = -ENOTBLK;This will only return the new error when there is no chain fence in the syncobj?
If all of you agree, that's best.
I've checked orginal EINVAL,there are 3 situations which would return EINVAL:
a. invalid flags
b. count_handles
c. failed to find fence in syncobj.
If user can make sure sanitization for paramters, then EINVAL can be used to identify "lack of fence in syncobj", which is waitBeforeSignal. I use it in my current implementation.
Quoted 2 lines
Don't you want the new error code after
dma_fence_chain_find_seqno()too?
No, I don't want to that, I just want to a meaningful and unique error code for umd.
Quoted 13 lines
Which make me realize there is probably a bug with this code :
ret =
dma_fence_chain_find_seqno(fence, point);
if (!ret)
return 0;dma_fence_put(*fence);Sounds like the condition should be
Quoted 8 lines
if (ret)
return ret;
I realize we have introduced a blocking behavior on the transfer ioctl.
If we're going to change this to return EWOULDBLOCK, we might want to get rid of it.
Sounds right, but I think current implementation is acceptable as well.
-David
Quoted 5 lines
-Lionel
Quoted 14 lines
Quoted 11 lines
drivers/gpu/drm/drm_syncobj.c +1
-1} if (!(flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))@@ -832,7 +832,7 @@ static signed long drm_syncobj_array_wait_timeout(struct drm_syncobj **syncobjs, if (flags & DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT) { continue; } else { - timeout = -EINVAL; + timeout = -ENOTBLK; goto cleanup_entries; }Quoted 1 line
}
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel