Patch "drm/xe/preempt_fence: enlarge the fence critical section" has been added to the 6.10-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/xe/preempt_fence: enlarge the fence critical section

to the 6.10-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-xe-preempt_fence-enlarge-the-fence-critical-sect.patch
and it can be found in the queue-6.10 subdirectory.

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



commit 01d5e852b29741df41afd95b2a1e478f1003046b
Author: Matthew Auld <matthew.auld@xxxxxxxxx>
Date:   Thu Apr 18 15:46:31 2024 +0100

    drm/xe/preempt_fence: enlarge the fence critical section
    
    [ Upstream commit 3cd1585e57908b6efcd967465ef7685f40b2a294 ]
    
    It is really easy to introduce subtle deadlocks in
    preempt_fence_work_func() since we operate on single global ordered-wq
    for signalling our preempt fences behind the scenes, so even though we
    signal a particular fence, everything in the callback should be in the
    fence critical section, since blocking in the callback will prevent
    other published fences from signalling. If we enlarge the fence critical
    section to cover the entire callback, then lockdep should be able to
    understand this better, and complain if we grab a sensitive lock like
    vm->lock, which is also held when waiting on preempt fences.
    
    Signed-off-by: Matthew Auld <matthew.auld@xxxxxxxxx>
    Cc: Matthew Brost <matthew.brost@xxxxxxxxx>
    Reviewed-by: Matthew Brost <matthew.brost@xxxxxxxxx>
    Link: https://patchwork.freedesktop.org/patch/msgid/20240418144630.299531-2-matthew.auld@xxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/xe/xe_preempt_fence.c b/drivers/gpu/drm/xe/xe_preempt_fence.c
index 7d50c6e89d8e7..5b243b7feb59d 100644
--- a/drivers/gpu/drm/xe/xe_preempt_fence.c
+++ b/drivers/gpu/drm/xe/xe_preempt_fence.c
@@ -23,11 +23,19 @@ static void preempt_fence_work_func(struct work_struct *w)
 		q->ops->suspend_wait(q);
 
 	dma_fence_signal(&pfence->base);
-	dma_fence_end_signalling(cookie);
-
+	/*
+	 * Opt for keep everything in the fence critical section. This looks really strange since we
+	 * have just signalled the fence, however the preempt fences are all signalled via single
+	 * global ordered-wq, therefore anything that happens in this callback can easily block
+	 * progress on the entire wq, which itself may prevent other published preempt fences from
+	 * ever signalling.  Therefore try to keep everything here in the callback in the fence
+	 * critical section. For example if something below grabs a scary lock like vm->lock,
+	 * lockdep should complain since we also hold that lock whilst waiting on preempt fences to
+	 * complete.
+	 */
 	xe_vm_queue_rebind_worker(q->vm);
-
 	xe_exec_queue_put(q);
+	dma_fence_end_signalling(cookie);
 }
 
 static const char *




[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