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 1/6] drm/xe/sa: allow callers to specify interruptible suballocator waits
Date: Fri, 27 Nov 2026 12:14:11 +0000 [thread overview]
Message-ID: <20261127-migrate-bb-optimise-v2-1-808d0d520ddb@intel.com> (raw)
In-Reply-To: <20261127-migrate-bb-optimise-v2-0-808d0d520ddb@intel.com>
__xe_sa_bo_new() currently hardcodes intr=true when calling
drm_suballoc_new(), making every suballocator wait interruptible even
when the caller cannot tolerate -ERESTARTSYS.
Plumb a bool intr parameter through __xe_sa_bo_new(), xe_sa_bo_new(),
and __xe_bb_new(), while defaulting xe_bb_new() to false for
kernel-internal callers.
v2:
- Add Fixes/stable tags (Thomas)
Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Cc: <stable@vger.kernel.org> # v6.12+
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 | 4 ++--
drivers/gpu/drm/xe/xe_bb.h | 9 ++++++++-
drivers/gpu/drm/xe/xe_guc_buf.c | 4 ++--
drivers/gpu/drm/xe/xe_page_reclaim.c | 2 +-
drivers/gpu/drm/xe/xe_sa.c | 6 ++++--
drivers/gpu/drm/xe/xe_sa.h | 9 ++++++---
6 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_bb.c b/drivers/gpu/drm/xe/xe_bb.c
index b896b6f6615c..6308a1dca464 100644
--- a/drivers/gpu/drm/xe/xe_bb.c
+++ b/drivers/gpu/drm/xe/xe_bb.c
@@ -28,7 +28,7 @@ static int bb_prefetch(struct xe_gt *gt)
return SZ_512;
}
-struct xe_bb *xe_bb_new(struct xe_gt *gt, u32 dwords, bool usm)
+struct xe_bb *__xe_bb_new(struct xe_gt *gt, u32 dwords, bool usm, bool intr)
{
struct xe_tile *tile = gt_to_tile(gt);
struct xe_bb *bb = kmalloc_obj(*bb);
@@ -44,7 +44,7 @@ struct xe_bb *xe_bb_new(struct xe_gt *gt, u32 dwords, bool usm)
* requirements.
*/
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) + bb_prefetch(gt), intr);
if (IS_ERR(bb->bo)) {
err = PTR_ERR(bb->bo);
goto err;
diff --git a/drivers/gpu/drm/xe/xe_bb.h b/drivers/gpu/drm/xe/xe_bb.h
index 231870b24c2f..66fcc40c0b00 100644
--- a/drivers/gpu/drm/xe/xe_bb.h
+++ b/drivers/gpu/drm/xe/xe_bb.h
@@ -6,6 +6,8 @@
#ifndef _XE_BB_H_
#define _XE_BB_H_
+#include <linux/types.h>
+
#include "xe_bb_types.h"
struct dma_fence;
@@ -15,7 +17,12 @@ struct xe_exec_queue;
struct xe_sa_manager;
struct xe_sched_job;
-struct xe_bb *xe_bb_new(struct xe_gt *gt, u32 dwords, bool usm);
+struct xe_bb *__xe_bb_new(struct xe_gt *gt, u32 dwords, bool usm, bool intr);
+
+static inline struct xe_bb *xe_bb_new(struct xe_gt *gt, u32 dwords, bool usm)
+{
+ return __xe_bb_new(gt, dwords, usm, false);
+}
struct xe_bb *xe_bb_alloc(struct xe_gt *gt);
int xe_bb_init(struct xe_bb *bb, struct xe_sa_manager *bb_pool, u32 dwords);
struct xe_sched_job *xe_bb_create_job(struct xe_exec_queue *q,
diff --git a/drivers/gpu/drm/xe/xe_guc_buf.c b/drivers/gpu/drm/xe/xe_guc_buf.c
index 11f77decd8d1..cdb3b3e31c94 100644
--- a/drivers/gpu/drm/xe/xe_guc_buf.c
+++ b/drivers/gpu/drm/xe/xe_guc_buf.c
@@ -95,7 +95,7 @@ struct xe_guc_buf xe_guc_buf_reserve(struct xe_guc_buf_cache *cache, u32 dwords)
struct drm_suballoc *sa;
if (cache->sam)
- sa = __xe_sa_bo_new(cache->sam, dwords * sizeof(u32), GFP_ATOMIC);
+ sa = __xe_sa_bo_new(cache->sam, dwords * sizeof(u32), GFP_ATOMIC, false);
else
sa = ERR_PTR(-EOPNOTSUPP);
@@ -117,7 +117,7 @@ struct xe_guc_buf xe_guc_buf_from_data(struct xe_guc_buf_cache *cache,
{
struct drm_suballoc *sa;
- sa = __xe_sa_bo_new(cache->sam, size, GFP_ATOMIC);
+ sa = __xe_sa_bo_new(cache->sam, size, GFP_ATOMIC, false);
if (!IS_ERR(sa))
memcpy(xe_sa_bo_cpu_addr(sa), data, size);
diff --git a/drivers/gpu/drm/xe/xe_page_reclaim.c b/drivers/gpu/drm/xe/xe_page_reclaim.c
index da1ed99cd3f8..921f30ffb4cb 100644
--- a/drivers/gpu/drm/xe/xe_page_reclaim.c
+++ b/drivers/gpu/drm/xe/xe_page_reclaim.c
@@ -76,7 +76,7 @@ struct drm_suballoc *xe_page_reclaim_create_prl_bo(struct xe_tlb_inval *tlb_inva
/* Maximum size of PRL is 1 4K-page */
prl_sa = __xe_sa_bo_new(tile->mem.reclaim_pool,
- prl_size, GFP_ATOMIC);
+ prl_size, GFP_ATOMIC, false);
if (IS_ERR(prl_sa))
return prl_sa;
diff --git a/drivers/gpu/drm/xe/xe_sa.c b/drivers/gpu/drm/xe/xe_sa.c
index f32045f40b7a..e8908c2973ff 100644
--- a/drivers/gpu/drm/xe/xe_sa.c
+++ b/drivers/gpu/drm/xe/xe_sa.c
@@ -164,12 +164,14 @@ void xe_sa_bo_sync_shadow(struct drm_suballoc *sa_bo)
* @sa_manager: the &xe_sa_manager
* @size: number of bytes we want to suballocate
* @gfp: gfp flags used for memory allocation. Typically GFP_KERNEL.
+ * @intr: whether to wait interruptibly if space is not immediately available
*
* Try to make a suballocation of size @size.
*
* Return: a &drm_suballoc, or an ERR_PTR.
*/
-struct drm_suballoc *__xe_sa_bo_new(struct xe_sa_manager *sa_manager, u32 size, gfp_t gfp)
+struct drm_suballoc *__xe_sa_bo_new(struct xe_sa_manager *sa_manager, u32 size,
+ gfp_t gfp, bool intr)
{
/*
* BB to large, return -ENOBUFS indicating user should split
@@ -178,7 +180,7 @@ struct drm_suballoc *__xe_sa_bo_new(struct xe_sa_manager *sa_manager, u32 size,
if (size > sa_manager->base.size)
return ERR_PTR(-ENOBUFS);
- return drm_suballoc_new(&sa_manager->base, size, gfp, true, 0);
+ return drm_suballoc_new(&sa_manager->base, size, gfp, intr, 0);
}
/**
diff --git a/drivers/gpu/drm/xe/xe_sa.h b/drivers/gpu/drm/xe/xe_sa.h
index 50218b0d1404..e24ed5ceb7dc 100644
--- a/drivers/gpu/drm/xe/xe_sa.h
+++ b/drivers/gpu/drm/xe/xe_sa.h
@@ -17,7 +17,8 @@ struct xe_tile;
#define XE_SA_BO_MANAGER_FLAG_SHADOW BIT(0)
struct xe_sa_manager *__xe_sa_bo_manager_init(struct xe_tile *tile, u32 size,
u32 guard, u32 align, u32 flags);
-struct drm_suballoc *__xe_sa_bo_new(struct xe_sa_manager *sa_manager, u32 size, gfp_t gfp);
+struct drm_suballoc *__xe_sa_bo_new(struct xe_sa_manager *sa_manager, u32 size,
+ gfp_t gfp, bool intr);
static inline struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile, u32 size, u32 align)
{
@@ -28,14 +29,16 @@ static inline struct xe_sa_manager *xe_sa_bo_manager_init(struct xe_tile *tile,
* xe_sa_bo_new() - Make a suballocation.
* @sa_manager: the &xe_sa_manager
* @size: number of bytes we want to suballocate
+ * @intr: whether to wait interruptibly if space is not immediately available
*
* Try to make a suballocation of size @size.
*
* Return: a &drm_suballoc, or an ERR_PTR.
*/
-static inline struct drm_suballoc *xe_sa_bo_new(struct xe_sa_manager *sa_manager, u32 size)
+static inline struct drm_suballoc *xe_sa_bo_new(struct xe_sa_manager *sa_manager,
+ u32 size, bool intr)
{
- return __xe_sa_bo_new(sa_manager, size, GFP_KERNEL);
+ return __xe_sa_bo_new(sa_manager, size, GFP_KERNEL, intr);
}
struct drm_suballoc *xe_sa_bo_alloc(gfp_t gfp);
--
2.56.1
next prev parent reply other threads:[~2026-11-27 12:15 UTC|newest]
Thread overview: 12+ 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 ` Matthew Auld [this message]
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 ` [PATCH v2 5/6] drm/xe/bb: drop per-batch prefetch padding Matthew Auld
2026-11-27 12:33 ` sashiko-bot
2026-11-27 14:20 ` Matthew Auld
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
2026-11-27 13:37 ` ✓ Xe.CI.BAT: " Patchwork
2026-11-28 5:32 ` ✓ Xe.CI.FULL: " 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-1-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 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.