From: Matthew Brost <matthew.brost@intel.com>
To: Brian Nguyen <brian3.nguyen@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <tejas.upadhyay@intel.com>,
<shuicheng.lin@intel.com>, <stuart.summers@intel.com>
Subject: Re: [PATCH v2 05/11] drm/xe/guc: Add page reclamation interface to GuC
Date: Tue, 2 Dec 2025 14:21:47 -0800 [thread overview]
Message-ID: <aS9meyANoPkhw1Ix@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20251126230201.3782788-18-brian3.nguyen@intel.com>
On Thu, Nov 27, 2025 at 07:02:06AM +0800, Brian Nguyen wrote:
> Add page reclamation related changes to GuC interface, handlers, and
> senders to support page reclamation.
>
> Currently TLB invalidations will perform an entire PPC flush in order to
> prevent stale memory access for noncoherent system memory. Page
> reclamation is an extension of the typical TLB invalidation
> workflow, allowing disabling of full PPC flush and enable selective PPC
> flushing. Selective flushing will be decided by a list of pages whom's
> address is passed to GuC at time of action.
>
> Page reclamation interfaces require at least GuC FW ver 70.31.0.
>
> v2:
> - Moved send_page_reclaim to first patch usage.
> - Add comments explaining shared done handler. (Matthew B)
> - Add FW version fallback to disable page reclaim
> on older versions. (Matthew B, Shuicheng)
>
> Signed-off-by: Brian Nguyen <brian3.nguyen@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> Cc: Shuicheng Lin <shuicheng.lin@intel.com>
> ---
> drivers/gpu/drm/xe/abi/guc_actions_abi.h | 2 ++
> drivers/gpu/drm/xe/xe_guc.c | 4 ++++
> drivers/gpu/drm/xe/xe_guc_ct.c | 17 +++++++++++++++++
> drivers/gpu/drm/xe/xe_guc_fwif.h | 1 +
> 4 files changed, 24 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/abi/guc_actions_abi.h b/drivers/gpu/drm/xe/abi/guc_actions_abi.h
> index 47756e4674a1..11de3bdf69b5 100644
> --- a/drivers/gpu/drm/xe/abi/guc_actions_abi.h
> +++ b/drivers/gpu/drm/xe/abi/guc_actions_abi.h
> @@ -151,6 +151,8 @@ enum xe_guc_action {
> XE_GUC_ACTION_TLB_INVALIDATION = 0x7000,
> XE_GUC_ACTION_TLB_INVALIDATION_DONE = 0x7001,
> XE_GUC_ACTION_TLB_INVALIDATION_ALL = 0x7002,
> + XE_GUC_ACTION_PAGE_RECLAMATION = 0x7003,
> + XE_GUC_ACTION_PAGE_RECLAMATION_DONE = 0x7004,
> XE_GUC_ACTION_STATE_CAPTURE_NOTIFICATION = 0x8002,
> XE_GUC_ACTION_NOTIFY_FLUSH_LOG_BUFFER_TO_FILE = 0x8003,
> XE_GUC_ACTION_NOTIFY_CRASH_DUMP_POSTED = 0x8004,
> diff --git a/drivers/gpu/drm/xe/xe_guc.c b/drivers/gpu/drm/xe/xe_guc.c
> index d6672cf30d3e..89b206c1eb86 100644
> --- a/drivers/gpu/drm/xe/xe_guc.c
> +++ b/drivers/gpu/drm/xe/xe_guc.c
> @@ -767,6 +767,10 @@ int xe_guc_init(struct xe_guc *guc)
> if (!xe_uc_fw_is_enabled(&guc->fw))
> return 0;
>
> + /* Disable page reclaim if GuC FW does not support */
> + if (GUC_FIRMWARE_VER(guc) < MAKE_GUC_VER(70, 31, 0))
> + xe->info.has_page_reclaim_hw_assist = false;
> +
> if (IS_SRIOV_VF(xe)) {
> ret = xe_guc_ct_init(&guc->ct);
> if (ret)
> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
> index 02b4588fece0..b9e406d69414 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
> @@ -1369,6 +1369,7 @@ static int parse_g2h_event(struct xe_guc_ct *ct, u32 *msg, u32 len)
> case XE_GUC_ACTION_DEREGISTER_CONTEXT_DONE:
> case XE_GUC_ACTION_SCHED_ENGINE_MODE_DONE:
> case XE_GUC_ACTION_TLB_INVALIDATION_DONE:
> + case XE_GUC_ACTION_PAGE_RECLAMATION_DONE:
> g2h_release_space(ct, len);
> }
>
> @@ -1555,6 +1556,15 @@ static int process_g2h_msg(struct xe_guc_ct *ct, u32 *msg, u32 len)
> ret = xe_guc_pagefault_handler(guc, payload, adj_len);
> break;
> case XE_GUC_ACTION_TLB_INVALIDATION_DONE:
> + case XE_GUC_ACTION_PAGE_RECLAMATION_DONE:
> + /*
> + * Page reclamation is an extension of TLB invalidation. Both
> + * operations share the same seqno and fence. When either
> + * action completes, we need to signal the corresponding
> + * fence. Since the handling logic (lookup fence by seqno,
> + * fence signalling) is identical, we use the same handler
> + * for both G2H events.
> + */
> ret = xe_guc_tlb_inval_done_handler(guc, payload, adj_len);
> break;
> case XE_GUC_ACTION_GUC2PF_RELAY_FROM_VF:
> @@ -1720,6 +1730,7 @@ static int g2h_read(struct xe_guc_ct *ct, u32 *msg, bool fast_path)
> switch (action) {
> case XE_GUC_ACTION_REPORT_PAGE_FAULT_REQ_DESC:
> case XE_GUC_ACTION_TLB_INVALIDATION_DONE:
> + case XE_GUC_ACTION_PAGE_RECLAMATION_DONE:
> break; /* Process these in fast-path */
> default:
> return 0;
> @@ -1756,6 +1767,12 @@ static void g2h_fast_path(struct xe_guc_ct *ct, u32 *msg, u32 len)
> ret = xe_guc_pagefault_handler(guc, payload, adj_len);
> break;
> case XE_GUC_ACTION_TLB_INVALIDATION_DONE:
> + case XE_GUC_ACTION_PAGE_RECLAMATION_DONE:
> + /*
> + * Seqno and fence handling of page reclamation and TLB
> + * invalidation is identical, so we can use the same handler
> + * for both actions.
> + */
> __g2h_release_space(ct, len);
> ret = xe_guc_tlb_inval_done_handler(guc, payload, adj_len);
> break;
> diff --git a/drivers/gpu/drm/xe/xe_guc_fwif.h b/drivers/gpu/drm/xe/xe_guc_fwif.h
> index 7d93c2749485..5aa6fb249be9 100644
> --- a/drivers/gpu/drm/xe/xe_guc_fwif.h
> +++ b/drivers/gpu/drm/xe/xe_guc_fwif.h
> @@ -16,6 +16,7 @@
> #define G2H_LEN_DW_DEREGISTER_CONTEXT 3
> #define G2H_LEN_DW_TLB_INVALIDATE 3
> #define G2H_LEN_DW_G2G_NOTIFY_MIN 3
> +#define G2H_LEN_DW_PAGE_RECLAMATION 3
>
> #define GUC_ID_MAX 65535
> #define GUC_ID_UNKNOWN 0xffffffff
> --
> 2.52.0
>
next prev parent reply other threads:[~2025-12-02 22:21 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-26 23:02 [PATCH v2 00/11] Page Reclamation Support for Xe3p Platforms Brian Nguyen
2025-11-26 23:02 ` [PATCH v2 01/11] [DO, NOT, REVIEW] drm/xe: Do not forward invalid TLB invalidation seqnos to upper layers Brian Nguyen
2025-11-26 23:02 ` [PATCH v2 02/11] drm/xe: Reset tlb fence timeout on invalid seqno received Brian Nguyen
2025-12-02 22:24 ` Matthew Brost
2025-11-26 23:02 ` [PATCH v2 03/11] drm/xe/xe_tlb_inval: Modify fence interface to support PPC flush Brian Nguyen
2025-12-02 22:18 ` Matthew Brost
2025-11-26 23:02 ` [PATCH v2 04/11] drm/xe: Add page reclamation info to device info Brian Nguyen
2025-11-26 23:02 ` [PATCH v2 05/11] drm/xe/guc: Add page reclamation interface to GuC Brian Nguyen
2025-12-02 22:21 ` Matthew Brost [this message]
2025-12-03 0:17 ` Lin, Shuicheng
2025-11-26 23:02 ` [PATCH v2 06/11] drm/xe: Create page reclaim list on unbind Brian Nguyen
2025-12-01 21:45 ` Nguyen, Brian3
2025-12-03 22:56 ` Matthew Brost
2025-12-04 0:19 ` Nguyen, Brian3
2025-11-26 23:02 ` [PATCH v2 07/11] drm/xe: Suballocate BO for page reclaim Brian Nguyen
2025-12-03 23:06 ` Matthew Brost
2025-11-26 23:02 ` [PATCH v2 08/11] drm/xe: Prep page reclaim in tlb inval job Brian Nguyen
2025-12-03 23:13 ` Matthew Brost
2025-12-04 0:22 ` Nguyen, Brian3
2025-12-04 1:20 ` Matthew Brost
2025-12-04 5:42 ` Nguyen, Brian3
2025-12-04 18:05 ` Matthew Brost
2025-12-04 20:02 ` Nguyen, Brian3
2025-12-09 5:57 ` Upadhyay, Tejas
2025-12-09 6:14 ` Nguyen, Brian3
2025-11-26 23:02 ` [PATCH v2 09/11] drm/xe: Append page reclamation action to tlb inval Brian Nguyen
2025-12-03 23:15 ` Matthew Brost
2025-11-26 23:02 ` [PATCH v2 10/11] drm/xe: Optimize flushing of L2$ by skipping unnecessary page reclaim Brian Nguyen
2025-12-09 14:23 ` Upadhyay, Tejas
2025-11-26 23:02 ` [PATCH v2 11/11] drm/xe: Add debugfs support for page reclamation Brian Nguyen
2025-12-02 22:28 ` Matthew Brost
2025-12-02 22:51 ` Nguyen, Brian3
2025-12-02 22:59 ` Matthew Brost
2025-12-05 18:02 ` Lin, Shuicheng
2025-11-26 23:52 ` ✗ CI.checkpatch: warning for Page Reclamation Support for Xe3p Platforms (rev2) Patchwork
2025-11-26 23:54 ` ✓ CI.KUnit: success " Patchwork
2025-11-27 0:54 ` ✗ Xe.CI.BAT: failure " Patchwork
2025-11-27 1:42 ` ✗ Xe.CI.Full: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aS9meyANoPkhw1Ix@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=brian3.nguyen@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=shuicheng.lin@intel.com \
--cc=stuart.summers@intel.com \
--cc=tejas.upadhyay@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox