From: Matthew Brost <matthew.brost@intel.com>
To: Brian Nguyen <brian3.nguyen@intel.com>
Cc: <intel-xe@lists.freedesktop.org>, <matthew.d.roper@intel.com>
Subject: Re: [PATCH 2/2] drm/xe: Move page reclaim done_handler to own func
Date: Mon, 23 Feb 2026 14:51:05 -0800 [thread overview]
Message-ID: <aZzZ2fqgUEi2wUUj@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20260129082756.1096935-4-brian3.nguyen@intel.com>
On Thu, Jan 29, 2026 at 08:27:58AM +0000, Brian Nguyen wrote:
> Originally, page reclamation is handled by the same fence as tlb
> invalidation and uses its seqno, so there was no reason to separate out
> the handlers. However in hindsight, for readability, and possible
> future changes, it seems more beneficial to move this all out to its own
> function.
>
> Signed-off-by: Brian Nguyen <brian3.nguyen@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/xe/xe_guc_ct.c | 23 ++++++++---------------
> drivers/gpu/drm/xe/xe_page_reclaim.c | 20 ++++++++++++++++++++
> drivers/gpu/drm/xe/xe_page_reclaim.h | 3 +++
> 3 files changed, 31 insertions(+), 15 deletions(-)
>
> diff --git a/drivers/gpu/drm/xe/xe_guc_ct.c b/drivers/gpu/drm/xe/xe_guc_ct.c
> index dfbf76037b04..3d69314170f8 100644
> --- a/drivers/gpu/drm/xe/xe_guc_ct.c
> +++ b/drivers/gpu/drm/xe/xe_guc_ct.c
> @@ -31,6 +31,7 @@
> #include "xe_guc_submit.h"
> #include "xe_guc_tlb_inval.h"
> #include "xe_map.h"
> +#include "xe_page_reclaim.h"
> #include "xe_pm.h"
> #include "xe_sriov_vf.h"
> #include "xe_trace_guc.h"
> @@ -1604,17 +1605,11 @@ 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_PAGE_RECLAMATION_DONE:
> + ret = xe_guc_page_reclaim_done_handler(guc, payload, adj_len);
> + break;
> case XE_GUC_ACTION_GUC2PF_RELAY_FROM_VF:
> ret = xe_guc_relay_process_guc2pf(&guc->relay, hxg, hxg_len);
> break;
> @@ -1822,15 +1817,13 @@ 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;
> + case XE_GUC_ACTION_PAGE_RECLAMATION_DONE:
> + __g2h_release_space(ct, len);
> + ret = xe_guc_page_reclaim_done_handler(guc, payload, adj_len);
> + break;
> default:
> xe_gt_warn(gt, "NOT_POSSIBLE");
> }
> diff --git a/drivers/gpu/drm/xe/xe_page_reclaim.c b/drivers/gpu/drm/xe/xe_page_reclaim.c
> index e13c71a89da2..60b0fda59ce3 100644
> --- a/drivers/gpu/drm/xe/xe_page_reclaim.c
> +++ b/drivers/gpu/drm/xe/xe_page_reclaim.c
> @@ -11,6 +11,7 @@
> #include "xe_page_reclaim.h"
>
> #include "xe_gt_stats.h"
> +#include "xe_guc_tlb_inval.h"
> #include "xe_macros.h"
> #include "xe_pat.h"
> #include "xe_sa.h"
> @@ -130,3 +131,22 @@ int xe_page_reclaim_list_alloc_entries(struct xe_page_reclaim_list *prl)
>
> return page ? 0 : -ENOMEM;
> }
> +
> +/**
> + * xe_guc_page_reclaim_done_handler() - Page reclaim done handler
> + * @guc: guc
> + * @msg: message indicating page reclamation done
> + * @len: length of message
> + *
> + * 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 is currently identical, this
> + * function delegates to the TLB invalidation handler.
> + *
> + * Return: 0 on success, -EPROTO for malformed messages.
> + */
> +int xe_guc_page_reclaim_done_handler(struct xe_guc *guc, u32 *msg, u32 len)
> +{
> + return xe_guc_tlb_inval_done_handler(guc, msg, len);
> +}
> diff --git a/drivers/gpu/drm/xe/xe_page_reclaim.h b/drivers/gpu/drm/xe/xe_page_reclaim.h
> index 3dd103e37beb..0412611f3af7 100644
> --- a/drivers/gpu/drm/xe/xe_page_reclaim.h
> +++ b/drivers/gpu/drm/xe/xe_page_reclaim.h
> @@ -20,6 +20,7 @@ struct xe_tlb_inval;
> struct xe_tlb_inval_fence;
> struct xe_tile;
> struct xe_gt;
> +struct xe_guc;
> struct xe_vma;
>
> struct xe_guc_page_reclaim_entry {
> @@ -122,4 +123,6 @@ static inline void xe_page_reclaim_entries_put(struct xe_guc_page_reclaim_entry
> put_page(virt_to_page(entries));
> }
>
> +int xe_guc_page_reclaim_done_handler(struct xe_guc *guc, u32 *msg, u32 len);
> +
> #endif /* _XE_PAGE_RECLAIM_H_ */
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-02-23 22:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-29 8:27 [PATCH 1/2] drm/xe: Skip over non leaf pte for PRL generation Brian Nguyen
2026-01-29 8:27 ` [PATCH 2/2] drm/xe: Move page reclaim done_handler to own func Brian Nguyen
2026-01-29 21:40 ` Lin, Shuicheng
2026-02-23 22:45 ` Summers, Stuart
2026-02-23 22:51 ` Matthew Brost [this message]
2026-01-29 9:14 ` ✓ CI.KUnit: success for series starting with [1/2] drm/xe: Skip over non leaf pte for PRL generation Patchwork
2026-01-29 9:48 ` ✓ Xe.CI.BAT: " Patchwork
2026-02-23 21:48 ` [PATCH 1/2] " Nguyen, Brian3
2026-02-23 22:49 ` Summers, Stuart
2026-02-23 22:59 ` Matthew Brost
2026-02-23 23:07 ` Summers, Stuart
2026-02-23 23:33 ` Nguyen, Brian3
2026-02-24 1:45 ` Matthew Brost
2026-02-24 2:02 ` Matthew Brost
2026-02-25 6:45 ` Nguyen, Brian3
2026-02-25 7:19 ` Matthew Brost
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=aZzZ2fqgUEi2wUUj@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=brian3.nguyen@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.d.roper@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