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=1796352173; b=PSVcw8GngMv306CpQZBY+eXB7OlybVIjrxbzOuv7vhvxS+lYpt9u1WLadSU0OeWqwK5L aXmN2GhbbOIxOvtUmu1SnbqiH0cSKank+BSnqw23av+xqro+M6mEe+o+3pbugveTDfOwZ aXURvdyfe4F9uLP6WrZ586YiRl9VSY5IYvwiVgs7cBagUvnWCkJ1vWiOv902yacOKUggw 7xo7XkbGxVJ7iow7OrNdwU36eGbiaCfU2oitva4rgqNC7r1JCF2UbzCl6o2Gagfdl6SRg 0DfsPlV7hgXvFY1e1cQe+ZdTE9d6lZHV2ib1Ey5JskuO8N2axn7EO3W+uXN3E8n6xyQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796352173; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=Y2vD5o4CRB+PxAd660xmL2BiNIE237a9j/uKza1KE1E=; b=fMpln/fGLq/FR5TTDapViiRkF2u4K7wC+WerC7uybtE4/k+nA89ZvSV0D/hY5Sf8Nc+I PNUILpDFDSoEDfGF8tO7hnFsu69m/6m+fqkaK2QUgwP0/1vCh6DCGbJuNsWY5ubp+9+64 rOFVeu7/O1qJgS26RUxUZZRrwA2nQBvc7RzTcq9drGsb8wI4HpqRlokx00KiPU4fYteKM 0u6xbAj8qnkml5QzPUJCqhAolZ2xT2GVlroZhljyMrszx/3s3f3Oczdz8OPIpsLxxvaLC VAGT+gIvEcuqAZ+GLDEtLntW5kGk0F5Y2IFQCs7OCMc/QuPf4ve2Byy0JN2L4xSy/dw== 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=SYBzY+zZ; 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 A34A6606A334 for ; Fri, 4 Dec 2026 02:42:53 +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=SYBzY+zZ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9F13F1F000C2; Fri, 4 Dec 2026 02:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796352173; bh=Y2vD5o4CRB+PxAd660xmL2BiNIE237a9j/uKza1KE1E=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SYBzY+zZJcRLvNIWLVC0031bN0+ihFVR3Ai/lGXZJZVUfjnAAg+cQ0+MCSV6rLfRY nS2dZtdHQ7ijxvUV3E10iox1sReUsw6c2NbUeXOTWGt8RjOHkAUiGV8NXvohYMt0dq cip6x/Lyns+yZtbtwmPIjB4kRUn3nlgkVpYLgDzJusuVQIPzBonbmidj2RvjtxrsRO Cn7Kq2aBkBABwo3oYLexCf2ow1XlJOMmgnXRa0iupG0f/Cw475I0rgdoyQ77sGtJYC 0jfAkNWwqwPOtPpWYUxUQJ0gnTcy/580KDbHEGV0jVrAdGVlzTigkaiTd++EEhG/Qv UsWj8jmhVFdNA== From: Sasha Levin To: stable@vger.kernel.org Cc: Zack Rusin , Maaz Mombasawala , fausten , Sasha Levin Subject: [PATCH 6.1.y] drm/vmwgfx: reserve cursor MOBs before unpinning them Date: Thu, 3 Dec 2026 21:42:51 -0500 Message-ID: <20261204024218.2245320-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026120230-stardust-hate-d66c@gregkh> References: <2026120230-stardust-hate-d66c@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 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 --- 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