Linux kernel -stable discussions
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Zack Rusin <zack.rusin@broadcom.com>,
	Maaz Mombasawala <maaz.mombasawala@broadcom.com>,
	fausten <yunfeng.li.nb@gmail.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.6.y] drm/vmwgfx: reserve cursor MOBs before unpinning them
Date: Thu,  3 Dec 2026 21:35:32 -0500	[thread overview]
Message-ID: <20261204023456.2201076-1-sashal@kernel.org> (raw)
In-Reply-To: <2026120230-headstone-facelift-dcb8@gregkh>

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 to the older function name vmw_du_destroy_cursor_mob() in vmwgfx_kms.c, since the cursor plane code is not yet split into vmwgfx_cursor_plane.c ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
index 79e9f9e4828fc..e24c47882fdc0 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c
@@ -224,10 +224,17 @@ static bool vmw_du_cursor_plane_has_changed(struct vmw_plane_state *old_vps,
 
 static void vmw_du_destroy_cursor_mob(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);
 }
 
-- 
2.53.0


      reply	other threads:[~2026-12-04  2:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 12:54 FAILED: patch "[PATCH] drm/vmwgfx: reserve cursor MOBs before unpinning them" failed to apply to 6.6-stable tree gregkh
2026-12-04  2:35 ` Sasha Levin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261204023456.2201076-1-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=maaz.mombasawala@broadcom.com \
    --cc=stable@vger.kernel.org \
    --cc=yunfeng.li.nb@gmail.com \
    --cc=zack.rusin@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox