Patch "drm/msm: Fix fence rollover issue" has been added to the 5.19-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/msm: Fix fence rollover issue

to the 5.19-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-msm-fix-fence-rollover-issue.patch
and it can be found in the queue-5.19 subdirectory.

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



commit 47ddd1c9fd1b70a5125a78193d402e3e422f7ed8
Author: Rob Clark <robdclark@xxxxxxxxxxxx>
Date:   Wed Jun 15 09:24:35 2022 -0700

    drm/msm: Fix fence rollover issue
    
    [ Upstream commit 2311720a0182756f175fbf4afc1fb76ac487b587 ]
    
    And while we are at it, let's start the fence counter close to the
    rollover point so that if issues slip in, they are more obvious.
    
    Signed-off-by: Rob Clark <robdclark@xxxxxxxxxxxx>
    Fixes: fde5de6cb461 ("drm/msm: move fence code to it's own file")
    Fixes: 5f3aee4ceb5b ("drm/msm: Handle fence rollover")
    Patchwork: https://patchwork.freedesktop.org/patch/489619/
    Link: https://lore.kernel.org/r/20220615162435.3011793-1-robdclark@xxxxxxxxx
    [DB: fixed the conflict while applying the patch]
    Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/msm/msm_fence.c b/drivers/gpu/drm/msm/msm_fence.c
index 38e3323bc232..a47e5837c528 100644
--- a/drivers/gpu/drm/msm/msm_fence.c
+++ b/drivers/gpu/drm/msm/msm_fence.c
@@ -28,6 +28,14 @@ msm_fence_context_alloc(struct drm_device *dev, volatile uint32_t *fenceptr,
 	fctx->fenceptr = fenceptr;
 	spin_lock_init(&fctx->spinlock);
 
+	/*
+	 * Start out close to the 32b fence rollover point, so we can
+	 * catch bugs with fence comparisons.
+	 */
+	fctx->last_fence = 0xffffff00;
+	fctx->completed_fence = fctx->last_fence;
+	*fctx->fenceptr = fctx->last_fence;
+
 	return fctx;
 }
 
@@ -52,7 +60,8 @@ void msm_update_fence(struct msm_fence_context *fctx, uint32_t fence)
 	unsigned long flags;
 
 	spin_lock_irqsave(&fctx->spinlock, flags);
-	fctx->completed_fence = max(fence, fctx->completed_fence);
+	if (fence_after(fence, fctx->completed_fence))
+		fctx->completed_fence = fence;
 	spin_unlock_irqrestore(&fctx->spinlock, flags);
 }
 



[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