Skip to contentSkip to conversation

drm/syncobj: ensure progress for syncobj queries

PATCH Superseded Chia-I Wu 2 participants 3 messages Oct 17, 2024 – Oct 22, 2024

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Chia-I Wu

author
#0 lore raw

PATCH 1/1 drm/syncobj: ensure progress for syncobj queries

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(+)
drivers/gpu/drm/drm_syncobj.c +3 -0
index 4fcfc0b9b386c..58c5593c897a2 100644
@@ -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);
Signature · 1 line
2.47.0.rc1.288.g06298d1525-goog
#1 lore raw
Quoted 10 lines · On Thu, 17 Oct 2024 09:20:53 -0700 Chia-I Wu <[email protected]> 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.

Quoted 18 lines
---
 drivers/gpu/drm/drm_syncobj.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_syncobj.c +3 -0
index 4fcfc0b9b386c..58c5593c897a2 100644
@@ -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);
author
#2 lore raw
Quoted 10 lines · Boris Brezillon
Quoted 6 lines · On Thu, 17 Oct 2024 09:20:53 -0700 Chia-I Wu <[email protected]> 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.

---

Quoted 7 lines
Quoted 4 lines

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.