From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796351735; b=xbX4YPmqYehUxywx+cf2ciiqPFODJ5p8Tdt9v+E3KJcd2DLO3RDFhhp5Nal6w4OqN41g GG1ug2AUS4ZX9Gw2Z6FZS5fy5Kl1wnQil/UBFWdZ3IRwkZXgRGrXjhUeM3kFa6DOSeeNW qQxQyY6Nd8Uq5A32cUEPheLjq7vpEL8p3l+D31yZrU1e0oiBsZ83Y4l3R3W7g9UfK1CZk 8l5a64q85FGIuzxasr8bAJn4B3JQ9esp0P8WX1gNGyF4/LI35COIgkvVuroyRFB3FhlV2 2N2P0NDFndK3OMbPAEPwSjUToGwzU5C6JY1Qd5J/YZQOlVDUnbH8h+Q+GhWL7lOVW2w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796351735; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=x0+ti/56um2Orce1eiuj2FKObokR4XhgfC/FVYYpJTQ=; b=ow6OVYicuk3hsgL3E5kAClPmkzFezbgw2aSWa8dogKSTGL+pe3FGqebb6fsBsEMuUNBg jpoGReeWlDjhZVK2YuYHePM3pcYu02u9cAH0RGICVffZfqB1IefESVK0+GIZJwx/oVybe Hr3w9qz7C5xYnMzXIo0xCLoMY9nMjuOtILLam9mX1SdzHt87F2i4YeWnVsArekJWlulpy XIvFIX2Jcu7Zg8gorIIqzsyX/MEeylCJKWwUaPbOngDTOU1kANuiTcw4A1JLQmAuv4Llj 0IAOJTY1nxb25d/4xBxj2YhjOyQ9ZklrudNoj8c4KK7amq88bZTWc/wcmirSvRj2xCw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="MT9sOj0/"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 630D2606A32D for ; Fri, 4 Dec 2026 02:35:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MT9sOj0/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 39C431F000C2; Fri, 4 Dec 2026 02:35:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796351734; bh=x0+ti/56um2Orce1eiuj2FKObokR4XhgfC/FVYYpJTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=MT9sOj0/r3LXNQNSut8v5cxFKq66e9/cu0CGwdowh1wvh2UUBDbqnvyMZ/EOrlSwL RhYoJzk1Cfke0wNX/auGt5nvJAqKDrD9Kq+fiUKdafj4JXBXVDTzHoLEURT4egt8XW wp11XKyUEFuqOlGOThaXcFGQVdfivCrqMDzDMwE5nInNZw8mn/7nzLiyygng9sHTyt IFB75suMyoORjacNd/3c7Z/A1j31iMFlRKOu17SjUTzPC386A4RJ8pyiCYfUkfuZNv d7Qh/9JolDHDqR3JgC+WEqiP7iATBJ5Q25Mg++V7IA99iYci1CdV9gMbto/8gs3l97 HsPoFQu1GLIWg== From: Sasha Levin To: stable@vger.kernel.org Cc: Zack Rusin , Maaz Mombasawala , fausten , Sasha Levin Subject: [PATCH 6.6.y] drm/vmwgfx: reserve cursor MOBs before unpinning them Date: Thu, 3 Dec 2026 21:35:32 -0500 Message-ID: <20261204023456.2201076-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026120230-headstone-facelift-dcb8@gregkh> References: <2026120230-headstone-facelift-dcb8@gregkh> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Zack Rusin [ 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 Reviewed-by: Maaz Mombasawala Tested-by: fausten 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 --- 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