Patch "drm/syncobj: handle NULL fence in syncobj_eventfd_entry_func" has been added to the 6.6-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/syncobj: handle NULL fence in syncobj_eventfd_entry_func

to the 6.6-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-syncobj-handle-null-fence-in-syncobj_eventfd_ent.patch
and it can be found in the queue-6.6 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 56d5942496147f0416e70accc1616524a44a1ced
Author: Erik Kurzinger <ekurzinger@xxxxxxxxxx>
Date:   Wed Feb 21 10:44:28 2024 -0800

    drm/syncobj: handle NULL fence in syncobj_eventfd_entry_func
    
    [ Upstream commit 2aa6f5b0fd052e363bb9d4b547189f0bf6b3d6d3 ]
    
    During syncobj_eventfd_entry_func, dma_fence_chain_find_seqno may set
    the fence to NULL if the given seqno is signaled and a later seqno has
    already been submitted. In that case, the eventfd should be signaled
    immediately which currently does not happen.
    
    This is a similar issue to the one addressed by commit b19926d4f3a6
    ("drm/syncobj: Deal with signalled fences in drm_syncobj_find_fence.").
    
    As a fix, if the return value of dma_fence_chain_find_seqno indicates
    success but it sets the fence to NULL, we will assign a stub fence to
    ensure the following code still signals the eventfd.
    
    v1 -> v2: assign a stub fence instead of signaling the eventfd
    
    Signed-off-by: Erik Kurzinger <ekurzinger@xxxxxxxxxx>
    Fixes: c7a472297169 ("drm/syncobj: add IOCTL to register an eventfd")
    Signed-off-by: Simon Ser <contact@xxxxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240221184527.37667-1-ekurzinger@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
index b3433265be6ab..5860428da8de8 100644
--- a/drivers/gpu/drm/drm_syncobj.c
+++ b/drivers/gpu/drm/drm_syncobj.c
@@ -1380,10 +1380,21 @@ syncobj_eventfd_entry_func(struct drm_syncobj *syncobj,
 
 	/* This happens inside the syncobj lock */
 	fence = dma_fence_get(rcu_dereference_protected(syncobj->fence, 1));
+	if (!fence)
+		return;
+
 	ret = dma_fence_chain_find_seqno(&fence, entry->point);
-	if (ret != 0 || !fence) {
+	if (ret != 0) {
+		/* The given seqno has not been submitted yet. */
 		dma_fence_put(fence);
 		return;
+	} else if (!fence) {
+		/* If dma_fence_chain_find_seqno returns 0 but sets the fence
+		 * to NULL, it implies that the given seqno is signaled and a
+		 * later seqno has already been submitted. Assign a stub fence
+		 * so that the eventfd still gets signaled below.
+		 */
+		fence = dma_fence_get_stub();
 	}
 
 	list_del_init(&entry->node);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux