From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Matthew Auld <matthew.auld@intel.com>, intel-xe@lists.freedesktop.org
Cc: Matthew Brost <matthew.brost@intel.com>
Subject: Re: [PATCH 2/6] drm/xe/bb: drop per-batch prefetch padding
Date: Fri, 30 Oct 2026 16:21:42 +0100 [thread overview]
Message-ID: <39655ff5489c884bda44278f6d84c51c217bd5ec.camel@linux.intel.com> (raw)
In-Reply-To: <20261030-migrate-bb-optimise-v1-2-b8d01649cfe9@intel.com>
On Fri, 2026-10-30 at 11:49 +0000, Matthew Auld wrote:
> 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.
>
> Assisted-by: LLM
> Link: https://gitlab.freedesktop.org/drm/xe/kernel/-/work_items/9644
> Signed-off-by: Matthew Auld <matthew.auld@intel.com>
> 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>
> ---
> 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 b896b6f6615c..b2603902c147 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)
> {
> 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)
> 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));
> + 4 * (dwords + 1));
> 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);
>
next prev parent reply other threads:[~2026-10-30 15:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 11:49 [PATCH 0/6] Interruptible bb wait + related bits Matthew Auld
2026-10-30 11:49 ` [PATCH 1/6] drm/xe/migrate: allow larger chunk sizes for identity VRAM clears Matthew Auld
2026-10-30 15:20 ` Thomas Hellström
2026-10-30 11:49 ` [PATCH 2/6] drm/xe/bb: drop per-batch prefetch padding Matthew Auld
2026-10-30 15:21 ` Thomas Hellström [this message]
2026-10-30 11:49 ` [PATCH 3/6] drm/xe/sa: remove unused shadow BO and two-step bb helpers Matthew Auld
2026-10-30 15:23 ` Thomas Hellström
2026-10-30 11:49 ` [PATCH 4/6] drm/xe/sa: allow callers to specify interruptible suballocator waits Matthew Auld
2026-10-30 15:25 ` Thomas Hellström
2026-10-30 11:49 ` [PATCH 5/6] drm/xe/migrate: plumb interruptible wait flag to clear and copy Matthew Auld
2026-10-30 15:28 ` Thomas Hellström
2026-10-30 11:49 ` [PATCH 6/6] drm/xe/migrate: avoid interruptible waits once passes are in flight Matthew Auld
2026-10-30 15:32 ` Thomas Hellström
2026-10-30 12:33 ` ✓ CI.KUnit: success for Interruptible bb wait + related bits Patchwork
2026-10-30 13:16 ` ✓ Xe.CI.BAT: " 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=39655ff5489c884bda44278f6d84c51c217bd5ec.camel@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=matthew.auld@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.