Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Stuart Summers <stuart.summers@intel.com>
Cc: intel-xe@lists.freedesktop.org, matthew.brost@intel.com,
	lucas.demarchi@intel.com,
	Stuart Summers <stuart.summers@intel.com>
Subject: [PATCH] drm/xe: Fix page fault queue calculation
Date: Thu,  1 May 2025 18:32:20 +0000	[thread overview]
Message-ID: <20250501183220.72097-1-stuart.summers@intel.com> (raw)

We followed up with the design architects to have a more
precise calculation for a theoretical maximum number of
page faults we might expect based on the number of TLBs
available in the system. Fix the original calculation which
did not take the number of TLBs into consideration.

Fixes: 29582e0ea75c ("drm/xe: Add page queue multiplier")
Fixes: 3338e4f90c14 ("drm/xe: Use topology to determine page fault queue size")

Signed-off-by: Stuart Summers <stuart.summers@intel.com>
---
 drivers/gpu/drm/xe/xe_gt_pagefault.c | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
index 10622ca471a2..80a816c3837b 100644
--- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
@@ -436,15 +436,20 @@ static int xe_alloc_pf_queue(struct xe_gt *gt, struct pf_queue *pf_queue)
 				XE_MAX_EU_FUSE_BITS) * num_dss;
 
 	/*
-	 * user can issue separate page faults per EU and per CS
+	 * Each TLB can report up to 32 faults. The number of TLBs is
+	 * equal to the number of render/compute/media engines plus twice
+	 * the number of copy engines plus the number of EUs.
 	 *
-	 * XXX: Multiplier required as compute UMD are getting PF queue errors
-	 * without it. Follow on why this multiplier is required.
+	 * Reserve enough space here to ensure we are able to cover that
+	 * theoretical maximum.
 	 */
-#define PF_MULTIPLIER	8
+#define MAX_FAULTS_PER_TLB	32
 	pf_queue->num_dw =
-		(num_eus + XE_NUM_HW_ENGINES) * PF_MSG_LEN_DW * PF_MULTIPLIER;
-#undef PF_MULTIPLIER
+		PF_MSG_LEN_DW * MAX_FAULTS_PER_TLB *
+		(num_eus +
+		 hweight64(gt->info.engine_mask) +
+		 hweight32(xe_hw_engine_mask_per_class(gt, XE_ENGINE_CLASS_COPY)));
+#undef MAX_FAULTS_PER_TLB
 
 	pf_queue->gt = gt;
 	pf_queue->data = devm_kcalloc(xe->drm.dev, pf_queue->num_dw,
-- 
2.34.1


             reply	other threads:[~2025-05-01 18:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-01 18:32 Stuart Summers [this message]
2025-05-01 19:01 ` ✓ CI.Patch_applied: success for drm/xe: Fix page fault queue calculation Patchwork
2025-05-01 19:01 ` ✓ CI.checkpatch: " Patchwork
2025-05-01 19:02 ` ✓ CI.KUnit: " Patchwork
2025-05-01 19:10 ` ✓ CI.Build: " Patchwork
2025-05-01 19:13 ` ✓ CI.Hooks: " Patchwork
2025-05-01 19:14 ` ✓ CI.checksparse: " Patchwork
2025-05-01 19:48 ` [PATCH] " Matthew Brost
2025-05-01 20:31   ` Summers, Stuart
2025-05-01 21:50 ` Cavitt, Jonathan
2025-05-01 22:46 ` ✗ Xe.CI.Full: failure for " Patchwork
2025-05-04  4:59 ` [PATCH] " Dafna Hirschfeld
2025-05-06  7:57 ` ✓ Xe.CI.BAT: success for " 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=20250501183220.72097-1-stuart.summers@intel.com \
    --to=stuart.summers@intel.com \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=lucas.demarchi@intel.com \
    --cc=matthew.brost@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