public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/syncobj: ensure progress for syncobj queries
@ 2024-10-17 16:20 Chia-I Wu
  2024-10-22 10:30 ` Boris Brezillon
  0 siblings, 1 reply; 3+ messages in thread
From: Chia-I Wu @ 2024-10-17 16:20 UTC (permalink / raw)
  To: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Daniel Vetter, dri-devel, linux-kernel
  Cc: faith.ekstrand, boris.brezillon

Userspace might poll a syncobj with the query ioctl.  Call
dma_fence_enable_sw_signaling to ensure dma_fence_is_signaled returns
true in finite time.

---

panvk hits this issue when timeline semaphore is enabled.  It uses the
transfer ioctl to propagate fences.  dma_fence_unwrap_merge converts the
dma_fence_chain to a dma_fence_array.  dma_fence_array_signaled never
return true unless signaling is enabled.
---
 drivers/gpu/drm/drm_syncobj.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index 4fcfc0b9b386c..58c5593c897a2 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -1689,6 +1689,9 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
 			    DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
 				point = fence->seqno;
 			} else {
+				/* ensure forward progress */
+				dma_fence_enable_sw_signaling(fence);
+
 				dma_fence_chain_for_each(iter, fence) {
 					if (iter->context != fence->context) {
 						dma_fence_put(iter);
-- 
2.47.0.rc1.288.g06298d1525-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/syncobj: ensure progress for syncobj queries
  2024-10-17 16:20 [PATCH] drm/syncobj: ensure progress for syncobj queries Chia-I Wu
@ 2024-10-22 10:30 ` Boris Brezillon
  2024-10-22 16:21   ` Chia-I Wu
  0 siblings, 1 reply; 3+ messages in thread
From: Boris Brezillon @ 2024-10-22 10:30 UTC (permalink / raw)
  To: Chia-I Wu
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Daniel Vetter, dri-devel, linux-kernel, faith.ekstrand

On Thu, 17 Oct 2024 09:20:53 -0700
Chia-I Wu <olvaffe@gmail.com> wrote:

> Userspace might poll a syncobj with the query ioctl.  Call
> dma_fence_enable_sw_signaling to ensure dma_fence_is_signaled returns
> true in finite time.
> 
> ---
> 
> panvk hits this issue when timeline semaphore is enabled.  It uses the
> transfer ioctl to propagate fences.  dma_fence_unwrap_merge converts the
> dma_fence_chain to a dma_fence_array.  dma_fence_array_signaled never
> return true unless signaling is enabled.

Looks like a bugfix to me. Should we add Fixes+Cc-stable tags so it
gets backported to stable branches.

> ---
>  drivers/gpu/drm/drm_syncobj.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> index 4fcfc0b9b386c..58c5593c897a2 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
> @@ -1689,6 +1689,9 @@ int drm_syncobj_query_ioctl(struct drm_device *dev, void *data,
>  			    DRM_SYNCOBJ_QUERY_FLAGS_LAST_SUBMITTED) {
>  				point = fence->seqno;
>  			} else {
> +				/* ensure forward progress */
> +				dma_fence_enable_sw_signaling(fence);
> +
>  				dma_fence_chain_for_each(iter, fence) {
>  					if (iter->context != fence->context) {
>  						dma_fence_put(iter);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/syncobj: ensure progress for syncobj queries
  2024-10-22 10:30 ` Boris Brezillon
@ 2024-10-22 16:21   ` Chia-I Wu
  0 siblings, 0 replies; 3+ messages in thread
From: Chia-I Wu @ 2024-10-22 16:21 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Maarten Lankhorst, Maxime Ripard, Thomas Zimmermann, David Airlie,
	Daniel Vetter, dri-devel, linux-kernel, faith.ekstrand

On Tue, Oct 22, 2024 at 3:30 AM Boris Brezillon
<boris.brezillon@collabora.com> wrote:
>
> On Thu, 17 Oct 2024 09:20:53 -0700
> Chia-I Wu <olvaffe@gmail.com> wrote:
>
> > Userspace might poll a syncobj with the query ioctl.  Call
> > dma_fence_enable_sw_signaling to ensure dma_fence_is_signaled returns
> > true in finite time.
> >
> > ---
> >
> > panvk hits this issue when timeline semaphore is enabled.  It uses the
> > transfer ioctl to propagate fences.  dma_fence_unwrap_merge converts the
> > dma_fence_chain to a dma_fence_array.  dma_fence_array_signaled never
> > return true unless signaling is enabled.
>
> Looks like a bugfix to me. Should we add Fixes+Cc-stable tags so it
> gets backported to stable branches.
Thanks.  v2 sent with the Fixes tag.  I did not add Cc-stable because
I was told it was the maintainers' decision last time.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-22 16:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-17 16:20 [PATCH] drm/syncobj: ensure progress for syncobj queries Chia-I Wu
2024-10-22 10:30 ` Boris Brezillon
2024-10-22 16:21   ` Chia-I Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox