From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E496F606A322 for ; Thu, 3 Dec 2026 08:54:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=f7HC//fl Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B07DC10E52F; Thu, 3 Dec 2026 08:53:56 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.18]) by gabe.freedesktop.org (Postfix) with ESMTPS id 532F510E1A1; Thu, 3 Dec 2026 08:53:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796288030; x=1827824030; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=ngnH0evxpaWRw60pUO5d+udMJt3udSeXkXKirFP9DNE=; b=f7HC//fl37I1FIVBA6woorBxP72rIZYatNKdSaQegrQWbCCv8fBXPUzq /zaIKKaAg5CHxVJ6wWtuXAR06E2SirC8kYhnU18jSrTS3VveMcJ0oskWQ E8/wb52+y9Mn+w85BWhDFJ/xmifLz01kCax1H+jFUUTHAAx+4uIsDfcKM rRArxHrf1QfpXABOimJzYaM3PNHYp260GS14oOu6F9DFfGQZG/JICnsyE e6fIc6HSGyFWCTVVuu1W3c8fh0fgTGEZPma5ObN4qZnZF/nPjDM16Hxm1 rl/T7VZRntpjKTBUxtLgjJI+ZoXxw+cNIi3eXGVWWSEt6WzeIgScPk+2K w==; X-CSE-ConnectionGUID: 7JDR5SYYRlWWH6FSGcyzcA== X-CSE-MsgGUID: baLrTI6eR8q+Zwn3jFOyQw== X-IronPort-AV: E=McAfee;i="6800,10657,11984"; a="5248371" X-IronPort-AV: E=Sophos;i="6.27,248,1787036400"; d="scan'208";a="5248371" Received: from fmviesa006.fm.intel.com ([10.60.135.146]) by fmvoesa112.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 00:53:49 -0800 X-CSE-ConnectionGUID: 0z6UDp85So+pHb7NqIOCWw== X-CSE-MsgGUID: TVLi+0zGQ3O0UqVj83PyRg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,248,1787036400"; d="scan'208";a="14077752" Received: from kniemiec-mobl1.ger.corp.intel.com (HELO fedora) ([10.245.244.75]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 00:53:48 -0800 From: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= To: intel-xe@lists.freedesktop.org Cc: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , Natalie Vock , Arun Pravin , Rodrigo Vivi , Matthew Auld , Matthew Brost , DRI-devel Subject: [PATCH v2 0/3] drm/ttm, drm/xe: Handle VRAM eviction failure at suspend Date: Thu, 3 Dec 2026 09:53:18 +0100 Message-ID: <20261203085321.235694-1-thomas.hellstrom@linux.intel.com> X-Mailer: git-send-email 2.56.1 X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Intel-xe" X-Spam-Status: No, score=-11.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 When the amount of VRAM in use exceeds the free system memory, evicting VRAM at suspend may invoke the OOM killer, and under heavy memory pressure the system may hang [1]. Patch 3 avoids invoking the OOM killer by having the user BO eviction use __GFP_RETRY_MAYFAIL, so that suspend is aborted with -ENOMEM instead. That makes eviction failures more likely, which exposes two pre-existing issues in the failure paths, fixed by patches 1 and 2: Patch 1 undoes the eviction of pinned BOs if suspend fails partway. Otherwise the device continues operating with stale backups, which a later resume restores over the live VRAM contents. This was reported by Sashiko on v1 of patch 2. Patch 2 converts -ENOMEM from the eviction at runtime suspend to -EAGAIN, since runtime PM otherwise treats the error as fatal and stops runtime-suspending the device. The patches are ordered so that no intermediate state makes the failure paths more likely to be hit before they are fixed. Patch 2 depends on patch 1, since retrying runtime suspend would otherwise restore stale pinned BO backups. v2: - Patches 2 and 3 were previously posted separately. Combined them into a series. - Patch 1: New patch. Undo pinned BO eviction on suspend failure, a prerequisite for patch 2. Reported by Sashiko. - Patch 2: Reworded the commit message for the new patch order. - Patch 3: Rebased. Testing: - W=1 build and checkpatch are clean. [1] https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/9615 AI tool use: an AI coding assistant was used for review and for drafting parts of the implementation and commit messages. Thomas Hellström (3): drm/xe: Undo pinned BO eviction on suspend failure drm/xe: Don't fail runtime suspend permanently on VRAM eviction -ENOMEM drm/ttm, drm/xe: Don't invoke the OOM killer when evicting VRAM at suspend drivers/gpu/drm/ttm/ttm_resource.c | 37 +++++++++++++++++++------ drivers/gpu/drm/xe/xe_bo.c | 26 ++++++++++++++++++ drivers/gpu/drm/xe/xe_bo.h | 1 + drivers/gpu/drm/xe/xe_bo_evict.c | 44 ++++++++++++++++++++++++++---- drivers/gpu/drm/xe/xe_bo_evict.h | 1 + drivers/gpu/drm/xe/xe_device.c | 5 +++- drivers/gpu/drm/xe/xe_pm.c | 15 ++++++++-- include/drm/ttm/ttm_resource.h | 5 ++++ 8 files changed, 118 insertions(+), 16 deletions(-) -- 2.56.1