Linux kernel -stable discussions
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] drm/vmwgfx: reserve cursor MOBs before unpinning them" failed to apply to 6.1-stable tree
@ 2026-12-02 12:54 gregkh
  2026-12-04  2:42 ` [PATCH 6.1.y] drm/vmwgfx: reserve cursor MOBs before unpinning them Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: gregkh @ 2026-12-02 12:54 UTC (permalink / raw)
  To: zack.rusin, maaz.mombasawala, yunfeng.li.nb; +Cc: stable


The patch below does not apply to the 6.1-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.1.y
git checkout FETCH_HEAD
git cherry-pick -x 8a9b3b4c3a6cc95ea959183e20871d2421a6b986
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026120230-stardust-hate-d66c@gregkh' --subject-prefix 'PATCH 6.1.y' 'HEAD^..'

Possible dependencies:



thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 8a9b3b4c3a6cc95ea959183e20871d2421a6b986 Mon Sep 17 00:00:00 2001
From: Zack Rusin <zack.rusin@broadcom.com>
Date: Tue, 27 Oct 2026 14:48:55 -0400
Subject: [PATCH] drm/vmwgfx: reserve cursor MOBs before unpinning them

vmw_cursor_mob_destroy() unpins cursor MOBs when discarding an image from
the plane's cache or destroying the cursor plane. It calls ttm_bo_unpin()
without reserving the BO, although TTM requires its reservation to be held
when changing pin counts and LRU membership.

KMS clients issuing repeated nonblocking cursor updates can exhaust the
cache and reach this path. On a lockdep-enabled kernel this triggers
reservation assertions in ttm_bo_unpin() and ttm_resource_unevictable().

Reserve the MOB around ttm_bo_unpin(), then release the reservation before
dropping the BO reference.

Fixes: 485d98d472d5 ("drm/vmwgfx: Add support for CursorMob and CursorBypass 4")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Tested-by: fausten <yunfeng.li.nb@gmail.com>
Link: https://patch.msgid.link/20261027211729.646988-7-zack.rusin@broadcom.com

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c b/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
index 9e8ea9e07f40..b678e5b68db7 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_cursor_plane.c
@@ -166,10 +166,17 @@ static u32 vmw_cursor_mob_size(enum vmw_cursor_update_type update_type,
 
 static void vmw_cursor_mob_destroy(struct vmw_bo **vbo)
 {
+	int ret;
+
 	if (!(*vbo))
 		return;
 
+	ret = ttm_bo_reserve(&(*vbo)->tbo, false, false, NULL);
+	if (WARN_ON_ONCE(ret))
+		return;
+
 	ttm_bo_unpin(&(*vbo)->tbo);
+	ttm_bo_unreserve(&(*vbo)->tbo);
 	vmw_bo_unreference(vbo);
 }
 


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

* [PATCH 6.1.y] drm/vmwgfx: reserve cursor MOBs before unpinning them
  2026-12-02 12:54 FAILED: patch "[PATCH] drm/vmwgfx: reserve cursor MOBs before unpinning them" failed to apply to 6.1-stable tree gregkh
@ 2026-12-04  2:42 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-12-04  2:42 UTC (permalink / raw)
  To: stable; +Cc: Zack Rusin, Maaz Mombasawala, fausten, Sasha Levin

From: Zack Rusin <zack.rusin@broadcom.com>

[ Upstream commit 8a9b3b4c3a6cc95ea959183e20871d2421a6b986 ]

vmw_cursor_mob_destroy() unpins cursor MOBs when discarding an image from
the plane's cache or destroying the cursor plane. It calls ttm_bo_unpin()
without reserving the BO, although TTM requires its reservation to be held
when changing pin counts and LRU membership.

KMS clients issuing repeated nonblocking cursor updates can exhaust the
cache and reach this path. On a lockdep-enabled kernel this triggers
reservation assertions in ttm_bo_unpin() and ttm_resource_unevictable().

Reserve the MOB around ttm_bo_unpin(), then release the reservation before
dropping the BO reference.

Fixes: 485d98d472d5 ("drm/vmwgfx: Add support for CursorMob and CursorBypass 4")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Reviewed-by: Maaz Mombasawala <maaz.mombasawala@broadcom.com>
Tested-by: fausten <yunfeng.li.nb@gmail.com>
Link: https://patch.msgid.link/20261027211729.646988-7-zack.rusin@broadcom.com
[ sashal: Adapted the fix into the older cursor MOB teardown function (plain TTM buffer objects), and dropped the explicit kfree() after ttm_bo_put() since the destructor already frees the buffer. ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 739e5e5ed8129..28f8dc30159c7 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -148,12 +148,17 @@ static void vmw_cursor_update_mob(struct vmw_private *dev_priv,
 void vmw_du_destroy_cursor_mob_array(struct vmw_cursor_plane *vcp)
 {
 	size_t i;
+	int ret;
 
 	for (i = 0; i < ARRAY_SIZE(vcp->cursor_mob); i++) {
 		if (vcp->cursor_mob[i] != NULL) {
+			ret = ttm_bo_reserve(vcp->cursor_mob[i], false, false, NULL);
+			if (WARN_ON_ONCE(ret))
+				continue;
+
 			ttm_bo_unpin(vcp->cursor_mob[i]);
+			ttm_bo_unreserve(vcp->cursor_mob[i]);
 			ttm_bo_put(vcp->cursor_mob[i]);
-			kfree(vcp->cursor_mob[i]);
 			vcp->cursor_mob[i] = NULL;
 		}
 	}
-- 
2.53.0


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

end of thread, other threads:[~2026-12-04  2:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 12:54 FAILED: patch "[PATCH] drm/vmwgfx: reserve cursor MOBs before unpinning them" failed to apply to 6.1-stable tree gregkh
2026-12-04  2:42 ` [PATCH 6.1.y] drm/vmwgfx: reserve cursor MOBs before unpinning them Sasha Levin

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