From: Matthew Auld <matthew.auld@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
"Matthew Brost" <matthew.brost@intel.com>,
"Matthew Auld" <matthew.auld@intel.com>
Subject: [PATCH v2 5/6] drm/xe/bb: drop per-batch prefetch padding
Date: Fri, 27 Nov 2026 12:14:15 +0000 [thread overview]
Message-ID: <20261127-migrate-bb-optimise-v2-5-808d0d520ddb@intel.com> (raw)
In-Reply-To: <20261127-migrate-bb-optimise-v2-0-808d0d520ddb@intel.com>
__xe_bb_new() currently appends bb_prefetch() (512B or 1K) to every
batch suballocation, inflating a 36B identity-mapped clear batch to
~1K and also causing xe_sa_bo_flush_write() to copy up to 1K of unused
padding to VRAM on every batch.
However, both kernel_bb_pool and usm.bb_pool are initialised via
xe_sa_bo_manager_init(), which already reserves a 4K guard region at
the end of the backing BO to cover CS prefetch, and prefetching into
adjacent suballocations within the mapped pool should be harmless. Drop
bb_prefetch().
This should reduce pressure on the bb pool.
Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/9644
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
---
drivers/gpu/drm/xe/xe_bb.c | 26 ++++++--------------------
1 file changed, 6 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_bb.c b/drivers/gpu/drm/xe/xe_bb.c
index 6308a1dca464..bcb3a56995a6 100644
--- a/drivers/gpu/drm/xe/xe_bb.c
+++ b/drivers/gpu/drm/xe/xe_bb.c
@@ -14,20 +14,6 @@
#include "xe_sched_job.h"
#include "xe_vm_types.h"
-static int bb_prefetch(struct xe_gt *gt)
-{
- struct xe_device *xe = gt_to_xe(gt);
-
- if (GRAPHICS_VERx100(xe) >= 1250 && xe_gt_is_main_type(gt))
- /*
- * RCS and CCS require 1K, although other engines would be
- * okay with 512.
- */
- return SZ_1K;
- else
- return SZ_512;
-}
-
struct xe_bb *__xe_bb_new(struct xe_gt *gt, u32 dwords, bool usm, bool intr)
{
struct xe_tile *tile = gt_to_tile(gt);
@@ -38,13 +24,13 @@ struct xe_bb *__xe_bb_new(struct xe_gt *gt, u32 dwords, bool usm, bool intr)
return ERR_PTR(-ENOMEM);
/*
- * We need to allocate space for the requested number of dwords,
- * one additional MI_BATCH_BUFFER_END dword, and additional buffer
- * space to accommodate the platform-specific hardware prefetch
- * requirements.
+ * We need to allocate space for the requested number of dwords and
+ * one additional MI_BATCH_BUFFER_END dword. Hardware CS prefetch
+ * at the end of the pool BO is covered by the SZ_4K guard region
+ * reserved by xe_sa_bo_manager_init().
*/
bb->bo = xe_sa_bo_new(!usm ? tile->mem.kernel_bb_pool : gt->usm.bb_pool,
- 4 * (dwords + 1) + bb_prefetch(gt), intr);
+ 4 * (dwords + 1), intr);
if (IS_ERR(bb->bo)) {
err = PTR_ERR(bb->bo);
goto err;
@@ -129,7 +115,7 @@ __xe_bb_create_job(struct xe_exec_queue *q, struct xe_bb *bb, u64 *addr)
if (bb->len == 0 || bb->cs[bb->len - 1] != MI_BATCH_BUFFER_END)
bb->cs[bb->len++] = MI_BATCH_BUFFER_END;
- xe_gt_assert(q->gt, bb->len * 4 + bb_prefetch(q->gt) <= size);
+ xe_gt_assert(q->gt, bb->len * 4 <= size);
xe_sa_bo_flush_write(bb->bo);
--
2.56.1
next prev parent reply other threads:[~2026-11-27 12:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 12:14 [PATCH v2 0/6] Interruptible bb wait + related bits Matthew Auld
2026-11-27 12:14 ` [PATCH v2 1/6] drm/xe/sa: allow callers to specify interruptible suballocator waits Matthew Auld
2026-11-27 12:14 ` [PATCH v2 2/6] drm/xe/migrate: plumb interruptible wait flag to clear and copy Matthew Auld
2026-11-27 12:14 ` [PATCH v2 3/6] drm/xe/migrate: avoid interruptible waits once passes are in flight Matthew Auld
2026-11-27 12:14 ` [PATCH v2 4/6] drm/xe/migrate: optimise chunk sizes for identity VRAM clears Matthew Auld
2026-11-27 12:14 ` Matthew Auld [this message]
2026-11-27 12:33 ` [PATCH v2 5/6] drm/xe/bb: drop per-batch prefetch padding sashiko-bot
2026-11-27 12:14 ` [PATCH v2 6/6] drm/xe/sa: remove unused shadow BO and two-step bb helpers Matthew Auld
2026-11-27 12:27 ` ✓ CI.KUnit: success for Interruptible bb wait + related bits (rev2) 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=20261127-migrate-bb-optimise-v2-5-808d0d520ddb@intel.com \
--to=matthew.auld@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.brost@intel.com \
--cc=thomas.hellstrom@linux.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