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.1.y] drm/vmwgfx: reserve cursor MOBs before unpinning them
Date: Thu, 3 Dec 2026 21:42:51 -0500 [thread overview]
Message-ID: <20261204024218.2245320-1-sashal@kernel.org> (raw)
In-Reply-To: <2026120230-stardust-hate-d66c@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 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
prev parent reply other threads:[~2026-12-04 2:42 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.1-stable tree gregkh
2026-12-04 2:42 ` 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=20261204024218.2245320-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