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=1796220906; b=k8ClVAnVBFA4Eom0PriqPT+h0LzdRzS4USIR0KuDNiCLVFg9ngpj3f7jOPITCobvh2Q0 kfOLYLLtGFfEi/SyqevKrziYAvG0I2Px0/d/zRpAq3oWgThJdEe76Y6K/68AF4/cdj036 1YNo3KzP4cUGuBHT+/Op2CnD/NGySshJF+AFtoYCE5Kuy5K1t6HqY5pYlD5O0KOhdtwe/ OHHf63E3+7A8P+ZXWWxeyB7sds7ndHdTsTN0w9umwJ36fBzE64c+FNrAkcR85OCFj3uVg kALH3jay6JyZ82JKdx2/2HQ2IrXoCVUvVd/3qoSolFj/7vQkgy1hgVW1zj6zzC48UYg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796220906; h=Received:DKIM-Signature:Subject:To:Cc:From:Date:Message-ID: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=sb4SwlDvVHOHcwiqOa3bGIZK5c7T7VCMek3JXxrykT0=; b=31poeAoovD7WfIQVmfaIG+E29mP453bju9MOMeorcKon97a9n30hTzdnBwiE6DME9TWJ wYu1MIja7SUfLAV7X/WSei04DOG+oTo7t6/+u1GlgpkXa2h3Rpknb9kLL+6W9ZsAcwzbO uoBMoaHNUf2gZ2SqqkxLiVl1UGIkR0eT2vpcRz79CAkBoJAXEDhRfunIUZWQNoqnsWr49 InlFZCaleykFAHBQ3GgryTYj2P43b/PbKxmWus1C8ap1/De8+7qKEXNMc9yDyf5Vwi0nN Pj8Q2ovpV0TWx/8szmrOVKsUCwW9a63OtZLB+LHq665/zc89CmGUO6OR2rm1Rw90jeA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=eTPKQhb2; 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 CAF3F606A32A for ; Wed, 2 Dec 2026 14:15:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=eTPKQhb2 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 844A81F00896; Wed, 2 Dec 2026 14:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796220906; bh=sb4SwlDvVHOHcwiqOa3bGIZK5c7T7VCMek3JXxrykT0=; h=Subject:To:Cc:From:Date; b=eTPKQhb2T+YdzmB5oWWX7ydFOMry/QsyfoOOf7RBoOo/d6q06hmevqbZQhkzGc9jB Ows3xRjjP5nLTEhaJYxKudy5vHin7f5i9o50/zAp+7d1njGypLN1QjtCjkYdM5sage IIUXLNH7vBbqfB+lZ6Y8/QMm9dASxpfUN1NFf5lo= Subject: FAILED: patch "[PATCH] drm/vmwgfx: log MOB limits outside the manager spinlock" failed to apply to 6.6-stable tree To: zack.rusin@broadcom.com,maaz.mombasawala@broadcom.com Cc: From: Date: Wed, 02 Dec 2026 13:52:18 +0100 Message-ID: <2026120217-blob-aloha-1ce7@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-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 6.6-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.6.y git checkout FETCH_HEAD git cherry-pick -x eee4285a8c3c918bbd21791e17f2bb261a709792 # git commit -s git send-email --to '' --in-reply-to '2026120217-blob-aloha-1ce7@gregkh' --subject-prefix 'PATCH 6.6.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From eee4285a8c3c918bbd21791e17f2bb261a709792 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Thu, 29 Oct 2026 02:22:25 -0400 Subject: [PATCH] drm/vmwgfx: log MOB limits outside the manager spinlock vmw_gmrid_man_get_node reports MOB limit expansion and allocation failures through vmw_host_printf while holding gman->lock. The helper formats its messages with GFP_KERNEL allocations, which may sleep. KDE startup and desktop mode changes can reach this path, producing "BUG: sleeping function called from invalid context" from kvasprintf() while the manager spinlock is held. That's likely a separate bug because KDE shouldn't be using that much memory but to debug that properly stop filling kernel logs with warnings. Defer both host messages until after dropping the spinlock. Capture the failed allocation's page limit and roll back its accounting while locked, then report the error and free the resource after unlocking. Use drm_warn for the guest messages so they identify the device. Fixes: cfdc3458db8a ("drm/vmwgfx: Be a lot more flexible with MOB limits") Cc: stable@vger.kernel.org Assisted-by: LLM Signed-off-by: Zack Rusin Reviewed-by: Maaz Mombasawala Link: https://patch.msgid.link/20261029215700.3009996-1-zack.rusin@broadcom.com diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c index d607452dff6a..cc580ce57797 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c @@ -54,8 +54,11 @@ static int vmw_gmrid_man_get_node(struct ttm_resource_manager *man, const struct ttm_place *place, struct ttm_resource **res) { + struct vmw_private *vmw = vmw_priv_from_ttm(bo->bdev); struct vmwgfx_gmrid_man *gman = to_gmrid_manager(man); - int id; + u32 max_gmr_pages = 0; + bool mob_overflow = false; + int id, ret = 0; *res = kmalloc_obj(**res); if (!*res) @@ -85,43 +88,53 @@ static int vmw_gmrid_man_get_node(struct ttm_resource_manager *man, const unsigned long max_graphics_pages = totalram_pages() / 2; uint32_t new_max_pages = 0; - DRM_WARN("vmwgfx: mob memory overflow. Consider increasing guest RAM and graphicsMemory.\n"); - vmw_host_printf("vmwgfx, warning: mob memory overflow. Consider increasing guest RAM and graphicsMemory.\n"); + mob_overflow = true; + drm_warn(&vmw->drm, + "vmwgfx: mob memory overflow. Consider increasing guest RAM and graphicsMemory.\n"); if (gman->max_gmr_pages > (max_graphics_pages / 2)) { - DRM_WARN("vmwgfx: guest requires more than half of RAM for graphics.\n"); + drm_warn(&vmw->drm, + "vmwgfx: guest requires more than half of RAM for graphics.\n"); new_max_pages = max_graphics_pages; } else new_max_pages = gman->max_gmr_pages * 2; if (new_max_pages > gman->max_gmr_pages && new_max_pages >= gman->used_gmr_pages) { - DRM_WARN("vmwgfx: increasing guest mob limits to %u KiB.\n", - ((new_max_pages) << (PAGE_SHIFT - 10))); + drm_warn(&vmw->drm, + "vmwgfx: increasing guest mob limits to %u KiB.\n", + new_max_pages << (PAGE_SHIFT - 10)); gman->max_gmr_pages = new_max_pages; } else { - char buf[256]; - snprintf(buf, sizeof(buf), - "vmwgfx, error: guest graphics is out of memory (mob limit at: %u KiB).\n", - ((gman->max_gmr_pages) << (PAGE_SHIFT - 10))); - vmw_host_printf(buf); - DRM_WARN("%s", buf); - goto nospace; + max_gmr_pages = gman->max_gmr_pages; + gman->used_gmr_pages -= PFN_UP((*res)->size); + ret = -ENOSPC; + goto out_unlock; } } } (*res)->start = id; +out_unlock: spin_unlock(&gman->lock); - return 0; -nospace: - gman->used_gmr_pages -= PFN_UP((*res)->size); - spin_unlock(&gman->lock); - ida_free(&gman->gmr_ida, id); - ttm_resource_fini(man, *res); - kfree(*res); - return -ENOSPC; + /* Host logging allocates with GFP_KERNEL and must run unlocked. */ + if (mob_overflow) + vmw_host_printf("%s", + "vmwgfx, warning: mob memory overflow. Consider increasing guest RAM and graphicsMemory.\n"); + if (ret) { + char buf[256]; + + snprintf(buf, sizeof(buf), + "vmwgfx, error: guest graphics is out of memory (mob limit at: %u KiB).\n", + max_gmr_pages << (PAGE_SHIFT - 10)); + vmw_host_printf("%s", buf); + drm_warn(&vmw->drm, "%s", buf); + ida_free(&gman->gmr_ida, id); + ttm_resource_fini(man, *res); + kfree(*res); + } + return ret; } static void vmw_gmrid_man_put_node(struct ttm_resource_manager *man,