From: Matthew Brost <matthew.brost@intel.com>
To: Brian Nguyen <brian3.nguyen@intel.com>
Cc: <intel-xe@lists.freedesktop.org>
Subject: Re: [PATCH 4/4] drm/xe: Add page reclamation related stats
Date: Thu, 8 Jan 2026 08:24:10 -0800 [thread overview]
Message-ID: <aV/aKtSZmTml5LAi@lstrano-desk.jf.intel.com> (raw)
In-Reply-To: <20260107010447.4125005-10-brian3.nguyen@intel.com>
On Wed, Jan 07, 2026 at 09:04:52AM +0800, Brian Nguyen wrote:
> Add page reclaim list (PRL) related stats to GT stats to assist in
> debugging and tuning of page reclaim related actions. Include counters
> of page sizes added to PRL and if PRL action is issued.
>
> v2:
> - Add PRL_ABORTED_COUNT stats and corresponding changes. (Matthew B)
>
> Signed-off-by: Brian Nguyen <brian3.nguyen@intel.com>
> Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
> ---
> drivers/gpu/drm/xe/xe_gt_stats.c | 5 +++++
> drivers/gpu/drm/xe/xe_gt_stats_types.h | 5 +++++
> drivers/gpu/drm/xe/xe_guc_tlb_inval.c | 3 +++
> drivers/gpu/drm/xe/xe_page_reclaim.c | 1 +
> drivers/gpu/drm/xe/xe_page_reclaim.h | 1 +
> drivers/gpu/drm/xe/xe_pt.c | 5 +++++
> 6 files changed, 20 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/xe_gt_stats.c b/drivers/gpu/drm/xe/xe_gt_stats.c
> index fb2904bd0abd..8294bcd40310 100644
> --- a/drivers/gpu/drm/xe/xe_gt_stats.c
> +++ b/drivers/gpu/drm/xe/xe_gt_stats.c
> @@ -76,6 +76,11 @@ static const char *const stat_description[__XE_GT_STATS_NUM_IDS] = {
> "hw_engine_group_suspend_lr_queue_us"),
> DEF_STAT_STR(HW_ENGINE_GROUP_WAIT_DMA_QUEUE_US,
> "hw_engine_group_wait_dma_queue_us"),
> + DEF_STAT_STR(PRL_4K_ENTRY_COUNT, "prl_4k_entry_count"),
> + DEF_STAT_STR(PRL_64K_ENTRY_COUNT, "prl_64k_entry_count"),
> + DEF_STAT_STR(PRL_2M_ENTRY_COUNT, "prl_2m_entry_count"),
> + DEF_STAT_STR(PRL_ISSUED_COUNT, "prl_issued_count"),
> + DEF_STAT_STR(PRL_ABORTED_COUNT, "prl_aborted_count"),
> };
>
> /**
> diff --git a/drivers/gpu/drm/xe/xe_gt_stats_types.h b/drivers/gpu/drm/xe/xe_gt_stats_types.h
> index b92d013091d5..b8accdbc54eb 100644
> --- a/drivers/gpu/drm/xe/xe_gt_stats_types.h
> +++ b/drivers/gpu/drm/xe/xe_gt_stats_types.h
> @@ -49,6 +49,11 @@ enum xe_gt_stats_id {
> XE_GT_STATS_ID_HW_ENGINE_GROUP_WAIT_DMA_QUEUE_COUNT,
> XE_GT_STATS_ID_HW_ENGINE_GROUP_SUSPEND_LR_QUEUE_US,
> XE_GT_STATS_ID_HW_ENGINE_GROUP_WAIT_DMA_QUEUE_US,
> + XE_GT_STATS_ID_PRL_4K_ENTRY_COUNT,
> + XE_GT_STATS_ID_PRL_64K_ENTRY_COUNT,
> + XE_GT_STATS_ID_PRL_2M_ENTRY_COUNT,
> + XE_GT_STATS_ID_PRL_ISSUED_COUNT,
> + XE_GT_STATS_ID_PRL_ABORTED_COUNT,
> /* must be the last entry */
> __XE_GT_STATS_NUM_IDS,
> };
> diff --git a/drivers/gpu/drm/xe/xe_guc_tlb_inval.c b/drivers/gpu/drm/xe/xe_guc_tlb_inval.c
> index 6532a88d51e2..774467befbb9 100644
> --- a/drivers/gpu/drm/xe/xe_guc_tlb_inval.c
> +++ b/drivers/gpu/drm/xe/xe_guc_tlb_inval.c
> @@ -97,6 +97,7 @@ static int send_tlb_inval_ggtt(struct xe_tlb_inval *tlb_inval, u32 seqno)
> static int send_page_reclaim(struct xe_guc *guc, u32 seqno,
> u64 gpu_addr)
> {
> + struct xe_gt *gt = guc_to_gt(guc);
> u32 action[] = {
> XE_GUC_ACTION_PAGE_RECLAMATION,
> seqno,
> @@ -104,6 +105,8 @@ static int send_page_reclaim(struct xe_guc *guc, u32 seqno,
> upper_32_bits(gpu_addr),
> };
>
> + xe_gt_stats_incr(gt, XE_GT_STATS_ID_PRL_ISSUED_COUNT, 1);
> +
> return xe_guc_ct_send(&guc->ct, action, ARRAY_SIZE(action),
> G2H_LEN_DW_PAGE_RECLAMATION, 1);
> }
> diff --git a/drivers/gpu/drm/xe/xe_page_reclaim.c b/drivers/gpu/drm/xe/xe_page_reclaim.c
> index 94d4608ebd74..a8f35919a9da 100644
> --- a/drivers/gpu/drm/xe/xe_page_reclaim.c
> +++ b/drivers/gpu/drm/xe/xe_page_reclaim.c
> @@ -12,6 +12,7 @@
>
> #include "regs/xe_gt_regs.h"
> #include "xe_assert.h"
> +#include "xe_gt_stats.h"
> #include "xe_macros.h"
> #include "xe_mmio.h"
> #include "xe_pat.h"
> diff --git a/drivers/gpu/drm/xe/xe_page_reclaim.h b/drivers/gpu/drm/xe/xe_page_reclaim.h
> index 12f861f357d8..3dd103e37beb 100644
> --- a/drivers/gpu/drm/xe/xe_page_reclaim.h
> +++ b/drivers/gpu/drm/xe/xe_page_reclaim.h
> @@ -91,6 +91,7 @@ void xe_page_reclaim_list_invalidate(struct xe_page_reclaim_list *prl);
> struct xe_page_reclaim_list *__prl = (prl); \
> \
> xe_page_reclaim_list_invalidate(__prl); \
> + xe_gt_stats_incr(__gt, XE_GT_STATS_ID_PRL_ABORTED_COUNT, 1); \
> vm_dbg(>_to_xe(__gt)->drm, "PRL aborted: " fmt, ##__VA_ARGS__); \
> } while (0)
>
> diff --git a/drivers/gpu/drm/xe/xe_pt.c b/drivers/gpu/drm/xe/xe_pt.c
> index a53944957be4..6703a7049227 100644
> --- a/drivers/gpu/drm/xe/xe_pt.c
> +++ b/drivers/gpu/drm/xe/xe_pt.c
> @@ -11,6 +11,7 @@
> #include "xe_drm_client.h"
> #include "xe_exec_queue.h"
> #include "xe_gt.h"
> +#include "xe_gt_stats.h"
> #include "xe_migrate.h"
> #include "xe_page_reclaim.h"
> #include "xe_pt_types.h"
> @@ -1587,6 +1588,7 @@ static int generate_reclaim_entry(struct xe_tile *tile,
> struct xe_page_reclaim_list *prl,
> u64 pte, struct xe_pt *xe_child)
> {
> + struct xe_gt *gt = tile->primary_gt;
> struct xe_guc_page_reclaim_entry *reclaim_entries = prl->entries;
> u64 phys_addr = pte & XE_PTE_ADDR_MASK;
> u64 phys_page = phys_addr >> XE_PTE_SHIFT;
> @@ -1607,12 +1609,15 @@ static int generate_reclaim_entry(struct xe_tile *tile,
> * Only 4K, 64K (level 0), and 2M pages are supported by hardware for page reclaim
> */
> if (xe_child->level == 0 && !(pte & XE_PTE_PS64)) {
> + xe_gt_stats_incr(gt, XE_GT_STATS_ID_PRL_4K_ENTRY_COUNT, 1);
> reclamation_size = COMPUTE_RECLAIM_ADDRESS_MASK(SZ_4K); /* reclamation_size = 0 */
> xe_tile_assert(tile, phys_addr % SZ_4K == 0);
> } else if (xe_child->level == 0) {
> + xe_gt_stats_incr(gt, XE_GT_STATS_ID_PRL_64K_ENTRY_COUNT, 1);
> reclamation_size = COMPUTE_RECLAIM_ADDRESS_MASK(SZ_64K); /* reclamation_size = 4 */
> xe_tile_assert(tile, phys_addr % SZ_64K == 0);
> } else if (xe_child->level == 1 && pte & XE_PDE_PS_2M) {
> + xe_gt_stats_incr(gt, XE_GT_STATS_ID_PRL_2M_ENTRY_COUNT, 1);
> reclamation_size = COMPUTE_RECLAIM_ADDRESS_MASK(SZ_2M); /* reclamation_size = 9 */
> xe_tile_assert(tile, phys_addr % SZ_2M == 0);
> } else {
> --
> 2.52.0
>
next prev parent reply other threads:[~2026-01-08 16:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-07 1:04 [PATCH 0/4] Page-reclaim fixes and PRL stats addition Brian Nguyen
2026-01-07 1:04 ` [PATCH 1/4] drm/xe: Remove debug comment in page reclaim Brian Nguyen
2026-01-07 1:04 ` [PATCH 2/4] drm/xe: Add explicit abort page reclaim list Brian Nguyen
2026-01-07 19:57 ` Matthew Brost
2026-01-07 1:04 ` [PATCH 3/4] drm/xe: Fix page reclaim entry handling for large pages Brian Nguyen
2026-01-08 16:22 ` Matthew Brost
2026-01-07 1:04 ` [PATCH 4/4] drm/xe: Add page reclamation related stats Brian Nguyen
2026-01-08 16:24 ` Matthew Brost [this message]
2026-01-07 1:19 ` ✓ CI.KUnit: success for Page-reclaim fixes and PRL stats addition (rev3) Patchwork
2026-01-07 2:02 ` ✓ Xe.CI.BAT: " Patchwork
2026-01-07 4:45 ` ✗ Xe.CI.Full: failure " Patchwork
-- strict thread matches above, loose matches on Subject: below --
2026-01-05 23:33 [PATCH 0/4] Page-reclaim fixes and PRL stats addition Brian Nguyen
2026-01-05 23:33 ` [PATCH 4/4] drm/xe: Add page reclamation related stats Brian Nguyen
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=aV/aKtSZmTml5LAi@lstrano-desk.jf.intel.com \
--to=matthew.brost@intel.com \
--cc=brian3.nguyen@intel.com \
--cc=intel-xe@lists.freedesktop.org \
/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