Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D3806C4450A for ; Thu, 16 Jul 2026 10:21:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 943B910E324; Thu, 16 Jul 2026 10:21:53 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=intel.com header.i=@intel.com header.b="dalvEYYn"; dkim-atps=neutral Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4408F10F285 for ; Thu, 16 Jul 2026 10:21:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1784197306; x=1815733306; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=xnqsiabqj+hw/fzH6w4AQ5phU11AIdO1Tz9kD5LmKnc=; b=dalvEYYnVtbnexpB2DOf8PEGzJTpjosAl3IGh1ZeJYJ7pNhFyGsKheeA c+jT9vnFx+folmK63okY3Hh7dorDHg5+/LpzYP3UU+3njM7Oi9nJvfzD1 LLLR+OJBpNpT/1jy8EIyzwFOVSUZIRl1NGfosrqrrfWyACES1iLXEgKhB yHVTZug/Vqx7V13ugm4Ili/X6jESV1DdYsyjYjkVyZe1hVtbXCappFw94 6HQET57G7D0BxG1KubxugsIF8+ygGXitG3okVL3CBLPn0wbUB+NmNBjQf utp4BcxsMcqb/vAd/6KEjgy0kei//G+fGmN52UpTBljq0Se2yJZNT+/1V A==; X-CSE-ConnectionGUID: Gd1avIDUTCaWf776hMCQcQ== X-CSE-MsgGUID: pL0uZTCjSqmRsYb+nDFbZQ== X-IronPort-AV: E=McAfee;i="6800,10657,11847"; a="96367801" X-IronPort-AV: E=Sophos;i="6.25,167,1779174000"; d="scan'208";a="96367801" Received: from fmviesa008.fm.intel.com ([10.60.135.148]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2026 03:21:46 -0700 X-CSE-ConnectionGUID: J5yXvxYQSF+XHukX2yAodg== X-CSE-MsgGUID: RRPRM4PgQjCtijcTrKXW3A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,167,1779174000"; d="scan'208";a="253833868" Received: from tejasupa-desk.iind.intel.com (HELO tejasupa-desk) ([10.190.239.37]) by fmviesa008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jul 2026 03:21:45 -0700 From: Tejas Upadhyay To: intel-xe@lists.freedesktop.org Cc: Tejas Upadhyay Subject: [PATCH V13 10/11] drm/xe: Add soft/hard offline mode for VRAM page retirement Date: Thu, 16 Jul 2026 15:51:16 +0530 Message-ID: <20260716102110.1549938-23-tejas.upadhyay@intel.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260716102110.1549938-13-tejas.upadhyay@intel.com> References: <20260716102110.1549938-13-tejas.upadhyay@intel.com> MIME-Version: 1.0 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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" Introduce a mode-based approach for VRAM page offlining to distinguish between soft (temporary) and hard (permanent) page retirement: - Add enum xe_page_offline_mode with XE_PAGE_OFFLINE_SOFT and XE_PAGE_OFFLINE_HARD states. - Add 'mode' field to struct xe_ttm_vram_offline_resource. On first fault at an address: - Reserve the block, add to offlined_pages with mode = SOFT. - Page stays out of the allocator pool but is not permanently retired. On second fault at the same address: - xe_ttm_vram_page_already_processed() finds the entry and promotes mode from SOFT to HARD. - Returns -EEXIST to the caller, which signals FW to permanently retire the page. This avoids unnecessary permanent retirement on transient single-bit errors while ensuring persistent faults get hard-offlined. v2(Sashiko): - Add soft-to-hard mode promotion for queued_pages Signed-off-by: Tejas Upadhyay --- drivers/gpu/drm/xe/xe_ttm_vram_mgr.c | 15 +++++++++++++-- drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h | 12 ++++++++++++ 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c index dbce00a7c521..0e5dfbf203a3 100644 --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr.c @@ -587,13 +587,23 @@ static bool xe_ttm_vram_page_already_processed(struct xe_ttm_vram_mgr *mgr, lockdep_assert_held(&mgr->lock); list_for_each_entry(pos, &mgr->offlined_pages, offlined_link) { - if (pos->addr == addr) + if (pos->addr == addr) { + /* + * Second fault at same addr: promote soft to hard. + * Caller returns -EEXIST to FW for permanent retirement. + */ + if (pos->mode == XE_PAGE_OFFLINE_SOFT) + pos->mode = XE_PAGE_OFFLINE_HARD; return true; + } } list_for_each_entry(pos, &mgr->queued_pages, queued_link) { - if (pos->addr == addr) + if (pos->addr == addr) { + if (pos->mode == XE_PAGE_OFFLINE_SOFT) + pos->mode = XE_PAGE_OFFLINE_HARD; return true; + } } return false; @@ -626,6 +636,7 @@ static int xe_ttm_vram_reserve_page_at_addr(struct xe_device *xe, unsigned long INIT_LIST_HEAD(&nentry->blocks); nentry->status = pending; nentry->addr = addr; + nentry->mode = XE_PAGE_OFFLINE_SOFT; if (block) { struct xe_bo *pbo; diff --git a/drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h b/drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h index c06ed244f83a..b93e5dddc475 100644 --- a/drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h +++ b/drivers/gpu/drm/xe/xe_ttm_vram_mgr_types.h @@ -55,6 +55,16 @@ struct xe_ttm_vram_mgr_resource { unsigned long flags; }; +/** + * enum xe_page_offline_mode - Mode of page offline + * @XE_PAGE_OFFLINE_SOFT: Page is soft-offlined (scrubbed, can be restored) + * @XE_PAGE_OFFLINE_HARD: Page is hard-offlined (permanently retired) + */ +enum xe_page_offline_mode { + XE_PAGE_OFFLINE_SOFT = 0, + XE_PAGE_OFFLINE_HARD, +}; + /** * struct xe_ttm_vram_offline_resource - Xe TTM VRAM offline resource */ @@ -73,6 +83,8 @@ struct xe_ttm_vram_offline_resource { unsigned long addr; /** @status: reservation status of resource */ bool status; + /** @mode: offline mode (soft or hard) */ + enum xe_page_offline_mode mode; }; #endif -- 2.52.0