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=1796351514; b=3/sNrW2yrseMPNUTe44RfS5vUpYPfLPE28B/efBHEKhAk/daanU9OG8cOKdMxYem5iP0 xyYnx+vFfarAPontfCeiGDIpp/+8btJwea/1WbbWgql5Wo3uq3jigCBmO2H2zJzaJLQwe IC/RmZk44RGa1EbkGFg1Z6BhPgwgPTUckNKULP1CFwKfc5RnDHzGKOFU0EncE4ukBF2DX KF+NCkXpFR133guxJ7D1iFXE2NoO5lmfKPMYW7YIsM1lARk+rotsRnHxRUdRk4/fCqNK0 sWpyyVOm54OAsaLZQmPvjsZVFw53FwmnkQInj4rocwNu3xZi/a/uHXqB0DfEoUiLYdw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796351514; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=HcfBQJhF9hj6kJYCrCY2sK83BZSK6TfBIkP77weDh94=; b=J16EKPpKOzeHPolo29dgphT0Gcpo6UwdNEZq5Ofe57fHNjBM/QyPuwSUfLYuCJWv/hvp zJCGfufJs3cPWk3t18AglqILH5AHIVl7jKhcPWb/HTN/22r0m5dd4Nbed7jOZPa+TaZiG xJLaAxjXVB+RsqVQOpmVIEnjf9esmlq7dgxal9HL3DIJBNt/7DaGaXOoMOq/VnO/QdS5k iCAkNo9TQthItCPxdmtr8uChWoL6WJ8nUfrOHuPAzrKe9S/TaPLzOdt9qUuKyGatD/Gt0 1VuaUesen9no9UIPtsEAunjhGPBGsiSkpOYvfWRlvRLRdal4kE1TocsUtl5V60K5+aw== 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=a0qy8FMk; 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 91CA0606A322 for ; Fri, 4 Dec 2026 02:31:54 +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=a0qy8FMk Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6E9381F000C2; Fri, 4 Dec 2026 02:31:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796351514; bh=HcfBQJhF9hj6kJYCrCY2sK83BZSK6TfBIkP77weDh94=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=a0qy8FMkBWogvrKIKDLNj8nogFLqjHKMJYLvMUEUHLj9811hSksL8ucrNKva4EMtw aq6kXmZl0yWVCq9m1BEz6oFajE6SMCKzx7xMNaD7ounuLq6rCAnGAaopz5ii5XbhRJ M/9qnqzHNEDiDP2Z0LWkfdHUFBCCisyJEEfU3IqNiAaGBPlqHcRa1sqexGDGTEssX2 FDeqKCTR97qAao9j4pJYK626nu6zhZqdIzbTK26OAT9Dp+1HSjW9+HDjVJSmJOb1IJ kSxixSOWfdGVbNAfzSbnQVhu2kSyRaxz3l+OKZuTwILGLNWXWq4N8NgysNszS7xtlF VUVWNm0zN0udA== From: Sasha Levin To: stable@vger.kernel.org Cc: Zack Rusin , Maaz Mombasawala , fausten , Sasha Levin Subject: [PATCH 6.12.y] drm/vmwgfx: reserve cursor MOBs before unpinning them Date: Thu, 3 Dec 2026 21:31:47 -0500 Message-ID: <20261204023111.2133413-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026120229-triage-runway-6083@gregkh> References: <2026120229-triage-runway-6083@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: Replaced the file and function names with vmw_du_destroy_cursor_mob() in vmwgfx_kms.c, since the cursor code isn't split into vmwgfx_cursor_plane.c here; the reserve/unreserve change itself is identical. ] 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 03bf0f9574bcf..5b7f04c3a3772 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_kms.c @@ -236,10 +236,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