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 18525606A322 for ; Thu, 3 Dec 2026 10:47:57 +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=H6R7EFga Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D24AC1127B4; Thu, 3 Dec 2026 10:47:51 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) by gabe.freedesktop.org (Postfix) with ESMTPS id 663821127B4; Thu, 3 Dec 2026 10:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796294866; x=1827830866; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=XxesLJDgvdAGeLoxDQLGjCuMnAgSeEw1/CKqoUpuv88=; b=H6R7EFgabZjpV9IqV+wSOKedWrhfE7AJsxHwhyXRTzN5irGBajITeHNU 2mymyzb9YxqoCAZlfWHf7vxs8q+l+keSz/YN/fXcBxgrEbnODH2emTa3r GhaRNONsQ8mgULOOvkU73TLH3H8ZIb06F2I6BD701pAbPqkrBjJfDLb52 cygOpQ76f1IlZAUpJIdwYAN+thpEGneomiNhJ+ZT9HJTG1XBDEx4ZDm1N k7zS5nPAM9PiqpEHj4FTRmIFGiYqDbhb5YByDOhLO6ACZxXM5CPcdtd4f jUg7VUivwG4YeiK5+LJLHkCvRgTXc0NpudSEFj+a48PQhFHuQpyYSnejr Q==; X-CSE-ConnectionGUID: Zi3aBkD2TNCjW5MO6cTxiA== X-CSE-MsgGUID: usR3Ar1NRcCyzZwR2Rkz8A== X-IronPort-AV: E=McAfee;i="6800,10657,11984"; a="5161218" X-IronPort-AV: E=Sophos;i="6.27,248,1787036400"; d="scan'208";a="5161218" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 02:47:45 -0800 X-CSE-ConnectionGUID: L1M2Ool0R1WwcO+hN+1c2g== X-CSE-MsgGUID: Z+S538Q/RRyThUBk17wNOw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,248,1787036400"; d="scan'208";a="13761691" Received: from ettammin-mobl3.ger.corp.intel.com (HELO fedora) ([10.245.244.105]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 02:47:43 -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 v3 0/3] drm/ttm, drm/xe: Handle VRAM eviction failure at suspend Date: Thu, 3 Dec 2026 11:47:12 +0100 Message-ID: <20261203104715.270111-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. v3: - Rebase onto latest drm-tip. 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